]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
build: fix recursive parser.h inclusion
authorPatrick McHardy <kaber@trash.net>
Thu, 16 Jan 2014 18:12:06 +0000 (18:12 +0000)
committerPatrick McHardy <kaber@trash.net>
Thu, 16 Jan 2014 18:12:06 +0000 (18:12 +0000)
Ocassionally when regenerating the scanner or parser (not sure which),
recursive inclusion of the parser.h file occurs. The reason is that
bison doesn't generate a header sandwich to protect against this (*sigh*).

Change the makefile to do this manually.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Makefile.rules.in

index 25988dd730a8485de6ce09aa24476068d37d04a4..ae563a540db74282af90723238e7ad00dd46ceb2 100644 (file)
@@ -22,7 +22,14 @@ configure:           configure.ac
 
 %.c %.h:               %.y     $(makedeps)
                        @echo -e "  YACC\t\t$<"
-                       $(YACC) $(YACCFLAGS) -d -o $@ $<
+                       $(YACC) $(YACCFLAGS) --defines=$*.h.tmp -o $@ $<
+                       ( \
+                               echo "#ifndef __$(*F)_H"; \
+                               echo "#define __$(*F)_H"; \
+                               cat $*.h.tmp; \
+                               echo "#endif /* __$(*F)_H */" \
+                       ) > $*.h
+                       $(RM) $*.h.tmp
 
 %.c %.h:               %.l     $(makedeps)
                        @echo -e "  LEX\t\t$<"