diff options
author | Bobby Bingham <koorogi@koorogi.info> | 2015-09-14 21:58:04 -0500 |
---|---|---|
committer | Bobby Bingham <koorogi@koorogi.info> | 2015-09-15 22:43:33 -0500 |
commit | f71dbb43a3f09b3409683e4fca4f9ec60774914d (patch) | |
tree | 0a56bb1e78753796eb35183a48dd189216223d15 | |
parent | ba2468c582934a97445f78bbbbb652386c642439 (diff) |
better accounting of build dependencies
-rw-r--r-- | Makefile | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -16,6 +16,7 @@ INSTALL = ./tools/install.sh -include config.mak BOOTSRCS = $(sort $(wildcard boot/*.c)) +BOOTOBJS = $(patsubst %.c,%.o,$(BOOTSRCS)) BOOTELFS = $(patsubst %.c,%.elf,$(BOOTSRCS)) BOOTBINS = $(patsubst boot/%.c,share/boot/%,$(BOOTSRCS)) @@ -24,14 +25,18 @@ DATA = $(sort $(wildcard src/*.bin)) OBJS = $(SRCS:.c=.o) $(DATA:.bin=.o) BINS = bin/saturn-mkboot bin/saturn-mkiso +DEPENDS = $(SRCS:.c=.d) $(BOOTSRCS:.c=.d) + .PHONY: all clean install install-bins install-data all: $(BINS) $(BOOTBINS) +-include $(DEPENDS) + install: install-bins install-data clean: - rm -f $(BINS) $(OBJS) $(BOOTBINS) $(BOOTELFS) + rm -f $(BINS) $(OBJS) $(BOOTBINS) $(BOOTELFS) $(BOOTOBJS) $(DEPENDS) bin/saturn-mkboot: src/securitycode.o src/symbols.o @@ -41,16 +46,19 @@ bin/%: src/%.o share/boot/%: boot/%.elf $(SATURN_OBJCOPY) -O binary $< $@ -%.elf: %.c boot/ldscript +%.elf: %.o boot/ldscript $(SATURN_CC) $(SATURN_CFLAGS) $(SATURN_LDFLAGS) -T boot/ldscript $< -o $@ %.c: %.bin tools/bin2c $< > $@ -%.o: %.c - $(CC) $(CFLAGS) -c $< -o $@ +boot/%.o: boot/%.c + $(SATURN_CC) $(SATURN_CFLAGS) -c $< -o $@ + $(SATURN_CC) -MM $(SATURN_CFLAGS) $< -MT $@ > boot/$*.d -src/saturn-mkboot.o: src/paths.h +src/%.o: src/%.c + $(CC) $(CFLAGS) -c $< -o $@ + $(CC) -MM $(CFLAGS) $< -MT $@ > src/$*.d src/paths.h: config.mak echo "#define DATA_PATH \"$(sharedir)\"" > $@ @@ -64,3 +72,5 @@ $(DESTDIR)$(sharedir)/%: share/% install-bins: $(BINS:bin/%=$(DESTDIR)$(bindir)/%) install-data: $(BOOTBINS:share/%=$(DESTDIR)$(sharedir)/%) + +.PRECIOUS: src/%.o boot/%.o %.elf %.c |