automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: lex output and maintainer-clean


From: Alexandre Duret-Lutz
Subject: FYI: lex output and maintainer-clean
Date: 21 Jun 2002 22:17:09 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Just like the previous patch for Yacc, this one fixes the
cleaning of Lex's output.

I'm checking in it on HEAD and branch-1-6.

2002-06-21  Alexandre Duret-Lutz  <address@hidden>

        * 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.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1287.2.13
diff -u -r1.1287.2.13 automake.in
--- automake.in 21 Jun 2002 20:01:00 -0000      1.1287.2.13
+++ automake.in 21 Jun 2002 20:17:23 -0000
@@ -903,7 +903,8 @@
                   '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'],
@@ -913,7 +914,8 @@
                   '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',
@@ -5510,6 +5512,19 @@
     }
     # Erase $OUTPUT on `make maintainer-clean' (by GNU standards).
     # See the comment above for $HEADER.
+    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);
 }
 
Index: tests/lex3.test
===================================================================
RCS file: /cvs/automake/automake/tests/lex3.test,v
retrieving revision 1.6
diff -u -r1.6 lex3.test
--- tests/lex3.test     26 Dec 2001 08:22:06 -0000      1.6
+++ tests/lex3.test     21 Jun 2002 20:17:34 -0000
@@ -67,3 +67,12 @@
 # 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

-- 
Alexandre Duret-Lutz




reply via email to

[Prev in Thread] Current Thread [Next in Thread]