2002-06-21 Alexandre Duret-Lutz <duret_g@epita.fr>
+ * automake.in: Register &lang_lex_target_hook for lex and lexxx.
+ (lang_lex_target_hook): New function.
+ * tests/lex3.c: Complete to check that maintainer-clean erases
+ Lex's output.
+ Reported by Flavien Astraud. This was lost on 2001-06-23 too.
+
+2002-06-21 Alexandre Duret-Lutz <duret_g@epita.fr>
+
* automake.in (lang_yacc_target_hook): Add $output to
@maintainer_clean_files. This was lost on 2001-06-23.
* tests/yacc7.test, tests/yacc4.test: Complete to check
'compile' => '$(LEX) $(LFLAGS) $(AM_LFLAGS)',
'compiler' => 'LEXCOMPILE',
'extensions' => ['.l'],
- '_finish' => \&lang_lex_finish);
+ '_finish' => \&lang_lex_finish,
+ '_target_hook' => \&lang_lex_target_hook);
register_language ('name' => 'lexxx',
'Name' => 'Lex (C++)',
'config_vars' => ['LEX'],
'compile' => '$(LEX) $(LFLAGS) $(AM_LFLAGS)',
'compiler' => 'LEXCOMPILE',
'extensions' => ['.l++', '.ll', '.lxx', '.lpp'],
- '_finish' => \&lang_lex_finish);
+ '_finish' => \&lang_lex_finish,
+ '_target_hook' => \&lang_lex_target_hook);
# Assembler.
register_language ('name' => 'asm',
push (@maintainer_clean_files, $output);
}
+# This is a lex helper which is called whenever we have decided to
+# compile a lex file.
+sub lang_lex_target_hook
+{
+ my ($self, $aggregate, $output, $input) = @_;
+ # If the files are built in the build directory, then we want to
+ # remove them with `make clean'. If they are in srcdir they
+ # shouldn't be touched. However, we can't determine this
+ # statically, and the GNU rules say that yacc/lex output files
+ # should be removed by maintainer-clean. So that's what we do.
+ push (@maintainer_clean_files, $output);
+}
+
# This is a helper for both lex and yacc.
sub yacc_lex_finish_helper
{