package/pkg-generic.mk: fix rule order for reinstall/rebuild/reconfigure
The reinstall, rebuild and reconfigure commands rely on the left-to-right order of evaluation of the dependencies to make sure that the stamp files are removed before attempting to rebuild. However, this order of evaluation is not guaranteed. In particular, if top-level parallel build is enabled, they are executed in parallel and the stamp file may not have been removed yet when it is evaluated to decide if rebuild has to be done. Since make 4.4, it is possible to reproduce this issue by passing `--shuffle=reverse` to the make commandline. To solve this, add a .WAIT directive between the clean and install/build/configure dependencies. .WAIT was introduced in make 4.4 as well. It makes sure that the dependencies on the left are evaluated before the dependencies on the right - exactly what we want here. Earlier versions of make don't know about .WAIT, so we need to add a .PHONY dependency to effectively ignore it. Note that this doesn't fix the problem for make versions earlier than 4.4. However, the issue isn't really that important: reinstall, rebuild and reconfigure are development tools, they're not fully reliable to begin with, and it's anyway less likely that someone uses `make -j` when doing a reinstall/rebuild/reconfigure. Signed-off-by: Arnout Vandecappelle <arnout@mind.be> Reported-by: James Hilliard <james.hilliard1@gmail.com>
This commit is contained in:
parent
d4d483451f
commit
7e3105d5c8
3
Makefile
3
Makefile
@ -1260,4 +1260,7 @@ include docs/manual/manual.mk
|
||||
|
||||
.PHONY: $(noconfig_targets)
|
||||
|
||||
# .WAIT was introduced in make 4.4. For older make, define it as phony.
|
||||
.PHONY: .WAIT
|
||||
|
||||
endif #umask / $(CURDIR) / $(O)
|
||||
|
@ -1063,17 +1063,17 @@ endif
|
||||
rm -f $$($(2)_TARGET_INSTALL_IMAGES)
|
||||
rm -f $$($(2)_TARGET_INSTALL_HOST)
|
||||
|
||||
$(1)-reinstall: $(1)-clean-for-reinstall $(1)
|
||||
$(1)-reinstall: $(1)-clean-for-reinstall .WAIT $(1)
|
||||
|
||||
$(1)-clean-for-rebuild: $(1)-clean-for-reinstall
|
||||
rm -f $$($(2)_TARGET_BUILD)
|
||||
|
||||
$(1)-rebuild: $(1)-clean-for-rebuild $(1)
|
||||
$(1)-rebuild: $(1)-clean-for-rebuild .WAIT $(1)
|
||||
|
||||
$(1)-clean-for-reconfigure: $(1)-clean-for-rebuild
|
||||
rm -f $$($(2)_TARGET_CONFIGURE)
|
||||
|
||||
$(1)-reconfigure: $(1)-clean-for-reconfigure $(1)
|
||||
$(1)-reconfigure: $(1)-clean-for-reconfigure .WAIT $(1)
|
||||
|
||||
# define the PKG variable for all targets, containing the
|
||||
# uppercase package variable prefix
|
||||
|
Loading…
Reference in New Issue
Block a user