From c9bd26a34d5c8f649109332aa2eea823c783fdcb Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Tue, 22 May 2012 16:09:22 -0300 Subject: [PATCH] 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. --- b2/Makefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/b2/Makefile b/b2/Makefile index 9479ca2..f1cc9f8 100644 --- a/b2/Makefile +++ b/b2/Makefile @@ -46,6 +46,12 @@ else DEPEND = $(DEPEND_quiet) 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 all: boom @@ -58,20 +64,18 @@ lex.yy.c: lang.l y.tab.h lex.yy.o: lex.yy.c y.tab.h $(CC) -c $(CFLAGS) $(SLOPPY) lex.yy.c + $(call MKDEP, lex.yy) y.tab.c y.tab.h: lang.y $(YACC) $(YYFLAGS) -d lang.y y.tab.o: y.tab.c $(CC) -c $(CFLAGS) $(SLOPPY) y.tab.c + $(call MKDEP, y.tab) %.o: %.c $(CC) -c $(CFLAGS) $*.c -o $*.o - $(DEPEND) $*.c | \ - sed -e \ - '/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/ */:\n/g;H;}' \ - -e '$${g;p;}' -e d >$*.d; \ - [ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $*.d; exit 1; } + $(call MKDEP, $*) -include $(OBJS:.o=.d)