1
0
Forka 0

Makefile: Add automatic dependency generation

This commit is contained in:
Aaron Lindsay 2012-09-26 23:35:52 -04:00
parent c455b1eeb3
commit c84fd58ce4
2 ha cambiato i file con 18 aggiunte e 8 eliminazioni

1
.gitignore esterno
Vedi File

@ -2,3 +2,4 @@ aedrix-kernel.elf
aedrix-kernel.img
*.o
*.swp
*.d

Vedi File

@ -50,21 +50,27 @@ aedrix-kernel.img: aedrix-kernel.elf
%.o: %.c
@echo ' CC $@'
$(V)$(CC) $(KCFLAGS) -c -o $@ $<
$(V)$(CC) $(KCFLAGS) -MD -c -o $@ $<
@# Automatic dependency generation fixups (http://mad-scientist.net/make/autodep.html)
@cp $*.d $(*D)/.$(*F).d; \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $(*D)/.$(*F).d; \
rm -f $*.d
# Assembly files without preprocessor directives
%.o: %.s
@echo ' AS $@'
$(V)$(AS) -o $@ $<
# Assembly files with preprocessor directives
%.o: %.S
@echo ' AS $@'
$(V)$(AS) -o $@ $<
$(V)$(CC) $(KCFLAGS) -MD -c -o $@ $<
@# Automatic dependency generation fixups (http://mad-scientist.net/make/autodep.html)
@cp $*.d $(*D)/.$(*F).d; \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $(*D)/.$(*F).d; \
rm -f $*.d
clean:
@echo ' CLEAN *.o'
$(V)rm -f $(KOBJS)
@echo ' CLEAN .*.d'
$(V)rm -f $(DEPENDENCY_FILES)
@echo ' CLEAN aedrix-kernel.elf'
$(V)rm -f aedrix-kernel.elf
@echo ' CLEAN aedrix-kernel.objdump'
@ -76,3 +82,6 @@ boot: aedrix-kernel.img
$(V)qemu-system-arm -m 1024 -M vexpress-a9 -kernel aedrix-kernel.img -serial stdio
boot-gdb: aedrix-kernel.img
$(V)qemu-system-arm -m 1024 -M vexpress-a9 -kernel aedrix-kernel.img -serial stdio -S -s
DEPENDENCY_FILES = $(foreach file,$(KOBJS), $(dir $(file)).$(notdir $(basename $(file))).d)
-include $(DEPENDENCY_FILES)