rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | LOCAL_DIR := $(GET_LOCAL_DIR) |
| 2 | |
| 3 | MODULE := $(LOCAL_DIR) |
| 4 | |
| 5 | WITH_KERNEL_VM=1 |
| 6 | |
| 7 | GLOBAL_DEFINES += \ |
| 8 | MEMBASE=0x00200000U \ |
| 9 | KERNEL_ASPACE_BASE=0x00200000U \ |
| 10 | KERNEL_ASPACE_SIZE=0x7fe00000U \ |
| 11 | X86_WITH_FPU=1 \ |
| 12 | SMP_MAX_CPUS=1 |
| 13 | |
| 14 | |
| 15 | KERNEL_BASE ?= 0x00200000 |
| 16 | KERNEL_LOAD_OFFSET ?= 0x0 |
| 17 | |
| 18 | MODULE_SRCS += \ |
| 19 | $(LOCAL_DIR)/crt0.S \ |
| 20 | $(LOCAL_DIR)/arch.c \ |
| 21 | $(LOCAL_DIR)/asm.S \ |
| 22 | $(LOCAL_DIR)/cache.c \ |
| 23 | $(LOCAL_DIR)/cache-ops.S \ |
| 24 | $(LOCAL_DIR)/ops.S \ |
| 25 | $(LOCAL_DIR)/thread.c \ |
| 26 | $(LOCAL_DIR)/mmu.c \ |
| 27 | $(LOCAL_DIR)/faults.c \ |
| 28 | $(LOCAL_DIR)/descriptor.c \ |
| 29 | $(LOCAL_DIR)/fpu.c |
| 30 | |
| 31 | # set the default toolchain to x86 elf and set a #define |
| 32 | ifndef TOOLCHAIN_PREFIX |
| 33 | TOOLCHAIN_PREFIX := i386-elf- |
| 34 | endif |
| 35 | |
| 36 | |
| 37 | cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc /dev/null 2>&1`"; \ |
| 38 | then echo "$(2)"; else echo "$(3)"; fi ;) |
| 39 | |
| 40 | # disable SSP if the compiler supports it; it will break stuff |
| 41 | GLOBAL_CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) |
| 42 | |
| 43 | GLOBAL_COMPILEFLAGS += -fasynchronous-unwind-tables |
| 44 | GLOBAL_COMPILEFLAGS += -gdwarf-2 |
| 45 | |
| 46 | ARCH_OPTFLAGS := -O2 |
| 47 | |
| 48 | # potentially generated files that should be cleaned out with clean make rule |
| 49 | GENERATED += \ |
| 50 | $(BUILDDIR)/kernel.ld |
| 51 | |
| 52 | # rules for generating the linker scripts |
| 53 | $(BUILDDIR)/kernel.ld: $(LOCAL_DIR)/kernel.ld $(wildcard arch/*.ld) |
| 54 | @echo generating $@ |
| 55 | @$(MKDIR) |
| 56 | $(NOECHO)cp $< $@ |
| 57 | |
| 58 | include make/module.mk |