aboutsummaryrefslogtreecommitdiff
path: root/external/common/rules.mk
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2015-12-04 11:00:00 +1030
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-12-04 14:36:48 +1100
commit6c21c4ffaf825b7a1bd130ff5b21c6349e772b68 (patch)
tree8ebc9eccc2ef87f3d0bdef39a72df4a4a1f4731b /external/common/rules.mk
parent3ee71369bcc9c3b299586acb7f714d83c7447011 (diff)
downloadskiboot-6c21c4ffaf825b7a1bd130ff5b21c6349e772b68.zip
skiboot-6c21c4ffaf825b7a1bd130ff5b21c6349e772b68.tar.gz
skiboot-6c21c4ffaf825b7a1bd130ff5b21c6349e772b68.tar.bz2
external/pflash: Fix makefile dependencies
When building under buildroot, libflash was being built before the links: make[2]: *** No rule to make target 'libflash/libflash.c', needed by 'libflash-libflash.o'. Stop. make[2]: *** Waiting for unfinished jobs.... LN ccan LN common LN libflash To reproduce this outside of buildroot, set PFLASH_VERSION to anything. This is another race that is only exposed in certain conditions. By describing the dependencies on the source files the build works again. I think it's almost time to stop using symlinks. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external/common/rules.mk')
-rw-r--r--external/common/rules.mk20
1 files changed, 12 insertions, 8 deletions
diff --git a/external/common/rules.mk b/external/common/rules.mk
index 4d94fe8..356c207 100644
--- a/external/common/rules.mk
+++ b/external/common/rules.mk
@@ -1,27 +1,29 @@
-ARCH = $(shell $(GET_ARCH) "$(CROSS_COMPILE)")
+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 := arm
+ARCH_FILES := arch_flash_common.c arch_flash_arm.c ast-sf-ctrl.c
else
ifeq ($(ARCH),ARCH_POWERPC)
-arch = powerpc
-ARCH_OBJS = common-arch_flash_common.o common-arch_flash_powerpc.o
+arch := powerpc
+ARCH_FILES := arch_flash_common.c arch_flash_powerpc.c
else
ifeq ($(ARCH),ARCH_X86)
-arch = x86
-ARCH_OBJS = common-arch_flash_common.o common-arch_flash_x86.o
+arch := x86
+ARCH_FILES := arch_flash_common.c arch_flash_x86.c
else
$(error Unsupported architecture $(ARCH))
endif
endif
endif
+ARCH_SRC := $(addprefix common/,$(ARCH_FILES))
+ARCH_OBJS := $(addprefix common-,$(ARCH_FILES:.c=.o))
# Arch links are like this so we can have dependencies work (so that we don't
# run the rule when the links exist), pretty build output (knowing the target
# name) and a list of the files so we can clean them up.
-ARCH_LINKS = common/ast-sf-ctrl.c common/ast.h common/io.h
+ARCH_LINKS := common/ast-sf-ctrl.c common/ast.h common/io.h
arch_links: $(ARCH_LINKS)
common/ast.h : ../../include/ast.h | common
@@ -37,6 +39,8 @@ common/ast-sf-ctrl.c : ../../hw/ast-bmc/ast-sf-ctrl.c | common
arch_clean:
rm -rf $(ARCH_OBJS) $(ARCH_LINKS)
+$(ARCH_SRC): | common
+
$(ARCH_OBJS): common-%.o: common/%.c
$(Q_CC)$(CROSS_COMPILE)gcc $(CFLAGS) -c $< -o $@