From 7260d9ea3d9b70578df15ff63e9fe7aaf730dc8d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 24 Sep 2020 11:02:54 +0930 Subject: [PATCH] plugins: generate list of plugins more atomically, respect V=1 and --quiet. I got a corrupt file, which looked like multiple concurrent attempts to build it. So instead, build it in one command, but also use VERBOSE so we print correctly with V=1 (and --quiet). Also move into plugins/ where it logically belongs. Signed-off-by: Rusty Russell --- Makefile | 11 +---------- lightningd/Makefile | 2 +- lightningd/plugin.c | 2 +- plugins/Makefile | 5 +++++ wallet/db_sqlite3_sqlgen.c | 2 +- wallet/statements_gettextgen.po | 4 ++-- 6 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index f6c44e335..4d4199652 100644 --- a/Makefile +++ b/Makefile @@ -208,7 +208,7 @@ WIRE_GEN_DEPS := $(WIRE_GEN) $(wildcard tools/gen/*_template) ALL_PROGRAMS := ALL_TEST_PROGRAMS := ALL_C_SOURCES := -ALL_C_HEADERS := gen_header_versions.h gen_list_of_builtin_plugins.h gen_version.h +ALL_C_HEADERS := gen_header_versions.h gen_version.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 @@ -315,15 +315,6 @@ ALL_OBJS := $(ALL_C_SOURCES:.c=.o) # spurious rebuilds. $(filter %printgen.h %printgen.c %wiregen.h %wiregen.c, $(ALL_C_HEADERS) $(ALL_C_SOURCES)): FORCE -# Generated from PLUGINS definition in plugins/Makefile -gen_list_of_builtin_plugins.h : plugins/Makefile Makefile - @echo GEN $@ - @rm -f $@ || true - @echo 'static const char *list_of_builtin_plugins[] = {' >> $@ - @echo '$(PLUGINS)' | sed 's@plugins/\([^ ]*\)@"\1",@g'>> $@ - @echo 'NULL' >> $@ - @echo '};' >> $@ - ifneq ($(TEST_GROUP_COUNT),) PYTEST_OPTS += --test-group=$(TEST_GROUP) --test-group-count=$(TEST_GROUP_COUNT) endif diff --git a/lightningd/Makefile b/lightningd/Makefile index b82935563..7d7798e82 100644 --- a/lightningd/Makefile +++ b/lightningd/Makefile @@ -132,7 +132,7 @@ 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: gen_list_of_builtin_plugins.h +lightningd/plugin.o: plugins/gen_list_of_builtin_plugins.h 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 > $@ diff --git a/lightningd/plugin.c b/lightningd/plugin.c index 476682bee..90c081e9a 100644 --- a/lightningd/plugin.c +++ b/lightningd/plugin.c @@ -18,7 +18,7 @@ #include /* Only this file can include this generated header! */ -# include +# include /* How many seconds may the plugin take to reply to the `getmanifest` * call? This is the maximum delay to `lightningd --help` and until diff --git a/plugins/Makefile b/plugins/Makefile index 36112b850..02cb8fdc9 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -116,3 +116,8 @@ $(PLUGIN_KEYSEND_OBJS): $(PLUGIN_PAY_LIB_HEADER) plugins/spenderp: bitcoin/chainparams.o $(PLUGIN_SPENDER_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_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 + @$(call VERBOSE,GEN $@,echo "static const char *list_of_builtin_plugins[] = { $(foreach d,$(notdir $(PLUGINS)),\"$d\",) NULL };" > $@) diff --git a/wallet/db_sqlite3_sqlgen.c b/wallet/db_sqlite3_sqlgen.c index 18f7d8296..fd4f4d1fb 100644 --- a/wallet/db_sqlite3_sqlgen.c +++ b/wallet/db_sqlite3_sqlgen.c @@ -1654,4 +1654,4 @@ struct db_query db_sqlite3_queries[] = { #endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */ -// SHA256STAMP:da7062bd6da96d600c8607162e7a125f3a67c9e830c687656e5746b6a6bb8ae2 +// SHA256STAMP:fa191e6b54c56b2d4e85a24ca83bc0d41dddec5dbde948e2bc5d627426089ade diff --git a/wallet/statements_gettextgen.po b/wallet/statements_gettextgen.po index 92c1a26fb..c85ef2034 100644 --- a/wallet/statements_gettextgen.po +++ b/wallet/statements_gettextgen.po @@ -1086,7 +1086,7 @@ msgstr "" msgid "not a valid SQL statement" msgstr "" -#: wallet/test/run-wallet.c:603 +#: wallet/test/run-wallet.c:1359 msgid "INSERT INTO channels (id) VALUES (1);" msgstr "" -# SHA256STAMP:7bc86b6b93e4bdb7d4b06ac466ce647bc2f81aaaca980c973d850dff7eebc0a8 +# SHA256STAMP:fb0b381451867f44c3f35f2202e741a06ff9f531329facf6e9df302036eff4e4