[Skiboot] [PATCH] external/pflash: Fix makefile dependencies
Joel Stanley
joel at jms.id.au
Thu Dec 3 14:40:25 AEDT 2015
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
This is another race that is only exposed certain conditions. To
reproduce outside of buildroot, set PFLASH_VERSION to anything. 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 at jms.id.au>
---
external/pflash/Makefile | 7 +++++++
external/pflash/rules.mk | 7 +++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/external/pflash/Makefile b/external/pflash/Makefile
index 9d7c18372c67..fb686cb18fe1 100644
--- a/external/pflash/Makefile
+++ b/external/pflash/Makefile
@@ -24,6 +24,13 @@ ccan:
common:
$(Q_LN)ln -sf ../common .
+# Surely there's a better way than this
+common/arch_flash_common.c: | common
+common/arch_flash_x86.c: | common
+common/arch_flash_arm.c: | common
+common/arch_flash_powrepc.c: | common
+common/ast-sf-ctrl.c: | common
+
$(OBJS): | links arch_links
.PHONY: VERSION-always
diff --git a/external/pflash/rules.mk b/external/pflash/rules.mk
index f49e438cedf2..219e3d34a706 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
-LIBFLASH_OBJS += libflash-libflash.o libflash-libffs.o libflash-ecc.o \
- libflash-blocklevel.o libflash-file.o
+LIBFLASH_FILES := libflash.c libffs.c ecc.c blocklevel.c file.c
+LIBFLASH_OBJS := $(addprefix libflash-, $(LIBFLASH_FILES:.c=.o))
+LIBFLASH_SRC := $(addprefix libflash/,$(LIBFLASH_FILES))
OBJS += $(LIBFLASH_OBJS)
OBJS += common-arch_flash.o
EXE = pflash
@@ -22,6 +23,8 @@ version.c: .version
%.o : %.c
$(Q_CC)$(CC) $(CFLAGS) -c $< -o $@
+$(LIBFLASH_SRC): | links
+
$(LIBFLASH_OBJS): libflash-%.o : libflash/%.c
$(Q_CC)$(CC) $(CFLAGS) -c $< -o $@
--
2.6.2
More information about the Skiboot
mailing list