From dc562f05333799b1681ee2b478c8c3ea2e801de2 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sat, 1 Apr 2017 21:28:30 +1030 Subject: [PATCH] Makefiles: fix from-scratch parallel build. 1) Need config.h before wire/gen_ are compiled. 2) The rule to checkout the libbase58 submodule doesn't work, so use the older one-depends-on-the-other approach. Signed-off-by: Rusty Russell --- bitcoin/Makefile | 8 +++++--- wire/Makefile | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bitcoin/Makefile b/bitcoin/Makefile index 49e47d7c8..cb6874302 100644 --- a/bitcoin/Makefile +++ b/bitcoin/Makefile @@ -26,9 +26,11 @@ LIBBASE58_SRC := bitcoin/libbase58/base58.c # Can't be inside submodule, as that makes git think it's dirty. LIBBASE58_OBJS := bitcoin/libbase58.o -# Wildcards here are magic. See http://stackoverflow.com/questions/2973445/gnu-makefile-rule-generating-a-few-targets-from-a-single-source-file -bitcoin/libbase58/libbase58.% bitcoin/libbase58/base58.%: - git submodule update bitcoin/libbase58/ +# Wildcards trick from http://stackoverflow.com/questions/2973445/gnu-makefile-rule-generating-a-few-targets-from-a-single-source-file doesn't work with no dependency, so instead make one depend on the other: +$(LIBBASE58_SRC): $(LIBBASE58_HEADERS) + +$(LIBBASE58_HEADERS): + git submodule update bitcoin/libbase58/ || true [ -f $@ ] || git submodule update --init bitcoin/libbase58/ bitcoin/libbase58.o: bitcoin/libbase58/base58.c diff --git a/wire/Makefile b/wire/Makefile index 055ceb873..7c29bf528 100644 --- a/wire/Makefile +++ b/wire/Makefile @@ -42,8 +42,8 @@ wire/gen_onion_wire.h: $(WIRE_GEN) wire/gen_onion_wire_csv wire/gen_onion_wire.c: $(WIRE_GEN) wire/gen_onion_wire_csv $(WIRE_GEN) ${@:.c=.h} onion_type < wire/gen_onion_wire_csv > $@ -wire/gen_peer_wire.o: wire/gen_peer_wire.h -wire/gen_onion_wire.o: wire/gen_onion_wire.h +wire/gen_peer_wire.o: wire/gen_peer_wire.h $(CCAN_HEADERS) +wire/gen_onion_wire.o: wire/gen_onion_wire.h $(CCAN_HEADERS) check-source: $(WIRE_SRC:%=check-src-include-order/%) $(WIRE_HEADERS:%=check-hdr-include-order/%)