Do not use a separate variable for internal flags

This commit is contained in:
mintsuki 2022-08-06 16:08:41 +02:00
parent 0e48accbcf
commit 8053ace047

View file

@ -33,7 +33,7 @@ LDFLAGS ?=
CPPFLAGS ?= CPPFLAGS ?=
# 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 CFLAGS += \
-I. \ -I. \
-std=c11 \ -std=c11 \
-ffreestanding \ -ffreestanding \
@ -53,14 +53,14 @@ override INTERNALCFLAGS := \
-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 LDFLAGS += \
-nostdlib \ -nostdlib \
-static \ -static \
-z max-page-size=0x1000 \ -z max-page-size=0x1000 \
-T linker.ld -T linker.ld
# Internal nasm flags that should not be changed by the user. # Internal nasm flags that should not be changed by the user.
override INTERNALNASMFLAGS := \ override NASMFLAGS += \
-f elf64 -f elf64
# Use find to glob all *.c, *.S, and *.asm files in the directory and extract the object names. # Use find to glob all *.c, *.S, and *.asm files in the directory and extract the object names.
@ -79,22 +79,22 @@ 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 $@ $(LD) $(OBJ) $(LDFLAGS) -o $@
# Include header dependencies. # Include header dependencies.
-include $(HEADER_DEPS) -include $(HEADER_DEPS)
# Compilation rules for *.c files. # Compilation rules for *.c files.
%.o: %.c limine.h %.o: %.c limine.h
$(CC) $(CPPFLAGS) $(CFLAGS) $(INTERNALCFLAGS) -c $< -o $@ $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
# Compilation rules for *.S files. # Compilation rules for *.S files.
%.o: %.S limine.h %.o: %.S limine.h
$(CC) $(CPPFLAGS) $(CFLAGS) $(INTERNALCFLAGS) -c $< -o $@ $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
# Compilation rules for *.asm (nasm) files. # Compilation rules for *.asm (nasm) files.
%.o: %.asm %.o: %.asm
nasm $(NASMFLAGS) $(INTERNALNASMFLAGS) $< -o $@ nasm $(NASMFLAGS) $< -o $@
# Remove object files and the final executable. # Remove object files and the final executable.
.PHONY: clean .PHONY: clean