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)