Move platform-specific flags to a separate file
This commit is contained in:
@@ -5,41 +5,3 @@ objcopy := llvm-objcopy
|
|||||||
platform ?= i386_pc
|
platform ?= i386_pc
|
||||||
build ?= release
|
build ?= release
|
||||||
|
|
||||||
ifeq ($(platform),i386_pc)
|
|
||||||
clang_res_dir := $(shell $(cc) -print-resource-dir)
|
|
||||||
|
|
||||||
kernel_cflags := --target=i386-none-elf \
|
|
||||||
-nostdinc \
|
|
||||||
-nostdlib \
|
|
||||||
-ffreestanding \
|
|
||||||
-fno-builtin \
|
|
||||||
-std=c11 \
|
|
||||||
-pedantic \
|
|
||||||
-Wall \
|
|
||||||
-Wextra
|
|
||||||
|
|
||||||
ifeq ($(build),debug)
|
|
||||||
kernel_cflags += -O0 -g
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(build),release)
|
|
||||||
kernel_cflags += -Oz
|
|
||||||
endif
|
|
||||||
|
|
||||||
kernel_ldflags := -mcpu=i386 \
|
|
||||||
--target=i386-none-elf \
|
|
||||||
-nostdlib \
|
|
||||||
-ffreestanding \
|
|
||||||
-fno-builtin \
|
|
||||||
-fuse-ld=lld \
|
|
||||||
-flto \
|
|
||||||
-static \
|
|
||||||
-Wl,--build-id=none \
|
|
||||||
$(clang_res_dir)/lib/*/libclang_rt.builtins-i386.a
|
|
||||||
|
|
||||||
ifeq ($(build),debug)
|
|
||||||
kernel_ldflags += -g
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ include $(srctree)/build/make.config
|
|||||||
|
|
||||||
here := $(srctree)/kernel
|
here := $(srctree)/kernel
|
||||||
|
|
||||||
|
include $(here)/make.$(platform).flags
|
||||||
include $(here)/make.src
|
include $(here)/make.src
|
||||||
|
|
||||||
all: $(srctree)/out/kernel.elf
|
all: $(srctree)/out/kernel.elf
|
||||||
|
|||||||
34
kernel/make.i386_pc.flags
Normal file
34
kernel/make.i386_pc.flags
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
clang_res_dir := $(shell $(cc) -print-resource-dir)
|
||||||
|
|
||||||
|
kernel_cflags := --target=i386-none-elf \
|
||||||
|
-nostdinc \
|
||||||
|
-nostdlib \
|
||||||
|
-ffreestanding \
|
||||||
|
-fno-builtin \
|
||||||
|
-std=c11 \
|
||||||
|
-pedantic \
|
||||||
|
-Wall \
|
||||||
|
-Wextra
|
||||||
|
|
||||||
|
ifeq ($(build),debug)
|
||||||
|
kernel_cflags += -O0 -g
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(build),release)
|
||||||
|
kernel_cflags += -Oz
|
||||||
|
endif
|
||||||
|
|
||||||
|
kernel_ldflags := -mcpu=i386 \
|
||||||
|
--target=i386-none-elf \
|
||||||
|
-nostdlib \
|
||||||
|
-ffreestanding \
|
||||||
|
-fno-builtin \
|
||||||
|
-fuse-ld=lld \
|
||||||
|
-flto \
|
||||||
|
-static \
|
||||||
|
-Wl,--build-id=none \
|
||||||
|
$(clang_res_dir)/lib/*/libclang_rt.builtins-i386.a
|
||||||
|
|
||||||
|
ifeq ($(build),debug)
|
||||||
|
kernel_ldflags += -g
|
||||||
|
endif
|
||||||
Reference in New Issue
Block a user