diff --git a/Makefile b/Makefile index c952ad596..ed23cb13b 100644 --- a/Makefile +++ b/Makefile @@ -40,10 +40,6 @@ BITCOIN_SRC := \ BITCOIN_OBJS := $(BITCOIN_SRC:.c=.o) -LIBBASE58_SRC := bitcoin/libbase58/base58.c - -LIBBASE58_OBJS := $(LIBBASE58_SRC:.c=.o) - CORE_SRC := \ close_tx.c \ find_p2sh_out.c \ @@ -167,8 +163,6 @@ BITCOIN_HEADERS := bitcoin/address.h \ bitcoin/tx.h \ bitcoin/varint.h -LIBBASE58_HEADERS := bitcoin/libbase58/libbase58.h - CORE_HEADERS := close_tx.h \ find_p2sh_out.h \ irc.h \ @@ -207,6 +201,9 @@ $(PROGRAMS): CFLAGS+=-I. default: $(PROGRAMS) $(MANPAGES) daemon-all +include bitcoin/Makefile +include wire/Makefile + # Git doesn't maintain timestamps, so we only regen if git says we should. CHANGED_FROM_GIT = [ x"`git log $@ | head -n1`" != x"`git log $< | head -n1`" -o x"`git diff $<`" != x"" ] @@ -214,10 +211,10 @@ $(MANPAGES): doc/%: doc/%.txt @if $(CHANGED_FROM_GIT); then echo a2x --format=manpage $<; a2x --format=manpage $<; else touch $@; fi # Everything depends on the CCAN headers. -$(CCAN_OBJS) $(CDUMP_OBJS) $(HELPER_OBJS) $(BITCOIN_OBJS) $(LIBBASE58_OBJS) $(TEST_PROGRAMS:=.o) ccan/ccan/cdump/tools/cdump-enumstr.o: $(CCAN_HEADERS) +$(CCAN_OBJS) $(CDUMP_OBJS) $(HELPER_OBJS) $(BITCOIN_OBJS) $(TEST_PROGRAMS:=.o) ccan/ccan/cdump/tools/cdump-enumstr.o: $(CCAN_HEADERS) # Except for CCAN, everything depends on bitcoin/ and core headers. -$(HELPER_OBJS) $(CORE_OBJS) $(BITCOIN_OBJS) $(LIBBASE58_OBJS) $(TEST_PROGRAMS:=.o): $(BITCOIN_HEADERS) $(CORE_HEADERS) $(CCAN_HEADERS) $(GEN_HEADERS) +$(HELPER_OBJS) $(CORE_OBJS) $(BITCOIN_OBJS) $(LIBBASE58_OBJS) $(TEST_PROGRAMS:=.o): $(BITCOIN_HEADERS) $(CORE_HEADERS) $(CCAN_HEADERS) $(GEN_HEADERS) $(LIBBASE58_HEADERS) test-protocol: test/test_protocol set -e; TMP=`mktemp`; for f in test/commits/*.script; do if ! $(VALGRIND) test/test_protocol < $$f > $$TMP; then echo "test/test_protocol < $$f FAILED" >&2; exit 1; fi; diff -u $$TMP $$f.expected; done; rm $$TMP @@ -229,9 +226,6 @@ protocol-diagrams: $(patsubst %.script, doc/protocol-%.svg, $(notdir $(wildcard check: test-protocol -include bitcoin/Makefile -include wire/Makefile - # Keep includes in alpha order. check-src-include-order/%: % @if [ "$$(grep '^#include' < $<)" != "$$(grep '^#include' < $< | LC_ALL=C sort)" ]; then echo "$<:1: includes out of order"; grep '^#include' < $<; echo VERSUS; grep '^#include' < $< | LC_ALL=C sort; exit 1; fi diff --git a/bitcoin/Makefile b/bitcoin/Makefile index 951b95728..8d542412e 100644 --- a/bitcoin/Makefile +++ b/bitcoin/Makefile @@ -18,3 +18,23 @@ check-source-bolt: $(BITCOIN_SRC:%=bolt-check/%) $(BITCOIN_HEADERS:%=bolt-check/ check-whitespace: $(BITCOIN_SRC:%=check-whitespace/%) $(BITCOIN_HEADERS:%=check-whitespace/%) check-whitespace/bitcoin/Makefile bitcoin-tests: $(BITCOIN_TEST_PROGRAMS:%=unittest/%) + +LIBBASE58_HEADERS := bitcoin/libbase58/libbase58.h + +LIBBASE58_SRC := bitcoin/libbase58/base58.c + +# Can't be inside submodule, as that makes git think it's dirty. +LIBBASE58_OBJS := bitcoin/libbase58.o + +# Git submodules are seriously broken. +bitcoin/libbase58/libbase58.h: + git submodule update bitcoin/libbase58/ + [ -f $@ ] || git submodule update --init bitcoin/libbase58/ + +# If we tell Make that the above builds both, it runs it twice in +# parallel. So we lie :( +bitcoin/libbase58/base58.c: bitcoin/libbase58/libbase58.h + [ -f $@ ] + +bitcoin/libbase58.o: bitcoin/libbase58/base58.c + $(COMPILE.c) $(OUTPUT_OPTION) $<