From 3cda8404ace6e8b6e029aaf2fe6e90433d703ca4 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sat, 8 Jun 2002 17:22:19 +0000 Subject: [PATCH] * automake.in (lang_yacc_target_hook): Add rule to recover from the removal of $header. * lib/am/yacc.am (%BASE%.h): Remove (duplicate with the one output by lang_yacc_target_hook). * tests/yacc7.test: Try to recreate foo.h after its removal. * tests/yacc8.test: Add `AM_YFLAGS = -d' and try to recreate parse.h too. Reported by Bernd Jendrissek. --- ChangeLog | 11 +++++++++++ THANKS | 1 + automake.in | 7 ++++++- lib/am/yacc.am | 5 ----- tests/yacc7.test | 6 ++++++ tests/yacc8.test | 8 ++++++++ 6 files changed, 32 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3dda149e..b880cd80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2002-06-08 Alexandre Duret-Lutz + + * automake.in (lang_yacc_target_hook): Add rule to recover from + the removal of $header. + * lib/am/yacc.am (%BASE%.h): Remove (duplicate with the one + output by lang_yacc_target_hook). + * tests/yacc7.test: Try to recreate foo.h after its removal. + * tests/yacc8.test: Add `AM_YFLAGS = -d' and try to recreate + parse.h too. + Reported by Bernd Jendrissek. + 2002-06-08 Alexandre Duret-Lutz For PR automake/317: diff --git a/THANKS b/THANKS index 44952f9a..0e528c0c 100644 --- a/THANKS +++ b/THANKS @@ -20,6 +20,7 @@ Arkadiusz Miskiewicz misiek@pld.ORG.PL Assar Westerlund assar@sics.se Axel Belinfante Axel.Belinfante@cs.utwente.nl Bernard Urban Bernard.Urban@meteo.fr +Bernd Jendrissek berndj@prism.co.za Bill Currie bcurrie@tssc.co.nz Bill Davidson bill@kayhay.com Bill Fenner fenner@parc.xerox.com diff --git a/automake.in b/automake.in index 8cfad340..92f187fe 100755 --- a/automake.in +++ b/automake.in @@ -5081,7 +5081,12 @@ sub lang_yacc_target_hook # Add a dependency for the generated header file, and arrange # for that file to be included in the distribution. # FIXME: this fails for `nodist_*_SOURCES'. - $output_rules .= "${header}: $output\n"; + $output_rules .= ("${header}: $output\n" + # Recover from removal of $header + . "\t\@if test ! -f \$@; then \\\n" + . "\t rm -f $output; \\\n" + . "\t \$(MAKE) $output; \\\n" + . "\telse :; fi\n"); &push_dist_common ($header); # If the files are built in the build directory, then we want # to remove them with `make clean'. If they are in srcdir diff --git a/lib/am/yacc.am b/lib/am/yacc.am index 5bffe568..8dcbdb8c 100644 --- a/lib/am/yacc.am +++ b/lib/am/yacc.am @@ -44,8 +44,3 @@ else !%?MORE-THAN-ONE% mv y.output %BASE%.output; \ fi endif !%?MORE-THAN-ONE% - -## Also generate a dependency for the .h file. -if !%?GENERIC% -%BASE%.h: %OBJ% -endif !%?GENERIC% diff --git a/tests/yacc7.test b/tests/yacc7.test index 7bd62748..7b474a73 100755 --- a/tests/yacc7.test +++ b/tests/yacc7.test @@ -45,4 +45,10 @@ test -f foo.h || exit 1 rm -f foo.h foo.c $MAKE check-dist || exit 1 +# We should be able to recover if foo.h is deleted. + +rm foo.h || exit 1 +$MAKE foo.h || exit 1 +test -f foo.h || exit 1 + exit 0 diff --git a/tests/yacc8.test b/tests/yacc8.test index d37e4ade..610f8a96 100755 --- a/tests/yacc8.test +++ b/tests/yacc8.test @@ -20,6 +20,7 @@ cat > Makefile.am << 'END' AUTOMAKE_OPTIONS = subdir-objects bin_PROGRAMS = foo/foo foo_foo_SOURCES = foo/parse.y +AM_YFLAGS = -d END mkdir foo @@ -49,6 +50,13 @@ $MAKE foo/parse.o test -f foo/parse.c test -f foo/parse.o +# Aside of the rest of this test, let's see if we can recover from +# parse.h removal +test -f foo/parse.h +rm -f foo/parse.h +$MAKE foo/parse.h +test -f foo/parse.h + # Now, adds another parser to test ylwrap. cd .. -- 2.43.5