From 168b71461d7706724ef2a6d921bc1460c8c3a20a Mon Sep 17 00:00:00 2001 From: Stewart Smith Date: Mon, 16 Nov 2015 15:29:51 +1100 Subject: Make gard and pflash build arch specific files in pwd Signed-off-by: Stewart Smith --- external/common/rules.mk | 12 +++++------- external/gard/rules.mk | 8 ++++++-- external/pflash/rules.mk | 8 ++++++-- 3 files changed, 17 insertions(+), 11 deletions(-) (limited to 'external') diff --git a/external/common/rules.mk b/external/common/rules.mk index 79078e5..3ae9181 100644 --- a/external/common/rules.mk +++ b/external/common/rules.mk @@ -2,15 +2,15 @@ ARCH = $(shell $(GET_ARCH) "$(CROSS_COMPILE)") ifeq ($(ARCH),ARCH_ARM) arch = arm -ARCH_OBJS = common/arch_flash_common.o common/arch_flash_arm.o common/ast-sf-ctrl.o +ARCH_OBJS = common-arch_flash_common.o common-arch_flash_arm.o common-ast-sf-ctrl.o else ifeq ($(ARCH),ARCH_POWERPC) arch = powerpc -ARCH_OBJS = common/arch_flash_common.o common/arch_flash_powerpc.o +ARCH_OBJS = common-arch_flash_common.o common-arch_flash_powerpc.o else ifeq ($(ARCH),ARCH_X86) arch = x86 -ARCH_OBJS = common/arch_flash_common.o common/arch_flash_x86.o +ARCH_OBJS = common-arch_flash_common.o common-arch_flash_x86.o else $(error Unsupported architecture $(ARCH)) endif @@ -26,11 +26,9 @@ arch_links: arch_clean: rm -rf $(ARCH_OBJS) -#If arch changes make won't realise it needs to rebuild... -.PHONY: .FORCE -common/arch_flash_common.o: common/arch_flash_common.c .FORCE +$(ARCH_OBJS): common-%.o: common/%.c $(CROSS_COMPILE)gcc $(CFLAGS) -c $< -o $@ -common/arch_flash.o: $(ARCH_OBJS) +common-arch_flash.o: $(ARCH_OBJS) $(CROSS_COMPILE)ld $(LDFLAGS) -r $(ARCH_OBJS) -o $@ diff --git a/external/gard/rules.mk b/external/gard/rules.mk index a78a401..f0086a2 100644 --- a/external/gard/rules.mk +++ b/external/gard/rules.mk @@ -2,8 +2,9 @@ override CFLAGS += -O2 -Wall -Werror -I. OBJS = version.o gard.o -OBJS += libflash/file.o libflash/libflash.o libflash/libffs.o libflash/ecc.o libflash/blocklevel.o -OBJS += common/arch_flash.o +LIBFLASH_OBJS += libflash-file.o libflash-libflash.o libflash-libffs.o libflash-ecc.o libflash-blocklevel.o +OBJS += $(LIBFLASH_OBJS) +OBJS += common-arch_flash.o EXE = gard CC = $(CROSS_COMPILE)gcc @@ -25,6 +26,9 @@ version.c: make_version.sh .version %.o : %.c $(CC) $(CFLAGS) -c $< -o $@ +$(LIBFLASH_OBJS): libflash-%.o : libflash/%.c + $(CC) $(CFLAGS) -c $< -o $@ + $(EXE): $(OBJS) $(CC) $(CFLAGS) $^ -o $@ diff --git a/external/pflash/rules.mk b/external/pflash/rules.mk index 003758a..96f6a4f 100644 --- a/external/pflash/rules.mk +++ b/external/pflash/rules.mk @@ -2,8 +2,9 @@ override CFLAGS += -O2 -Wall -I. OBJS = pflash.o progress.o version.o -OBJS += libflash/libflash.o libflash/libffs.o libflash/ecc.o libflash/blocklevel.o libflash/file.o -OBJS += common/arch_flash.o +LIBFLASH_OBJS += libflash-libflash.o libflash-libffs.o libflash-ecc.o libflash-blocklevel.o libflash-file.o +OBJS += $(LIBFLASH_OBJS) +OBJS += common-arch_flash.o EXE = pflash CC = $(CROSS_COMPILE)gcc @@ -20,6 +21,9 @@ version.c: make_version.sh .version %.o : %.c $(CC) $(CFLAGS) -c $< -o $@ +$(LIBFLASH_OBJS): libflash-%.o : libflash/%.c + $(CC) $(CFLAGS) -c $< -o $@ + $(EXE): $(OBJS) $(CC) $(CFLAGS) $^ -lrt -o $@ -- cgit v1.1