From 229f288eb5f94770c159e759aa327a80cef2cf8f Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 26 Feb 2018 13:21:55 +1030 Subject: [PATCH] Makefile: allow configurator to use a different CC, by setting CONFIGURATOR_CC This should solve what @icota wanted in https://github.com/ElementsProject/lightning/pull/1035 in a much cleaner way. In particular, this allows you to say what configurator should use, independent of what other compilation should use, and reverts the '-static' which broke MacOS. Fixes: #1059 Signed-off-by: Rusty Russell --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f7c47233f..8b16d4bcb 100644 --- a/Makefile +++ b/Makefile @@ -163,6 +163,9 @@ CWARNFLAGS := -Werror -Wall -Wundef -Wmissing-prototypes -Wmissing-declarations CDEBUGFLAGS := -std=gnu11 -g -fstack-protector CFLAGS = $(CPPFLAGS) $(CWARNFLAGS) $(CDEBUGFLAGS) -I $(CCANDIR) $(EXTERNAL_INCLUDE_FLAGS) -I . -I/usr/local/include $(FEATURES) $(COVFLAGS) $(DEV_CFLAGS) -DSHACHAIN_BITS=48 -DJSMN_PARENT_LINKS $(PIE_CFLAGS) +# We can get configurator to run a different compile cmd to cross-configure. +CONFIGURATOR_CC := $(CC) + LDFLAGS = $(PIE_LDFLAGS) LDLIBS = -L/usr/local/lib -lm -lgmp -lsqlite3 $(COVFLAGS) @@ -269,7 +272,7 @@ ALL_PROGRAMS += ccan/ccan/cdump/tools/cdump-enumstr ccan/ccan/cdump/tools/cdump-enumstr.o: $(CCAN_HEADERS) Makefile ccan/config.h: ccan/tools/configurator/configurator - if $< $(CC) -static > $@.new; then mv $@.new $@; else rm $@.new; exit 1; fi + if $< --configurator-cc="$(CONFIGURATOR_CC)" $(CC) $(CFLAGS) > $@.new; then mv $@.new $@; else rm $@.new; exit 1; fi gen_version.h: FORCE @(echo "#define VERSION \"`git describe --always --dirty`\"" && echo "#define VERSION_NAME \"$(NAME)\"" && echo "#define BUILD_FEATURES \"$(FEATURES)\"") > $@.new