Header deps compilation
This commit is contained in:
parent
671e19510e
commit
3e3f4a1c4c
9
Makefile
9
Makefile
@ -1,3 +1,5 @@
|
|||||||
|
# Used to generated .d file that deal with header dependencies
|
||||||
|
CPPFLAGS = -MMD
|
||||||
AS=nasm
|
AS=nasm
|
||||||
ASFLAGS += -f elf32
|
ASFLAGS += -f elf32
|
||||||
LDFLAGS += -m32 -nostdlib -static -fno-common -fno-use-cxa-atexit -fno-exceptions -fno-non-call-exceptions -fno-weak -fno-rtti -fno-stack-protector
|
LDFLAGS += -m32 -nostdlib -static -fno-common -fno-use-cxa-atexit -fno-exceptions -fno-non-call-exceptions -fno-weak -fno-rtti -fno-stack-protector
|
||||||
@ -9,6 +11,7 @@ asmsrc=$(wildcard *.asm)
|
|||||||
asmobj=$(asmsrc:%.asm=%.o)
|
asmobj=$(asmsrc:%.asm=%.o)
|
||||||
csrc=$(wildcard *.c)
|
csrc=$(wildcard *.c)
|
||||||
cobj=$(csrc:%.c=%.o)
|
cobj=$(csrc:%.c=%.o)
|
||||||
|
deps = $(csrc:%.c=%.d)
|
||||||
|
|
||||||
kernel:$(asmobj) $(cobj) linker.ld
|
kernel:$(asmobj) $(cobj) linker.ld
|
||||||
$(CXX) $(LDFLAGS) $(cobj) $(asmobj) -o $@ -T linker.ld
|
$(CXX) $(LDFLAGS) $(cobj) $(asmobj) -o $@ -T linker.ld
|
||||||
@ -30,4 +33,8 @@ test:kernel
|
|||||||
qemu-system-x86_64 -fda $<
|
qemu-system-x86_64 -fda $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) kernel $(asmobj) $(cobj)
|
$(RM) kernel $(asmobj) $(cobj) $(deps)
|
||||||
|
|
||||||
|
ifneq ($(MAKECMDGOALS),clean)
|
||||||
|
-include $(deps)
|
||||||
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user