rules.mk 1.0 KB

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