Makefile: fix parallel update-mocks build.

We always rebuild headerversions to examine critical system headers,
however that stomps on parallel builds with:

make[1]: execvp: tools/headerversions: Text file busy

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2019-07-30 11:40:24 +09:30
parent 928e3964f2
commit af5b3203b5

View File

@ -385,8 +385,9 @@ gen_version.h: FORCE
@if cmp $@.new $@ >/dev/null 2>&2; then rm -f $@.new; else mv $@.new $@; echo Version updated; fi
# We force make to relink this every time, to detect version changes.
# Do it atomically, otherwise parallel builds can get upset!
tools/headerversions: FORCE tools/headerversions.o $(CCAN_OBJS)
@$(LINK.o) tools/headerversions.o $(CCAN_OBJS) $(LOADLIBES) $(LDLIBS) -o $@
@trap "rm -f $@.tmp.$$$$" EXIT; $(LINK.o) tools/headerversions.o $(CCAN_OBJS) $(LOADLIBES) $(LDLIBS) -o $@.tmp.$$$$ && mv $@.tmp.$$$$ $@
# That forces this rule to be run every time, too.
gen_header_versions.h: tools/headerversions