Makefile update

This commit is contained in:
mintsuki 2022-04-21 22:42:28 +02:00
parent f1ca8986df
commit fb73d4df13

View file

@ -2,21 +2,27 @@
# Change as needed. # Change as needed.
override KERNEL := kernel.elf override KERNEL := kernel.elf
# Convenience macro to reliably declare overridable command variables.
define DEFAULT_VAR =
ifeq ($(origin $1), default)
override $(1) := $(2)
endif
ifeq ($(origin $1), undefined)
override $(1) := $(2)
endif
endef
# It is highly recommended to use a custom built cross toolchain to build a kernel. # It is highly recommended to use a custom built cross toolchain to build a kernel.
# We are only using "cc" as a placeholder here. It may work by using # We are only using "cc" as a placeholder here. It may work by using
# the host system's toolchain, but this is not guaranteed. # the host system's toolchain, but this is not guaranteed.
ifeq ($(origin CC), default) $(eval $(call DEFAULT_VAR,CC,cc))
CC := cc
endif
# Likewise, "ld" here is just a placeholder and your mileage may vary if using the # Likewise, "ld" here is just a placeholder and your mileage may vary if using the
# host's "ld". # host's "ld".
ifeq ($(origin LD), default) $(eval $(call DEFAULT_VAR,LD,ld))
LD := ld
endif
# User controllable CFLAGS. # User controllable CFLAGS.
CFLAGS ?= -O2 -g -Wall -Wextra -Wpedantic -pipe CFLAGS ?= -O2 -g -Wall -Wextra -pipe
# User controllable linker flags. We set none by default. # User controllable linker flags. We set none by default.
LDFLAGS ?= LDFLAGS ?=
@ -29,6 +35,7 @@ override INTERNALCFLAGS := \
-fno-stack-protector \ -fno-stack-protector \
-fno-stack-check \ -fno-stack-check \
-fno-pic \ -fno-pic \
-fno-pie \
-mabi=sysv \ -mabi=sysv \
-mno-80387 \ -mno-80387 \
-mno-mmx \ -mno-mmx \