Skip to content

Commit

Permalink
plugins: generate list of plugins more atomically, respect V=1 and --…
Browse files Browse the repository at this point in the history
…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 <[email protected]>
  • Loading branch information
rustyrussell committed Sep 24, 2020
1 parent accfa76 commit b03b73c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 15 deletions.
11 changes: 1 addition & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lightningd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 > $@
Expand Down
2 changes: 1 addition & 1 deletion lightningd/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <sys/types.h>

/* Only this file can include this generated header! */
# include <gen_list_of_builtin_plugins.h>
# include <plugins/gen_list_of_builtin_plugins.h>

/* How many seconds may the plugin take to reply to the `getmanifest`
* call? This is the maximum delay to `lightningd --help` and until
Expand Down
5 changes: 5 additions & 0 deletions plugins/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 };" > $@)
2 changes: 1 addition & 1 deletion wallet/db_sqlite3_sqlgen.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions wallet/statements_gettextgen.po

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b03b73c

Please sign in to comment.