blob: d929cb6d69b52838d8b11e4b2596bba82db14992 [file] [log] [blame]
Corey Tabaka84697242009-03-26 02:32:01 -04001LOCAL_DIR := $(GET_LOCAL_DIR)
2
3INCLUDES += \
4 -I$(LOCAL_DIR)/include
5
6BOOTOBJS += \
7 $(LOCAL_DIR)/crt0.o
8
9OBJS += \
10 $(LOCAL_DIR)/arch.o \
11 $(LOCAL_DIR)/asm.o \
12 $(LOCAL_DIR)/cache.o \
13 $(LOCAL_DIR)/cache-ops.o \
14 $(LOCAL_DIR)/ops.o \
15 $(LOCAL_DIR)/thread.o \
16 $(LOCAL_DIR)/mmu.o \
17 $(LOCAL_DIR)/faults.o \
18 $(LOCAL_DIR)/descriptor.o
19
20# set the default toolchain to x86 elf and set a #define
Corey Tabaka7e9d6152009-03-30 02:49:38 -040021TOOLCHAIN_PREFIX ?= i386-elf-
Corey Tabaka84697242009-03-26 02:32:01 -040022
23LIBGCC := $(shell $(TOOLCHAIN_PREFIX)gcc $(CFLAGS) -print-libgcc-file-name)
24#$(info LIBGCC = $(LIBGCC))
25
Corey Tabaka7e9d6152009-03-30 02:49:38 -040026cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc /dev/null 2>&1`"; \
27 then echo "$(2)"; else echo "$(3)"; fi ;)
28
29# disable SSP if the compiler supports it; it will break stuff
30CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
31
Corey Tabaka84697242009-03-26 02:32:01 -040032# potentially generated files that should be cleaned out with clean make rule
33GENERATED += \
34 $(BUILDDIR)/kernel.ld
35
36# rules for generating the linker scripts
37
38$(BUILDDIR)/kernel.ld: $(LOCAL_DIR)/kernel.ld
39 @echo generating $@
40 @$(MKDIR)
41 $(NOECHO)cp $< $@