a cow based x86_64 operating system, using limine and stivale2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
1.7 KiB

KERNEL := ../disk_root/boot/kernel.elf
CC := x86_64-elf-gcc
LD := x86_64-elf-ld
ASM := nasm
ASM_FLAGS := -felf64
PY := python3
9 months ago
BUILDDIR := ./build
1 year ago
CFLAGS = -Wall -Wextra -O3 -pipe
INTERNALLDFLAGS := -Tlinker.ld \
-nostdlib \
12 months ago
-Wl,--export-dynamic \
-zmax-page-size=0x1000 \
-static \
-pie \
-ztext
# ,--dynamic-linker
12 months ago
INTERNALCFLAGS := -mgeneral-regs-only \
-ffreestanding \
-mno-red-zone \
-fno-omit-frame-pointer\
-std=gnu11 \
-Wall -Wextra -Wno-trigraphs \
-fcompare-debug-second \
-I/opt/cross/include/ \
12 months ago
-I../lai/include \
-fPIE \
12 months ago
# -D BIGGER_FONT
12 months ago
LAI_FILE := ../lai/lai.elf
CFILES := $(shell find ./ -type f -name '*.c')
SFILES := $(shell find ./ -type f -name '*.s')
9 months ago
OBJ := $(SFILES:.s=.s.o) \
$(CFILES:.c=.c.o)
OBJ := $(patsubst ./%, $(BUILDDIR)/%, $(OBJ))
12 months ago
LDSCRIPT := linker.ld
11 months ago
.PHONY: all clean debug release
debug: INTERNALCFLAGS += -fno-inline -g
debug: all
release: INTERNALCFLAGS += -DNDEBUG
release: all
all: $(KERNEL)
11 months ago
$(KERNEL): $(OBJ) $(LDSCRIPT) parse_symbols.py
12 months ago
$(CC) $(INTERNALLDFLAGS) $(OBJ) $(LAI_FILE) -o $@
rm symbols.txt
nm ../disk_root/boot/kernel.elf -n >> symbols.txt
$(PY) ./parse_symbols.py
mv symbols.dat ../disk_root/boot/kernel.symbols
9 months ago
$(BUILDDIR)/%.c.o: %.c
mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(INTERNALCFLAGS) -c $< -o $@
9 months ago
$(BUILDDIR)/%.s.o: %.s
mkdir -p $(dir $@)
$(ASM) $(ASM_FLAGS) $< -o $@
clean:
rm -rf $(KERNEL) $(OBJ)