Files
kern/kernel/makefile
T
Tom-on 50a1d6198e The great 64-bit rewrite
* We did loose tasking and only have a paging skeleton, but hey it took like 4 months so i'm happy that there's something :p
2026-02-08 13:04:39 +01:00

33 lines
673 B
Makefile

include ../config.mk
SRC = ./src
BIN = ./bin
INC = ./include
SRCS_C = $(wildcard $(SRC)/*.c)
SRCS_S = $(wildcard $(SRC)/*.s)
OBJS_C = $(patsubst $(SRC)/%.c, $(BIN)/%.c.o, $(SRCS_C))
OBJS_S = $(patsubst $(SRC)/%.s, $(BIN)/%.s.o, $(SRCS_S))
OUT = $(SYSROOT)/boot/kernel.elf
LINKER = ./linker.ld
# Stack Canary
SSP := 0x$(shell openssl rand -hex 8)
CCFLAGS += -DSTACK_CHK_GUARD=$(SSP)
.PHONY: all clean
all: $(OUT)
$(OUT): $(OBJS_C) $(OBJS_S)
$(LD) $(LDFLAGS) -T$(LINKER) -o $@ $^
$(BIN)/%.c.o: $(SRC)/%.c
@mkdir -p $(dir $@)
$(CC) $(CCFLAGS) -I$(INC) -c -o $@ $^
$(BIN)/%.s.o: $(SRC)/%.s
@mkdir -p $(dir $@)
$(AS) $(ASFLAGS) -o $@ $^
clean:
rm -fr $(BIN) $(OUT)