From: Alexandre Duret-Lutz Date: Fri, 21 Jun 2002 20:24:33 +0000 (+0000) Subject: * automake.in: Register &lang_lex_target_hook for lex and lexxx. X-Git-Tag: v1.10.2~1302 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f254537b6f734c9444a17edcd4559c54f2ce589a;p=platform%2Fupstream%2Fautomake.git * 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. --- diff --git a/ChangeLog b/ChangeLog index ebd4824..8ea9beb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2002-06-21 Alexandre Duret-Lutz + * 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 + * 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 diff --git a/automake.in b/automake.in index 756ce90..afc7fb7 100755 --- a/automake.in +++ b/automake.in @@ -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 { diff --git a/tests/lex3.test b/tests/lex3.test index 82bc3b5..f92f859 100755 --- a/tests/lex3.test +++ b/tests/lex3.test @@ -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