EXEC := boucane CC := g++ -g -Wno-write-strings -Wno-int-to-pointer-cast -mcmodel=large -nostdlib -nostdinc -no-pie -fno-builtin -fno-stack-protector -I ./ -I include 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 '*.cc' -o -name '*.S' ! -name "boot.S"))) DRIVERS_OBJ := $(addsuffix .o,$(basename $(shell find ./drivers -name '*.cc' -o -name '*.S'))) LIBS_OBJ := $(addsuffix .o,$(basename $(shell find ./libs -name '*.cc' -o -name '*.S'))) CORE_OBJ := $(addsuffix .o,$(basename $(shell find ./core -name '*.cc' -o -name '*.S'))) RES_OBJ := $(addsuffix .o,$(basename $(shell find ./res -type f))) all: $(EXEC) $(EXEC): boot/boot.o $(BOOT_OBJ) $(DRIVERS_OBJ) $(LIBS_OBJ) $(CORE_OBJ) $(RES_OBJ) boucane.o $(CC) -T $(LD_SCRIPT) -nostdlib -o $@ $^ %.o: %.S as -o $@ $^ %.o: %.cc $(CC) -c -o $@ $^ %.o: %.psf objcopy -I binary -O elf64-x86-64 --prefix-symbol res $^ $@ %.o: %.bmp objcopy -I binary -O elf64-x86-64 --prefix-symbol res $^ $@ clean: rm -f $(EXEC) find ./ -name "*.o" -delete .PHONY: clean cdrom