diff options
author | Joel Stanley <joel@jms.id.au> | 2016-07-22 23:17:40 +0930 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-07-27 18:13:58 +1000 |
commit | 8692215d6ff81a935e8086ccff6c05e9dc2cc6be (patch) | |
tree | 879279d5b77650cbd2976f40bd4626d65fa8dc26 | |
parent | 4ee8c5e30d181f3e414e0d8cf8b4f88069f02827 (diff) | |
download | skiboot-8692215d6ff81a935e8086ccff6c05e9dc2cc6be.zip skiboot-8692215d6ff81a935e8086ccff6c05e9dc2cc6be.tar.gz skiboot-8692215d6ff81a935e8086ccff6c05e9dc2cc6be.tar.bz2 |
pflash: Clean up makefiles and resolve build race
The pflash build process has regressed from when the were last fixed in
6c21c4ffaf82.
This patch resolves that issue and performs some cleanups:
- Remove duplicated rules. Patches had moved rules into common files,
but forgotten to remove them from the pflash makefiles.
- Make assignements simply expanded variables where possible. Form the
make manual:
Functions referenced in the definition will be executed every time
the variable is expanded. This makes make run slower; worse, it
causes the wildcard and shell functions to give unpredictable
results because you cannot easily control when they are called, or
even how many times.
To avoid all the problems and inconveniences of recursively
expanded variables, there is another flavor: simply expanded
variables.
- set the 'shared' target as a dependency of the libflash objects. This
was the final piece to resolve the race condition.
The failed build could be reproduced by doing a `git clean -f -x` and
then running the following:
$ make -j 32 CROSS_COMPILE=arm-linux-gnueabi- SKIBOOT_VERSION=5.2.4
PFLASH_VERSION=5.2.4 V=1 -C external/pflash all LINKAGE=dynamic
make: Entering directory '/home/joel/dev/skiboot/external/pflash'
ln -sf ../../libflash ./libflash
ln -sf ../../ccan ./ccan
ln -sf ../common ./common
cc -O2 -Wall -I. -c pflash.c -o pflash.o
cc -O2 -Wall -I. -c progress.c -o progress.o
make -C ../shared
make[1]: Entering directory '/home/joel/dev/skiboot/external/shared'
ln -sf ../../hw/ast-bmc/ast-sf-ctrl.c common/ast-sf-ctrl.c
ln -sf ../../include/ast.h common/ast.h
ln -sf arch_flash_arm_io.h common/io.h
cc -O2 -Wall -I. -c common/arch_flash_common.c -o
common-arch_flash_common.o
cc -O2 -Wall -I. -c common/arch_flash_arm.c -o common-arch_flash_arm.o
cc -O2 -Wall -I. -c common/ast-sf-ctrl.c -o common-ast-sf-ctrl.o
cc -O2 -Wall -I. -c version.c -o version.o
ld -r common-arch_flash_common.o common-arch_flash_arm.o
common-ast-sf-ctrl.o -o common-arch_flash.o
ln -sf ../../libflash ./libflash
ln -sf ../../ccan ./ccan
ln -sf ../common ./common
make[1]: *** No rule to make target 'libflash/file.c', needed by
'libflash-file.o'. Stop.
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/joel/dev/skiboot/external/shared'
rules.mk:25: recipe for target
'../shared/libflash.so.skiboot-5.2.4-1-g9f13f64c322f-joel-dirty-d5873ce'
failed
make: ***
[../shared/libflash.so.skiboot-5.2.4-1-g9f13f64c322f-joel-dirty-d5873ce]
Error 2
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
(cherry picked from commit c327eddd9b291a0e6e54001fa3b1e547bad3fca2)
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | external/pflash/Makefile | 2 | ||||
-rw-r--r-- | external/pflash/rules.mk | 16 | ||||
-rw-r--r-- | external/shared/Makefile | 23 |
3 files changed, 20 insertions, 21 deletions
diff --git a/external/pflash/Makefile b/external/pflash/Makefile index 3a4c563..4c9b08b 100644 --- a/external/pflash/Makefile +++ b/external/pflash/Makefile @@ -1,5 +1,5 @@ include rules.mk -GET_ARCH = ../../external/common/get_arch.sh +GET_ARCH := ../../external/common/get_arch.sh include ../../external/common/rules.mk all: links arch_links $(EXE) diff --git a/external/pflash/rules.mk b/external/pflash/rules.mk index df814fe..6be9b67 100644 --- a/external/pflash/rules.mk +++ b/external/pflash/rules.mk @@ -1,11 +1,8 @@ .DEFAULT_GOAL := all override CFLAGS += -O2 -Wall -I. -PFLASH_OBJS = pflash.o progress.o version.o common-arch_flash.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 = $(PFLASH_OBJS) $(LIBFLASH_OBJS) +PFLASH_OBJS := pflash.o progress.o version.o common-arch_flash.o +OBJS := $(PFLASH_OBJS) $(LIBFLASH_OBJS) EXE = pflash sbindir?=/usr/sbin @@ -14,8 +11,8 @@ LINKAGE?=static ifeq ($(LINKAGE),dynamic) include ../shared/rules.mk -SHARED=../shared/$(SHARED_NAME) -OBJS=$(PFLASH_OBJS) $(SHARED) +SHARED := ../shared/$(SHARED_NAME) +OBJS := $(PFLASH_OBJS) $(SHARED) INSTALLDEPS+=install-shared install-shared: @@ -35,11 +32,6 @@ 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 $@ - $(EXE): $(OBJS) $(Q_CC)$(CC) $(CFLAGS) $^ -lrt -o $@ diff --git a/external/shared/Makefile b/external/shared/Makefile index c643666..e0b3ff3 100644 --- a/external/shared/Makefile +++ b/external/shared/Makefile @@ -1,23 +1,30 @@ .DEFAULT_GOAL := all -GET_ARCH = ../../external/common/get_arch.sh +GET_ARCH := ../../external/common/get_arch.sh include ../../external/common/rules.mk include rules.mk PREFIX ?= /usr/local/ -LIBDIR = $(PREFIX)/lib -INCDIR = $(PREFIX)/include/libflash +LIBDIR := $(PREFIX)/lib +INCDIR := $(PREFIX)/include/libflash ifneq ($(ARCH), ARCH_ARM) CFLAGS += -m64 endif CFLAGS += -Werror -Wall -g2 -ggdb -I. -fPIC -LIBFLASH_OBJS = libflash-file.o libflash-libflash.o libflash-libffs.o libflash-ecc.o libflash-blocklevel.o -ARCHFLASH_OBJS = common-arch_flash.o -OBJS = $(LIBFLASH_OBJS) $(ARCHFLASH_OBJS) +LIBFLASH_OBJS := libflash-file.o libflash-libflash.o libflash-libffs.o \ + libflash-ecc.o libflash-blocklevel.o +ARCHFLASH_OBJS := common-arch_flash.o +OBJS := $(LIBFLASH_OBJS) $(ARCHFLASH_OBJS) -LIBFLASH_H = libflash/file.h libflash/libflash.h libflash/libffs.h libflash/ffs.h libflash/ecc.h libflash/blocklevel.h libflash/errors.h -ARCHFLASH_H = common/arch_flash.h +LIBFLASH_H := libflash/file.h libflash/libflash.h libflash/libffs.h \ + libflash/ffs.h libflash/ecc.h libflash/blocklevel.h libflash/errors.h +ARCHFLASH_H := common/arch_flash.h + +LIBFLASH_FILES := libflash.c libffs.c ecc.c blocklevel.c file.c +LIBFLASH_SRC := $(addprefix libflash/,$(LIBFLASH_FILES)) + +$(LIBFLASH_SRC): | links $(LIBFLASH_OBJS) : libflash-%.o : libflash/%.c $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ |