1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-12-23 13:04:15 +02:00

b2/Makefile: generate dependencies also for YACC- and LEX-generated files

We need explicit rules to compile lex.yy.c and y.tab.c for the relaxed
CFLAGS. However, this means that the implicit rule was not used and
therefore no dependencies were generated.
This commit is contained in:
Werner Almesberger 2012-05-22 16:09:22 -03:00
parent 4f142c1250
commit c9bd26a34d

View File

@ -46,6 +46,12 @@ else
DEPEND = $(DEPEND_quiet) DEPEND = $(DEPEND_quiet)
endif endif
MKDEP = $(DEPEND) $(1).c | \
sed -e \
'/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/ */:\n/g;H;}' \
-e '$${g;p;}' -e d >$(1).d; \
[ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $(1).d; exit 1; }
.PHONY: all clean spotless try .PHONY: all clean spotless try
all: boom all: boom
@ -58,20 +64,18 @@ lex.yy.c: lang.l y.tab.h
lex.yy.o: lex.yy.c y.tab.h lex.yy.o: lex.yy.c y.tab.h
$(CC) -c $(CFLAGS) $(SLOPPY) lex.yy.c $(CC) -c $(CFLAGS) $(SLOPPY) lex.yy.c
$(call MKDEP, lex.yy)
y.tab.c y.tab.h: lang.y y.tab.c y.tab.h: lang.y
$(YACC) $(YYFLAGS) -d lang.y $(YACC) $(YYFLAGS) -d lang.y
y.tab.o: y.tab.c y.tab.o: y.tab.c
$(CC) -c $(CFLAGS) $(SLOPPY) y.tab.c $(CC) -c $(CFLAGS) $(SLOPPY) y.tab.c
$(call MKDEP, y.tab)
%.o: %.c %.o: %.c
$(CC) -c $(CFLAGS) $*.c -o $*.o $(CC) -c $(CFLAGS) $*.c -o $*.o
$(DEPEND) $*.c | \ $(call MKDEP, $*)
sed -e \
'/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/ */:\n/g;H;}' \
-e '$${g;p;}' -e d >$*.d; \
[ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $*.d; exit 1; }
-include $(OBJS:.o=.d) -include $(OBJS:.o=.d)