summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2020-10-19 15:55:24 -0700
committerGuy Harris <gharris@sonic.net>2020-10-19 15:55:24 -0700
commit6391277a805c3311cc2e90ee7111d86660d3bea0 (patch)
treed2eac189c3fd0974ead42cd592f2e83010b75cea
parentdd707ae4b5f1abd9ee295895766a42f4bbcba498 (diff)
downloadlibpcap-6391277a805c3311cc2e90ee7111d86660d3bea0.tar.gz
grammar.y is now a built file.
It's built from grammar.y.in. Do so in the Makefile, as well as in the configure script, so if the grammar.y.in file is changed, the grammar.c file gets changed. Remove it on "make distclean". Include grammar.y.in in the distribution tarball.
-rw-r--r--Makefile.in25
1 files changed, 22 insertions, 3 deletions
diff --git a/Makefile.in b/Makefile.in
index ad2a9e02..d8b8507b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -280,7 +280,7 @@ EXTRA_DIST = \
fad-getad.c \
fad-gifc.c \
fad-glifc.c \
- grammar.y \
+ grammar.y.in \
install-sh \
lbl/os-aix4.h \
lbl/os-aix7.h \
@@ -510,7 +510,26 @@ scanner.h: scanner.c
scanner.o: scanner.c grammar.h
$(CC) $(FULL_CFLAGS) -c scanner.c
-grammar.c: $(srcdir)/grammar.y
+#
+# Generate the grammar.y file.
+#
+# Some Makes, e.g. AIX Make and Solaris Make, can't handle "--file=$@.tmp:$<";
+# for example, the Solaris 9 make man page says
+#
+# Because make assigns $< and $* as it would for implicit rules
+# (according to the suffixes list and the directory contents),
+# they may be unreliable when used within explicit target entries.
+#
+# and this is an explicit target entry.
+#
+# Therefore, instead of using $<, we explicitly put in $(srcdir)/libpcap.pc.in.
+#
+grammar.y: $(srcdir)/grammar.y.in ./config.status
+ @rm -f $@ $@.tmp
+ ./config.status --file=$@.tmp:$(srcdir)/grammar.y.in
+ mv $@.tmp $@
+
+grammar.c: grammar.y
$(YACC) -p pcap_ -o grammar.c -d $<
grammar.h: grammar.c
## Recover from the removal of $@
@@ -775,7 +794,7 @@ clean:
cd testprogs; $(MAKE) clean
distclean: clean
- rm -f Makefile config.cache config.log config.status \
+ rm -f Makefile grammar.y config.cache config.log config.status \
config.h gnuc.h net os-proto.h libpcap.pc \
pcap-config stamp-h stamp-h.in
rm -f $(MAN3PCAP_EXPAND:.in=) $(MANFILE:.in=) $(MANMISC:.in=)