Makefile: normalize all the Makefiles

We create ALL_PROGRAMS, ALL_TEST_PROGRAMS, ALL_C_SOURCES and
ALL_C_HEADERS.  Then the toplevel Makefile knows which are
autogenerated (by wildcard), so it can have all the rules to clean
them or check the source as necessary.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2020-08-31 10:43:25 +09:30 committed by neil saitug
parent 2835cf8a43
commit 1746406e41
28 changed files with 251 additions and 550 deletions

View File

@ -204,7 +204,11 @@ WIRE_GEN := $(BOLT_GEN)
# If you use wiregen, you're dependent on the tool, its templates, and Makefile # If you use wiregen, you're dependent on the tool, its templates, and Makefile
WIRE_GEN_DEPS := $(WIRE_GEN) Makefile $(wildcard tools/gen/*_template) WIRE_GEN_DEPS := $(WIRE_GEN) Makefile $(wildcard tools/gen/*_template)
ALL_PROGRAMS = # These are filled by individual Makefiles
ALL_PROGRAMS :=
ALL_TEST_PROGRAMS :=
ALL_C_SOURCES :=
ALL_C_HEADERS := gen_header_versions.h gen_list_of_builtin_plugins.h gen_version.h
CPPFLAGS += -DBINTOPKGLIBEXECDIR="\"$(shell sh tools/rel.sh $(bindir) $(pkglibexecdir))\"" CPPFLAGS += -DBINTOPKGLIBEXECDIR="\"$(shell sh tools/rel.sh $(bindir) $(pkglibexecdir))\""
CFLAGS = $(CPPFLAGS) $(CWARNFLAGS) $(CDEBUGFLAGS) $(COPTFLAGS) -I $(CCANDIR) $(EXTERNAL_INCLUDE_FLAGS) -I . -I/usr/local/include $(SQLITE3_CFLAGS) $(POSTGRES_INCLUDE) $(FEATURES) $(COVFLAGS) $(DEV_CFLAGS) -DSHACHAIN_BITS=48 -DJSMN_PARENT_LINKS $(PIE_CFLAGS) $(COMPAT_CFLAGS) -DBUILD_ELEMENTS=1 CFLAGS = $(CPPFLAGS) $(CWARNFLAGS) $(CDEBUGFLAGS) $(COPTFLAGS) -I $(CCANDIR) $(EXTERNAL_INCLUDE_FLAGS) -I . -I/usr/local/include $(SQLITE3_CFLAGS) $(POSTGRES_INCLUDE) $(FEATURES) $(COVFLAGS) $(DEV_CFLAGS) -DSHACHAIN_BITS=48 -DJSMN_PARENT_LINKS $(PIE_CFLAGS) $(COMPAT_CFLAGS) -DBUILD_ELEMENTS=1
@ -288,6 +292,14 @@ include tools/Makefile
include plugins/Makefile include plugins/Makefile
include tests/plugins/Makefile include tests/plugins/Makefile
# We make pretty much everything depend on these.
ALL_GEN_HEADERS := $(filter gen%.h %printgen.h %wiregen.h,$(ALL_C_HEADERS))
ALL_GEN_SOURCES := $(filter gen%.c %printgen.c %wiregen.c,$(ALL_C_SOURCES))
ALL_NONGEN_SRCFILES := $(filter-out gen%.h %printgen.h %wiregen.h,$(ALL_C_HEADERS)) $(filter-out gen%.c %printgen.c %wiregen.c,$(ALL_C_SOURCES))
# Every single object file.
ALL_OBJS := $(ALL_C_SOURCES:.c=.o)
# Generated from PLUGINS definition in plugins/Makefile # Generated from PLUGINS definition in plugins/Makefile
gen_list_of_builtin_plugins.h : plugins/Makefile Makefile gen_list_of_builtin_plugins.h : plugins/Makefile Makefile
@echo GEN $@ @echo GEN $@
@ -353,12 +365,12 @@ LOCAL_BOLTDIR=.tmp.lightningrfc
bolt-precheck: bolt-precheck:
@[ -d $(BOLTDIR) ] || exit 0; set -e; if [ -z "$(BOLTVERSION)" ]; then rm -rf $(LOCAL_BOLTDIR); ln -sf $(BOLTDIR) $(LOCAL_BOLTDIR); exit 0; fi; [ "$$(git -C $(LOCAL_BOLTDIR) rev-list --max-count=1 HEAD 2>/dev/null)" != "$(BOLTVERSION)" ] || exit 0; rm -rf $(LOCAL_BOLTDIR) && git clone -q $(BOLTDIR) $(LOCAL_BOLTDIR) && cd $(LOCAL_BOLTDIR) && git checkout -q $(BOLTVERSION) @[ -d $(BOLTDIR) ] || exit 0; set -e; if [ -z "$(BOLTVERSION)" ]; then rm -rf $(LOCAL_BOLTDIR); ln -sf $(BOLTDIR) $(LOCAL_BOLTDIR); exit 0; fi; [ "$$(git -C $(LOCAL_BOLTDIR) rev-list --max-count=1 HEAD 2>/dev/null)" != "$(BOLTVERSION)" ] || exit 0; rm -rf $(LOCAL_BOLTDIR) && git clone -q $(BOLTDIR) $(LOCAL_BOLTDIR) && cd $(LOCAL_BOLTDIR) && git checkout -q $(BOLTVERSION)
check-source-bolt: $(ALL_TEST_PROGRAMS:%=bolt-check/%.c) check-source-bolt: $(ALL_NONGEN_SRCFILES:%=bolt-check/%)
check-whitespace/%: % check-whitespace/%: %
@if grep -Hn '[ ]$$' $<; then echo Extraneous whitespace found >&2; exit 1; fi @if grep -Hn '[ ]$$' $<; then echo Extraneous whitespace found >&2; exit 1; fi
check-whitespace: check-whitespace/Makefile check-whitespace/tools/check-bolt.c $(ALL_TEST_PROGRAMS:%=check-whitespace/%.c) check-whitespace: check-whitespace/Makefile check-whitespace/tools/check-bolt.c $(ALL_NONGEN_SRCFILES:%=check-whitespace/%)
check-markdown: check-markdown:
@tools/check-markdown.sh @tools/check-markdown.sh
@ -440,9 +452,6 @@ gen_version.h: FORCE
gen_header_versions.h: tools/headerversions gen_header_versions.h: tools/headerversions
@tools/headerversions $@ @tools/headerversions $@
# Rebuild the world if this changes.
ALL_GEN_HEADERS += gen_header_versions.h
# All binaries require the external libs, ccan and system library versions. # All binaries require the external libs, ccan and system library versions.
$(ALL_PROGRAMS) $(ALL_TEST_PROGRAMS): $(EXTERNAL_LIBS) $(CCAN_OBJS) $(ALL_PROGRAMS) $(ALL_TEST_PROGRAMS): $(EXTERNAL_LIBS) $(CCAN_OBJS)
@ -462,8 +471,8 @@ $(CCAN_OBJS) $(CDUMP_OBJS): $(CCAN_HEADERS) Makefile
# Except for CCAN, we treat everything else as dependent on external/ bitcoin/ common/ wire/ and all generated headers, and Makefile # Except for CCAN, we treat everything else as dependent on external/ bitcoin/ common/ wire/ and all generated headers, and Makefile
$(ALL_OBJS): $(BITCOIN_HEADERS) $(COMMON_HEADERS) $(CCAN_HEADERS) $(WIRE_HEADERS) $(ALL_GEN_HEADERS) $(EXTERNAL_HEADERS) Makefile $(ALL_OBJS): $(BITCOIN_HEADERS) $(COMMON_HEADERS) $(CCAN_HEADERS) $(WIRE_HEADERS) $(ALL_GEN_HEADERS) $(EXTERNAL_HEADERS) Makefile
# We generate headers in two ways, so regen when either changes (or Makefile) # Regen headers when Makefile changes
$(ALL_GEN_HEADERS): ccan/ccan/cdump/tools/cdump-enumstr Makefile $(ALL_GEN_HEADERS): Makefile
update-ccan: update-ccan:
mv ccan ccan.old mv ccan ccan.old
@ -486,11 +495,12 @@ distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
@echo 'This command is intended for maintainers to use; it' @echo 'This command is intended for maintainers to use; it'
@echo 'deletes files that may need special tools to rebuild.' @echo 'deletes files that may need special tools to rebuild.'
$(RM) $(ALL_GEN_HEADERS) $(ALL_GEN_SOURCES)
clean: clean:
$(RM) $(CCAN_OBJS) $(CDUMP_OBJS) $(ALL_OBJS) $(RM) $(CCAN_OBJS) $(CDUMP_OBJS) $(ALL_OBJS)
$(RM) $(ALL_PROGRAMS) $(ALL_PROGRAMS:=.o) $(RM) $(ALL_PROGRAMS)
$(RM) $(ALL_TEST_PROGRAMS) $(ALL_TEST_PROGRAMS:=.o) $(RM) $(ALL_TEST_PROGRAMS)
$(RM) gen_*.h */gen_* ccan/tools/configurator/configurator $(RM) gen_*.h */gen_* ccan/tools/configurator/configurator
$(RM) ccan/ccan/cdump/tools/cdump-enumstr.o $(RM) ccan/ccan/cdump/tools/cdump-enumstr.o
find . -name '*gcda' -delete find . -name '*gcda' -delete

View File

@ -8,7 +8,7 @@ $(BITCOIN_TEST_PROGRAMS): $(CCAN_OBJS) $(BITCOIN_TEST_COMMON_OBJS) bitcoin/chain
$(BITCOIN_TEST_OBJS): $(CCAN_HEADERS) $(BITCOIN_HEADERS) $(BITCOIN_SRC) $(BITCOIN_TEST_OBJS): $(CCAN_HEADERS) $(BITCOIN_HEADERS) $(BITCOIN_SRC)
ALL_TEST_PROGRAMS += $(BITCOIN_TEST_PROGRAMS) ALL_TEST_PROGRAMS += $(BITCOIN_TEST_PROGRAMS)
ALL_OBJS += $(BITCOIN_TEST_PROGRAMS:=.o) ALL_C_SOURCES += $(BITCOIN_TEST_PROGRAMS:=.c)
# This needs to know what level of optimization we're using. # This needs to know what level of optimization we're using.
bitcoin/test/run-secret_eq_consttime.o: CFLAGS += -DCOPTFLAGS="\"${COPTFLAGS}\"" bitcoin/test/run-secret_eq_consttime.o: CFLAGS += -DCOPTFLAGS="\"${COPTFLAGS}\""

View File

@ -1,38 +1,31 @@
#! /usr/bin/make #! /usr/bin/make
# Designed to be run one level up CHANNELD_HEADERS := \
channeld-wrongdir: channeld/gen_full_channel_error_names.h \
$(MAKE) -C ../.. lightningd/channel-all channeld/channeld_wiregen.h \
default: channeld-all
channeld-all: lightningd/lightning_channeld
LIGHTNINGD_CHANNEL_HEADERS_GEN := \
channeld/gen_full_channel_error_names.h \
channeld/channeld_wiregen.h
LIGHTNINGD_CHANNEL_HEADERS_NOGEN := \
channeld/channeld_htlc.h \ channeld/channeld_htlc.h \
channeld/commit_tx.h \ channeld/commit_tx.h \
channeld/full_channel.h \ channeld/full_channel.h \
channeld/full_channel_error.h \ channeld/full_channel_error.h \
channeld/watchtower.h channeld/watchtower.h
LIGHTNINGD_CHANNEL_HEADERS := $(LIGHTNINGD_CHANNEL_HEADERS_GEN) $(LIGHTNINGD_CHANNEL_HEADERS_NOGEN) CHANNELD_SRC := channeld/channeld.c \
LIGHTNINGD_CHANNEL_SRC := channeld/channeld.c \
channeld/commit_tx.c \ channeld/commit_tx.c \
channeld/full_channel.c \ channeld/full_channel.c \
channeld/channeld_wiregen.c \ channeld/channeld_wiregen.c \
channeld/watchtower.c channeld/watchtower.c
LIGHTNINGD_CHANNEL_OBJS := $(LIGHTNINGD_CHANNEL_SRC:.c=.o) CHANNELD_OBJS := $(CHANNELD_SRC:.c=.o)
$(CHANNELD_OBJS): $(CHANNELD_HEADERS)
# Make sure these depend on everything. # Make sure these depend on everything.
ALL_OBJS += $(LIGHTNINGD_CHANNEL_OBJS) ALL_C_SOURCES += $(CHANNELD_SRC)
ALL_C_HEADERS += $(CHANNELD_HEADERS)
ALL_PROGRAMS += lightningd/lightning_channeld ALL_PROGRAMS += lightningd/lightning_channeld
ALL_GEN_HEADERS += $(LIGHTNINGD_CHANNEL_HEADERS_GEN)
# Here's what lightningd depends on
LIGHTNINGD_CONTROL_HEADERS += channeld/channeld_wiregen.h
LIGHTNINGD_CONTROL_OBJS += channeld/channeld_wiregen.o
# Common source we use. # Common source we use.
CHANNELD_COMMON_OBJS := \ CHANNELD_COMMON_OBJS := \
@ -96,37 +89,9 @@ CHANNELD_COMMON_OBJS := \
wire/fromwire.o \ wire/fromwire.o \
wire/towire.o wire/towire.o
LIGHTNINGD_CHANNEL_SRC_GEN := $(filter channeld/%_wiregen.c, $(LIGHTNINGD_CHANNEL_SRC))
LIGHTNINGD_CHANNEL_SRC_NOGEN := $(filter-out channeld/%_wiregen.c, $(LIGHTNINGD_CHANNEL_SRC))
# Control daemon uses this:
LIGHTNINGD_CHANNEL_CONTROL_HEADERS := $(LIGHTNINGD_CHANNEL_HEADERS_GEN)
LIGHTNINGD_CHANNEL_CONTROL_SRC := $(LIGHTNINGD_CHANNEL_SRC_GEN)
LIGHTNINGD_CHANNEL_CONTROL_OBJS := $(LIGHTNINGD_CHANNEL_CONTROL_SRC:.c=.o)
# Add to headers which any object might need.
LIGHTNINGD_HEADERS_GEN += $(LIGHTNINGD_CHANNEL_HEADERS_GEN)
LIGHTNINGD_HEADERS_NOGEN += $(LIGHTNINGD_CHANNEL_HEADERS_NOGEN)
channeld/gen_full_channel_error_names.h: channeld/full_channel_error.h ccan/ccan/cdump/tools/cdump-enumstr channeld/gen_full_channel_error_names.h: channeld/full_channel_error.h ccan/ccan/cdump/tools/cdump-enumstr
ccan/ccan/cdump/tools/cdump-enumstr channeld/full_channel_error.h > $@ ccan/ccan/cdump/tools/cdump-enumstr channeld/full_channel_error.h > $@
lightningd/lightning_channeld: $(CHANNELD_OBJS) $(WIRE_ONION_OBJS) $(CHANNELD_COMMON_OBJS) $(WIRE_OBJS) $(BITCOIN_OBJS) $(HSMD_CLIENT_OBJS)
$(LIGHTNINGD_CHANNEL_OBJS): $(LIGHTNINGD_HEADERS) $(LIGHTNINGD_GOSSIP_CONTROL_HEADERS) include channeld/test/Makefile
LIGHTNINGD_CHANNEL_OBJS := $(LIGHTNINGD_CHANNEL_SRC:.c=.o)
lightningd/lightning_channeld: $(LIGHTNINGD_CHANNEL_OBJS) $(WIRE_ONION_OBJS) $(CHANNELD_COMMON_OBJS) $(WIRE_OBJS) $(BITCOIN_OBJS) $(LIGHTNINGD_HSM_CLIENT_OBJS)
check-source: $(LIGHTNINGD_CHANNEL_SRC_NOGEN:%=check-src-include-order/%)
check-source-bolt: $(LIGHTNINGD_CHANNEL_SRC:%=bolt-check/%) $(LIGHTNINGD_CHANNEL_HEADERS:%=bolt-check/%)
check-whitespace: $(LIGHTNINGD_CHANNEL_SRC_NOGEN:%=check-whitespace/%) $(LIGHTNINGD_CHANNEL_HEADERS_NOGEN:%=check-whitespace/%)
clean: lightningd/channel-clean
lightningd/channel-clean:
$(RM) $(LIGHTNINGD_CHANNEL_OBJS)
-include channeld/test/Makefile

View File

@ -4,8 +4,8 @@ CHANNELD_TEST_SRC := $(wildcard channeld/test/run-*.c)
CHANNELD_TEST_OBJS := $(CHANNELD_TEST_SRC:.c=.o) CHANNELD_TEST_OBJS := $(CHANNELD_TEST_SRC:.c=.o)
CHANNELD_TEST_PROGRAMS := $(CHANNELD_TEST_OBJS:.o=) CHANNELD_TEST_PROGRAMS := $(CHANNELD_TEST_OBJS:.o=)
ALL_C_SOURCES += $(CHANNELD_TEST_SRC)
ALL_TEST_PROGRAMS += $(CHANNELD_TEST_PROGRAMS) ALL_TEST_PROGRAMS += $(CHANNELD_TEST_PROGRAMS)
ALL_OBJS += $(CHANNELD_TEST_OBJS)
CHANNELD_TEST_COMMON_OBJS := \ CHANNELD_TEST_COMMON_OBJS := \
common/amount.o \ common/amount.o \
@ -26,6 +26,6 @@ update-mocks: $(CHANNELD_TEST_SRC:%=update-mocks/%)
$(CHANNELD_TEST_PROGRAMS): $(CCAN_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(CHANNELD_TEST_COMMON_OBJS) $(CHANNELD_TEST_PROGRAMS): $(CCAN_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(CHANNELD_TEST_COMMON_OBJS)
$(CHANNELD_TEST_OBJS): $(LIGHTNINGD_CHANNEL_HEADERS) $(LIGHTNINGD_CHANNEL_SRC) $(CHANNELD_TEST_OBJS): $(CHANNELD_HEADERS) $(CHANNELD_SRC)
check-units: $(CHANNELD_TEST_PROGRAMS:%=unittest/%) check-units: $(CHANNELD_TEST_PROGRAMS:%=unittest/%)

View File

@ -1,6 +1,10 @@
LIGHTNING_CLI_SRC := cli/lightning-cli.c LIGHTNING_CLI_SRC := cli/lightning-cli.c
LIGHTNING_CLI_OBJS := $(LIGHTNING_CLI_SRC:.c=.o) LIGHTNING_CLI_OBJS := $(LIGHTNING_CLI_SRC:.c=.o)
ALL_C_SOURCES += $(LIGHTNING_CLI_SRC)
ALL_C_HEADERS +=
ALL_PROGRAMS += cli/lightning-cli
LIGHTNING_CLI_COMMON_OBJS := \ LIGHTNING_CLI_COMMON_OBJS := \
bitcoin/chainparams.o \ bitcoin/chainparams.o \
common/configdir.o \ common/configdir.o \
@ -9,23 +13,8 @@ LIGHTNING_CLI_COMMON_OBJS := \
common/utils.o \ common/utils.o \
common/version.o common/version.o
lightning-cli-all: cli/lightning-cli $(LIGHTNING_CLI_OBJS): $(JSMN_HEADERS) $(COMMON_HEADERS) $(CCAN_HEADERS)
$(LIGHTNINGD_OPENING_OBJS): $(LIGHTNINGD_HEADERS) $(EXTERNAL_HEADERS)
$(LIGHTNING_CLI_OBJS) $(JSMN_OBJS): $(JSMN_HEADERS) $(COMMON_HEADERS) $(CCAN_HEADERS)
cli/lightning-cli: $(LIGHTNING_CLI_OBJS) $(LIGHTNING_CLI_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) cli/lightning-cli: $(LIGHTNING_CLI_OBJS) $(LIGHTNING_CLI_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS)
# Make sure these depend on everything.
ALL_PROGRAMS += cli/lightning-cli
ALL_OBJS += $(LIGHTNING_CLI_OBJS)
check-source: $(LIGHTNING_CLI_SRC:%=check-src-include-order/%)
clean: lightning-cli-clean
lightning-cli-clean:
$(RM) $(LIGHTNING-CLI_LIB_OBJS) $(DAEMON_JSMN_OBJS)
include cli/test/Makefile include cli/test/Makefile

View File

@ -4,8 +4,8 @@ CLI_TEST_SRC := $(wildcard cli/test/run-*.c)
CLI_TEST_OBJS := $(CLI_TEST_SRC:.c=.o) CLI_TEST_OBJS := $(CLI_TEST_SRC:.c=.o)
CLI_TEST_PROGRAMS := $(CLI_TEST_OBJS:.o=) CLI_TEST_PROGRAMS := $(CLI_TEST_OBJS:.o=)
ALL_C_SOURCES += $(CLI_TEST_SRC)
ALL_TEST_PROGRAMS += $(CLI_TEST_PROGRAMS) ALL_TEST_PROGRAMS += $(CLI_TEST_PROGRAMS)
ALL_OBJS += $(CLI_TEST_OBJS)
CLI_TEST_COMMON_OBJS := \ CLI_TEST_COMMON_OBJS := \
common/configdir.o \ common/configdir.o \

View File

@ -1,44 +1,21 @@
#! /usr/bin/make #! /usr/bin/make
# Designed to be run one level up CLOSINGD_HEADERS := closingd/closingd_wiregen.h
closingd-wrongdir:
$(MAKE) -C ../.. closingd-all
default: closingd-all CLOSINGD_SRC := closingd/closingd.c \
$(CLOSINGD_HEADERS:.h=.c)
closingd-all: lightningd/lightning_closingd CLOSINGD_OBJS := $(CLOSINGD_SRC:.c=.o)
$(CLOSINGD_OBJS): $(CLOSINGD_HEADERS)
# closingd needs these:
LIGHTNINGD_CLOSING_HEADERS_GEN := \
closingd/closingd_wiregen.h
LIGHTNINGD_CLOSING_HEADERS_NOGEN :=
LIGHTNINGD_CLOSING_HEADERS := $(LIGHTNINGD_CLOSING_HEADERS_GEN) $(LIGHTNINGD_CLOSING_HEADERS_NOGEN)
LIGHTNINGD_CLOSING_SRC := closingd/closingd.c \
$(LIGHTNINGD_CLOSING_HEADERS:.h=.c)
LIGHTNINGD_CLOSING_OBJS := $(LIGHTNINGD_CLOSING_SRC:.c=.o)
# Make sure these depend on everything. # Make sure these depend on everything.
ALL_OBJS += $(LIGHTNINGD_CLOSING_OBJS) ALL_C_SOURCES += $(CLOSINGD_SRC)
ALL_C_HEADERS += $(CLOSINGD_HEADERS)
ALL_PROGRAMS += lightningd/lightning_closingd ALL_PROGRAMS += lightningd/lightning_closingd
ALL_GEN_HEADERS += $(LIGHTNINGD_CLOSING_HEADERS_GEN)
# Control daemon uses this: # Here's what lightningd depends on
LIGHTNINGD_CLOSING_CONTROL_HEADERS := $(LIGHTNINGD_CLOSING_HEADERS) LIGHTNINGD_CONTROL_HEADERS += closingd/closingd_wiregen.h
LIGHTNINGD_CLOSING_CONTROL_SRC := $(LIGHTNINGD_CLOSING_HEADERS:.h=.c) LIGHTNINGD_CONTROL_OBJS += closingd/closingd_wiregen.o
LIGHTNINGD_CLOSING_CONTROL_OBJS := $(LIGHTNINGD_CLOSING_CONTROL_SRC:.c=.o)
LIGHTNINGD_CLOSING_GEN_SRC := $(filter closingd/%wiregen.c, $(LIGHTNINGD_CLOSING_SRC) $(LIGHTNINGD_CLOSING_CONTROL_SRC))
LIGHTNINGD_CLOSING_SRC_NOGEN := $(filter-out closingd/%wiregen.c, $(LIGHTNINGD_CLOSING_SRC))
# Add to headers which any object might need.
LIGHTNINGD_HEADERS_GEN += $(LIGHTNINGD_CLOSING_HEADERS_GEN)
LIGHTNINGD_HEADERS_NOGEN += $(LIGHTNINGD_CLOSING_HEADERS_NOGEN)
$(LIGHTNINGD_CLOSING_OBJS): $(LIGHTNINGD_HEADERS)
# Common source we use. # Common source we use.
CLOSINGD_COMMON_OBJS := \ CLOSINGD_COMMON_OBJS := \
@ -84,18 +61,6 @@ CLOSINGD_COMMON_OBJS := \
common/wireaddr.o \ common/wireaddr.o \
gossipd/gossipd_peerd_wiregen.o gossipd/gossipd_peerd_wiregen.o
LIGHTNINGD_CLOSING_OBJS := $(LIGHTNINGD_CLOSING_SRC:.c=.o) $(LIGHTNINGD_CLOSING_GEN_SRC:.c=.o) lightningd/lightning_closingd: $(CLOSINGD_OBJS) $(WIRE_ONION_OBJS) $(CLOSINGD_COMMON_OBJS) $(WIRE_OBJS) $(BITCOIN_OBJS) $(HSMD_CLIENT_OBJS)
lightningd/lightning_closingd: $(LIGHTNINGD_CLOSING_OBJS) $(WIRE_ONION_OBJS) $(CLOSINGD_COMMON_OBJS) $(WIRE_OBJS) $(BITCOIN_OBJS) $(LIGHTNINGD_HSM_CLIENT_OBJS)
check-source: $(LIGHTNINGD_CLOSING_SRC_NOGEN:%=check-src-include-order/%)
check-source-bolt: $(LIGHTNINGD_CLOSING_SRC:%=bolt-check/%) $(LIGHTNINGD_CLOSING_HEADERS:%=bolt-check/%)
check-whitespace: $(LIGHTNINGD_CLOSING_SRC_NOGEN:%=check-whitespace/%) $(LIGHTNINGD_CLOSING_HEADERS_NOGEN:%=check-whitespace/%)
clean: closingd-clean
closingd-clean:
$(RM) $(LIGHTNINGD_CLOSING_OBJS)
-include closingd/test/Makefile -include closingd/test/Makefile

View File

@ -104,8 +104,7 @@ $(COMMON_OBJS): $(CCAN_HEADERS) $(BITCOIN_HEADERS) $(EXTERNAL_HEADERS) $(COMMON_
# Only common/version.c can include this header. # Only common/version.c can include this header.
common/version.o: gen_version.h common/version.o: gen_version.h
ALL_GEN_HEADERS += $(COMMON_HEADERS_GEN) ALL_C_HEADERS += $(COMMON_HEADERS)
ALL_OBJS += $(COMMON_OBJS)
common/gen_htlc_state_names.h: common/htlc_state.h ccan/ccan/cdump/tools/cdump-enumstr common/gen_htlc_state_names.h: common/htlc_state.h ccan/ccan/cdump/tools/cdump-enumstr
ccan/ccan/cdump/tools/cdump-enumstr common/htlc_state.h > $@ ccan/ccan/cdump/tools/cdump-enumstr common/htlc_state.h > $@

View File

@ -9,8 +9,8 @@ COMMON_TEST_COMMON_OBJS := \
$(COMMON_TEST_PROGRAMS): $(COMMON_TEST_COMMON_OBJS) $(BITCOIN_OBJS) $(COMMON_TEST_PROGRAMS): $(COMMON_TEST_COMMON_OBJS) $(BITCOIN_OBJS)
$(COMMON_TEST_OBJS): $(COMMON_HEADERS) $(WIRE_HEADERS) $(COMMON_SRC) $(COMMON_TEST_OBJS): $(COMMON_HEADERS) $(WIRE_HEADERS) $(COMMON_SRC)
ALL_C_SOURCES += $(COMMON_TEST_SRC)
ALL_TEST_PROGRAMS += $(COMMON_TEST_PROGRAMS) ALL_TEST_PROGRAMS += $(COMMON_TEST_PROGRAMS)
ALL_OBJS += $(COMMON_TEST_PROGRAMS:=.o)
# Sphinx test wants to decode TLVs. # Sphinx test wants to decode TLVs.
common/test/run-sphinx: wire/onion_wiregen.o wire/towire.o wire/fromwire.o common/test/run-sphinx: wire/onion_wiregen.o wire/towire.o wire/fromwire.o

View File

@ -1,18 +1,6 @@
#! /usr/bin/make #! /usr/bin/make
# Designed to be run one level up CONNECTD_HEADERS := connectd/connectd_wiregen.h \
connectd-wrongdir:
$(MAKE) -C .. connectd-all
default: connectd-all
# Control daemon uses this:
LIGHTNINGD_CONNECT_CONTROL_HEADERS := connectd/connectd_wiregen.h connectd/connectd_gossipd_wiregen.h
LIGHTNINGD_CONNECT_CONTROL_SRC := connectd/connectd_wiregen.c connectd/connectd_gossipd_wiregen.c
LIGHTNINGD_CONNECT_CONTROL_OBJS := $(LIGHTNINGD_CONNECT_CONTROL_SRC:.c=.o)
# connectd needs these:
LIGHTNINGD_CONNECT_HEADERS := connectd/connectd_wiregen.h \
connectd/connectd_gossipd_wiregen.h \ connectd/connectd_gossipd_wiregen.h \
connectd/connectd.h \ connectd/connectd.h \
connectd/peer_exchange_initmsg.h \ connectd/peer_exchange_initmsg.h \
@ -20,20 +8,20 @@ LIGHTNINGD_CONNECT_HEADERS := connectd/connectd_wiregen.h \
connectd/netaddress.h \ connectd/netaddress.h \
connectd/tor_autoservice.h \ connectd/tor_autoservice.h \
connectd/tor.h connectd/tor.h
LIGHTNINGD_CONNECT_SRC := $(LIGHTNINGD_CONNECT_HEADERS:.h=.c)
LIGHTNINGD_CONNECT_OBJS := $(LIGHTNINGD_CONNECT_SRC:.c=.o) CONNECTD_SRC := $(CONNECTD_HEADERS:.h=.c) connectd/connectd.c
CONNECTD_OBJS := $(CONNECTD_SRC:.c=.o)
$(CONNECTD_OBJS): $(CONNECTD_HEADERS)
# Make sure these depend on everything. # Make sure these depend on everything.
ALL_OBJS += $(LIGHTNINGD_CONNECT_OBJS) ALL_C_SOURCES += $(CONNECTD_SRC)
ALL_C_HEADERS += $(CONNECTD_HEADERS)
ALL_PROGRAMS += lightningd/lightning_connectd ALL_PROGRAMS += lightningd/lightning_connectd
ALL_GEN_HEADERS += connectd/connectd_wiregen.h connectd/connectd_gossipd_wiregen.h
# For checking # Here's what lightningd depends on
LIGHTNINGD_CONNECT_ALLSRC_NOGEN := $(filter-out connectd/%wiregen.c, $(LIGHTNINGD_CONNECT_CLIENT_SRC) $(LIGHTNINGD_CONNECT_SRC)) LIGHTNINGD_CONTROL_HEADERS += connectd/connectd_wiregen.h
LIGHTNINGD_CONNECT_ALLHEADERS_NOGEN := $(filter-out connectd/%wiregen.h, $(LIGHTNINGD_CONNECT_CLIENT_HEADERS) $(LIGHTNINGD_CONNECT_HEADERS)) LIGHTNINGD_CONTROL_OBJS += connectd/connectd_wiregen.o
# Add to headers which any object might need.
LIGHTNINGD_HEADERS_GEN += $(LIGHTNINGD_CONNECT_HEADERS)
# Common source we use. # Common source we use.
CONNECTD_COMMON_OBJS := \ CONNECTD_COMMON_OBJS := \
@ -77,21 +65,6 @@ CONNECTD_COMMON_OBJS := \
lightningd/gossip_msg.o \ lightningd/gossip_msg.o \
wire/onion_wiregen.o wire/onion_wiregen.o
$(LIGHTNINGD_CONNECT_OBJS): $(LIGHTNINGD_HEADERS) $(LIGHTNINGD_CONNECT_HEADERS) lightningd/lightning_connectd: $(CONNECTD_OBJS) $(CONNECTD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(HSMD_CLIENT_OBJS)
$(LIGHTNINGD_CONNECT_CONTROL_OBJS) : $(LIGHTNINGD_CONNECT_CONTROL_HEADERS) include connectd/test/Makefile
connectd-all: lightningd/lightning_connectd
lightningd/lightning_connectd: $(LIGHTNINGD_CONNECT_OBJS) $(CONNECTD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(LIGHTNINGD_HSM_CLIENT_OBJS)
check-source: $(LIGHTNINGD_CONNECT_ALLSRC_NOGEN:%=check-src-include-order/%) $(LIGHTNINGD_CONNECT_ALLHEADERS_NOGEN:%=check-hdr-include-order/%)
check-source-bolt: $(LIGHTNINGD_CONNECT_SRC:%=bolt-check/%) $(LIGHTNINGD_CONNECT_HEADERS:%=bolt-check/%)
check-whitespace: $(LIGHTNINGD_CONNECT_ALLSRC_NOGEN:%=check-whitespace/%) $(LIGHTNINGD_CONNECT_ALLHEADERS_NOGEN:%=check-whitespace/%)
clean: connectd-clean
connectd-clean:
$(RM) $(LIGHTNINGD_CONNECT_OBJS)
-include connectd/test/Makefile

View File

@ -1,5 +1,3 @@
check-units: connectd-tests
# Note that these actually #include everything they need, except ccan/ and bitcoin/. # Note that these actually #include everything they need, except ccan/ and bitcoin/.
# That allows for unit testing of statics, and special effects. # That allows for unit testing of statics, and special effects.
CONNECTD_TEST_SRC := $(wildcard connectd/test/run-*.c) CONNECTD_TEST_SRC := $(wildcard connectd/test/run-*.c)
@ -12,15 +10,15 @@ CONNECTD_TEST_COMMON_OBJS := \
common/type_to_string.o \ common/type_to_string.o \
common/utils.o common/utils.o
ALL_C_SOURCES += $(CONNECT_TEST_SRC)
ALL_TEST_PROGRAMS += $(CONNECTD_TEST_PROGRAMS)
update-mocks: $(CONNECTD_TEST_SRC:%=update-mocks/%) update-mocks: $(CONNECTD_TEST_SRC:%=update-mocks/%)
$(CONNECTD_TEST_PROGRAMS): $(CONNECTD_TEST_COMMON_OBJS) $(BITCOIN_OBJS) $(CONNECTD_TEST_PROGRAMS): $(CONNECTD_TEST_COMMON_OBJS) $(BITCOIN_OBJS)
# Test objects depend on ../ src and headers. # Test objects depend on ../ src and headers.
$(CONNECTD_TEST_OBJS): $(LIGHTNINGD_CONNECT_HEADERS) $(LIGHTNINGD_CONNECT_SRC) $(CONNECTD_TEST_OBJS): $(CONNECTD_HEADERS) $(CONNECTD_SRC)
ALL_OBJS += $(CONNECTD_TEST_OBJS) check-units: $(CONNECTD_TEST_PROGRAMS:%=unittest/%)
ALL_TEST_PROGRAMS += $(CONNECTD_TEST_PROGRAMS)
connectd-tests: $(CONNECTD_TEST_PROGRAMS:%=unittest/%)

View File

@ -6,10 +6,13 @@ ifeq ($(EXPERIMENTAL_FEATURES),1)
DEVTOOLS += devtools/blindedpath DEVTOOLS += devtools/blindedpath
endif endif
DEVTOOLS_TOOL_SRC := $(DEVTOOLS:=.c) DEVTOOLS_TOOL_SRC := $(DEVTOOLS:=.c) devtools/print_wire.c devtools/clean_topo.c
DEVTOOLS_TOOL_OBJS := $(DEVTOOLS_TOOL_SRC:.c=.o) devtools/clean_topo.o DEVTOOLS_TOOL_OBJS := $(DEVTOOLS_TOOL_SRC:.c=.o)
DEVTOOLS_BOLT_DEPS += $(BOLT_DEPS) tools/gen/print_impl_template tools/gen/print_header_template # Make sure these depend on everything.
ALL_C_SOURCES += $(DEVTOOLS_TOOL_SRC)
ALL_C_HEADERS +=
ALL_PROGRAMS += $(DEVTOOLS)
DEVTOOLS_COMMON_OBJS := \ DEVTOOLS_COMMON_OBJS := \
common/amount.o \ common/amount.o \
@ -41,11 +44,9 @@ DEVTOOLS_COMMON_OBJS := \
wire/onion_wiregen.o \ wire/onion_wiregen.o \
wire/peer_wiregen.o wire/peer_wiregen.o
devtools-all: $(DEVTOOLS)
devtools/bolt11-cli: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/bolt11-cli.o devtools/bolt11-cli: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/bolt11-cli.o
devtools/decodemsg: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o wire/peer_printgen.o wire/onion_printgen.o devtools/print_wire.o devtools/decodemsg.o devtools/decodemsg: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) $(WIRE_PRINT_OBJS) wire/fromwire.o wire/towire.o devtools/print_wire.o devtools/decodemsg.o
devtools/dump-gossipstore: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/dump-gossipstore.o gossipd/gossip_store_wiregen.o devtools/dump-gossipstore: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/dump-gossipstore.o gossipd/gossip_store_wiregen.o
@ -83,14 +84,3 @@ devtools/lightning-checkmessage: $(DEVTOOLS_COMMON_OBJS) $(CCAN_OBJS) $(BITCOIN_
devtools/route: $(DEVTOOLS_COMMON_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o wire/tlvstream.o common/gossmap.o common/random_select.o common/route.o common/dijkstra.o devtools/clean_topo.o devtools/route.o devtools/route: $(DEVTOOLS_COMMON_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o wire/tlvstream.o common/gossmap.o common/random_select.o common/route.o common/dijkstra.o devtools/clean_topo.o devtools/route.o
devtools/topology: $(DEVTOOLS_COMMON_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o wire/tlvstream.o common/gossmap.o common/random_select.o common/dijkstra.o common/route.o devtools/clean_topo.o devtools/topology.o devtools/topology: $(DEVTOOLS_COMMON_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o wire/tlvstream.o common/gossmap.o common/random_select.o common/dijkstra.o common/route.o devtools/clean_topo.o devtools/topology.o
# Make sure these depend on everything.
ALL_PROGRAMS += $(DEVTOOLS)
ALL_OBJS += $(DEVTOOLS_TOOL_OBJS)
check-source: $(DEVTOOLS_SRC:%=check-src-include-order/%) $(DEVTOOLS_TOOLS_SRC:%=check-src-include-order/%)
clean: devtools-clean
devtools-clean:
$(RM) $(DEVTOOLS_TOOL_OBJS) $(DEVTOOLS)

View File

@ -1,18 +1,6 @@
#! /usr/bin/make #! /usr/bin/make
# Designed to be run one level up GOSSIPD_HEADERS_WSRC := gossipd/gossipd_wiregen.h \
gossipd-wrongdir:
$(MAKE) -C .. gossipd-all
default: gossipd-all
# lightningd uses this:
LIGHTNINGD_GOSSIP_CONTROL_HEADERS := gossipd/gossipd_wiregen.h
LIGHTNINGD_GOSSIP_CONTROL_SRC := gossipd/gossipd_wiregen.c
LIGHTNINGD_GOSSIP_CONTROL_OBJS := $(LIGHTNINGD_GOSSIP_CONTROL_SRC:.c=.o)
# gossipd needs these:
LIGHTNINGD_GOSSIP_HEADERS_WSRC := gossipd/gossipd_wiregen.h \
gossipd/gossipd_peerd_wiregen.h \ gossipd/gossipd_peerd_wiregen.h \
gossipd/gossip_store_wiregen.h \ gossipd/gossip_store_wiregen.h \
gossipd/gossipd.h \ gossipd/gossipd.h \
@ -21,21 +9,20 @@ LIGHTNINGD_GOSSIP_HEADERS_WSRC := gossipd/gossipd_wiregen.h \
gossipd/gossip_generation.h \ gossipd/gossip_generation.h \
gossipd/routing.h \ gossipd/routing.h \
gossipd/seeker.h gossipd/seeker.h
LIGHTNINGD_GOSSIP_HEADERS := $(LIGHTNINGD_GOSSIP_HEADERS_WSRC) gossipd/broadcast.h GOSSIPD_HEADERS := $(GOSSIPD_HEADERS_WSRC) gossipd/broadcast.h
LIGHTNINGD_GOSSIP_SRC := $(LIGHTNINGD_GOSSIP_HEADERS_WSRC:.h=.c)
LIGHTNINGD_GOSSIP_OBJS := $(LIGHTNINGD_GOSSIP_SRC:.c=.o) GOSSIPD_SRC := $(GOSSIPD_HEADERS_WSRC:.h=.c)
GOSSIPD_OBJS := $(GOSSIPD_SRC:.c=.o)
$(GOSSIPD_OBJS): $(GOSSIPD_HEADERS)
# Make sure these depend on everything. # Make sure these depend on everything.
ALL_OBJS += $(LIGHTNINGD_GOSSIP_OBJS) ALL_C_SOURCES += $(GOSSIPD_SRC)
ALL_C_HEADERS += $(GOSSIPD_HEADERS)
ALL_PROGRAMS += lightningd/lightning_gossipd ALL_PROGRAMS += lightningd/lightning_gossipd
ALL_GEN_HEADERS += $(wildcard gossipd/*wiregen.h)
# For checking # Here's what lightningd depends on
LIGHTNINGD_GOSSIP_ALLSRC_NOGEN := $(filter-out gossipd/%wiregen.c, $(LIGHTNINGD_GOSSIP_CLIENT_SRC) $(LIGHTNINGD_GOSSIP_SRC)) LIGHTNINGD_CONTROL_HEADERS += gossipd/gossipd_wiregen.h
LIGHTNINGD_GOSSIP_ALLHEADERS_NOGEN := $(filter-out gossipd/%wiregen.h, $(LIGHTNINGD_GOSSIP_CLIENT_HEADERS) $(LIGHTNINGD_GOSSIP_HEADERS)) LIGHTNINGD_CONTROL_OBJS += gossipd/gossipd_wiregen.o
# Add to headers which any object might need.
LIGHTNINGD_HEADERS_GEN += $(LIGHTNINGD_GOSSIP_HEADERS)
# Common source we use. # Common source we use.
GOSSIPD_COMMON_OBJS := \ GOSSIPD_COMMON_OBJS := \
@ -81,21 +68,6 @@ GOSSIPD_COMMON_OBJS := \
lightningd/gossip_msg.o \ lightningd/gossip_msg.o \
wire/onion_wiregen.o wire/onion_wiregen.o
$(LIGHTNINGD_GOSSIP_OBJS) $(LIGHTNINGD_GOSSIP_CLIENT_OBJS): $(LIGHTNINGD_HEADERS) $(LIGHTNINGD_GOSSIP_HEADERS) lightningd/lightning_gossipd: $(GOSSIPD_OBJS) $(GOSSIPD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(HSMD_CLIENT_OBJS)
$(LIGHTNINGD_GOSSIP_CONTROL_OBJS) : $(LIGHTNINGD_GOSSIP_CONTROL_HEADERS) include gossipd/test/Makefile
gossipd-all: lightningd/lightning_gossipd $(LIGHTNINGD_GOSSIP_CLIENT_OBJS)
lightningd/lightning_gossipd: $(LIGHTNINGD_GOSSIP_OBJS) $(GOSSIPD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(LIGHTNINGD_HSM_CLIENT_OBJS)
check-source: $(LIGHTNINGD_GOSSIP_ALLSRC_NOGEN:%=check-src-include-order/%) $(LIGHTNINGD_GOSSIP_ALLHEADERS_NOGEN:%=check-hdr-include-order/%)
check-source-bolt: $(LIGHTNINGD_GOSSIP_SRC:%=bolt-check/%) $(LIGHTNINGD_GOSSIP_HEADERS:%=bolt-check/%)
check-whitespace: $(LIGHTNINGD_GOSSIP_ALLSRC_NOGEN:%=check-whitespace/%) $(LIGHTNINGD_GOSSIP_ALLHEADERS_NOGEN:%=check-whitespace/%)
clean: gossipd-clean
gossipd-clean:
$(RM) $(LIGHTNINGD_GOSSIP_OBJS)
-include gossipd/test/Makefile

View File

@ -21,15 +21,15 @@ GOSSIPD_TEST_COMMON_OBJS := \
wire/fromwire.o \ wire/fromwire.o \
wire/towire.o wire/towire.o
ALL_C_SOURCES += $(GOSSIPD_TEST_SRC)
ALL_TEST_PROGRAMS += $(GOSSIPD_TEST_PROGRAMS)
update-mocks: $(GOSSIPD_TEST_SRC:%=update-mocks/%) update-mocks: $(GOSSIPD_TEST_SRC:%=update-mocks/%)
$(GOSSIPD_TEST_PROGRAMS): $(GOSSIPD_TEST_COMMON_OBJS) $(BITCOIN_OBJS) $(GOSSIPD_TEST_PROGRAMS): $(GOSSIPD_TEST_COMMON_OBJS) $(BITCOIN_OBJS)
# Test objects depend on ../ src and headers. # Test objects depend on ../ src and headers.
$(GOSSIPD_TEST_OBJS): $(LIGHTNINGD_GOSSIP_HEADERS) $(LIGHTNINGD_GOSSIP_SRC) $(GOSSIPD_TEST_OBJS): $(GOSSIPD_HEADERS) $(GOSSIPD_SRC)
ALL_OBJS += $(GOSSIPD_TEST_OBJS)
ALL_TEST_PROGRAMS += $(GOSSIPD_TEST_PROGRAMS)
gossipd-tests: $(GOSSIPD_TEST_PROGRAMS:%=unittest/%) gossipd-tests: $(GOSSIPD_TEST_PROGRAMS:%=unittest/%)

View File

@ -1,15 +1,19 @@
#! /usr/bin/make #! /usr/bin/make
# Designed to be run one level up HSMD_SRC := hsmd/hsmd.c \
hsmd-wrongdir:
$(MAKE) -C .. lightningd/hsm-all
default: hsmd-all
LIGHTNINGD_HSM_SRC := hsmd/hsmd.c \
hsmd/hsmd_wiregen.c hsmd/hsmd_wiregen.c
LIGHTNINGD_HSM_HEADERS := hsmd/hsmd_wiregen.h HSMD_HEADERS := hsmd/hsmd_wiregen.h
LIGHTNINGD_HSM_OBJS := $(LIGHTNINGD_HSM_SRC:.c=.o) HSMD_OBJS := $(HSMD_SRC:.c=.o)
$(HSMD_OBJS): $(HSMD_HEADERS)
# Other programs which use the hsm need this.
HSMD_CLIENT_OBJS := hsmd/hsmd_wiregen.o
# Make sure these depend on everything.
ALL_C_SOURCES += $(HSMD_SRC)
ALL_C_HEADERS += $(HSMD_HEADERS)
ALL_PROGRAMS += lightningd/lightning_hsmd
# Common source we use. # Common source we use.
HSMD_COMMON_OBJS := \ HSMD_COMMON_OBJS := \
@ -38,31 +42,7 @@ HSMD_COMMON_OBJS := \
common/version.o \ common/version.o \
common/withdraw_tx.o common/withdraw_tx.o
LIGHTNINGD_HSM_CLIENT_OBJS := hsmd/hsmd_wiregen.o
# For checking lightningd/lightning_hsmd: $(HSMD_OBJS) $(HSMD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS)
LIGHTNINGD_HSM_ALLSRC_NOGEN := $(filter-out hsmd/%wiregen.c, $(LIGHTNINGD_HSM_SRC) $(LIGHTNINGD_HSM_SRC))
LIGHTNINGD_HSM_ALLHEADERS_NOGEN := $(filter-out hsmd/%wiregen.h, $(LIGHTNINGD_HSM_HEADERS))
$(LIGHTNINGD_HSM_OBJS): $(LIGHTNINGD_HEADERS)
# Make sure these depend on everything.
ALL_OBJS += $(LIGHTNINGD_HSM_OBJS)
ALL_PROGRAMS += lightningd/lightning_hsmd
ALL_GEN_HEADERS += hsmd/hsmd_wiregen.h
hsmd-all: lightningd/lightning_hsmd
lightningd/lightning_hsmd: $(LIGHTNINGD_HSM_OBJS) $(LIGHTNINGD_LIB_OBJS) $(HSMD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS)
check-source: $(LIGHTNINGD_HSM_ALLSRC_NOGEN:%=check-src-include-order/%) $(LIGHTNINGD_HSM_ALLHEADERS_NOGEN:%=check-hdr-include-order/%)
check-source-bolt: $(LIGHTNINGD_HSM_SRC:%=bolt-check/%)
check-whitespace: $(LIGHTNINGD_HSM_ALLSRC_NOGEN:%=check-whitespace/%) $(LIGHTNINGD_HSM_ALLHEADERS_NOGEN:%=check-whitespace/%)
clean: lightningd/hsm-clean
lightningd/hsm-clean:
$(RM) $(LIGHTNINGD_HSM_OBJS)
-include hsmd/test/Makefile -include hsmd/test/Makefile

View File

@ -1,16 +1,56 @@
#! /usr/bin/make #! /usr/bin/make
# Designed to be run one level up LIGHTNINGD_SRC := \
lightningd-wrongdir: lightningd/bitcoind.c \
$(MAKE) -C .. lightningd-all lightningd/chaintopology.c \
lightningd/channel.c \
lightningd/channel_control.c \
lightningd/closing_control.c \
lightningd/coin_mvts.c \
lightningd/connect_control.c \
lightningd/onion_message.c \
lightningd/gossip_control.c \
lightningd/gossip_msg.c \
lightningd/hsm_control.c \
lightningd/htlc_end.c \
lightningd/htlc_set.c \
lightningd/invoice.c \
lightningd/io_loop_with_timers.c \
lightningd/json.c \
lightningd/jsonrpc.c \
lightningd/lightningd.c \
lightningd/log.c \
lightningd/log_status.c \
lightningd/memdump.c \
lightningd/notification.c \
lightningd/onchain_control.c \
lightningd/opening_control.c \
lightningd/options.c \
lightningd/pay.c \
lightningd/peer_control.c \
lightningd/peer_htlcs.c \
lightningd/ping.c \
lightningd/plugin.c \
lightningd/plugin_control.c \
lightningd/plugin_hook.c \
lightningd/subd.c \
lightningd/watch.c
LIGHTNINGD_PROGRAM := lightningd/lightningd LIGHTNINGD_SRC_NOHDR := \
lightningd/signmessage.c
ALL_PROGRAMS += $(LIGHTNINGD_PROGRAM) LIGHTNINGD_HEADERS := \
$(LIGHTNINGD_SRC:.c=.h) \
lightningd/channel_state.h \
lightningd/gen_channel_state_names.h
lightningd-all: $(LIGHTNINGD_PROGRAM) LIGHTNINGD_OBJS := $(LIGHTNINGD_SRC:.c=.o) $(LIGHTNINGD_SRC_NOHDR:.c=.o)
$(LIGHTNINGD_OBJS): $(LIGHTNINGD_HEADERS) $(LIGHTNINGD_CONTROL_HEADERS)
default: lightningd-all # Make sure these depend on everything.
ALL_C_SOURCES += $(LIGHTNINGD_SRC)
ALL_C_HEADERS += $(LIGHTNINGD_HEADERS)
ALL_PROGRAMS += lightningd/lightningd
# Common source we use. # Common source we use.
LIGHTNINGD_COMMON_OBJS := \ LIGHTNINGD_COMMON_OBJS := \
@ -75,89 +115,19 @@ LIGHTNINGD_COMMON_OBJS := \
common/wireaddr.o \ common/wireaddr.o \
common/withdraw_tx.o common/withdraw_tx.o
LIGHTNINGD_SRC := \
lightningd/bitcoind.c \
lightningd/chaintopology.c \
lightningd/channel.c \
lightningd/channel_control.c \
lightningd/closing_control.c \
lightningd/coin_mvts.c \
lightningd/connect_control.c \
lightningd/onion_message.c \
lightningd/gossip_control.c \
lightningd/gossip_msg.c \
lightningd/hsm_control.c \
lightningd/htlc_end.c \
lightningd/htlc_set.c \
lightningd/invoice.c \
lightningd/io_loop_with_timers.c \
lightningd/json.c \
lightningd/jsonrpc.c \
lightningd/lightningd.c \
lightningd/log.c \
lightningd/log_status.c \
lightningd/memdump.c \
lightningd/notification.c \
lightningd/onchain_control.c \
lightningd/opening_control.c \
lightningd/options.c \
lightningd/pay.c \
lightningd/peer_control.c \
lightningd/peer_htlcs.c \
lightningd/ping.c \
lightningd/plugin.c \
lightningd/plugin_control.c \
lightningd/plugin_hook.c \
lightningd/subd.c \
lightningd/watch.c
LIGHTNINGD_SRC_NOHDR := \
lightningd/signmessage.c
LIGHTNINGD_OBJS := $(LIGHTNINGD_SRC:.c=.o) $(LIGHTNINGD_SRC_NOHDR:.c=.o)
# Make sure these depend on everything.
ALL_OBJS += $(LIGHTNINGD_OBJS)
# We accumulate all lightningd/ headers in these three:
LIGHTNINGD_HEADERS_NOGEN = \
$(LIGHTNINGD_SRC:.c=.h) \
lightningd/channel_state.h
# Generated headers
LIGHTNINGD_HEADERS_GEN = \
lightningd/gen_channel_state_names.h
ALL_GEN_HEADERS += $(LIGHTNINGD_HEADERS_GEN)
include wallet/Makefile include wallet/Makefile
# All together in one convenient var # All together in one convenient var
LIGHTNINGD_HEADERS = $(LIGHTNINGD_HEADERS_NOGEN) $(LIGHTNINGD_HEADERS_GEN) $(WALLET_LIB_HEADERS) LIGHTNINGD_HEADERS = $(LIGHTNINGD_HEADERS_NOGEN) $(LIGHTNINGD_HEADERS_GEN) $(WALLET_LIB_HEADERS)
$(LIGHTNINGD_OBJS): $(LIGHTNINGD_HEADERS) $(LIGHTNINGD_OBJS): $(LIGHTNINGD_HEADERS) $(WALLET_HDRS)
# Only the plugin component needs to depend on this header. # Only the plugin component needs to depend on this header.
lightningd/plugin.o : gen_list_of_builtin_plugins.h lightningd/plugin.o: gen_list_of_builtin_plugins.h
lightningd/gen_channel_state_names.h: lightningd/channel_state.h ccan/ccan/cdump/tools/cdump-enumstr lightningd/gen_channel_state_names.h: lightningd/channel_state.h ccan/ccan/cdump/tools/cdump-enumstr
ccan/ccan/cdump/tools/cdump-enumstr lightningd/channel_state.h > $@ ccan/ccan/cdump/tools/cdump-enumstr lightningd/channel_state.h > $@
check-source: $(LIGHTNINGD_SRC:%=check-src-include-order/%) $(LIGHTNINGD_SRC_NOHDR:%=check-src-include-order/%) lightningd/lightningd: $(LIGHTNINGD_OBJS) $(WALLET_OBJS) $(LIGHTNINGD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(WIRE_ONION_OBJS) $(LIGHTNINGD_CONTROL_OBJS) $(HSMD_CLIENT_OBJS)
check-source: $(LIGHTNINGD_HEADERS_NOGEN:%=check-hdr-include-order/%)
check-source-bolt: $(LIGHTNINGD_SRC:%=bolt-check/%) $(LIGHTNINGD_SRC_NOHDR:%=bolt-check/%) $(LIGHTNINGD_HEADERS_NOGEN:%=bolt-check/%)
check-whitespace: $(LIGHTNINGD_SRC:%=check-whitespace/%) $(LIGHTNINGD_SRC_NOHDR:%=check-whitespace/%) $(LIGHTNINGD_HEADERS_NOGEN:%=check-whitespace/%)
check-makefile: check-lightningd-makefile
check-lightningd-makefile:
@for f in lightningd/*.h lightningd/*/*.h; do if ! echo $(LIGHTNINGD_HEADERS_NOGEN) $(LIGHTNINGD_HEADERS_GEN) "" | grep -q "$$f "; then echo $$f not mentioned in LIGHTNINGD_HEADERS_NOGEN or LIGHTNINGD_HEADERS_GEN >&2; exit 1; fi; done
lightningd/lightningd: $(LIGHTNINGD_OBJS) $(LIGHTNINGD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(WIRE_ONION_OBJS) $(LIGHTNINGD_HANDSHAKE_CONTROL_OBJS) $(LIGHTNINGD_GOSSIP_CONTROL_OBJS) $(LIGHTNINGD_OPENING_CONTROL_OBJS) $(LIGHTNINGD_CHANNEL_CONTROL_OBJS) $(LIGHTNINGD_CLOSING_CONTROL_OBJS) $(LIGHTNINGD_ONCHAIN_CONTROL_OBJS) $(WALLET_LIB_OBJS) $(LIGHTNINGD_CONNECT_CONTROL_OBJS) $(LIGHTNINGD_HSM_CLIENT_OBJS)
clean: lightningd-clean
lightningd-clean:
$(RM) $(LIGHTNINGD_OBJS) $(LIGHTNINGD_JSMN_OBJS) $(LIGHTNINGD_PROGRAM) lightningd/gen*
include lightningd/test/Makefile include lightningd/test/Makefile

View File

@ -4,8 +4,8 @@ LIGHTNINGD_TEST_SRC := $(wildcard lightningd/test/run-*.c)
LIGHTNINGD_TEST_OBJS := $(LIGHTNINGD_TEST_SRC:.c=.o) LIGHTNINGD_TEST_OBJS := $(LIGHTNINGD_TEST_SRC:.c=.o)
LIGHTNINGD_TEST_PROGRAMS := $(LIGHTNINGD_TEST_OBJS:.o=) LIGHTNINGD_TEST_PROGRAMS := $(LIGHTNINGD_TEST_OBJS:.o=)
ALL_C_SOURCES += $(LIGHTNINGD_TEST_SRC)
ALL_TEST_PROGRAMS += $(LIGHTNINGD_TEST_PROGRAMS) ALL_TEST_PROGRAMS += $(LIGHTNINGD_TEST_PROGRAMS)
ALL_OBJS += $(LIGHTNINGD_TEST_OBJS)
LIGHTNINGD_TEST_COMMON_OBJS := \ LIGHTNINGD_TEST_COMMON_OBJS := \
common/amount.o \ common/amount.o \
@ -28,6 +28,6 @@ update-mocks: $(LIGHTNINGD_TEST_SRC:%=update-mocks/%)
$(LIGHTNINGD_TEST_PROGRAMS): $(CCAN_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(LIGHTNINGD_TEST_COMMON_OBJS) $(LIGHTNINGD_TEST_PROGRAMS): $(CCAN_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(LIGHTNINGD_TEST_COMMON_OBJS)
$(LIGHTNINGD_TEST_OBJS): $(LIGHTNINGD_HEADERS) $(LIGHTNINGD_SRC) $(LIGHTNINGD_TEST_OBJS): $(LIGHTNINGD_HEADERS) $(LIGHTNINGD_SRC) $(LIGHTNINGD_SRC_NOHDR)
check-units: $(LIGHTNINGD_TEST_PROGRAMS:%=unittest/%) check-units: $(LIGHTNINGD_TEST_PROGRAMS:%=unittest/%)

View File

@ -505,9 +505,6 @@ void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED)
/* Generated stub for towire_onchaind_dev_memleak */ /* Generated stub for towire_onchaind_dev_memleak */
u8 *towire_onchaind_dev_memleak(const tal_t *ctx UNNEEDED) u8 *towire_onchaind_dev_memleak(const tal_t *ctx UNNEEDED)
{ fprintf(stderr, "towire_onchaind_dev_memleak called!\n"); abort(); } { fprintf(stderr, "towire_onchaind_dev_memleak called!\n"); abort(); }
/* Generated stub for towire_temporary_node_failure */
u8 *towire_temporary_node_failure(const tal_t *ctx UNNEEDED)
{ fprintf(stderr, "towire_temporary_node_failure called!\n"); abort(); }
/* Generated stub for txfilter_add_scriptpubkey */ /* Generated stub for txfilter_add_scriptpubkey */
void txfilter_add_scriptpubkey(struct txfilter *filter UNNEEDED, const u8 *script TAKES UNNEEDED) void txfilter_add_scriptpubkey(struct txfilter *filter UNNEEDED, const u8 *script TAKES UNNEEDED)
{ fprintf(stderr, "txfilter_add_scriptpubkey called!\n"); abort(); } { fprintf(stderr, "txfilter_add_scriptpubkey called!\n"); abort(); }

View File

@ -1,49 +1,34 @@
#! /usr/bin/make #! /usr/bin/make
# Designed to be run one level up ONCHAIND_HEADERS := \
onchaind-wrongdir: onchaind/onchaind_wiregen.h \
$(MAKE) -C ../.. onchaind-all onchaind/gen_onchain_types_names.h \
onchaind/onchain_types.h \
onchaind/onchaind_wire.h
default: onchaind-all ONCHAIND_SRC := onchaind/onchaind.c \
onchaind/onchaind_wiregen.c \
onchaind-all: lightningd/lightning_onchaind onchaind/onchaind_wire.c \
onchaind/onchaind.c
onchaind/gen_onchain_types_names.h: onchaind/onchain_types.h ccan/ccan/cdump/tools/cdump-enumstr onchaind/gen_onchain_types_names.h: onchaind/onchain_types.h ccan/ccan/cdump/tools/cdump-enumstr
ccan/ccan/cdump/tools/cdump-enumstr onchaind/onchain_types.h > $@ ccan/ccan/cdump/tools/cdump-enumstr onchaind/onchain_types.h > $@
# onchaind needs these: ONCHAIND_OBJS := $(ONCHAIND_SRC:.c=.o)
LIGHTNINGD_ONCHAIN_HEADERS_GEN := \ $(ONCHAIND_OBJS): $(ONCHAIND_HEADERS)
onchaind/onchaind_wiregen.h \
onchaind/gen_onchain_types_names.h
LIGHTNINGD_ONCHAIN_HEADERS_NOGEN := \ # Make sure these depend on everything.
onchaind/onchain_types.h \ ALL_C_SOURCES += $(ONCHAIND_SRC)
ALL_C_HEADERS += $(ONCHAIND_HEADERS)
ALL_PROGRAMS += lightningd/lightning_onchaind
# Here's what lightningd depends on
LIGHTNINGD_CONTROL_HEADERS += \
onchaind/onchaind_wiregen.h \
onchaind/onchaind_wire.h onchaind/onchaind_wire.h
LIGHTNINGD_CONTROL_OBJS += \
LIGHTNINGD_ONCHAIN_HEADERS := $(LIGHTNINGD_ONCHAIN_HEADERS_GEN) $(LIGHTNINGD_ONCHAIN_HEADERS_NOGEN) onchaind/onchaind_wiregen.o \
onchaind/onchaind_wire.o
LIGHTNINGD_ONCHAIN_SRC := onchaind/onchaind.c \
onchaind/onchaind_wiregen.c \
onchaind/onchaind_wire.c
LIGHTNINGD_ONCHAIN_OBJS := $(LIGHTNINGD_ONCHAIN_SRC:.c=.o)
# Control daemon uses this:
LIGHTNINGD_ONCHAIN_CONTROL_HEADERS := \
onchaind/onchaind_wiregen.h \
onchaind/onchaind_wire.h
LIGHTNINGD_ONCHAIN_CONTROL_SRC := $(LIGHTNINGD_ONCHAIN_CONTROL_HEADERS:.h=.c)
LIGHTNINGD_ONCHAIN_CONTROL_OBJS := $(LIGHTNINGD_ONCHAIN_CONTROL_SRC:.c=.o)
LIGHTNINGD_ONCHAIN_GEN_SRC := $(filter onchaind/%wiregen.c, $(LIGHTNINGD_ONCHAIN_SRC) $(LIGHTNINGD_ONCHAIN_CONTROL_SRC))
LIGHTNINGD_ONCHAIN_SRC_NOGEN := $(filter-out onchaind/%wiregen.c, $(LIGHTNINGD_ONCHAIN_SRC))
# Add to headers which any object might need.
LIGHTNINGD_HEADERS_GEN += $(LIGHTNINGD_ONCHAIN_HEADERS_GEN)
LIGHTNINGD_HEADERS_NOGEN += $(LIGHTNINGD_ONCHAIN_HEADERS_NOGEN)
$(LIGHTNINGD_ONCHAIN_OBJS): $(LIGHTNINGD_HEADERS)
# Common source we use. # Common source we use.
ONCHAIND_COMMON_OBJS := \ ONCHAIND_COMMON_OBJS := \
@ -78,23 +63,6 @@ ONCHAIND_COMMON_OBJS := \
common/version.o \ common/version.o \
common/wallet.o common/wallet.o
LIGHTNINGD_ONCHAIN_OBJS := $(LIGHTNINGD_ONCHAIN_SRC:.c=.o) $(LIGHTNINGD_ONCHAIN_GEN_SRC:.c=.o) lightningd/lightning_onchaind: $(ONCHAIND_OBJS) $(WIRE_ONION_OBJS) $(ONCHAIND_COMMON_OBJS) $(WIRE_OBJS) $(BITCOIN_OBJS) $(HSMD_CLIENT_OBJS)
# Make sure these depend on everything. include onchaind/test/Makefile
ALL_OBJS += $(LIGHTNINGD_ONCHAIN_OBJS)
ALL_PROGRAMS += lightningd/lightning_onchaind
ALL_GEN_HEADERS += $(LIGHTNINGD_ONCHAIN_HEADERS_GEN)
lightningd/lightning_onchaind: $(LIGHTNINGD_ONCHAIN_OBJS) $(WIRE_ONION_OBJS) $(ONCHAIND_COMMON_OBJS) $(WIRE_OBJS) $(BITCOIN_OBJS) $(LIGHTNINGD_HSM_CLIENT_OBJS)
check-source: $(LIGHTNINGD_ONCHAIN_SRC_NOGEN:%=check-src-include-order/%)
check-source-bolt: $(LIGHTNINGD_ONCHAIN_SRC:%=bolt-check/%) $(LIGHTNINGD_ONCHAIN_HEADERS:%=bolt-check/%)
check-whitespace: $(LIGHTNINGD_ONCHAIN_SRC_NOGEN:%=check-whitespace/%) $(LIGHTNINGD_ONCHAIN_HEADERS_NOGEN:%=check-whitespace/%)
clean: onchaind-clean
onchaind-clean:
$(RM) $(LIGHTNINGD_ONCHAIN_OBJS)
-include onchaind/test/Makefile

View File

@ -6,6 +6,9 @@ ONCHAIND_TEST_SRC := $(wildcard onchaind/test/run-*.c)
ONCHAIND_TEST_OBJS := $(ONCHAIND_TEST_SRC:.c=.o) ONCHAIND_TEST_OBJS := $(ONCHAIND_TEST_SRC:.c=.o)
ONCHAIND_TEST_PROGRAMS := $(ONCHAIND_TEST_OBJS:.o=) ONCHAIND_TEST_PROGRAMS := $(ONCHAIND_TEST_OBJS:.o=)
ALL_C_SOURCES += $(ONCHAIND_TEST_SRC)
ALL_TEST_PROGRAMS += $(ONCHAIND_TEST_PROGRAMS)
ONCHAIND_TEST_COMMON_OBJS := \ ONCHAIND_TEST_COMMON_OBJS := \
common/amount.o \ common/amount.o \
common/features.o \ common/features.o \
@ -19,10 +22,7 @@ update-mocks: $(ONCHAIND_TEST_SRC:%=update-mocks/%)
$(ONCHAIND_TEST_PROGRAMS): $(ONCHAIND_TEST_COMMON_OBJS) $(BITCOIN_OBJS) $(ONCHAIND_TEST_PROGRAMS): $(ONCHAIND_TEST_COMMON_OBJS) $(BITCOIN_OBJS)
# Test objects depend on ../ src and headers. # Test objects depend on ../ src and headers.
$(ONCHAIND_TEST_OBJS): $(LIGHTNINGD_ONCHAIN_HEADERS) $(LIGHTNINGD_ONCHAIN_SRC) $(ONCHAIND_TEST_OBJS): $(ONCHAIND_HEADERS) $(ONCHAIND_SRC)
ALL_OBJS += $(ONCHAIND_TEST_OBJS)
ALL_TEST_PROGRAMS += $(ONCHAIND_TEST_PROGRAMS)
onchaind-tests: $(ONCHAIND_TEST_PROGRAMS:%=unittest/%) onchaind-tests: $(ONCHAIND_TEST_PROGRAMS:%=unittest/%)

View File

@ -1,37 +1,21 @@
#! /usr/bin/make #! /usr/bin/make
# Designed to be run one level up OPENINGD_HEADERS := openingd/openingd_wiregen.h
opening-wrongdir:
$(MAKE) -C ../.. opening-all
default: opening-all OPENINGD_SRC := openingd/openingd.c \
$(OPENINGD_HEADERS:.h=.c)
opening-all: lightningd/lightning_openingd OPENINGD_OBJS := $(OPENINGD_SRC:.c=.o)
$(OPENINGD_OBJS): $(OPENINGD_HEADERS)
# opening needs these: # Make sure these depend on everything.
LIGHTNINGD_OPENING_HEADERS_GEN := \ ALL_C_SOURCES += $(OPENINGD_SRC)
openingd/openingd_wiregen.h ALL_C_HEADERS += $(OPENINGD_HEADERS)
ALL_PROGRAMS += lightningd/lightning_openingd
LIGHTNINGD_OPENING_HEADERS_NOGEN := # Here's what lightningd depends on
LIGHTNINGD_CONTROL_HEADERS += openingd/openingd_wiregen.h
LIGHTNINGD_OPENING_HEADERS := $(LIGHTNINGD_OPENING_HEADERS_GEN) $(LIGHTNINGD_OPENING_HEADERS_NOGEN) LIGHTNINGD_CONTROL_OBJS += openingd/openingd_wiregen.o
LIGHTNINGD_OPENING_SRC := openingd/openingd.c \
$(LIGHTNINGD_OPENING_HEADERS:.h=.c)
LIGHTNINGD_OPENING_OBJS := $(LIGHTNINGD_OPENING_SRC:.c=.o)
# Control daemon uses this:
LIGHTNINGD_OPENING_CONTROL_HEADERS := $(LIGHTNINGD_OPENING_HEADERS)
LIGHTNINGD_OPENING_CONTROL_SRC := $(LIGHTNINGD_OPENING_HEADERS:.h=.c)
LIGHTNINGD_OPENING_CONTROL_OBJS := $(LIGHTNINGD_OPENING_CONTROL_SRC:.c=.o)
LIGHTNINGD_OPENING_GEN_SRC := $(filter openingd/%wiregen.c, $(LIGHTNINGD_OPENING_SRC) $(LIGHTNINGD_OPENING_CONTROL_SRC))
LIGHTNINGD_OPENING_SRC_NOGEN := $(filter-out openingd/%wiregen.c, $(LIGHTNINGD_OPENING_SRC))
# Add to headers which any object might need.
LIGHTNINGD_HEADERS_GEN += $(LIGHTNINGD_OPENING_HEADERS_GEN)
LIGHTNINGD_HEADERS_NOGEN += $(LIGHTNINGD_OPENING_HEADERS_NOGEN)
# Common source we use. # Common source we use.
OPENINGD_COMMON_OBJS := \ OPENINGD_COMMON_OBJS := \
@ -85,25 +69,6 @@ OPENINGD_COMMON_OBJS := \
gossipd/gossipd_peerd_wiregen.o \ gossipd/gossipd_peerd_wiregen.o \
lightningd/gossip_msg.o lightningd/gossip_msg.o
$(LIGHTNINGD_OPENING_OBJS): $(LIGHTNINGD_HEADERS) lightningd/lightning_openingd: $(OPENINGD_OBJS) $(OPENINGD_COMMON_OBJS) $(WIRE_OBJS) $(BITCOIN_OBJS) $(HSMD_CLIENT_OBJS)
LIGHTNINGD_OPENING_OBJS := $(LIGHTNINGD_OPENING_SRC:.c=.o) $(LIGHTNINGD_OPENING_GEN_SRC:.c=.o)
# Make sure these depend on everything.
ALL_OBJS += $(LIGHTNINGD_OPENING_OBJS)
ALL_PROGRAMS += lightningd/lightning_openingd
ALL_GEN_HEADERS += $(LIGHTNINGD_OPENING_HEADERS_GEN)
lightningd/lightning_openingd: $(LIGHTNINGD_OPENING_OBJS) $(OPENINGD_COMMON_OBJS) $(WIRE_OBJS) $(BITCOIN_OBJS) $(LIGHTNINGD_HSM_CLIENT_OBJS)
check-source: $(LIGHTNINGD_OPENING_SRC_NOGEN:%=check-src-include-order/%)
check-source-bolt: $(LIGHTNINGD_OPENING_SRC:%=bolt-check/%) $(LIGHTNINGD_OPENING_HEADERS:%=bolt-check/%)
check-whitespace: $(LIGHTNINGD_OPENING_SRC_NOGEN:%=check-whitespace/%) $(LIGHTNINGD_OPENING_HEADERS_NOGEN:%=check-whitespace/%)
clean: opening-clean
opening-clean:
$(RM) $(LIGHTNINGD_OPENING_OBJS)
-include openingd/test/Makefile -include openingd/test/Makefile

View File

@ -41,6 +41,11 @@ PLUGINS := \
plugins/keysend \ plugins/keysend \
plugins/pay plugins/pay
# Make sure these depend on everything.
ALL_C_SOURCES += $(PLUGIN_ALL_SRC)
ALL_C_HEADERS +=
ALL_PROGRAMS += $(PLUGINS)
PLUGIN_COMMON_OBJS := \ PLUGIN_COMMON_OBJS := \
bitcoin/base58.o \ bitcoin/base58.o \
bitcoin/feerate.o \ bitcoin/feerate.o \
@ -94,19 +99,3 @@ plugins/keysend: bitcoin/chainparams.o wire/tlvstream.o wire/onion_wiregen.o $(P
$(PLUGIN_KEYSEND_OBJS): $(PLUGIN_PAY_LIB_HEADER) $(PLUGIN_KEYSEND_OBJS): $(PLUGIN_PAY_LIB_HEADER)
$(PLUGIN_ALL_OBJS): $(PLUGIN_LIB_HEADER) $(PLUGIN_ALL_OBJS): $(PLUGIN_LIB_HEADER)
# Make sure these depend on everything.
ALL_PROGRAMS += $(PLUGINS)
ALL_OBJS += $(PLUGIN_ALL_OBJS)
check-source: $(PLUGIN_ALL_SRC:%=check-src-include-order/%)
check-source: $(PLUGIN_ALL_HEADER:%=check-hdr-include-order/%)
check-source-bolt: $(PLUGIN_ALL_SRC:%=bolt-check/%)
check-source-bolt: $(PLUGIN_ALL_HEADER:%=bolt-check/%)
check-whitespace: $(PLUGIN_ALL_SRC:%=check-whitespace/%)
check-whitespace: $(PLUGIN_ALL_HEADER:%=check-whitespace/%)
clean: plugin-clean
plugin-clean:
$(RM) $(PLUGIN_ALL_OBJS)

View File

@ -6,13 +6,5 @@ tests/plugins/test_libplugin: bitcoin/chainparams.o $(PLUGIN_TESTLIBPLUGIN_OBJS)
$(PLUGIN_TESTLIBPLUGIN_OBJS): $(PLUGIN_LIB_HEADER) $(PLUGIN_TESTLIBPLUGIN_OBJS): $(PLUGIN_LIB_HEADER)
# Make sure these depend on everything. # Make sure these depend on everything.
ALL_PROGRAMS += tests/plugins/test_libplugin ALL_TEST_PROGRAMS += tests/plugins/test_libplugin
ALL_OBJS += $(PLUGIN_TESTLIBPLUGIN_OBJS) ALL_C_SOURCES += $(PLUGIN_TESTLIBPLUGIN_SRC)
check-source: $(PLUGIN_TESTLIBPLUGIN_SRC:%=check-src-include-order/%)
check-whitespace: $(PLUGIN_TESTLIBPLUGIN_SRC:%=check-whitespace/%)
clean: test-plugin-clean
test-plugin-clean:
$(RM) $(PLUGIN_TESTLIBPLUGIN_OBJS)

View File

@ -2,8 +2,11 @@
TOOLS := tools/hsmtool tools/check-bolt TOOLS := tools/hsmtool tools/check-bolt
TOOLS_SRC := $(TOOLS:=.c) TOOLS_SRC := $(TOOLS:=.c)
TOOLS_OBJ := $(TOOLS_SRC:.c=.o) TOOLS_OBJ := $(TOOLS_SRC:.c=.o)
# Make sure these depend on everything.
ALL_C_SOURCES += $(TOOLS_SRC)
ALL_C_HEADERS +=
ALL_PROGRAMS += $(TOOLS) ALL_PROGRAMS += $(TOOLS)
ALL_OBJS += $(TOOLS_OBJ)
TOOLS_COMMON_OBJS = common/utils.o TOOLS_COMMON_OBJS = common/utils.o
@ -22,8 +25,6 @@ tools/lightning-hsmtool: tools/hsmtool
clean: tools-clean clean: tools-clean
tools-clean: tools-clean:
$(RM) tools/check-bolt tools/*.o
$(RM) tools/headerversions $(RM) tools/headerversions
$(RM) $(TOOLS_OBJ) $(TOOLS) tools/lightning-hsmtool
include tools/test/Makefile include tools/test/Makefile

View File

@ -18,20 +18,15 @@ WALLET_DB_DRIVERS := \
wallet/db_postgres.c \ wallet/db_postgres.c \
wallet/db_sqlite3.c wallet/db_sqlite3.c
WALLET_LIB_OBJS := $(WALLET_LIB_SRC:.c=.o) $(WALLET_LIB_SRC_NOHDR:.c=.o) $(WALLET_DB_DRIVERS:.c=.o) WALLET_SRC := $(WALLET_LIB_SRC) $(WALLET_LIB_SRC_NOHDR) $(WALLET_DB_DRIVERS)
WALLET_LIB_HEADERS := $(WALLET_LIB_SRC:.c=.h) WALLET_HDRS := $(WALLET_LIB_SRC:.c=.h)
WALLET_OBJS := $(WALLET_SRC:.c=.o)
$(WALLET_OBJS): $(WALLET_HDRS) $(LIGHTNINGD_HEADERS)
# Make sure these depend on everything. # Make sure these depend on everything.
ALL_OBJS += $(WALLET_LIB_OBJS) ALL_C_SOURCES += $(WALLET_SRC)
ALL_C_HEADERS += $(WALLET_HDRS)
$(WALLET_LIB_OBJS): $(LIGHTNINGD_HEADERS_NOGEN) $(WALLET_LIB_HEADERS)
check-whitespace: $(WALLET_LIB_SRC:%=check-whitespace/%) $(WALLET_LIB_HEADERS:%=check-whitespace/%)
check-source: $(WALLET_LIB_SRC:%=check-src-include-order/%)
check-source: $(WALLET_LIB_HEADERS:%=check-hdr-include-order/%)
check-source-bolt: $(WALLET_LIB_SRC:%=bolt-check/%) $(WALLET_LIB_HEADERS:%=bolt-check/%)
clean: wallet-clean
# Each database driver depends on its rewritten statements. # Each database driver depends on its rewritten statements.
wallet/db_sqlite3.o: wallet/gen_db_sqlite3.c wallet/db_sqlite3.o: wallet/gen_db_sqlite3.c
@ -51,8 +46,8 @@ wallet/statements.po: $(SQL_FILES)
wallet/gen_db_%.c: wallet/statements.po devtools/sql-rewrite.py wallet/gen_db_%.c: wallet/statements.po devtools/sql-rewrite.py
devtools/sql-rewrite.py wallet/statements.po $* > wallet/gen_db_$*.c devtools/sql-rewrite.py wallet/statements.po $* > wallet/gen_db_$*.c
clean: wallet_clean
wallet-clean: wallet-clean:
$(RM) $(WALLET_LIB_OBJS)
$(RM) wallet/statements.po $(RM) wallet/statements.po
$(RM) wallet/gen_db_sqlite3.c $(RM) wallet/gen_db_sqlite3.c
$(RM) wallet/gen_db_postgres.c $(RM) wallet/gen_db_postgres.c

View File

@ -2,6 +2,9 @@ WALLET_TEST_SRC := $(wildcard wallet/test/run-*.c)
WALLET_TEST_OBJS := $(WALLET_TEST_SRC:.c=.o) WALLET_TEST_OBJS := $(WALLET_TEST_SRC:.c=.o)
WALLET_TEST_PROGRAMS := $(WALLET_TEST_OBJS:.o=) WALLET_TEST_PROGRAMS := $(WALLET_TEST_OBJS:.o=)
ALL_C_SOURCES += $(WALLET_TEST_SRC)
ALL_TEST_PROGRAMS += $(WALLET_TEST_PROGRAMS)
WALLET_TEST_COMMON_OBJS := \ WALLET_TEST_COMMON_OBJS := \
common/amount.o \ common/amount.o \
common/base32.o \ common/base32.o \
@ -24,18 +27,11 @@ WALLET_TEST_COMMON_OBJS := \
wire/towire.o \ wire/towire.o \
wire/fromwire.o wire/fromwire.o
# Make sure these depend on everything.
ALL_TEST_PROGRAMS += $(WALLET_TEST_PROGRAMS)
ALL_OBJS += $(WALLET_LIB_OBJS) $(WALLET_TEST_OBJS)
$(WALLET_TEST_PROGRAMS): $(BITCOIN_OBJS) $(WALLET_TEST_COMMON_OBJS) $(WALLET_TEST_PROGRAMS): $(BITCOIN_OBJS) $(WALLET_TEST_COMMON_OBJS)
$(WALLET_TEST_OBJS): $(WALLET_LIB_HEADERS) $(WALLET_LIB_SRC) $(WALLET_TEST_OBJS): $(WALLET_HDRS) $(WALLET_SRC)
wallet/tests: $(WALLET_TEST_PROGRAMS:%=unittest/%) wallet/tests: $(WALLET_TEST_PROGRAMS:%=unittest/%)
$(WALLET_TEST_PROGRAMS): $(WALLET_TEST_COMMON_OBJS) $(BITCOIN_OBJS)
$(WALLET_TEST_OBJS): $(WALLET_SRC)
update-mocks: $(WALLET_TEST_SRC:%=update-mocks/%) update-mocks: $(WALLET_TEST_SRC:%=update-mocks/%)
check-units: $(WALLET_TEST_PROGRAMS:%=unittest/%) check-units: $(WALLET_TEST_PROGRAMS:%=unittest/%)

View File

@ -1,38 +1,39 @@
#! /usr/bin/make #! /usr/bin/make
# Designed to be run one level up WIRE_HEADERS := wire/onion_defs.h \
wire-wrongdir:
$(MAKE) -C .. wire-all
WIRE_HEADERS_NOGEN := wire/onion_defs.h \
wire/peer_wire.h \ wire/peer_wire.h \
wire/tlvstream.h \ wire/tlvstream.h \
wire/wire.h \ wire/wire.h \
wire/wire_sync.h \ wire/wire_sync.h \
wire/wire_io.h wire/wire_io.h \
WIRE_GEN_HEADERS := wire/peer_wiregen.h \ wire/peer_wiregen.h \
wire/onion_wiregen.h \ wire/onion_wiregen.h \
wire/common_wiregen.h \ wire/common_wiregen.h \
wire/peer_printgen.h \ wire/peer_printgen.h \
wire/onion_printgen.h wire/onion_printgen.h
WIRE_GEN_SRC := wire/peer_wiregen.c wire/common_wiregen.c # We don't include peer_printgen/onion_printgen here since most don't need it.
WIRE_GEN_ONION_SRC := wire/onion_wiregen.c
WIRE_GEN_PRINT_SRC := wire/peer_printgen.c wire/onion_printgen.c
WIRE_SRC := wire/wire_sync.c \ WIRE_SRC := wire/wire_sync.c \
wire/wire_io.c \ wire/wire_io.c \
wire/fromwire.c \ wire/fromwire.c \
wire/peer_wire.c \ wire/peer_wire.c \
wire/tlvstream.c \ wire/tlvstream.c \
wire/towire.c wire/towire.c \
WIRE_HEADERS := $(WIRE_HEADERS_NOGEN) $(WIRE_GEN_HEADERS) wire/common_wiregen.c \
wire/peer_wiregen.c \
wire/onion_wiregen.c
WIRE_OBJS := $(WIRE_SRC:.c=.o) $(WIRE_GEN_SRC:.c=.o) WIRE_PRINT_SRC := \
WIRE_ONION_OBJS := $(WIRE_GEN_ONION_SRC:.c=.o) wire/onion_printgen.c \
wire/peer_printgen.c
ALL_OBJS += $(WIRE_OBJS) $(WIRE_ONION_OBJS) WIRE_OBJS := $(WIRE_SRC:.c=.o)
ALL_GEN_HEADERS += $(WIRE_GEN_HEADERS) WIRE_PRINT_OBJS := $(WIRE_PRINT_SRC:.c=.o)
$(WIRE_OBJS) $(WIRE_PRINT_OBJS): $(WIRE_HEADERS)
# Make sure these depend on everything.
ALL_C_SOURCES += $(WIRE_SRC) $(WIRE_PRINT_SRC)
ALL_C_HEADERS += $(WIRE_HEADERS)
# They may not have the bolts. # They may not have the bolts.
BOLT_EXTRACT=$(LOCAL_BOLTDIR)/tools/extract-formats.py BOLT_EXTRACT=$(LOCAL_BOLTDIR)/tools/extract-formats.py
@ -89,22 +90,9 @@ wire/onion_wiregen.h_args := --include='bitcoin/short_channel_id.h' --include='b
wire/onion_wiregen.c_args := -s --expose-tlv-type=tlv_payload wire/onion_wiregen.c_args := -s --expose-tlv-type=tlv_payload
check-source: $(WIRE_SRC:%=check-src-include-order/%) $(WIRE_HEADERS_NOGEN:%=check-hdr-include-order/%)
check-source-bolt: $(WIRE_SRC:%=bolt-check/%) $(WIRE_HEADERS_NOGEN:%=bolt-check/%)
check-whitespace: $(WIRE_SRC:%=check-whitespace/%) $(WIRE_HEADERS_NOGEN:%=check-whitespace/%) check-whitespace/wire/Makefile
clean: wire-clean
maintainer-clean: wire-maintainer-clean maintainer-clean: wire-maintainer-clean
wire-maintainer-clean: wire-maintainer-clean:
$(RM) wire/gen_*_csv wire/extracted_*_experimental_csv $(RM) wire/gen_*_csv wire/extracted_*_experimental_csv
wire-all: $(WIRE_OBJS) $(WIRE_ONION_OBJS)
wire-clean:
$(RM) $(WIRE_OBJS) $(WIRE_ONION_OBJS) $(WIRE_GEN_SRC) $(WIRE_GEN_ONION_SRC) $(WIRE_GEN_HEADERS) wire/gen_*_wire_csv
include wire/test/Makefile include wire/test/Makefile

View File

@ -6,6 +6,9 @@ WIRE_TEST_SRC := $(wildcard wire/test/run-*.c)
WIRE_TEST_OBJS := $(WIRE_TEST_SRC:.c=.o) WIRE_TEST_OBJS := $(WIRE_TEST_SRC:.c=.o)
WIRE_TEST_PROGRAMS := $(WIRE_TEST_OBJS:.o=) WIRE_TEST_PROGRAMS := $(WIRE_TEST_OBJS:.o=)
ALL_C_SOURCES += $(WIRE_TEST_SRC)
ALL_TEST_PROGRAMS += $(WIRE_TEST_PROGRAMS)
WIRE_TEST_COMMON_OBJS := \ WIRE_TEST_COMMON_OBJS := \
common/utils.o common/utils.o
@ -14,11 +17,7 @@ update-mocks: $(WIRE_TEST_SRC:%=update-mocks/%)
# run-tlvstream.c needs to reach into bitcoin/pubkey for SUPERVERBOSE # run-tlvstream.c needs to reach into bitcoin/pubkey for SUPERVERBOSE
$(WIRE_TEST_PROGRAMS): $(WIRE_TEST_COMMON_OBJS) $(filter-out bitcoin/pubkey.o,$(BITCOIN_OBJS)) $(WIRE_TEST_PROGRAMS): $(WIRE_TEST_COMMON_OBJS) $(filter-out bitcoin/pubkey.o,$(BITCOIN_OBJS))
# Test objects require source to be generated, since they include .. $(WIRE_TEST_OBJS): $(WIRE_HEADERS) $(WIRE_SRC) $(WIRE_PRINT_SRC)
$(WIRE_TEST_OBJS): $(WIRE_GEN_SRC) $(WIRE_SRC) $(WIRE_HEADERS)
ALL_OBJS += $(WIRE_TEST_OBJS)
ALL_TEST_PROGRAMS += $(WIRE_TEST_PROGRAMS)
wire-tests: $(WIRE_TEST_PROGRAMS:%=unittest/%) wire-tests: $(WIRE_TEST_PROGRAMS:%=unittest/%)