From d9443c7fdf756212bb52ffc934b1166038bc2ad3 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Wed, 21 Apr 2021 12:23:54 +0200 Subject: Refactoring --- src/Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 7c2ee5f..1c2b408 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,25 +1,25 @@ EXEC := boucane -CC := gcc -c -fno-pie -fno-builtin -fno-stack-protector -I ./ +CC := g++ -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 "*.[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]"))) +BOOT_OBJ := $(addsuffix .cc,$(basename $(shell find ./boot -name '*.cc' -name '*.S' ! -name "boot.S"))) +DRIVERS_OBJ := $(addsuffix .o,$(basename $(shell find ./drivers -name '*.cc' -o -name '*.S'))) +LIBS_OBJ := $(addsuffix .cc,$(basename $(shell find ./libs -name '*.cc' -o -name '*.S'))) all: $(EXEC) -$(EXEC): boot/boot.o $(BOOT_OBJ) $(DRIVERS_OBJ) $(LIBC_OBJ) boucane.o - ld -n -T $(LD_SCRIPT) -nostdlib -o $@ $^ +$(EXEC): boot/boot.o $(BOOT_OBJ) $(DRIVERS_OBJ) $(LIBS_OBJ) boucane.o + $(CC) -n -T $(LD_SCRIPT) -nostdlib -o $@ $^ %.o: %.S as -o $@ $^ -%.o: %.c - $(CC) -o $@ $< - +%.o: %.cc + $(CC) -c -o $@ $^ + clean: rm -f $(EXEC) find ./ -name "*.o" -delete -- cgit v1.2.3