@@ -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
@@ -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 $@
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@jms.id.au> --- external/pflash/Makefile | 7 +++++++ external/pflash/rules.mk | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-)