42 lines
1.1 KiB
Plaintext
42 lines
1.1 KiB
Plaintext
clang_res_dir := $(shell $(cc) -print-resource-dir)
|
|
|
|
kernel_cflags := --target=i386-none-elf \
|
|
-march=pentium \
|
|
-nostdinc \
|
|
-nostdlib \
|
|
-ffreestanding \
|
|
-fno-builtin \
|
|
-std=c11 \
|
|
-pedantic \
|
|
-Wall \
|
|
-Wextra \
|
|
-ffunction-sections -fdata-sections
|
|
|
|
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 \
|
|
-static \
|
|
-Wl,--build-id=none \
|
|
$(clang_res_dir)/lib/*/libclang_rt.builtins-i386.a
|
|
|
|
ifeq ($(build),debug)
|
|
kernel_ldflags += -g
|
|
endif
|
|
|
|
ifeq ($(build),release)
|
|
kernel_ldflags += -Wl,--gc-sections \
|
|
-Wl,--strip-all \
|
|
-flto
|
|
endif
|