Update Makefile

This commit is contained in:
mintsuki 2022-05-26 08:12:46 +02:00
parent c2376b388f
commit c522b3f832

View file

@ -17,41 +17,37 @@ endef
# the host system's toolchain, but this is not guaranteed. # the host system's toolchain, but this is not guaranteed.
$(eval $(call DEFAULT_VAR,CC,cc)) $(eval $(call DEFAULT_VAR,CC,cc))
# Likewise, "ld" here is just a placeholder and your mileage may vary if using the
# host's "ld".
$(eval $(call DEFAULT_VAR,LD,ld))
# User controllable CFLAGS. # User controllable CFLAGS.
CFLAGS ?= -O2 -g -Wall -Wextra -pipe CFLAGS ?= -O2 -g -Wall -Wextra -Wpedantic -pipe
# User controllable linker flags. We set none by default. # User controllable linker flags. We set none by default.
LDFLAGS ?= LDFLAGS ?=
# Internal C flags that should not be changed by the user. # Internal C flags that should not be changed by the user.
override INTERNALCFLAGS := \ override INTERNALCFLAGS := \
-I. \ -I. \
-std=c11 \ -std=c11 \
-ffreestanding \ -ffreestanding \
-fno-stack-protector \ -fno-stack-protector \
-fno-stack-check \ -fno-stack-check \
-fno-pic \ -fno-pic \
-fno-pie \ -fno-pie \
-mabi=sysv \ -mabi=sysv \
-mno-80387 \ -mno-80387 \
-mno-mmx \ -mno-mmx \
-mno-3dnow \ -mno-3dnow \
-mno-sse \ -mno-sse \
-mno-sse2 \ -mno-sse2 \
-mno-red-zone \ -mno-red-zone \
-mcmodel=kernel \ -mcmodel=kernel \
-MMD -MMD
# Internal linker flags that should not be changed by the user. # Internal linker flags that should not be changed by the user.
override INTERNALLDFLAGS := \ override INTERNALLDFLAGS := \
-Tlinker.ld \ -nostdlib \
-nostdlib \ -static \
-zmax-page-size=0x1000 \ -Wl,-z,max-page-size=0x1000 \
-static -Wl,-T,linker.ld
# Use find to glob all *.c files in the directory and extract the object names. # Use find to glob all *.c files in the directory and extract the object names.
override CFILES := $(shell find ./ -type f -name '*.c') override CFILES := $(shell find ./ -type f -name '*.c')
@ -67,7 +63,7 @@ limine.h:
# Link rules for the final kernel executable. # Link rules for the final kernel executable.
$(KERNEL): $(OBJ) $(KERNEL): $(OBJ)
$(LD) $(OBJ) $(LDFLAGS) $(INTERNALLDFLAGS) -o $@ $(CC) $(OBJ) $(LDFLAGS) $(INTERNALLDFLAGS) -o $@
# Compilation rules for *.c files. # Compilation rules for *.c files.
-include $(HEADER_DEPS) -include $(HEADER_DEPS)