summaryrefslogtreecommitdiff
path: root/na/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'na/Makefile')
-rw-r--r--na/Makefile9
1 files changed, 8 insertions, 1 deletions
diff --git a/na/Makefile b/na/Makefile
index 6b5e84c..cc51a65 100644
--- a/na/Makefile
+++ b/na/Makefile
@@ -42,7 +42,8 @@ ARCH := riscv
BUILD := build
TARGET := $(BUILD)/kernel.elf
IMAGE := $(BUILD)/kernel.bin
-LINKER_SCRIPT := linker.ld
+LDS_SRC := arch/$(ARCH)/kernel/lumeos.lds.S
+LINKER_SCRIPT := $(BUILD)/lumeos.lds
# Common flags (base, before module includes)
WARNINGS := -Wall -Wextra -Wno-unused-parameter
@@ -103,6 +104,12 @@ DEPS := $(OBJS:.o=.d)
all: $(IMAGE)
+# Preprocess linker script template (.lds.S → .lds)
+$(LINKER_SCRIPT): $(LDS_SRC) include/lume/lumeos.lds.h
+ @echo " LDS $@"
+ @mkdir -p $(dir $@)
+ @$(CC) -E -P -x c $(INCLUDES) $< -o $@
+
# Link kernel ELF
$(TARGET): $(OBJS) $(LINKER_SCRIPT)
@echo " LD $@"