From 4d6050e4ef39a538c9272b12436ca1e619f058a1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= Date: Fri, 14 Jan 2011 21:22:24 +0000 Subject: [PATCH] Automatically calculate make dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Make make use the automatically generated dependency files. Signed-off-by: Asbjørn Sloth Tønnesen --- src/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index bf7dcc7..fbc9ad9 100644 --- a/src/Makefile +++ b/src/Makefile @@ -11,6 +11,9 @@ USB_OBJS=usb/serial.o usb/core.o usb/desc.o usb/hw.o usb/user.o usb/vcom.o usb/c BOARD_OBJS=$(BPATH)/startup.o $(BPATH)/system.o boards/cortex_m3/core_cm3.o OBJECTS=main.o $(BOARD_OBJS) $(USB_OBJS) +depend=$(shell sh -c 'b=$$(echo $1|sed -e"s/\\.o$$//g");([ -f $$b.d ] \ + && sed -e":a;N;$$!ba;s/\\\\\\n//g" $$b.d|grep "^$$(basename $1):"\ + | cut -d: -f2)||echo $$b.c') all: crc @@ -20,7 +23,8 @@ $(PROJECT).elf: $(OBJECTS) %.bin: %.elf $(PLATFORM)-objcopy -O binary $< $*.bin -%.o: %.c +.SECONDEXPANSION: +%.o: $$(call depend,$$@) $(PLATFORM)-gcc -MM $< -MF $(patsubst %.o,%.d,$@) -MP $(PLATFORM)-gcc $(CFLAGS) -c $< -o $@ -- 1.7.10.4