diff options
author | Greg Bellows <greg.bellows@linaro.org> | 2015-01-05 11:02:11 -0600 |
---|---|---|
committer | Greg Bellows <greg.bellows@linaro.org> | 2015-01-05 11:02:11 -0600 |
commit | 9e2cb23c7314c4862244d20da67aee4fde21d522 (patch) | |
tree | 96fe14a7bde220d919c126d39392ebe05f2e24ba | |
parent | 521807e4f9aaf816588514949fe470efa501b2a0 (diff) |
Convert arm Makefile to local build
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
-rw-r--r-- | Makefile | 19 | ||||
-rw-r--r-- | arm/Makefile | 71 | ||||
-rw-r--r-- | arm/tztest_secure.lds.S | 2 | ||||
-rw-r--r-- | libcflat/Makefile | 5 |
4 files changed, 48 insertions, 49 deletions
@@ -9,7 +9,7 @@ include config.mak libgcc := $(shell $(CC) -m$(ARCH) --print-libgcc-file-name) -export FLATLIBS = libcflat/libcflat.a $(libgcc) libcflat/libeabi.a +export FLATLIBS = ../libcflat/libcflat.a $(libgcc) ../libcflat/$(ARCH)/libeabi.a # cc-option # Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0) @@ -17,29 +17,30 @@ export FLATLIBS = libcflat/libcflat.a $(libgcc) libcflat/libeabi.a cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \ > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) -CFLAGS += -I$(ARCH) -DASM +autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d + CFLAGS += -m${ARCH} -mcpu=$(PROCESSOR) CFLAGS += $(autodepend-flags) -CFLAGS += -std=gnu99 +CFLAGS += -std=gnu99 -DASM CFLAGS += -ffreestanding CFLAGS += -Wextra -Werror -Wall CFLAGS += -g -O0 -CFLAGS += -Ilib -Ilibcflat/include -Ilibcflat/$(ARCH)/include -CFLAGS += -Iplatform/$(PLAT) +CFLAGS += -I. -I/include -I$(ARCH)/include +CFLAGS += -I../libcflat/include +CFLAGS += -I../platform/$(PLAT) CFLAGS += $(call cc-option, -fomit-frame-pointer, "") CFLAGS += $(call cc-option, -fno-stack-protector, "") CFLAGS += $(call cc-option, -fno-stack-protector-all, "") export CFLAGS -#autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d -#-include */.*.d */*/.*.d - all: $(MAKE) -C libcflat all + $(MAKE) -C $(ARCH) all clean: $(MAKE) -C libcflat clean + $(MAKE) -C $(ARCH) clean distclean: clean - $(RM) config.mak ..d cscope.* + $(RM) config.mak cscope.* diff --git a/arm/Makefile b/arm/Makefile index 3a3e0f2..b7b3b12 100644 --- a/arm/Makefile +++ b/arm/Makefile @@ -1,42 +1,40 @@ -SECTEST = $(ARCH)/tztest_secure.elf -NSECTEST = $(ARCH)/tztest_nonsecure.elf -SECTESTIMAGE = $(ARCH)/tztest_secure.flat -NSECTESTIMAGE = $(ARCH)/tztest_nonsecure.flat -TZTEST_IMAGE = $(ARCH)/tztest.img -TZBOOT = $(ARCH)/tzboot.o -TZSECLOAD = $(ARCH)/tztest_secure.lds -TZNSECLOAD = $(ARCH)/tztest_nonsecure.lds -TZSECOBJS = $(ARCH)/secure_init.o \ - $(ARCH)/secure_svc.o \ - $(ARCH)/secure_asm.o \ - $(ARCH)/monitor.o \ - $(ARCH)/monitor_asm.o \ - $(ARCH)/sm_asm.o \ - $(ARCH)/sm.o -TZNSECOBJS = $(ARCH)/nonsecure_init.o \ - $(ARCH)/nonsecure_svc.o \ - $(ARCH)/tztest.o -TZOBJS = $(ARCH)/common_mmu.o \ - $(ARCH)/common_svc.o +SECTEST = tztest_secure.elf +NSECTEST = tztest_nonsecure.elf +SECTESTIMAGE = tztest_secure.flat +NSECTESTIMAGE = tztest_nonsecure.flat +TZTEST_IMAGE = tztest.img +TZBOOT = tzboot.o +TZSECLOAD = tztest_secure.lds +TZNSECLOAD = tztest_nonsecure.lds +TZSECOBJS = secure_init.o \ + secure_svc.o \ + secure_asm.o \ + monitor.o \ + monitor_asm.o \ + sm_asm.o \ + sm.o +TZNSECOBJS = nonsecure_init.o \ + nonsecure_svc.o \ + tztest.o +TZOBJS = common_mmu.o \ + common_svc.o ifneq (,$(findstring DEBUG, $(CFLAGS))) - TZNSECOBJS += $(ARCH)/tztest_debug.o + TZNSECOBJS += tztest_debug.o endif -all: $(TZTEST_IMAGE) +-include .*.d ################################################################## -COMMON = $(FLATLIBS) $(TZOBJS) - -$(SECTEST): $(TZSECOBJS) $(COMMON) $(TZSECLOAD) $(TZNSECLOAD) $(TZBOOT) - $(LD) -o $@ $(TZSECOBJS) $(COMMON) --script=$(TZSECLOAD) +$(SECTEST): $(TZSECOBJS) $(TZOBJS) $(TZSECLOAD) $(TZNSECLOAD) $(TZBOOT) + $(LD) -o $@ $(TZSECOBJS) $(FLATLIBS) $(TZOBJS) --script=$(TZSECLOAD) $(SECTESTIMAGE): $(SECTEST) $(OBJCOPY) -O binary $(SECTEST) $(SECTESTIMAGE) -$(NSECTEST): $(TZNSECOBJS) $(COMMON) $(TZNSECLOAD) $(TZSECLOAD) - $(LD) -o $@ $(TZNSECOBJS) $(COMMON) --script=$(TZNSECLOAD) +$(NSECTEST): $(TZNSECOBJS) $(TZOBJS) $(TZNSECLOAD) $(TZSECLOAD) + $(LD) -o $@ $(TZNSECOBJS) $(FLATLIBS) $(TZOBJS) --script=$(TZNSECLOAD) $(NSECTESTIMAGE): $(NSECTEST) $(OBJCOPY) -O binary $(NSECTEST) $(NSECTESTIMAGE) @@ -46,21 +44,22 @@ $(TZTEST_IMAGE): $(SECTESTIMAGE) $(NSECTESTIMAGE) dd if=$(NSECTESTIMAGE) of=$@ seek=65536 oflag=seek_bytes 2> /dev/null chmod +x $(TZTEST_IMAGE) -$(TZBOOT): $(ARCH)/tzboot.S +$(TZBOOT): tzboot.S $(CC) $(CFLAGS) -c -o $@ $< -$(TZSECLOAD): $(ARCH)/tztest_secure.lds.S Makefile platform/$(PLAT)/ +$(TZSECLOAD): tztest_secure.lds.S Makefile ../platform/$(PLAT)/ $(CC) $(CFLAGS) -E -P -C -o $@ $< -$(TZNSECLOAD): $(ARCH)/tztest_nonsecure.lds.S Makefile platform/$(PLAT)/ +$(TZNSECLOAD): tztest_nonsecure.lds.S Makefile ../platform/$(PLAT)/ $(CC) $(CFLAGS) -E -P -C -o $@ $< -%.o: %.c - $(CC) $(CFLAGS) -c -o $@ $< +%.o: %.S + $(CC) $(CFLAGS) -c -nostdlib -o $@ $< + +all: $(TZTEST_IMAGE) -arch_clean: +clean: $(RM) $(TZOBJS) $(TZSECOBJS) $(TZNSECOBJS) \ $(TZSECLOAD) $(TZNSECLOAD) $(TZBOOT) \ $(SECTEST) $(SECTESTIMAGE) $(NSECTEST) $(NSECTESTIMAGE) \ - $(TZTEST_IMAGE) \ - $(LIBCFLAT_OBJS) $(LIBCFLAT_archdir)/.*.d $(ARCH)/.*.d + $(TZTEST_IMAGE) .*.d diff --git a/arm/tztest_secure.lds.S b/arm/tztest_secure.lds.S index 6593a5f..9bb5e71 100644 --- a/arm/tztest_secure.lds.S +++ b/arm/tztest_secure.lds.S @@ -18,7 +18,7 @@ _ram_nsec_base = RAM_NSEC_BASE; SECTIONS { . = FLASH_SEC_BASE; - .boot : { arm/tzboot.o } + .boot : { tzboot.o } _eboot = .; _flash_secvecs_start = .; diff --git a/libcflat/Makefile b/libcflat/Makefile index 236f2f0..d64453f 100644 --- a/libcflat/Makefile +++ b/libcflat/Makefile @@ -9,8 +9,7 @@ LIBCFLAT_OBJS = printf.o \ LIBEABI = $(ARCH)/libeabi.a LIBEABI_OBJS = $(ARCH)/eabi_compat.o -CFLAGS += -Iinclude -I$(ARCH)/include -CFLAGS += -I../platform/$(PLAT) -I../../platform/$(PLAT) +-include .*.d $(ARCH)/.*.d $(LIBCFLAT): $(LIBCFLAT_OBJS) $(AR) rcs $@ $^ @@ -30,4 +29,4 @@ libcflat_clean: $(RM) $(LIBCFLAT) $(LIBCFLAT_OBJS) clean: libcflat_clean libeabi_clean - $(RM) .*.d + $(RM) .*.d $(ARCH)/.*.d |