2021-04-19 19:06:28 +02:00
|
|
|
EXEC := boucane
|
2021-04-27 19:02:17 +02:00
|
|
|
CC := g++ -mcmodel=large -nostdlib -nostdinc -no-pie -fno-builtin -fno-stack-protector -I ./ -I include
|
2021-04-19 19:06:28 +02:00
|
|
|
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)
|
2021-04-24 10:09:43 +02:00
|
|
|
BOOT_OBJ := $(addsuffix .o,$(basename $(shell find ./boot -name '*.cc' -o -name '*.S' ! -name "boot.S")))
|
2021-04-21 12:23:54 +02:00
|
|
|
DRIVERS_OBJ := $(addsuffix .o,$(basename $(shell find ./drivers -name '*.cc' -o -name '*.S')))
|
2021-04-24 10:09:43 +02:00
|
|
|
LIBS_OBJ := $(addsuffix .o,$(basename $(shell find ./libs -name '*.cc' -o -name '*.S')))
|
2021-04-21 18:54:50 +02:00
|
|
|
CORE_OBJ := $(addsuffix .o,$(basename $(shell find ./core -name '*.cc' -o -name '*.S')))
|
2021-04-26 12:37:34 +02:00
|
|
|
RES_OBJ := $(addsuffix .o,$(basename $(shell find ./res -type f)))
|
2021-04-19 19:06:28 +02:00
|
|
|
|
|
|
|
all: $(EXEC)
|
|
|
|
|
2021-04-26 12:37:34 +02:00
|
|
|
$(EXEC): boot/boot.o $(BOOT_OBJ) $(DRIVERS_OBJ) $(LIBS_OBJ) $(CORE_OBJ) $(RES_OBJ) boucane.o
|
2021-04-27 19:02:17 +02:00
|
|
|
$(CC) -T $(LD_SCRIPT) -nostdlib -o $@ $^
|
2021-04-19 19:06:28 +02:00
|
|
|
|
|
|
|
%.o: %.S
|
|
|
|
as -o $@ $^
|
|
|
|
|
2021-04-21 12:23:54 +02:00
|
|
|
%.o: %.cc
|
|
|
|
$(CC) -c -o $@ $^
|
|
|
|
|
2021-04-26 12:37:34 +02:00
|
|
|
%.o: %.psf
|
|
|
|
objcopy -I binary -O elf64-x86-64 --prefix-symbol res $^ $@
|
|
|
|
|
2021-04-30 09:31:30 +02:00
|
|
|
%.o: %.bmp
|
|
|
|
objcopy -I binary -O elf64-x86-64 --prefix-symbol res $^ $@
|
|
|
|
|
2021-04-19 19:06:28 +02:00
|
|
|
clean:
|
|
|
|
rm -f $(EXEC)
|
|
|
|
find ./ -name "*.o" -delete
|
|
|
|
|
|
|
|
.PHONY: clean cdrom
|
|
|
|
|
|
|
|
|