[Skiboot] [PATCH] Make gard and pflash build arch specific files in pwd

Stewart Smith stewart at linux.vnet.ibm.com
Mon Nov 16 15:40:07 AEDT 2015


Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 external/common/rules.mk | 12 +++++-------
 external/gard/rules.mk   |  8 ++++++--
 external/pflash/rules.mk |  8 ++++++--
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/external/common/rules.mk b/external/common/rules.mk
index 79078e57c747..3ae9181db20e 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 a78a401fd97f..f0086a2b2024 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 003758aa9413..96f6a4f6e809 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 $@
 
-- 
2.1.4



More information about the Skiboot mailing list