[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
AM_YFLAGS = -d, recover from parse.h removal
From: |
Alexandre Duret-Lutz |
Subject: |
AM_YFLAGS = -d, recover from parse.h removal |
Date: |
08 May 2002 20:27:28 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
If stumbled across somthing odd when working on this patch: The
`parse.h: parse.c' dependency rule is output twice by Automake.
One definition comes from &lang_yacc_target_hook, the other from
lib/am/yacc.am. But this latter is output only when a specific
(i.e. non generic) rule is used. I don't really understand
the logic here (assuming it was meant).
2002-05-08 Alexandre Duret-Lutz <address@hidden>
* 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.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1287.2.6
diff -u -r1.1287.2.6 automake.in
--- automake.in 6 May 2002 19:12:11 -0000 1.1287.2.6
+++ automake.in 8 May 2002 18:30:50 -0000
@@ -5476,7 +5476,12 @@
# 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
+ . "address@hidden 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
Index: lib/am/yacc.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/yacc.am,v
retrieving revision 1.13
diff -u -r1.13 yacc.am
--- lib/am/yacc.am 26 Mar 2002 09:24:53 -0000 1.13
+++ lib/am/yacc.am 8 May 2002 18:30:51 -0000
@@ -44,8 +44,3 @@
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%
Index: tests/yacc7.test
===================================================================
RCS file: /cvs/automake/automake/tests/yacc7.test,v
retrieving revision 1.5
diff -u -r1.5 yacc7.test
--- tests/yacc7.test 26 Dec 2001 08:22:06 -0000 1.5
+++ tests/yacc7.test 8 May 2002 18:30:52 -0000
@@ -36,4 +36,10 @@
test -f foo.h || 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
Index: tests/yacc8.test
===================================================================
RCS file: /cvs/automake/automake/tests/yacc8.test,v
retrieving revision 1.5
diff -u -r1.5 yacc8.test
--- tests/yacc8.test 10 Apr 2002 17:30:43 -0000 1.5
+++ tests/yacc8.test 8 May 2002 18:30:52 -0000
@@ -20,6 +20,7 @@
AUTOMAKE_OPTIONS = subdir-objects
bin_PROGRAMS = foo/foo
foo_foo_SOURCES = foo/parse.y
+AM_YFLAGS = -d
END
mkdir foo
@@ -48,6 +49,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.
--
Alexandre Duret-Lutz
- AM_YFLAGS = -d, recover from parse.h removal,
Alexandre Duret-Lutz <=