summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile11
1 files changed, 10 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 6860f90..0fc5520 100644
--- a/Makefile
+++ b/Makefile
@@ -44,6 +44,7 @@ ASMSOURCES=$(wildcard ./asm/*.asm)
#kernel object files
OBJECTS=$(patsubst %.c, %.o, $(SOURCES))
+DEPS=$(patsubst %.c, %.d, $(SOURCES))
ASMOBJECTS=$(patsubst %.asm, %.o, $(ASMSOURCES))
KERNEL_ENTRY=./boot/kernel_entry.o
@@ -74,8 +75,16 @@ newrun: clean run
%.bin: %.asm
nasm -f bin $^ -o $@
+
+%.o: %.c
+ $(CC) -c $(CFLAGS) $*.c -o $*.o
+ $(CC) -MM -MT $*.o $(CFLAGS) $*.c > $*.d
+# include dependancies of our object files
+-include $(DEPS)
+
+
############ linking kernel binary ############
# the kernel_entry.o needs to be FIRST!!
@@ -129,7 +138,7 @@ stick: FoolOS.img
############ cleanup ############
clean_release:
- -rm *.bin FoolData.img binfont.img bochs.log $(KERNEL_ENTRY) $(ASMOBJECTS) $(OBJECTS) $(FILLUP) $(MBR) $(MP_BIN) bochs.out ne2k-tx.log ne2k-txdump.txt $(STAGE2)
+ -rm *.bin FoolData.img binfont.img bochs.log $(KERNEL_ENTRY) $(ASMOBJECTS) $(OBJECTS) $(FILLUP) $(MBR) $(MP_BIN) bochs.out ne2k-tx.log ne2k-txdump.txt $(STAGE2) $(DEPS)
make -C userspace clean
clean: clean_release