diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2021-04-19 19:06:28 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2021-04-19 19:06:28 +0200 |
| commit | ca1e725b0dc9b10997897dd2ac6d44028601d9bb (patch) | |
| tree | 0eb7bd087a2382d1d1a660ceda1eae01d1b8b3ca /src/Makefile | |
| parent | f5146ca9c987ed5e6ea69a0c67b7ed03444be30c (diff) | |
Init sources
Diffstat (limited to 'src/Makefile')
| -rw-r--r-- | src/Makefile | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..7c2ee5f --- /dev/null +++ b/src/Makefile @@ -0,0 +1,29 @@ +EXEC := boucane +CC := gcc -c -fno-pie -fno-builtin -fno-stack-protector -I ./ +LD_SCRIPT := linker.ld + +# Note that BOOT_OBJ do not match boot.S +# Indeed boot.o generated by boot.S should appear +# first in the kernel binary (thus it must be linked first, cf the $(EXEC) rule) +BOOT_OBJ := $(addsuffix .o,$(basename $(shell find ./boot -name "*.[c|S]" ! -name "boot.S"))) +DRIVERS_OBJ := $(addsuffix .o,$(basename $(shell find ./drivers -name "*.[c|S]"))) +LIBC_OBJ := $(addsuffix .o,$(basename $(shell find ./libc -name "*.[c|S]"))) + +all: $(EXEC) + +$(EXEC): boot/boot.o $(BOOT_OBJ) $(DRIVERS_OBJ) $(LIBC_OBJ) boucane.o + ld -n -T $(LD_SCRIPT) -nostdlib -o $@ $^ + +%.o: %.S + as -o $@ $^ + +%.o: %.c + $(CC) -o $@ $< + +clean: + rm -f $(EXEC) + find ./ -name "*.o" -delete + +.PHONY: clean cdrom + + |
