From 7b90902316604c0f78120ced0cd558e61b99cce5 Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Mon, 31 May 2021 09:40:58 +0900 Subject: [PATCH] I really should make this build system work better --- Makefile | 11 ++--------- build/arch.mk | 1 - build/x86_64.mk | 6 ++++++ 3 files changed, 8 insertions(+), 10 deletions(-) delete mode 100644 build/arch.mk create mode 100644 build/x86_64.mk diff --git a/Makefile b/Makefile index a041f77..ce4ae18 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,8 @@ TOOLCHAIN=util BASE=base export PATH := $(shell $(TOOLCHAIN)/activate.sh) -include build/arch.mk -TARGET=x86_64-pc-toaru +include build/x86_64.mk CC = ${TARGET}-gcc NM = ${TARGET}-nm @@ -13,14 +12,8 @@ AS = ${TARGET}-as OC = ${TARGET}-objcopy KERNEL_CFLAGS = -ffreestanding -O2 -std=gnu11 -g -static - -# Arch-specific arguments -KERNEL_CFLAGS += -mno-red-zone -fno-omit-frame-pointer -mfsgsbase -KERNEL_CFLAGS += -mgeneral-regs-only -z max-page-size=0x1000 -nostdlib - -# Warnings KERNEL_CFLAGS += -Wall -Wextra -Wno-unused-function -Wno-unused-parameter -KERNEL_CFLAGS += -pedantic -Wwrite-strings +KERNEL_CFLAGS += -pedantic -Wwrite-strings ${ARCH_KERNEL_CFLAGS} # Defined constants for the kernel KERNEL_CFLAGS += -D_KERNEL_ -DKERNEL_ARCH=${ARCH} diff --git a/build/arch.mk b/build/arch.mk deleted file mode 100644 index 7315763..0000000 --- a/build/arch.mk +++ /dev/null @@ -1 +0,0 @@ -ARCH=x86_64 diff --git a/build/x86_64.mk b/build/x86_64.mk new file mode 100644 index 0000000..0135d4b --- /dev/null +++ b/build/x86_64.mk @@ -0,0 +1,6 @@ +ARCH=x86_64 + +ARCH_KERNEL_CFLAGS = -mno-red-zone -fno-omit-frame-pointer -mfsgsbase +ARCH_KERNEL_CFLAGS += -mgeneral-regs-only -z max-page-size=0x1000 -nostdlib + +TARGET=x86_64-pc-toaru