mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-18 14:44:22 +01:00
Makefile: unify generated files definition.
We change gen_ to _gen, because filtering on gen_% doesn't work if they're in subdirectories :( Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -15,7 +15,8 @@ TAGS
|
||||
tags
|
||||
ccan/tools/configurator/configurator
|
||||
ccan/ccan/cdump/tools/cdump-enumstr
|
||||
gen_*
|
||||
*_gen.c
|
||||
*_gen.h
|
||||
cli/lightning-cli
|
||||
tools/check-bolt
|
||||
tools/hsmtool
|
||||
|
||||
22
Makefile
22
Makefile
@@ -218,7 +218,7 @@ ALL_PROGRAMS :=
|
||||
ALL_TEST_PROGRAMS :=
|
||||
ALL_FUZZ_TARGETS :=
|
||||
ALL_C_SOURCES :=
|
||||
ALL_C_HEADERS := gen_header_versions.h gen_version.h
|
||||
ALL_C_HEADERS := header_versions_gen.h version_gen.h
|
||||
|
||||
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
|
||||
@@ -324,9 +324,11 @@ ifneq ($(FUZZING),0)
|
||||
endif
|
||||
|
||||
# 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))
|
||||
ALL_GEN_HEADERS := $(filter %gen.h,$(ALL_C_HEADERS))
|
||||
ALL_GEN_SOURCES := $(filter %gen.c,$(ALL_C_SOURCES))
|
||||
ALL_NONGEN_HEADERS := $(filter-out %gen.h,$(ALL_C_HEADERS))
|
||||
ALL_NONGEN_SOURCES := $(filter-out %gen.c,$(ALL_C_SOURCES))
|
||||
ALL_NONGEN_SRCFILES := $(ALL_NONGEN_HEADERS) $(ALL_NONGEN_SOURCES)
|
||||
|
||||
# Don't delete these intermediaries.
|
||||
.PRECIOUS: $(ALL_GEN_HEADERS) $(ALL_GEN_SOURCES)
|
||||
@@ -478,12 +480,12 @@ ALL_PROGRAMS += ccan/ccan/cdump/tools/cdump-enumstr
|
||||
# Can't add to ALL_OBJS, as that makes a circular dep.
|
||||
ccan/ccan/cdump/tools/cdump-enumstr.o: $(CCAN_HEADERS) Makefile
|
||||
|
||||
gen_version.h: FORCE
|
||||
version_gen.h: FORCE
|
||||
@(echo "#define VERSION \"$(VERSION)\"" && echo "#define BUILD_FEATURES \"$(FEATURES)\"") > $@.new
|
||||
@if cmp $@.new $@ >/dev/null 2>&1; then rm -f $@.new; else mv $@.new $@; $(ECHO) Version updated; fi
|
||||
|
||||
# That forces this rule to be run every time, too.
|
||||
gen_header_versions.h: tools/headerversions
|
||||
header_versions_gen.h: tools/headerversions
|
||||
@tools/headerversions $@
|
||||
|
||||
# All binaries require the external libs, ccan and system library versions.
|
||||
@@ -535,12 +537,16 @@ maintainer-clean: distclean
|
||||
@echo 'deletes files that may need special tools to rebuild.'
|
||||
$(RM) $(ALL_GEN_HEADERS) $(ALL_GEN_SOURCES)
|
||||
|
||||
clean:
|
||||
# We used to have gen_ files, now we have _gen files.
|
||||
obsclean:
|
||||
$(RM) gen_*.h */gen_*.[ch] */*/gen_*.[ch]
|
||||
|
||||
clean: obsclean
|
||||
$(RM) $(CCAN_OBJS) $(CDUMP_OBJS) $(ALL_OBJS)
|
||||
$(RM) $(ALL_PROGRAMS)
|
||||
$(RM) $(ALL_TEST_PROGRAMS)
|
||||
$(RM) $(ALL_FUZZ_TARGETS)
|
||||
$(RM) gen_*.h */gen_* ccan/tools/configurator/configurator
|
||||
$(RM) ccan/tools/configurator/configurator
|
||||
$(RM) ccan/ccan/cdump/tools/cdump-enumstr.o
|
||||
find . -name '*gcda' -delete
|
||||
find . -name '*gcno' -delete
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#! /usr/bin/make
|
||||
|
||||
CHANNELD_HEADERS := \
|
||||
channeld/gen_full_channel_error_names.h \
|
||||
channeld/full_channel_error_names_gen.h \
|
||||
channeld/channeld_wiregen.h \
|
||||
channeld/channeld_htlc.h \
|
||||
channeld/commit_tx.h \
|
||||
@@ -96,7 +96,7 @@ ifeq ($(EXPERIMENTAL_FEATURES),1)
|
||||
CHANNELD_COMMON_OBJS += common/psbt_internal.o
|
||||
endif
|
||||
|
||||
channeld/gen_full_channel_error_names.h: channeld/full_channel_error.h ccan/ccan/cdump/tools/cdump-enumstr
|
||||
channeld/full_channel_error_names_gen.h: channeld/full_channel_error.h ccan/ccan/cdump/tools/cdump-enumstr
|
||||
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)
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
/* Needs to be at end, since it doesn't include its own hdrs */
|
||||
#include "gen_full_channel_error_names.h"
|
||||
#include "full_channel_error_names_gen.h"
|
||||
|
||||
#if DEVELOPER
|
||||
static void memleak_help_htlcmap(struct htable *memtable,
|
||||
|
||||
@@ -95,7 +95,7 @@ COMMON_HEADERS_NOGEN := $(COMMON_SRC_NOGEN:.c=.h) \
|
||||
common/overflows.h \
|
||||
common/status_levels.h \
|
||||
common/tx_roles.h
|
||||
COMMON_HEADERS_GEN := common/gen_htlc_state_names.h common/status_wiregen.h common/peer_status_wiregen.h
|
||||
COMMON_HEADERS_GEN := common/htlc_state_names_gen.h common/status_wiregen.h common/peer_status_wiregen.h
|
||||
|
||||
COMMON_HEADERS := $(COMMON_HEADERS_GEN) $(COMMON_HEADERS_NOGEN)
|
||||
COMMON_SRC := $(COMMON_SRC_NOGEN) $(COMMON_SRC_GEN)
|
||||
@@ -106,12 +106,12 @@ COMMON_OBJS := $(COMMON_SRC:.c=.o)
|
||||
$(COMMON_OBJS): $(CCAN_HEADERS) $(BITCOIN_HEADERS) $(EXTERNAL_HEADERS) $(COMMON_HEADERS_GEN)
|
||||
|
||||
# Only common/version.c can include this header.
|
||||
common/version.o: gen_version.h
|
||||
common/version.o: version_gen.h
|
||||
|
||||
ALL_C_HEADERS += $(COMMON_HEADERS)
|
||||
ALL_C_SOURCES += $(COMMON_SRC)
|
||||
|
||||
common/gen_htlc_state_names.h: common/htlc_state.h ccan/ccan/cdump/tools/cdump-enumstr
|
||||
common/htlc_state_names_gen.h: common/htlc_state.h ccan/ccan/cdump/tools/cdump-enumstr
|
||||
ccan/ccan/cdump/tools/cdump-enumstr common/htlc_state.h > $@
|
||||
|
||||
common/gossip_store.o: gossipd/gossip_store_wiregen.h
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <ccan/array_size/array_size.h>
|
||||
#include <common/htlc.h>
|
||||
#include "gen_htlc_state_names.h"
|
||||
#include "htlc_state_names_gen.h"
|
||||
|
||||
const char *htlc_state_name(enum htlc_state s)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
/* Only common/version.c can safely include this. */
|
||||
# include "gen_version.h"
|
||||
# include "version_gen.h"
|
||||
|
||||
const char *version(void)
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ LIGHTNINGD_SRC_NOHDR := \
|
||||
LIGHTNINGD_HEADERS := \
|
||||
$(LIGHTNINGD_SRC:.c=.h) \
|
||||
lightningd/channel_state.h \
|
||||
lightningd/gen_channel_state_names.h
|
||||
lightningd/channel_state_names_gen.h
|
||||
|
||||
LIGHTNINGD_OBJS := $(LIGHTNINGD_SRC:.c=.o) $(LIGHTNINGD_SRC_NOHDR:.c=.o)
|
||||
$(LIGHTNINGD_OBJS): $(LIGHTNINGD_HEADERS) $(LIGHTNINGD_CONTROL_HEADERS)
|
||||
@@ -129,9 +129,9 @@ LIGHTNINGD_HEADERS = $(LIGHTNINGD_HEADERS_NOGEN) $(LIGHTNINGD_HEADERS_GEN) $(WAL
|
||||
$(LIGHTNINGD_OBJS): $(LIGHTNINGD_HEADERS) $(WALLET_HDRS)
|
||||
|
||||
# Only the plugin component needs to depend on this header.
|
||||
lightningd/plugin.o: plugins/gen_list_of_builtin_plugins.h
|
||||
lightningd/plugin.o: plugins/list_of_builtin_plugins_gen.h
|
||||
|
||||
lightningd/gen_channel_state_names.h: lightningd/channel_state.h ccan/ccan/cdump/tools/cdump-enumstr
|
||||
lightningd/channel_state_names_gen.h: lightningd/channel_state.h ccan/ccan/cdump/tools/cdump-enumstr
|
||||
ccan/ccan/cdump/tools/cdump-enumstr lightningd/channel_state.h > $@
|
||||
|
||||
lightningd/lightningd: $(LIGHTNINGD_OBJS) $(WALLET_OBJS) $(LIGHTNINGD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(WIRE_ONION_OBJS) $(LIGHTNINGD_CONTROL_OBJS) $(HSMD_CLIENT_OBJS)
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
#include <hsmd/hsmd_wiregen.h>
|
||||
#include <inttypes.h>
|
||||
#include <lightningd/channel.h>
|
||||
#include <lightningd/channel_state_names_gen.h>
|
||||
#include <lightningd/connect_control.h>
|
||||
#include <lightningd/gen_channel_state_names.h>
|
||||
#include <lightningd/hsm_control.h>
|
||||
#include <lightningd/jsonrpc.h>
|
||||
#include <lightningd/lightningd.h>
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <gen_header_versions.h>
|
||||
#include <header_versions_gen.h>
|
||||
#include <lightningd/bitcoind.h>
|
||||
#include <lightningd/chaintopology.h>
|
||||
#include <lightningd/channel_control.h>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
/* Only this file can include this generated header! */
|
||||
# include <plugins/gen_list_of_builtin_plugins.h>
|
||||
# include <plugins/list_of_builtin_plugins_gen.h>
|
||||
|
||||
/* How many seconds may the plugin take to reply to the `getmanifest`
|
||||
* call? This is the maximum delay to `lightningd --help` and until
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
ONCHAIND_HEADERS := \
|
||||
onchaind/onchaind_wiregen.h \
|
||||
onchaind/gen_onchain_types_names.h \
|
||||
onchaind/onchain_types_names_gen.h \
|
||||
onchaind/onchain_types.h \
|
||||
onchaind/onchaind_wire.h
|
||||
|
||||
@@ -11,7 +11,7 @@ ONCHAIND_SRC := onchaind/onchaind.c \
|
||||
onchaind/onchaind_wire.c \
|
||||
onchaind/onchaind.c
|
||||
|
||||
onchaind/gen_onchain_types_names.h: onchaind/onchain_types.h ccan/ccan/cdump/tools/cdump-enumstr
|
||||
onchaind/onchain_types_names_gen.h: onchaind/onchain_types.h ccan/ccan/cdump/tools/cdump-enumstr
|
||||
ccan/ccan/cdump/tools/cdump-enumstr onchaind/onchain_types.h > $@
|
||||
|
||||
ONCHAIND_OBJS := $(ONCHAIND_SRC:.c=.o)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <wire/wire_sync.h>
|
||||
#include "gen_onchain_types_names.h"
|
||||
#include "onchain_types_names_gen.h"
|
||||
|
||||
/* stdin == requests */
|
||||
#define REQ_FD STDIN_FILENO
|
||||
|
||||
@@ -118,6 +118,6 @@ plugins/spenderp: bitcoin/chainparams.o $(PLUGIN_SPENDER_OBJS) $(PLUGIN_LIB_OBJS
|
||||
$(PLUGIN_ALL_OBJS): $(PLUGIN_LIB_HEADER)
|
||||
|
||||
# Generated from PLUGINS definition in plugins/Makefile
|
||||
ALL_C_HEADERS += plugins/gen_list_of_builtin_plugins.h
|
||||
plugins/gen_list_of_builtin_plugins.h: plugins/Makefile Makefile
|
||||
ALL_C_HEADERS += plugins/list_of_builtin_plugins_gen.h
|
||||
plugins/list_of_builtin_plugins_gen.h: plugins/Makefile Makefile
|
||||
@$(call VERBOSE,GEN $@,echo "static const char *list_of_builtin_plugins[] = { $(foreach d,$(notdir $(PLUGINS)),\"$d\",) NULL };" > $@)
|
||||
|
||||
@@ -11,9 +11,9 @@ ifeq ($(HAVE_PYTHON3_MAKO),1)
|
||||
check-units: check-tools
|
||||
|
||||
TOOL_TEST_INCL_SRC := tools/test/enum.c
|
||||
TOOL_GEN_SRC := tools/test/gen_test.c tools/test/gen_print.c
|
||||
TOOL_GEN_SRC := tools/test/test_gen.c tools/test/print_gen.c
|
||||
TOOL_GEN_OBJS := $(TOOL_GEN_SRC:.c=.o)
|
||||
TOOL_GEN_HEADER := tools/test/gen_test.h tools/test/gen_print.h
|
||||
TOOL_GEN_HEADER := tools/test/test_gen.h tools/test/print_gen.h
|
||||
TOOL_TEST_SRC := $(wildcard tools/test/run-*.c)
|
||||
TOOL_TEST_OBJS := $(TOOL_TEST_SRC:.c=.o)
|
||||
# Don't require update-mocks hack unless developer mode.
|
||||
@@ -35,22 +35,22 @@ TOOLS_WIRE_DEPS := $(BOLT_DEPS) tools/test/test_cases $(wildcard tools/gen/*_tem
|
||||
$(TOOL_TEST_OBJS) $(TOOL_GEN_OBJS): $(TOOL_GEN_HEADER)
|
||||
$(TOOL_TEST_PROGRAMS): $(TOOL_TEST_COMMON_OBJS) $(TOOL_GEN_SRC:.c=.o) tools/test/enum.o
|
||||
|
||||
tools/test/gen_test.h: $(TOOLS_WIRE_DEPS) tools/test/Makefile
|
||||
tools/test/test_gen.h: $(TOOLS_WIRE_DEPS) tools/test/Makefile
|
||||
$(BOLT_GEN) --page header $@ test_type < tools/test/test_cases > $@
|
||||
|
||||
.INTERMEDIATE: tools/test/gen_test.c.tmp.c
|
||||
.INTERMEDIATE: tools/test/test_gen.c.tmp.c
|
||||
# Parallel make sometimes tries to use file before update-mocks, so split.
|
||||
tools/test/gen_test.c.tmp.c: $(TOOLS_WIRE_DEPS)
|
||||
$(BOLT_GEN) --page impl tools/test/gen_test.h test_type < tools/test/test_cases > $@
|
||||
tools/test/test_gen.c.tmp.c: $(TOOLS_WIRE_DEPS)
|
||||
$(BOLT_GEN) --page impl tools/test/test_gen.h test_type < tools/test/test_cases > $@
|
||||
|
||||
tools/test/gen_test.c: tools/test/gen_test.c.tmp.c $(EXTERNAL_HEADERS) tools/test/gen_test.h
|
||||
tools/test/test_gen.c: tools/test/test_gen.c.tmp.c $(EXTERNAL_HEADERS) tools/test/test_gen.h
|
||||
@MAKE=$(MAKE) tools/update-mocks.sh "$<" $(SUPPRESS_OUTPUT) && mv "$<" "$@"
|
||||
|
||||
tools/test/gen_print.h: wire/onion$(EXP)_wiregen.h $(TOOLS_WIRE_DEPS)
|
||||
tools/test/print_gen.h: wire/onion$(EXP)_wiregen.h $(TOOLS_WIRE_DEPS)
|
||||
$(BOLT_GEN) -P --page header $@ test_type < tools/test/test_cases > $@
|
||||
|
||||
tools/test/gen_print.c: $(TOOLS_WIRE_DEPS)
|
||||
echo '#include "gen_test.h"' > $@
|
||||
tools/test/print_gen.c: $(TOOLS_WIRE_DEPS)
|
||||
echo '#include "test_gen.h"' > $@
|
||||
$(BOLT_GEN) -P --page impl ${@:.c=.h} test_type < tools/test/test_cases >> $@
|
||||
|
||||
ALL_TEST_PROGRAMS += $(TOOL_TEST_PROGRAMS)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "gen_test.h"
|
||||
#include "gen_print.h"
|
||||
#include "test_gen.h"
|
||||
#include "print_gen.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
Reference in New Issue
Block a user