diff options
author | dzwdz | 2021-07-18 14:10:08 +0200 |
---|---|---|
committer | dzwdz | 2021-07-18 14:10:08 +0200 |
commit | e333a43fb7c1e39418cfcc1be660d5006903c42a (patch) | |
tree | b87a5a209ddf751a2c693b6af3f090a48a2d96a0 /Makefile | |
parent | bd5e237a64116cb6e5b046b6647d244b20d2e395 (diff) |
Make: use a from_sources function instead of a global OBJ macro
this will make sense once i start compiling other binaries too
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -6,8 +6,10 @@ CFLAGS += -Isrc/ LFLAGS = -ffreestanding -O2 -nostdlib -lgcc QFLAGS = -no-reboot -d guest_errors,int,pcall,cpu_reset -OBJ = $(patsubst src/%.s,out/obj/%.s.o,$(shell find src/ -type f -name '*.s')) -OBJ += $(patsubst src/%.c,out/obj/%.c.o,$(shell find src/ -type f -name '*.c')) +define from_sources + $(patsubst src/%.s,out/obj/%.s.o,$(shell find $(1) -type f -name '*.s')) \ + $(patsubst src/%.c,out/obj/%.c.o,$(shell find $(1) -type f -name '*.c')) +endef out/boot.iso: out/fs/boot/kernel.bin out/fs/boot/grub/grub.cfg out/fs/boot/init grub-mkrescue -o $@ out/fs/ @@ -20,7 +22,7 @@ out/fs/boot/init: src/test_module @mkdir -p $(@D) cp $< $@ -out/fs/boot/kernel.bin: $(OBJ) +out/fs/boot/kernel.bin: $(call from_sources, src/) @mkdir -p $(@D) $(CC) $(LFLAGS) -T linker.ld $^ -o $@ grub-file --is-x86-multiboot $@ |