* automake.in: Register &lang_lex_target_hook for lex and lexxx.
authorAlexandre Duret-Lutz <adl@gnu.org>
Fri, 21 Jun 2002 20:24:33 +0000 (20:24 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Fri, 21 Jun 2002 20:24:33 +0000 (20:24 +0000)
(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.

ChangeLog
automake.in
tests/lex3.test

index ebd4824..8ea9beb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 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
index 756ce90..afc7fb7 100755 (executable)
@@ -856,7 +856,8 @@ register_language ('name' => 'lex',
                   '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'],
@@ -865,7 +866,8 @@ register_language ('name' => 'lexxx',
                   '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',
@@ -5120,6 +5122,19 @@ sub lang_yacc_target_hook
     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
 {
index 82bc3b5..f92f859 100755 (executable)
@@ -59,3 +59,12 @@ $MAKE distcheck
 # foo.c must be shipped.
 gunzip am_lex_bug-0.1.1.tar.gz
 tar tf am_lex_bug-0.1.1.tar | $FGREP foo.c
+
+# While we are at it, make sure that foo.c is erased by
+# maintainer-clean, and not by distclean.
+test -f foo.c
+$MAKE distclean
+test -f foo.c
+./configure
+$MAKE maintainer-clean
+test ! -f foo.c