diff options
-rw-r--r-- | src/Makefile | 11 | ||||
-rw-r--r-- | src/sys/arch/amd64/Makefile | 6 | ||||
-rw-r--r-- | src/sys/conf/sys.mk | 3 | ||||
-rw-r--r-- | src/sys/os/Makefile | 5 |
4 files changed, 14 insertions, 11 deletions
diff --git a/src/Makefile b/src/Makefile index 15a65e2..9a2409c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -10,9 +10,10 @@ ISO = lunos.iso # Build tools BINUTILS_DIR := $(shell pwd)/cc/toolchain/build-binutils -CC := $(shell pwd)/cc/gcc/bin/x86_64-pc-ethos-gcc -LD := $(BINUTILS_DIR)/bin/x86_64-pc-ethos-ld -AS := $(BINUTILS_DIR)/bin/x86_64-pc-ethos-as +CC := clang +LD := ld +AS := as +SYS_LD_FLAGS := -Tsys/arch/$(TARGET)/conf/sys.ld # QEMU emulator flags QEMU_FLAGS = --enable-kvm -serial stdio -cdrom $(ISO) \ @@ -24,7 +25,6 @@ all: root lib user sys image .PHONY: sys sys: cd sys/; make CC=$(CC) AS=$(AS) LD=$(LD) TARGET=$(TARGET) TOOLS=$(shell pwd)/tools - cp $(KBIN) root/boot/ .PHONY: user user: @@ -46,6 +46,9 @@ root: .PHONY: sysroot image: + $(LD) $(shell find sys/ -name "*.o") \ + -o $(KBIN) $(SYS_LD_FLAGS) + cp $(KBIN) root/boot/ mkdir -p iso_root/boot/ cp data/boot/limine.conf $(SHIMDIR)/limine/limine-bios.sys \ $(SHIMDIR)/limine/limine-bios-cd.bin $(SHIMDIR)/limine/limine-uefi-cd.bin iso_root/ diff --git a/src/sys/arch/amd64/Makefile b/src/sys/arch/amd64/Makefile index 5f3722a..0113b47 100644 --- a/src/sys/arch/amd64/Makefile +++ b/src/sys/arch/amd64/Makefile @@ -5,7 +5,8 @@ override PROMPT := printf "%s\t\t%s\n" CONF := $(shell cat conf/GENERIC | $(TOOLS)/kconf/kconf) TARGET_BIN = ../../l5 TARGET_INC = -I../../target/header/ -CFLAGS = -I../../include/ -I../../include/lib/ $(TARGET_INC) $(MI_CFLAGS) $(MD_CFLAGS) $(CONF) +CFLAGS = -I../../include/ -I../../include/lib/ $(TARGET_INC) $(MI_CFLAGS) $(MD_CFLAGS) $(CONF) \ + -target x86_64-elf CFILES = $(shell find . -name "*.c") ASMFILES = $(shell find . -name "*.S") @@ -14,11 +15,10 @@ ASMOBJECTS = $(ASMFILES:.S=.S.o) DEPS = $(CFILES:.c=.d) ASMDEPS = $(ASMFILES:.S=.S.d) OBJECTS = $(CFILES:%.c=%.o) -LD_FLAGS = -Tconf/sys.ld -L../../target --whole-archive -l:libkern.a --no-whole-archive +LD_FLAGS = -Tconf/sys.ld .PHONY: all all: $(OBJECTS) $(ASMOBJECTS) - $(LD) $(OBJECTS) $(ASMOBJECTS) -o $(TARGET_BIN) $(LD_FLAGS) -include $(DEPS) %.o: %.c diff --git a/src/sys/conf/sys.mk b/src/sys/conf/sys.mk index d6f51a9..4893549 100644 --- a/src/sys/conf/sys.mk +++ b/src/sys/conf/sys.mk @@ -12,4 +12,5 @@ override MI_CFLAGS = -fexceptions --std=gnu11 -ffreestanding -fno-stack-protecto -Werror=incompatible-pointer-types -Werror=int-to-pointer-cast \ -Werror=return-type -mno-red-zone -mcmodel=kernel \ -D_KERNEL -Wno-pointer-sign -MMD -nostdinc \ - -Wno-format-pedantic -Wno-attributes -D_KERNEL $(MD_CFLAGS) + -Wno-format-pedantic -Wno-attributes -D_KERNEL $(MD_CFLAGS) -O0 \ + -Wno-switch -Wno-c23-extensions diff --git a/src/sys/os/Makefile b/src/sys/os/Makefile index da481ec..0cd7817 100644 --- a/src/sys/os/Makefile +++ b/src/sys/os/Makefile @@ -4,8 +4,8 @@ include ../conf/sys.mk override PROMPT := printf "%s\t\t%s\n" CONF := $(shell cat ../conf/GENERIC | $(TOOLS)/kconf/kconf) -TARGET_LIB = ../target/libkern.a -CFLAGS = -I../include/ -I../include/lib/ -I../target/header/ $(MI_CFLAGS) -O0 $(CONF) +CFLAGS = -I../include/ -I../include/lib/ -I../target/header/ $(MI_CFLAGS) -O0 $(CONF) \ + -target x86_64-elf CFILES = $(shell find . -name "*.c") CFILES += $(shell find ../vm -name "*.c") CFILES += $(shell find ../lib -name "*.c") @@ -20,7 +20,6 @@ OBJECTS = $(CFILES:%.c=%.o) .PHONY: all all: $(OBJECTS) $(PROMPT) " MI.AR " $< - ar rcs $(TARGET_LIB) $(OBJECTS) -include $(DEPS) %.o: %.c |