2015-05-26 06:38:12 +02:00
|
|
|
#! /usr/bin/make
|
2019-01-11 05:56:30 +01:00
|
|
|
|
|
|
|
# Extract version from git, or if we're from a zipfile, use dirname
|
2020-09-15 10:47:00 +02:00
|
|
|
VERSION=$(shell git describe --always --dirty=-modded --abbrev=7 2>/dev/null || pwd | sed -n 's|.*/c\{0,1\}lightning-v\{0,1\}\([0-9a-f.rc\-]*\)$$|\1|gp')
|
2019-01-10 06:22:46 +01:00
|
|
|
|
2020-05-19 03:53:17 +02:00
|
|
|
# --quiet / -s means quiet, dammit!
|
|
|
|
ifeq ($(findstring s,$(word 1, $(MAKEFLAGS))),s)
|
|
|
|
ECHO := :
|
2020-05-19 05:11:25 +02:00
|
|
|
SUPPRESS_OUTPUT := > /dev/null
|
2020-05-19 03:53:17 +02:00
|
|
|
else
|
|
|
|
ECHO := echo
|
2020-05-19 05:11:25 +02:00
|
|
|
SUPPRESS_OUTPUT :=
|
2020-05-19 03:53:17 +02:00
|
|
|
endif
|
|
|
|
|
2018-06-21 02:39:15 +02:00
|
|
|
DISTRO=$(shell lsb_release -is 2>/dev/null || echo unknown)-$(shell lsb_release -rs 2>/dev/null || echo unknown)
|
2021-12-20 12:11:41 +01:00
|
|
|
OS=$(shell uname -s)
|
|
|
|
ARCH=$(shell uname -m)
|
2022-04-06 07:09:48 +02:00
|
|
|
# Changing this could break installs!
|
2017-12-06 15:12:04 +01:00
|
|
|
PKGNAME = c-lightning
|
|
|
|
|
2016-01-21 21:08:08 +01:00
|
|
|
# We use our own internal ccan copy.
|
|
|
|
CCANDIR := ccan
|
|
|
|
|
2016-05-02 08:28:56 +02:00
|
|
|
# Where we keep the BOLT RFCs
|
2022-04-20 23:16:48 +02:00
|
|
|
BOLTDIR := ../bolts/
|
2022-05-18 03:22:41 +02:00
|
|
|
DEFAULT_BOLTVERSION := 105c2e5e9f17c68e8c19dc4ca548600a0b8f66f0
|
2021-04-06 03:21:20 +02:00
|
|
|
# Can be overridden on cmdline.
|
|
|
|
BOLTVERSION := $(DEFAULT_BOLTVERSION)
|
2016-05-02 08:28:56 +02:00
|
|
|
|
2018-06-06 22:40:24 +02:00
|
|
|
-include config.vars
|
2016-05-17 06:19:54 +02:00
|
|
|
|
2020-01-31 12:39:29 +01:00
|
|
|
SORT=LC_ALL=C sort
|
|
|
|
|
2020-05-19 03:53:17 +02:00
|
|
|
|
2020-05-01 11:19:11 +02:00
|
|
|
ifeq ($V,1)
|
2020-08-25 03:33:08 +02:00
|
|
|
VERBOSE = $(ECHO) '$(2)'; $(2)
|
2020-05-01 11:19:11 +02:00
|
|
|
else
|
2020-05-19 03:53:17 +02:00
|
|
|
VERBOSE = $(ECHO) $(1); $(2)
|
2020-05-01 11:19:11 +02:00
|
|
|
endif
|
|
|
|
|
2018-06-06 22:40:24 +02:00
|
|
|
ifneq ($(VALGRIND),0)
|
2019-04-03 05:34:28 +02:00
|
|
|
VG=VALGRIND=1 valgrind -q --error-exitcode=7
|
2018-06-06 22:40:24 +02:00
|
|
|
VG_TEST_ARGS = --track-origins=yes --leak-check=full --show-reachable=yes --errors-for-leak-kinds=all
|
2016-12-02 08:40:13 +01:00
|
|
|
endif
|
|
|
|
|
2020-09-07 17:32:19 +02:00
|
|
|
SANITIZER_FLAGS :=
|
|
|
|
|
2019-01-21 12:21:20 +01:00
|
|
|
ifneq ($(ASAN),0)
|
2020-09-07 17:32:19 +02:00
|
|
|
SANITIZER_FLAGS += -fsanitize=address
|
|
|
|
endif
|
|
|
|
|
2020-10-14 18:17:34 +02:00
|
|
|
ifneq ($(UBSAN),0)
|
|
|
|
SANITIZER_FLAGS += -fsanitize=undefined
|
|
|
|
endif
|
|
|
|
|
2020-09-07 17:32:19 +02:00
|
|
|
ifneq ($(FUZZING), 0)
|
|
|
|
SANITIZER_FLAGS += -fsanitize=fuzzer-no-link
|
2019-01-21 12:21:20 +01:00
|
|
|
endif
|
|
|
|
|
2017-10-24 04:06:14 +02:00
|
|
|
ifeq ($(DEVELOPER),1)
|
2019-06-12 02:38:54 +02:00
|
|
|
DEV_CFLAGS=-DCCAN_TAKE_DEBUG=1 -DCCAN_TAL_DEBUG=1 -DCCAN_JSON_OUT_DEBUG=1
|
2017-10-24 04:06:14 +02:00
|
|
|
else
|
2018-06-14 04:14:12 +02:00
|
|
|
DEV_CFLAGS=
|
2017-10-24 04:06:14 +02:00
|
|
|
endif
|
|
|
|
|
2017-01-06 18:53:11 +01:00
|
|
|
ifeq ($(COVERAGE),1)
|
|
|
|
COVFLAGS = --coverage
|
|
|
|
endif
|
|
|
|
|
2018-02-19 10:13:44 +01:00
|
|
|
ifeq ($(PIE),1)
|
|
|
|
PIE_CFLAGS=-fPIE -fPIC
|
|
|
|
PIE_LDFLAGS=-pie
|
|
|
|
endif
|
|
|
|
|
2018-06-14 04:14:14 +02:00
|
|
|
ifeq ($(COMPAT),1)
|
2018-03-06 19:28:21 +01:00
|
|
|
# We support compatibility with pre-0.6.
|
2021-07-13 23:04:30 +02:00
|
|
|
COMPAT_CFLAGS=-DCOMPAT_V052=1 -DCOMPAT_V060=1 -DCOMPAT_V061=1 -DCOMPAT_V062=1 -DCOMPAT_V070=1 -DCOMPAT_V072=1 -DCOMPAT_V073=1 -DCOMPAT_V080=1 -DCOMPAT_V081=1 -DCOMPAT_V082=1 -DCOMPAT_V090=1 -DCOMPAT_V0100=1
|
2018-03-06 19:28:21 +01:00
|
|
|
endif
|
|
|
|
|
2018-11-24 14:57:03 +01:00
|
|
|
# (method=thread to support xdist)
|
2021-01-19 21:06:25 +01:00
|
|
|
PYTEST_OPTS := -v -p no:logging $(PYTEST_OPTS)
|
2021-03-10 14:05:28 +01:00
|
|
|
MY_CHECK_PYTHONPATH=$${PYTHONPATH}$${PYTHONPATH:+:}$(shell pwd)/contrib/pyln-client:$(shell pwd)/contrib/pyln-testing:$(shell pwd)/contrib/pyln-proto/:$(shell pwd)/external/lnprototest:$(shell pwd)/contrib/pyln-spec/bolt1:$(shell pwd)/contrib/pyln-spec/bolt2:$(shell pwd)/contrib/pyln-spec/bolt4:$(shell pwd)/contrib/pyln-spec/bolt7
|
2021-04-23 15:26:15 +02:00
|
|
|
# Collect generated python files to be excluded from lint checks
|
2022-07-11 18:11:47 +02:00
|
|
|
PYTHON_GENERATED= \
|
|
|
|
contrib/pyln-testing/pyln/testing/primitives_pb2.py \
|
|
|
|
contrib/pyln-testing/pyln/testing/node_pb2_grpc.py \
|
|
|
|
contrib/pyln-testing/pyln/testing/node_pb2.py \
|
|
|
|
contrib/pyln-testing/pyln/testing/grpc2py.py
|
2017-11-09 14:36:56 +01:00
|
|
|
|
2021-04-28 15:05:43 +02:00
|
|
|
# Options to pass to cppcheck. Mostly used to exclude files that are
|
|
|
|
# generated with external tools that we don't have control over
|
|
|
|
CPPCHECK_OPTS=-q --language=c --std=c11 --error-exitcode=1 --suppressions-list=.cppcheck-suppress --inline-suppr
|
|
|
|
|
2016-11-10 14:00:35 +01:00
|
|
|
# This is where we add new features as bitcoin adds them.
|
2016-11-11 00:02:04 +01:00
|
|
|
FEATURES :=
|
2015-06-25 06:20:16 +02:00
|
|
|
|
2015-09-24 07:33:20 +02:00
|
|
|
CCAN_OBJS := \
|
2017-01-04 03:46:47 +01:00
|
|
|
ccan-asort.o \
|
2022-07-16 06:55:11 +02:00
|
|
|
ccan-base64.o \
|
2018-11-05 02:22:03 +01:00
|
|
|
ccan-bitmap.o \
|
2018-04-06 09:36:51 +02:00
|
|
|
ccan-bitops.o \
|
2017-01-04 03:46:47 +01:00
|
|
|
ccan-breakpoint.o \
|
2021-10-19 03:51:43 +02:00
|
|
|
ccan-closefrom.o \
|
2019-06-11 07:30:54 +02:00
|
|
|
ccan-crc32c.o \
|
2017-01-04 03:46:47 +01:00
|
|
|
ccan-crypto-hmac.o \
|
|
|
|
ccan-crypto-hkdf.o \
|
2015-09-24 07:33:20 +02:00
|
|
|
ccan-crypto-ripemd160.o \
|
|
|
|
ccan-crypto-sha256.o \
|
2017-08-28 18:10:01 +02:00
|
|
|
ccan-crypto-shachain.o \
|
2016-06-28 23:19:20 +02:00
|
|
|
ccan-crypto-siphash24.o \
|
2015-09-24 07:33:20 +02:00
|
|
|
ccan-err.o \
|
2017-01-04 03:46:47 +01:00
|
|
|
ccan-fdpass.o \
|
2016-01-21 21:11:46 +01:00
|
|
|
ccan-htable.o \
|
2016-01-21 21:08:09 +01:00
|
|
|
ccan-ilog.o \
|
2016-01-21 21:11:45 +01:00
|
|
|
ccan-io-io.o \
|
2017-01-24 14:33:15 +01:00
|
|
|
ccan-intmap.o \
|
2016-01-21 21:11:45 +01:00
|
|
|
ccan-io-poll.o \
|
2017-01-04 03:46:47 +01:00
|
|
|
ccan-io-fdpass.o \
|
2016-01-21 21:08:09 +01:00
|
|
|
ccan-isaac.o \
|
|
|
|
ccan-isaac64.o \
|
2019-06-12 02:38:54 +02:00
|
|
|
ccan-json_escape.o \
|
|
|
|
ccan-json_out.o \
|
2015-09-24 07:33:20 +02:00
|
|
|
ccan-list.o \
|
2016-05-04 08:44:22 +02:00
|
|
|
ccan-mem.o \
|
2018-10-18 02:48:36 +02:00
|
|
|
ccan-membuf.o \
|
2015-09-24 07:33:20 +02:00
|
|
|
ccan-noerr.o \
|
|
|
|
ccan-opt-helpers.o \
|
|
|
|
ccan-opt-parse.o \
|
|
|
|
ccan-opt-usage.o \
|
|
|
|
ccan-opt.o \
|
2016-01-21 21:11:45 +01:00
|
|
|
ccan-pipecmd.o \
|
2018-01-22 15:49:09 +01:00
|
|
|
ccan-ptr_valid.o \
|
2018-05-10 01:18:23 +02:00
|
|
|
ccan-rbuf.o \
|
2015-09-24 07:33:20 +02:00
|
|
|
ccan-read_write_all.o \
|
2022-07-16 06:55:11 +02:00
|
|
|
ccan-rune-coding.o \
|
|
|
|
ccan-rune-rune.o \
|
2018-05-10 01:18:24 +02:00
|
|
|
ccan-str-base32.o \
|
2015-09-24 07:33:20 +02:00
|
|
|
ccan-str-hex.o \
|
|
|
|
ccan-str.o \
|
2019-02-04 11:55:42 +01:00
|
|
|
ccan-strmap.o \
|
2021-11-14 18:59:46 +01:00
|
|
|
ccan-strset.o \
|
2015-09-24 07:33:20 +02:00
|
|
|
ccan-take.o \
|
|
|
|
ccan-tal-grab_file.o \
|
2018-02-18 13:55:46 +01:00
|
|
|
ccan-tal-link.o \
|
2016-01-21 21:11:48 +01:00
|
|
|
ccan-tal-path.o \
|
2015-09-24 07:33:20 +02:00
|
|
|
ccan-tal-str.o \
|
2016-01-21 21:08:09 +01:00
|
|
|
ccan-tal.o \
|
2016-01-21 21:11:45 +01:00
|
|
|
ccan-time.o \
|
2018-06-28 03:30:05 +02:00
|
|
|
ccan-timer.o \
|
|
|
|
ccan-utf8.o
|
2015-09-24 07:33:20 +02:00
|
|
|
|
2016-01-21 21:08:08 +01:00
|
|
|
CCAN_HEADERS := \
|
|
|
|
$(CCANDIR)/config.h \
|
|
|
|
$(CCANDIR)/ccan/alignof/alignof.h \
|
|
|
|
$(CCANDIR)/ccan/array_size/array_size.h \
|
|
|
|
$(CCANDIR)/ccan/asort/asort.h \
|
2021-10-15 03:35:21 +02:00
|
|
|
$(CCANDIR)/ccan/base64/base64.h \
|
2018-11-05 02:22:03 +01:00
|
|
|
$(CCANDIR)/ccan/bitmap/bitmap.h \
|
2018-04-06 09:36:51 +02:00
|
|
|
$(CCANDIR)/ccan/bitops/bitops.h \
|
2017-01-04 03:46:47 +01:00
|
|
|
$(CCANDIR)/ccan/breakpoint/breakpoint.h \
|
2016-01-21 21:08:08 +01:00
|
|
|
$(CCANDIR)/ccan/build_assert/build_assert.h \
|
|
|
|
$(CCANDIR)/ccan/cast/cast.h \
|
|
|
|
$(CCANDIR)/ccan/cdump/cdump.h \
|
|
|
|
$(CCANDIR)/ccan/check_type/check_type.h \
|
2021-10-19 03:51:43 +02:00
|
|
|
$(CCANDIR)/ccan/closefrom/closefrom.h \
|
2016-01-21 21:08:08 +01:00
|
|
|
$(CCANDIR)/ccan/compiler/compiler.h \
|
|
|
|
$(CCANDIR)/ccan/container_of/container_of.h \
|
2016-09-06 06:17:07 +02:00
|
|
|
$(CCANDIR)/ccan/cppmagic/cppmagic.h \
|
2019-06-11 07:30:54 +02:00
|
|
|
$(CCANDIR)/ccan/crc32c/crc32c.h \
|
2017-01-04 03:46:47 +01:00
|
|
|
$(CCANDIR)/ccan/crypto/hkdf_sha256/hkdf_sha256.h \
|
|
|
|
$(CCANDIR)/ccan/crypto/hmac_sha256/hmac_sha256.h \
|
2016-01-21 21:08:08 +01:00
|
|
|
$(CCANDIR)/ccan/crypto/ripemd160/ripemd160.h \
|
|
|
|
$(CCANDIR)/ccan/crypto/sha256/sha256.h \
|
|
|
|
$(CCANDIR)/ccan/crypto/shachain/shachain.h \
|
2016-06-28 23:19:20 +02:00
|
|
|
$(CCANDIR)/ccan/crypto/siphash24/siphash24.h \
|
2016-01-21 21:08:08 +01:00
|
|
|
$(CCANDIR)/ccan/endian/endian.h \
|
|
|
|
$(CCANDIR)/ccan/err/err.h \
|
2017-01-04 03:46:47 +01:00
|
|
|
$(CCANDIR)/ccan/fdpass/fdpass.h \
|
2021-12-14 00:39:53 +01:00
|
|
|
$(CCANDIR)/ccan/graphql/graphql.h \
|
2016-01-21 21:08:08 +01:00
|
|
|
$(CCANDIR)/ccan/htable/htable.h \
|
|
|
|
$(CCANDIR)/ccan/htable/htable_type.h \
|
|
|
|
$(CCANDIR)/ccan/ilog/ilog.h \
|
2017-01-24 14:33:15 +01:00
|
|
|
$(CCANDIR)/ccan/intmap/intmap.h \
|
2016-01-21 21:11:45 +01:00
|
|
|
$(CCANDIR)/ccan/io/backend.h \
|
2017-01-04 03:46:47 +01:00
|
|
|
$(CCANDIR)/ccan/io/fdpass/fdpass.h \
|
2016-01-21 21:11:45 +01:00
|
|
|
$(CCANDIR)/ccan/io/io.h \
|
|
|
|
$(CCANDIR)/ccan/io/io_plan.h \
|
2016-01-21 21:08:09 +01:00
|
|
|
$(CCANDIR)/ccan/isaac/isaac.h \
|
|
|
|
$(CCANDIR)/ccan/isaac/isaac64.h \
|
2019-06-12 02:38:54 +02:00
|
|
|
$(CCANDIR)/ccan/json_escape/json_escape.h \
|
|
|
|
$(CCANDIR)/ccan/json_out/json_out.h \
|
2016-01-21 21:08:08 +01:00
|
|
|
$(CCANDIR)/ccan/likely/likely.h \
|
|
|
|
$(CCANDIR)/ccan/list/list.h \
|
|
|
|
$(CCANDIR)/ccan/mem/mem.h \
|
2018-10-18 02:48:36 +02:00
|
|
|
$(CCANDIR)/ccan/membuf/membuf.h \
|
2016-01-21 21:08:08 +01:00
|
|
|
$(CCANDIR)/ccan/noerr/noerr.h \
|
|
|
|
$(CCANDIR)/ccan/opt/opt.h \
|
|
|
|
$(CCANDIR)/ccan/opt/private.h \
|
|
|
|
$(CCANDIR)/ccan/order/order.h \
|
2016-01-21 21:11:45 +01:00
|
|
|
$(CCANDIR)/ccan/pipecmd/pipecmd.h \
|
2017-01-04 03:46:47 +01:00
|
|
|
$(CCANDIR)/ccan/ptr_valid/ptr_valid.h \
|
2016-01-21 21:08:08 +01:00
|
|
|
$(CCANDIR)/ccan/ptrint/ptrint.h \
|
2018-05-10 01:18:23 +02:00
|
|
|
$(CCANDIR)/ccan/rbuf/rbuf.h \
|
2016-01-21 21:08:08 +01:00
|
|
|
$(CCANDIR)/ccan/read_write_all/read_write_all.h \
|
2022-07-16 06:55:11 +02:00
|
|
|
$(CCANDIR)/ccan/rune/internal.h \
|
|
|
|
$(CCANDIR)/ccan/rune/rune.h \
|
2016-01-21 21:08:08 +01:00
|
|
|
$(CCANDIR)/ccan/short_types/short_types.h \
|
2018-05-10 01:18:24 +02:00
|
|
|
$(CCANDIR)/ccan/str/base32/base32.h \
|
2016-01-21 21:08:08 +01:00
|
|
|
$(CCANDIR)/ccan/str/hex/hex.h \
|
|
|
|
$(CCANDIR)/ccan/str/str.h \
|
|
|
|
$(CCANDIR)/ccan/str/str_debug.h \
|
|
|
|
$(CCANDIR)/ccan/strmap/strmap.h \
|
2021-11-14 18:59:46 +01:00
|
|
|
$(CCANDIR)/ccan/strset/strset.h \
|
2016-01-21 21:08:08 +01:00
|
|
|
$(CCANDIR)/ccan/structeq/structeq.h \
|
|
|
|
$(CCANDIR)/ccan/take/take.h \
|
|
|
|
$(CCANDIR)/ccan/tal/grab_file/grab_file.h \
|
2018-02-18 13:55:46 +01:00
|
|
|
$(CCANDIR)/ccan/tal/link/link.h \
|
2016-01-21 21:08:08 +01:00
|
|
|
$(CCANDIR)/ccan/tal/path/path.h \
|
|
|
|
$(CCANDIR)/ccan/tal/str/str.h \
|
|
|
|
$(CCANDIR)/ccan/tal/tal.h \
|
|
|
|
$(CCANDIR)/ccan/tcon/tcon.h \
|
2016-01-21 21:08:09 +01:00
|
|
|
$(CCANDIR)/ccan/time/time.h \
|
2016-01-21 21:11:45 +01:00
|
|
|
$(CCANDIR)/ccan/timer/timer.h \
|
2018-06-28 03:30:05 +02:00
|
|
|
$(CCANDIR)/ccan/typesafe_cb/typesafe_cb.h \
|
|
|
|
$(CCANDIR)/ccan/utf8/utf8.h
|
2016-01-21 21:08:08 +01:00
|
|
|
|
2015-09-25 04:21:18 +02:00
|
|
|
CDUMP_OBJS := ccan-cdump.o ccan-strmap.o
|
|
|
|
|
2019-07-24 01:54:21 +02:00
|
|
|
BOLT_GEN := tools/generate-wire.py
|
2019-07-24 00:51:11 +02:00
|
|
|
WIRE_GEN := $(BOLT_GEN)
|
2020-08-31 03:13:23 +02:00
|
|
|
|
2020-09-07 22:54:26 +02:00
|
|
|
# If you use wiregen, you're dependent on the tool and its templates
|
|
|
|
WIRE_GEN_DEPS := $(WIRE_GEN) $(wildcard tools/gen/*_template)
|
2017-01-04 04:39:20 +01:00
|
|
|
|
2020-08-31 03:13:25 +02:00
|
|
|
# These are filled by individual Makefiles
|
|
|
|
ALL_PROGRAMS :=
|
|
|
|
ALL_TEST_PROGRAMS :=
|
2022-01-17 17:52:45 +01:00
|
|
|
ALL_TEST_GEN :=
|
2020-09-07 17:32:19 +02:00
|
|
|
ALL_FUZZ_TARGETS :=
|
2020-08-31 03:13:25 +02:00
|
|
|
ALL_C_SOURCES :=
|
2020-10-22 01:51:08 +02:00
|
|
|
ALL_C_HEADERS := header_versions_gen.h version_gen.h
|
2022-01-14 15:34:41 +01:00
|
|
|
# Extra (non C) targets that should be built by default.
|
|
|
|
DEFAULT_TARGETS :=
|
2015-05-26 06:38:12 +02:00
|
|
|
|
2021-12-20 12:11:41 +01:00
|
|
|
# M1 macos machines with homebrew will install the native libraries in
|
|
|
|
# /opt/homebrew instead of /usr/local, most likely because they
|
|
|
|
# emulate x86_64 compatibility via Rosetta, and wanting to keep the
|
|
|
|
# libraries separate. This however means we also need to switch out
|
|
|
|
# the paths accordingly when we detect we're on an M1 macos machine.
|
|
|
|
ifeq ("$(OS)-$(ARCH)", "Darwin-arm64")
|
|
|
|
CPATH := /opt/homebrew/include
|
|
|
|
LIBRARY_PATH := /opt/homebrew/lib
|
|
|
|
else
|
|
|
|
CPATH := /usr/local/include
|
|
|
|
LIBRARY_PATH := /usr/local/lib
|
|
|
|
endif
|
|
|
|
|
2019-09-12 23:08:04 +02:00
|
|
|
CPPFLAGS += -DBINTOPKGLIBEXECDIR="\"$(shell sh tools/rel.sh $(bindir) $(pkglibexecdir))\""
|
2021-12-20 12:11:41 +01:00
|
|
|
CFLAGS = $(CPPFLAGS) $(CWARNFLAGS) $(CDEBUGFLAGS) $(COPTFLAGS) -I $(CCANDIR) $(EXTERNAL_INCLUDE_FLAGS) -I . -I$(CPATH) $(SQLITE3_CFLAGS) $(POSTGRES_INCLUDE) $(FEATURES) $(COVFLAGS) $(DEV_CFLAGS) -DSHACHAIN_BITS=48 -DJSMN_PARENT_LINKS $(PIE_CFLAGS) $(COMPAT_CFLAGS) -DBUILD_ELEMENTS=1
|
2020-02-19 16:17:47 +01:00
|
|
|
# If CFLAGS is already set in the environment of make (to whatever value, it
|
|
|
|
# does not matter) then it would export it to subprocesses with the above value
|
|
|
|
# we set, including CWARNFLAGS which by default contains -Wall -Werror. This
|
|
|
|
# breaks at least libwally-core which tries to switch off some warnings with
|
|
|
|
# -Wno-whatever. So, tell make to not export our CFLAGS to subprocesses.
|
|
|
|
unexport CFLAGS
|
2016-01-21 21:11:37 +01:00
|
|
|
|
2018-02-26 03:51:55 +01:00
|
|
|
# We can get configurator to run a different compile cmd to cross-configure.
|
|
|
|
CONFIGURATOR_CC := $(CC)
|
|
|
|
|
2019-09-12 23:08:04 +02:00
|
|
|
LDFLAGS += $(PIE_LDFLAGS) $(SANITIZER_FLAGS) $(COPTFLAGS)
|
2020-09-07 17:32:19 +02:00
|
|
|
CFLAGS += $(SANITIZER_FLAGS)
|
|
|
|
|
2018-12-10 07:38:43 +01:00
|
|
|
ifeq ($(STATIC),1)
|
2019-10-14 05:15:34 +02:00
|
|
|
# For MacOS, Jacob Rapoport <jacob@rumblemonkey.com> changed this to:
|
|
|
|
# -L/usr/local/lib -Wl,-lgmp -lsqlite3 -lz -Wl,-lm -lpthread -ldl $(COVFLAGS)
|
|
|
|
# But that doesn't static link.
|
2021-12-20 12:11:41 +01:00
|
|
|
LDLIBS = -L$(CPATH) -Wl,-dn -lgmp $(SQLITE3_LDLIBS) -lz -Wl,-dy -lm -lpthread -ldl $(COVFLAGS)
|
2018-12-10 07:38:43 +01:00
|
|
|
else
|
2021-12-20 12:11:41 +01:00
|
|
|
LDLIBS = -L$(CPATH) -lm -lgmp $(SQLITE3_LDLIBS) -lz $(COVFLAGS)
|
2018-12-10 07:38:43 +01:00
|
|
|
endif
|
2015-05-26 06:38:12 +02:00
|
|
|
|
2019-08-30 13:47:52 +02:00
|
|
|
# If we have the postgres client library we need to link against it as well
|
|
|
|
ifeq ($(HAVE_POSTGRES),1)
|
2020-08-28 09:26:12 +02:00
|
|
|
LDLIBS += $(POSTGRES_LDLIBS)
|
2019-08-30 13:47:52 +02:00
|
|
|
endif
|
|
|
|
|
2022-01-14 15:34:41 +01:00
|
|
|
default: show-flags all-programs all-test-programs doc-all default-targets
|
2020-05-01 11:19:11 +02:00
|
|
|
|
2021-05-26 07:39:01 +02:00
|
|
|
ifneq ($(SUPPRESS_GENERATION),1)
|
|
|
|
FORCE = FORCE
|
|
|
|
FORCE::
|
|
|
|
endif
|
|
|
|
|
2020-08-25 03:33:16 +02:00
|
|
|
show-flags: config.vars
|
2020-05-19 03:53:17 +02:00
|
|
|
@$(ECHO) "CC: $(CC) $(CFLAGS) -c -o"
|
|
|
|
@$(ECHO) "LD: $(LINK.o) $(filter-out %.a,$^) $(LOADLIBES) $(EXTERNAL_LDLIBS) $(LDLIBS) -o"
|
2016-09-06 09:17:41 +02:00
|
|
|
|
2019-01-02 04:13:39 +01:00
|
|
|
ccan/config.h: config.vars configure ccan/tools/configurator/configurator.c
|
2018-06-06 22:40:24 +02:00
|
|
|
./configure --reconfigure
|
|
|
|
|
2019-01-02 04:13:39 +01:00
|
|
|
config.vars:
|
|
|
|
@echo 'File config.vars not found: you must run ./configure before running make.' >&2
|
|
|
|
@exit 1
|
|
|
|
|
2020-05-01 11:19:11 +02:00
|
|
|
%.o: %.c
|
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
|
|
|
|
2020-09-07 23:06:50 +02:00
|
|
|
# '_exp' inserted before _wiregen.[ch] to demark experimental
|
|
|
|
# spec-derived headers, which are *not* committed into git.
|
|
|
|
ifeq ($(EXPERIMENTAL_FEATURES),1)
|
|
|
|
EXP := _exp
|
|
|
|
else
|
|
|
|
EXP :=
|
|
|
|
endif
|
|
|
|
|
2021-05-21 07:16:05 +02:00
|
|
|
# tools/update-mocks.sh does nasty recursive make, must not do this!
|
|
|
|
ifeq ($(SUPPRESS_GENERATION),1)
|
|
|
|
SHA256STAMP_CHANGED = false
|
|
|
|
SHA256STAMP = exit 1
|
2022-07-13 17:45:39 +02:00
|
|
|
SHA256STAMP_CHANGED_ALL = false
|
|
|
|
SHA256STAMP_ALL = exit 1
|
2021-05-21 07:16:05 +02:00
|
|
|
else
|
2020-08-31 03:13:23 +02:00
|
|
|
# Git doesn't maintain timestamps, so we only regen if sources actually changed:
|
|
|
|
# We place the SHA inside some generated files so we can tell if they need updating.
|
2020-09-07 22:54:26 +02:00
|
|
|
# Usage: $(call SHA256STAMP_CHANGED)
|
2022-07-13 17:45:39 +02:00
|
|
|
SHA256STAMP_CHANGED = [ x"`sed -n 's/.*SHA256STAMP:\([a-f0-9]*\).*/\1/p' $@ 2>/dev/null`" != x"`cat $(sort $(filter-out FORCE,$<)) | $(SHA256SUM) | cut -c1-64`" ]
|
2021-05-26 07:40:01 +02:00
|
|
|
# Usage: $(call SHA256STAMP,commentprefix,commentpostfix)
|
2022-07-13 17:45:39 +02:00
|
|
|
SHA256STAMP = echo "$(1) SHA256STAMP:"`cat $(sort $(filter-out FORCE,$<)) | $(SHA256SUM) | cut -c1-64`"$(2)" >> $@
|
|
|
|
|
|
|
|
SHA256STAMP_CHANGED_ALL = [ x"`sed -n 's/.*SHA256STAMP:\([a-f0-9]*\).*/\1/p' $@ 2>/dev/null`" != x"`cat $(sort $(filter-out FORCE,$^)) | $(SHA256SUM) | cut -c1-64`" ]
|
|
|
|
# Usage: $(call SHA256STAMP,commentprefix,commentpostfix)
|
|
|
|
SHA256STAMP_ALL = echo "$(1) SHA256STAMP:"`cat $(sort $(filter-out FORCE,$^)) | $(SHA256SUM) | cut -c1-64`"$(2)" >> $@
|
2021-05-21 07:16:05 +02:00
|
|
|
endif
|
2020-08-31 03:13:23 +02:00
|
|
|
|
2020-08-25 03:33:16 +02:00
|
|
|
# generate-wire.py --page [header|impl] hdrfilename wirename < csv > file
|
2020-08-31 03:13:23 +02:00
|
|
|
%_wiregen.h: %_wire.csv $(WIRE_GEN_DEPS)
|
2021-09-22 06:15:13 +02:00
|
|
|
@if $(call SHA256STAMP_CHANGED); then \
|
2021-05-26 07:40:01 +02:00
|
|
|
$(call VERBOSE,"wiregen $@",tools/generate-wire.py --page header $($@_args) $@ `basename $< .csv | sed 's/_exp_/_/'` < $< > $@ && $(call SHA256STAMP,//,)); \
|
2020-10-17 16:48:01 +02:00
|
|
|
fi
|
2020-08-25 03:33:16 +02:00
|
|
|
|
2020-08-31 03:13:23 +02:00
|
|
|
%_wiregen.c: %_wire.csv $(WIRE_GEN_DEPS)
|
2021-09-22 06:15:13 +02:00
|
|
|
@if $(call SHA256STAMP_CHANGED); then \
|
2021-05-26 07:40:01 +02:00
|
|
|
$(call VERBOSE,"wiregen $@",tools/generate-wire.py --page impl $($@_args) ${@:.c=.h} `basename $< .csv | sed 's/_exp_/_/'` < $< > $@ && $(call SHA256STAMP,//,)); \
|
2020-10-17 16:48:01 +02:00
|
|
|
fi
|
2020-08-25 03:33:16 +02:00
|
|
|
|
2020-08-31 03:13:25 +02:00
|
|
|
%_printgen.h: %_wire.csv $(WIRE_GEN_DEPS)
|
2021-09-22 06:15:13 +02:00
|
|
|
@if $(call SHA256STAMP_CHANGED); then \
|
2021-05-26 07:40:01 +02:00
|
|
|
$(call VERBOSE,"printgen $@",tools/generate-wire.py -s -P --page header $($@_args) $@ `basename $< .csv | sed 's/_exp_/_/'` < $< > $@ && $(call SHA256STAMP,//,)); \
|
2020-10-17 16:48:01 +02:00
|
|
|
fi
|
2020-08-31 03:13:25 +02:00
|
|
|
|
|
|
|
%_printgen.c: %_wire.csv $(WIRE_GEN_DEPS)
|
2021-09-22 06:15:13 +02:00
|
|
|
@if $(call SHA256STAMP_CHANGED); then \
|
2021-05-26 07:40:01 +02:00
|
|
|
$(call VERBOSE,"printgen $@",tools/generate-wire.py -s -P --page impl $($@_args) ${@:.c=.h} `basename $< .csv | sed 's/_exp_/_/'` < $< > $@ && $(call SHA256STAMP,//,)); \
|
2020-10-17 16:48:01 +02:00
|
|
|
fi
|
2020-08-31 03:13:25 +02:00
|
|
|
|
2022-01-14 15:34:41 +01:00
|
|
|
RUST_PROFILE ?= debug
|
|
|
|
ifneq ($(RUST_PROFILE),debug)
|
|
|
|
CARGO_OPTS := --profile=$(RUST_PROFILE) --quiet
|
|
|
|
else
|
|
|
|
CARGO_OPTS := --quiet
|
|
|
|
endif
|
|
|
|
|
2017-08-28 18:11:01 +02:00
|
|
|
include external/Makefile
|
2016-12-20 01:04:59 +01:00
|
|
|
include bitcoin/Makefile
|
2017-08-28 18:13:01 +02:00
|
|
|
include common/Makefile
|
2016-12-20 01:04:59 +01:00
|
|
|
include wire/Makefile
|
2022-01-03 19:45:35 +01:00
|
|
|
include db/Makefile
|
2017-08-29 06:12:04 +02:00
|
|
|
include hsmd/Makefile
|
|
|
|
include gossipd/Makefile
|
|
|
|
include openingd/Makefile
|
|
|
|
include channeld/Makefile
|
|
|
|
include closingd/Makefile
|
|
|
|
include onchaind/Makefile
|
2018-07-24 08:18:58 +02:00
|
|
|
include connectd/Makefile
|
2017-01-10 06:07:51 +01:00
|
|
|
include lightningd/Makefile
|
2017-08-28 18:04:01 +02:00
|
|
|
include cli/Makefile
|
2017-08-28 18:13:01 +02:00
|
|
|
include doc/Makefile
|
2017-11-22 01:26:08 +01:00
|
|
|
include devtools/Makefile
|
2019-07-19 19:01:41 +02:00
|
|
|
include tools/Makefile
|
2019-01-15 05:13:27 +01:00
|
|
|
include plugins/Makefile
|
2020-01-31 18:36:26 +01:00
|
|
|
include tests/plugins/Makefile
|
2022-07-13 16:50:33 +02:00
|
|
|
|
2020-09-07 17:32:19 +02:00
|
|
|
ifneq ($(FUZZING),0)
|
|
|
|
include tests/fuzz/Makefile
|
|
|
|
endif
|
2022-01-14 15:34:41 +01:00
|
|
|
ifneq ($(RUST),0)
|
2022-01-14 16:11:28 +01:00
|
|
|
include cln-rpc/Makefile
|
2022-01-14 19:45:30 +01:00
|
|
|
include cln-grpc/Makefile
|
2022-01-17 17:54:08 +01:00
|
|
|
|
2022-06-30 11:08:50 +02:00
|
|
|
GRPC_GEN = contrib/pyln-testing/pyln/testing/node_pb2.py \
|
|
|
|
contrib/pyln-testing/pyln/testing/node_pb2_grpc.py \
|
|
|
|
contrib/pyln-testing/pyln/testing/primitives_pb2.py
|
2022-01-17 17:54:08 +01:00
|
|
|
|
|
|
|
ALL_TEST_GEN += $(GRPC_GEN)
|
|
|
|
|
|
|
|
$(GRPC_GEN): cln-grpc/proto/node.proto cln-grpc/proto/primitives.proto
|
2022-06-30 11:08:50 +02:00
|
|
|
python -m grpc_tools.protoc -I cln-grpc/proto cln-grpc/proto/node.proto --python_out=contrib/pyln-testing/pyln/testing/ --grpc_python_out=contrib/pyln-testing/pyln/testing/ --experimental_allow_proto3_optional
|
|
|
|
python -m grpc_tools.protoc -I cln-grpc/proto cln-grpc/proto/primitives.proto --python_out=contrib/pyln-testing/pyln/testing/ --experimental_allow_proto3_optional
|
|
|
|
# The compiler assumes that the proto files are in the same
|
|
|
|
# directory structure as the generated files will be. Since we
|
|
|
|
# don't do that we need to path the files up.
|
|
|
|
find contrib/pyln-testing/pyln/testing/ -type f -name "*.py" -print0 | xargs -0 sed -i 's/^import \(.*\)_pb2 as .*__pb2/from . import \1_pb2 as \1__pb2/g'
|
2022-01-17 17:54:08 +01:00
|
|
|
|
2022-01-14 15:34:41 +01:00
|
|
|
endif
|
2016-12-20 01:04:59 +01:00
|
|
|
|
2020-08-31 03:13:25 +02:00
|
|
|
# We make pretty much everything depend on these.
|
2020-10-22 01:51:08 +02:00
|
|
|
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)
|
2020-08-31 03:13:25 +02:00
|
|
|
|
2020-10-22 02:57:12 +02:00
|
|
|
# Programs to install in bindir and pkglibexecdir.
|
|
|
|
# TODO: $(EXEEXT) support for Windows? Needs more coding for
|
|
|
|
# the individual Makefiles, however.
|
|
|
|
BIN_PROGRAMS = \
|
|
|
|
cli/lightning-cli \
|
|
|
|
lightningd/lightningd \
|
|
|
|
tools/lightning-hsmtool
|
|
|
|
PKGLIBEXEC_PROGRAMS = \
|
|
|
|
lightningd/lightning_channeld \
|
|
|
|
lightningd/lightning_closingd \
|
|
|
|
lightningd/lightning_connectd \
|
2021-03-12 01:19:40 +01:00
|
|
|
lightningd/lightning_dualopend \
|
2020-10-22 02:57:12 +02:00
|
|
|
lightningd/lightning_gossipd \
|
|
|
|
lightningd/lightning_hsmd \
|
|
|
|
lightningd/lightning_onchaind \
|
2021-10-15 07:49:05 +02:00
|
|
|
lightningd/lightning_openingd \
|
|
|
|
lightningd/lightning_websocketd
|
2020-10-22 02:57:12 +02:00
|
|
|
|
2020-08-31 03:22:37 +02:00
|
|
|
# Don't delete these intermediaries.
|
|
|
|
.PRECIOUS: $(ALL_GEN_HEADERS) $(ALL_GEN_SOURCES)
|
|
|
|
|
2020-08-31 03:13:25 +02:00
|
|
|
# Every single object file.
|
|
|
|
ALL_OBJS := $(ALL_C_SOURCES:.c=.o)
|
|
|
|
|
2020-08-31 03:13:25 +02:00
|
|
|
# We always regen wiregen and printgen files, since SHA256STAMP protects against
|
|
|
|
# spurious rebuilds.
|
2021-05-21 07:16:05 +02:00
|
|
|
$(filter %printgen.h %printgen.c %wiregen.h %wiregen.c, $(ALL_C_HEADERS) $(ALL_C_SOURCES)): $(FORCE)
|
2020-08-31 03:13:25 +02:00
|
|
|
|
2018-05-16 17:18:38 +02:00
|
|
|
ifneq ($(TEST_GROUP_COUNT),)
|
|
|
|
PYTEST_OPTS += --test-group=$(TEST_GROUP) --test-group-count=$(TEST_GROUP_COUNT)
|
2017-12-21 14:12:51 +01:00
|
|
|
endif
|
|
|
|
|
2018-09-05 10:52:49 +02:00
|
|
|
# If we run the tests in parallel we can speed testing up by a lot, however we
|
|
|
|
# then don't exit on the first error, since that'd kill the other tester
|
|
|
|
# processes and result in loads in loads of output. So we only tell py.test to
|
|
|
|
# abort early if we aren't running in parallel.
|
2018-05-18 15:12:05 +02:00
|
|
|
ifneq ($(PYTEST_PAR),)
|
|
|
|
PYTEST_OPTS += -n=$(PYTEST_PAR)
|
2018-09-05 10:52:49 +02:00
|
|
|
else
|
|
|
|
PYTEST_OPTS += -x
|
2018-05-18 15:12:05 +02:00
|
|
|
endif
|
|
|
|
|
2019-06-20 20:13:14 +02:00
|
|
|
check-units:
|
|
|
|
|
2021-03-18 21:56:49 +01:00
|
|
|
check: check-units installcheck check-protos pytest
|
|
|
|
|
|
|
|
check-protos: $(ALL_PROGRAMS)
|
|
|
|
ifeq ($(PYTEST),)
|
|
|
|
@echo "py.test is required to run the protocol tests, please install using 'pip3 install -r requirements.txt', and rerun 'configure'."; false
|
|
|
|
else
|
2021-04-28 17:28:10 +02:00
|
|
|
ifeq ($(DEVELOPER),1)
|
2021-03-10 14:05:28 +01:00
|
|
|
@(cd external/lnprototest && PYTHONPATH=$(MY_CHECK_PYTHONPATH) LIGHTNING_SRC=../.. $(PYTEST) --runner lnprototest.clightning.Runner $(PYTEST_OPTS))
|
2021-04-28 17:28:10 +02:00
|
|
|
else
|
|
|
|
@echo "lnprototest target requires DEVELOPER=1, skipping"
|
|
|
|
endif
|
2021-03-18 21:56:49 +01:00
|
|
|
endif
|
2016-04-11 09:12:53 +02:00
|
|
|
|
2022-01-17 17:52:45 +01:00
|
|
|
pytest: $(ALL_PROGRAMS) $(DEFAULT_TARGETS) $(ALL_TEST_PROGRAMS) $(ALL_TEST_GEN)
|
2018-12-18 04:32:52 +01:00
|
|
|
ifeq ($(PYTEST),)
|
2020-04-08 14:21:26 +02:00
|
|
|
@echo "py.test is required to run the integration tests, please install using 'pip3 install -r requirements.txt', and rerun 'configure'."
|
2018-05-04 11:59:21 +02:00
|
|
|
exit 1
|
2017-11-09 14:36:56 +01:00
|
|
|
else
|
2018-06-06 22:40:24 +02:00
|
|
|
# Explicitly hand DEVELOPER and VALGRIND so you can override on make cmd line.
|
2021-03-10 14:05:28 +01:00
|
|
|
PYTHONPATH=$(MY_CHECK_PYTHONPATH) TEST_DEBUG=1 DEVELOPER=$(DEVELOPER) VALGRIND=$(VALGRIND) $(PYTEST) tests/ $(PYTEST_OPTS)
|
2017-11-09 14:36:56 +01:00
|
|
|
endif
|
2017-01-14 20:33:07 +01:00
|
|
|
|
2016-01-21 21:08:09 +01:00
|
|
|
# Keep includes in alpha order.
|
|
|
|
check-src-include-order/%: %
|
2020-01-31 12:39:29 +01:00
|
|
|
@if [ "$$(grep '^#include' < $<)" != "$$(grep '^#include' < $< | $(SORT))" ]; then echo "$<:1: includes out of order"; grep '^#include' < $<; echo VERSUS; grep '^#include' < $< | $(SORT); exit 1; fi
|
2016-01-21 21:08:09 +01:00
|
|
|
|
|
|
|
# Keep includes in alpha order, after including "config.h"
|
|
|
|
check-hdr-include-order/%: %
|
|
|
|
@if [ "$$(grep '^#include' < $< | head -n1)" != '#include "config.h"' ]; then echo "$<:1: doesn't include config.h first"; exit 1; fi
|
2020-01-31 12:39:29 +01:00
|
|
|
@if [ "$$(grep '^#include' < $< | tail -n +2)" != "$$(grep '^#include' < $< | tail -n +2 | $(SORT))" ]; then echo "$<:1: includes out of order"; exit 1; fi
|
2016-01-21 21:08:09 +01:00
|
|
|
|
|
|
|
# Make sure Makefile includes all headers.
|
2017-08-28 17:53:01 +02:00
|
|
|
check-makefile:
|
2020-01-31 12:39:29 +01:00
|
|
|
@if [ x"$(CCANDIR)/config.h `find $(CCANDIR)/ccan -name '*.h' | grep -v /test/ | $(SORT) | tr '\n' ' '`" != x"$(CCAN_HEADERS) " ]; then echo CCAN_HEADERS incorrect; exit 1; fi
|
2016-01-21 21:08:09 +01:00
|
|
|
|
2020-10-22 02:57:07 +02:00
|
|
|
# We exclude test files, which need to do weird include tricks!
|
|
|
|
SRC_TO_CHECK := $(filter-out $(ALL_TEST_PROGRAMS:=.c), $(ALL_NONGEN_SOURCES))
|
|
|
|
check-src-includes: $(SRC_TO_CHECK:%=check-src-include-order/%)
|
|
|
|
check-hdr-includes: $(ALL_NONGEN_HEADERS:%=check-hdr-include-order/%)
|
|
|
|
|
2021-04-06 03:21:20 +02:00
|
|
|
# If you want to check a specific variant of quotes use:
|
|
|
|
# make check-source-bolt BOLTVERSION=xxx
|
|
|
|
ifeq ($(BOLTVERSION),$(DEFAULT_BOLTVERSION))
|
2019-07-24 06:39:29 +02:00
|
|
|
CHECK_BOLT_PREFIX=
|
2021-04-06 03:21:20 +02:00
|
|
|
else
|
|
|
|
CHECK_BOLT_PREFIX=--prefix="BOLT-$(BOLTVERSION)"
|
2019-07-24 06:39:29 +02:00
|
|
|
endif
|
|
|
|
|
2017-12-07 23:59:39 +01:00
|
|
|
# Any mention of BOLT# must be followed by an exact quote, modulo whitespace.
|
2017-08-22 07:04:11 +02:00
|
|
|
bolt-check/%: % bolt-precheck tools/check-bolt
|
2019-07-24 06:39:29 +02:00
|
|
|
@if [ -d .tmp.lightningrfc ]; then tools/check-bolt $(CHECK_BOLT_PREFIX) .tmp.lightningrfc $<; else echo "Not checking BOLTs: BOLTDIR $(BOLTDIR) does not exist" >&2; fi
|
2017-01-04 04:39:20 +01:00
|
|
|
|
2018-09-14 00:59:22 +02:00
|
|
|
LOCAL_BOLTDIR=.tmp.lightningrfc
|
|
|
|
|
2017-01-04 04:39:20 +01:00
|
|
|
bolt-precheck:
|
2018-09-21 09:49:33 +02:00
|
|
|
@[ -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)
|
2017-01-04 04:39:20 +01:00
|
|
|
|
2020-08-31 03:13:25 +02:00
|
|
|
check-source-bolt: $(ALL_NONGEN_SRCFILES:%=bolt-check/%)
|
2016-05-02 08:28:56 +02:00
|
|
|
|
2017-01-04 04:39:20 +01:00
|
|
|
check-whitespace/%: %
|
|
|
|
@if grep -Hn '[ ]$$' $<; then echo Extraneous whitespace found >&2; exit 1; fi
|
|
|
|
|
2020-08-31 03:13:25 +02:00
|
|
|
check-whitespace: check-whitespace/Makefile check-whitespace/tools/check-bolt.c $(ALL_NONGEN_SRCFILES:%=check-whitespace/%)
|
2016-11-11 00:06:10 +01:00
|
|
|
|
2018-01-18 17:35:56 +01:00
|
|
|
check-markdown:
|
|
|
|
@tools/check-markdown.sh
|
|
|
|
|
2018-01-22 10:49:30 +01:00
|
|
|
check-spelling:
|
|
|
|
@tools/check-spelling.sh
|
|
|
|
|
2022-06-19 09:13:11 +02:00
|
|
|
PYSRC=$(shell git ls-files "*.py" | grep -v /text.py)
|
2018-03-10 06:25:56 +01:00
|
|
|
|
2020-09-25 12:34:37 +02:00
|
|
|
# Some tests in pyln will need to find lightningd to run, so have a PATH that
|
|
|
|
# allows it to find that
|
|
|
|
PYLN_PATH=$(shell pwd)/lightningd:$(PATH)
|
2020-10-22 02:57:12 +02:00
|
|
|
check-pyln-%: $(BIN_PROGRAMS) $(PKGLIBEXEC_PROGRAMS) $(PLUGINS)
|
2021-03-10 14:05:28 +01:00
|
|
|
@(cd contrib/$(shell echo $@ | cut -b 7-) && PATH=$(PYLN_PATH) PYTHONPATH=$(MY_CHECK_PYTHONPATH) $(MAKE) check)
|
2020-09-25 12:34:37 +02:00
|
|
|
|
2020-11-25 01:18:03 +01:00
|
|
|
check-python: check-python-flake8 check-pytest-pyln-proto check-pyln-client check-pyln-testing
|
|
|
|
|
|
|
|
check-python-flake8:
|
2018-02-24 19:02:42 +01:00
|
|
|
@# E501 line too long (N > 79 characters)
|
|
|
|
@# E731 do not assign a lambda expression, use a def
|
2018-10-26 07:49:53 +02:00
|
|
|
@# W503: line break before binary operator
|
2021-09-22 18:06:50 +02:00
|
|
|
@# E741: ambiguous variable name
|
2022-02-23 19:50:34 +01:00
|
|
|
@flake8 --ignore=E501,E731,E741,W503,F541 --exclude $(shell echo ${PYTHON_GENERATED} | sed 's/ \+/,/g') ${PYSRC}
|
2018-02-24 19:02:42 +01:00
|
|
|
|
2020-11-25 01:18:03 +01:00
|
|
|
check-pytest-pyln-proto:
|
2021-03-10 14:05:28 +01:00
|
|
|
PATH=$(PYLN_PATH) PYTHONPATH=$(MY_CHECK_PYTHONPATH) $(PYTEST) contrib/pyln-proto/tests/
|
2019-02-21 18:59:15 +01:00
|
|
|
|
2020-10-22 02:57:07 +02:00
|
|
|
check-includes: check-src-includes check-hdr-includes
|
2018-03-22 11:33:48 +01:00
|
|
|
@tools/check-includes.sh
|
|
|
|
|
2018-03-26 03:01:58 +02:00
|
|
|
# cppcheck gets confused by list_for_each(head, i, list): thinks i is uninit.
|
|
|
|
.cppcheck-suppress:
|
2021-04-28 15:05:43 +02:00
|
|
|
@git ls-files -- "*.c" "*.h" | grep -vE '^(ccan|contrib)/' | xargs grep -n '_for_each' | sed 's/\([^:]*:.*\):.*/uninitvar:\1/' > $@
|
2018-03-26 03:01:58 +02:00
|
|
|
|
|
|
|
check-cppcheck: .cppcheck-suppress
|
2021-04-28 15:05:43 +02:00
|
|
|
@trap 'rm -f .cppcheck-suppress' 0; git ls-files -- "*.c" "*.h" | grep -vE '^ccan/' | xargs cppcheck ${CPPCHECK_OPTS}
|
2018-03-26 03:01:58 +02:00
|
|
|
|
2018-04-03 18:42:09 +02:00
|
|
|
check-shellcheck:
|
2018-10-05 22:15:07 +02:00
|
|
|
@git ls-files -- "*.sh" | xargs shellcheck
|
2018-04-03 18:42:09 +02:00
|
|
|
|
2018-04-25 12:55:34 +02:00
|
|
|
check-setup_locale:
|
|
|
|
@tools/check-setup_locale.sh
|
|
|
|
|
2018-05-17 07:08:11 +02:00
|
|
|
check-tmpctx:
|
2020-05-16 00:36:24 +02:00
|
|
|
@if git grep -n 'tal_free[(]tmpctx)' | grep -Ev '^ccan/|/test/|^common/setup.c:|^common/utils.c:'; then echo "Don't free tmpctx!">&2; exit 1; fi
|
2018-05-17 07:08:11 +02:00
|
|
|
|
2018-08-01 12:32:25 +02:00
|
|
|
check-discouraged-functions:
|
2021-04-28 15:45:44 +02:00
|
|
|
@if git grep -E "[^a-z_/](fgets|fputs|gets|scanf|sprintf)\(" -- "*.c" "*.h" ":(exclude)ccan/" ":(exclude)contrib/"; then exit 1; fi
|
2018-08-01 12:32:25 +02:00
|
|
|
|
2019-02-21 04:45:56 +01:00
|
|
|
# Don't access amount_msat and amount_sat members directly without a good reason
|
|
|
|
# since it risks overflow.
|
|
|
|
check-amount-access:
|
|
|
|
@! (git grep -nE "(->|\.)(milli)?satoshis" -- "*.c" "*.h" ":(exclude)common/amount.*" ":(exclude)*/test/*" | grep -v '/* Raw:')
|
|
|
|
@! git grep -nE "\\(struct amount_(m)?sat\\)" -- "*.c" "*.h" ":(exclude)common/amount.*" ":(exclude)*/test/*"
|
|
|
|
|
|
|
|
check-source: check-makefile check-source-bolt check-whitespace check-markdown check-spelling check-python check-includes check-cppcheck check-shellcheck check-setup_locale check-tmpctx check-discouraged-functions check-amount-access
|
2016-01-21 21:08:09 +01:00
|
|
|
|
2017-08-28 18:13:01 +02:00
|
|
|
full-check: check check-source
|
2015-09-29 09:32:02 +02:00
|
|
|
|
2021-02-10 11:23:34 +01:00
|
|
|
# Simple target to be used on CI systems to check that all the derived
|
|
|
|
# files were checked in and updated. It depends on the generated
|
|
|
|
# targets, and checks if any of the tracked files changed. If they did
|
|
|
|
# then one of the gen-targets caused this change, meaning either the
|
|
|
|
# gen-target is not reproducible or the files were forgotten.
|
|
|
|
#
|
|
|
|
# Do not run on your development tree since it will complain if you
|
|
|
|
# have a dirty tree.
|
2022-07-12 18:12:41 +02:00
|
|
|
CHECK_GEN_ALL = \
|
|
|
|
$(CLN_GRPC_GENALL) \
|
|
|
|
$(CLN_RPC_GENALL) \
|
|
|
|
$(MANPAGES) \
|
|
|
|
$(WALLET_DB_QUERIES) \
|
|
|
|
$(PYTHON_GENERATED) \
|
|
|
|
$(ALL_GEN_HEADERS) \
|
|
|
|
$(ALL_GEN_SOURCES) \
|
|
|
|
wallet/statements_gettextgen.po \
|
|
|
|
.msggen.json
|
|
|
|
|
|
|
|
check-gen-updated: $(CHECK_GEN_ALL)
|
2021-02-10 11:23:34 +01:00
|
|
|
@echo "Checking for generated files being changed by make"
|
|
|
|
git diff --exit-code HEAD $?
|
|
|
|
|
2017-08-28 18:13:01 +02:00
|
|
|
coverage/coverage.info: check pytest
|
2017-01-09 11:18:11 +01:00
|
|
|
mkdir coverage || true
|
|
|
|
lcov --capture --directory . --output-file coverage/coverage.info
|
|
|
|
|
|
|
|
coverage: coverage/coverage.info
|
|
|
|
genhtml coverage/coverage.info --output-directory coverage
|
|
|
|
|
2018-06-05 12:32:50 +02:00
|
|
|
# We make libwallycore.la a dependency, so that it gets built normally, without ncc.
|
|
|
|
# Ncc can't handle the libwally source code (yet).
|
2020-01-30 00:15:32 +01:00
|
|
|
ncc: ${TARGET_DIR}/libwally-core-build/src/libwallycore.la
|
2019-07-29 04:03:56 +02:00
|
|
|
$(MAKE) CC="ncc -ncgcc -ncld -ncfabs" AR=nccar LD=nccld
|
2018-06-05 12:32:50 +02:00
|
|
|
|
2017-01-04 03:47:47 +01:00
|
|
|
# Ignore test/ directories.
|
2021-05-21 07:16:05 +02:00
|
|
|
TAGS:
|
2018-08-31 06:04:23 +02:00
|
|
|
$(RM) TAGS; find * -name test -type d -prune -o -name '*.[ch]' -print -o -name '*.py' -print | xargs etags --append
|
2021-05-21 07:16:05 +02:00
|
|
|
|
2022-01-07 22:58:40 +01:00
|
|
|
tags:
|
|
|
|
$(RM) tags; find * -name test -type d -prune -o -name '*.[ch]' -print -o -name '*.py' -print | xargs ctags --append
|
|
|
|
|
2017-08-28 18:13:01 +02:00
|
|
|
ccan/ccan/cdump/tools/cdump-enumstr: ccan/ccan/cdump/tools/cdump-enumstr.o $(CDUMP_OBJS) $(CCAN_OBJS)
|
2017-01-11 00:12:26 +01:00
|
|
|
|
2017-08-28 18:13:01 +02:00
|
|
|
ALL_PROGRAMS += ccan/ccan/cdump/tools/cdump-enumstr
|
|
|
|
# Can't add to ALL_OBJS, as that makes a circular dep.
|
2018-01-20 05:27:13 +01:00
|
|
|
ccan/ccan/cdump/tools/cdump-enumstr.o: $(CCAN_HEADERS) Makefile
|
2015-06-12 05:59:06 +02:00
|
|
|
|
2022-04-26 05:55:47 +02:00
|
|
|
# Without a working git, you can't generate this file, so assume if it exists
|
|
|
|
# it is ok (fixes "sudo make install").
|
|
|
|
ifeq ($(VERSION),)
|
|
|
|
version_gen.h:
|
|
|
|
echo "ERROR: git is required for generating version information" >&2
|
|
|
|
exit 1
|
|
|
|
else
|
2021-05-21 07:16:05 +02:00
|
|
|
version_gen.h: $(FORCE)
|
2018-06-21 02:39:15 +02:00
|
|
|
@(echo "#define VERSION \"$(VERSION)\"" && echo "#define BUILD_FEATURES \"$(FEATURES)\"") > $@.new
|
2020-05-19 03:53:17 +02:00
|
|
|
@if cmp $@.new $@ >/dev/null 2>&1; then rm -f $@.new; else mv $@.new $@; $(ECHO) Version updated; fi
|
2022-04-26 05:55:47 +02:00
|
|
|
endif
|
2015-08-08 13:15:49 +02:00
|
|
|
|
2018-12-11 00:30:53 +01:00
|
|
|
# That forces this rule to be run every time, too.
|
2020-10-22 01:51:08 +02:00
|
|
|
header_versions_gen.h: tools/headerversions
|
2018-12-11 00:30:53 +01:00
|
|
|
@tools/headerversions $@
|
|
|
|
|
2022-07-16 06:55:09 +02:00
|
|
|
# We make a static library, this way linker can discard unused parts.
|
|
|
|
libccan.a: $(CCAN_OBJS)
|
|
|
|
@$(call VERBOSE, "ar $@", $(AR) r $@ $(CCAN_OBJS))
|
|
|
|
|
2018-12-11 01:27:47 +01:00
|
|
|
# All binaries require the external libs, ccan and system library versions.
|
2022-07-16 06:55:09 +02:00
|
|
|
$(ALL_PROGRAMS) $(ALL_TEST_PROGRAMS) $(ALL_FUZZ_TARGETS): $(EXTERNAL_LIBS) libccan.a
|
2017-08-28 18:13:01 +02:00
|
|
|
|
|
|
|
# Each test program depends on its own object.
|
2020-09-07 17:32:19 +02:00
|
|
|
$(ALL_TEST_PROGRAMS) $(ALL_FUZZ_TARGETS): %: %.o
|
2015-08-08 13:15:49 +02:00
|
|
|
|
2017-08-28 18:13:01 +02:00
|
|
|
# Without this rule, the (built-in) link line contains
|
|
|
|
# external/libwallycore.a directly, which causes a symbol clash (it
|
|
|
|
# uses some ccan modules internally). We want to rely on -lwallycore etc.
|
|
|
|
# (as per EXTERNAL_LDLIBS) so we filter them out here.
|
|
|
|
$(ALL_PROGRAMS) $(ALL_TEST_PROGRAMS):
|
2022-07-16 06:55:09 +02:00
|
|
|
@$(call VERBOSE, "ld $@", $(LINK.o) $(filter-out %.a,$^) $(LOADLIBES) $(EXTERNAL_LDLIBS) $(LDLIBS) libccan.a -o $@)
|
2017-08-28 18:13:01 +02:00
|
|
|
|
2020-09-07 17:32:19 +02:00
|
|
|
# We special case the fuzzing target binaries, as they need to link against libfuzzer,
|
|
|
|
# which brings its own main().
|
|
|
|
FUZZ_LDFLAGS = -fsanitize=fuzzer
|
|
|
|
$(ALL_FUZZ_TARGETS):
|
|
|
|
@$(call VERBOSE, "ld $@", $(LINK.o) $(filter-out %.a,$^) $(LOADLIBES) $(EXTERNAL_LDLIBS) $(LDLIBS) $(FUZZ_LDFLAGS) -o $@)
|
|
|
|
|
|
|
|
|
2018-01-20 05:27:13 +01:00
|
|
|
# Everything depends on the CCAN headers, and Makefile
|
|
|
|
$(CCAN_OBJS) $(CDUMP_OBJS): $(CCAN_HEADERS) Makefile
|
2017-08-28 18:13:01 +02:00
|
|
|
|
2018-01-20 05:27:13 +01:00
|
|
|
# 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
|
2017-08-29 06:12:04 +02:00
|
|
|
|
2021-10-08 00:53:47 +02:00
|
|
|
# Test files can literally #include generated C files.
|
|
|
|
$(ALL_TEST_PROGRAMS:=.o): $(ALL_GEN_SOURCES)
|
|
|
|
|
2015-07-09 07:38:17 +02:00
|
|
|
update-ccan:
|
|
|
|
mv ccan ccan.old
|
2020-01-31 12:39:29 +01:00
|
|
|
DIR=$$(pwd)/ccan; cd ../ccan && ./tools/create-ccan-tree -a $$DIR `cd $$DIR.old/ccan && find * -name _info | sed s,/_info,, | $(SORT)` $(CCAN_NEW)
|
2015-07-09 07:38:17 +02:00
|
|
|
mkdir -p ccan/tools/configurator
|
2018-06-06 05:34:27 +02:00
|
|
|
cp ../ccan/tools/configurator/configurator.c ../ccan/doc/configurator.1 ccan/tools/configurator/
|
2015-07-09 07:38:17 +02:00
|
|
|
$(MAKE) ccan/config.h
|
|
|
|
grep -v '^CCAN version:' ccan.old/README > ccan/README
|
|
|
|
echo CCAN version: `git -C ../ccan describe` >> ccan/README
|
|
|
|
$(RM) -r ccan.old
|
2018-05-17 07:04:46 +02:00
|
|
|
$(RM) -r ccan/ccan/hash/ ccan/ccan/tal/talloc/ # Unnecessary deps
|
2016-07-01 03:57:57 +02:00
|
|
|
|
2017-09-11 06:52:58 +02:00
|
|
|
# Now ALL_PROGRAMS is fully populated, we can expand it.
|
|
|
|
all-programs: $(ALL_PROGRAMS)
|
2020-09-07 17:32:19 +02:00
|
|
|
all-test-programs: $(ALL_TEST_PROGRAMS) $(ALL_FUZZ_TARGETS)
|
2022-01-14 15:34:41 +01:00
|
|
|
default-targets: $(DEFAULT_TARGETS)
|
2015-07-09 07:38:17 +02:00
|
|
|
|
2015-05-26 06:38:12 +02:00
|
|
|
distclean: clean
|
2018-06-07 04:43:45 +02:00
|
|
|
$(RM) ccan/config.h config.vars
|
2015-09-30 07:19:42 +02:00
|
|
|
|
2016-08-09 05:41:13 +02:00
|
|
|
maintainer-clean: distclean
|
2015-09-30 07:19:42 +02:00
|
|
|
@echo 'This command is intended for maintainers to use; it'
|
|
|
|
@echo 'deletes files that may need special tools to rebuild.'
|
2015-05-26 06:38:12 +02:00
|
|
|
|
2020-10-22 01:51:08 +02:00
|
|
|
# We used to have gen_ files, now we have _gen files.
|
|
|
|
obsclean:
|
|
|
|
$(RM) gen_*.h */gen_*.[ch] */*/gen_*.[ch]
|
|
|
|
|
|
|
|
clean: obsclean
|
2022-07-16 06:55:09 +02:00
|
|
|
$(RM) libccan.a $(CCAN_OBJS) $(CDUMP_OBJS) $(ALL_OBJS)
|
2021-12-02 17:31:12 +01:00
|
|
|
$(RM) $(ALL_GEN_HEADERS) $(ALL_GEN_SOURCES)
|
2020-08-31 03:13:25 +02:00
|
|
|
$(RM) $(ALL_PROGRAMS)
|
|
|
|
$(RM) $(ALL_TEST_PROGRAMS)
|
2020-09-07 17:32:19 +02:00
|
|
|
$(RM) $(ALL_FUZZ_TARGETS)
|
2020-10-22 01:51:08 +02:00
|
|
|
$(RM) ccan/tools/configurator/configurator
|
2016-09-08 08:27:33 +02:00
|
|
|
$(RM) ccan/ccan/cdump/tools/cdump-enumstr.o
|
2017-01-09 11:18:11 +01:00
|
|
|
find . -name '*gcda' -delete
|
|
|
|
find . -name '*gcno' -delete
|
2018-06-05 12:32:50 +02:00
|
|
|
find . -name '*.nccout' -delete
|
2022-01-14 15:34:41 +01:00
|
|
|
if [ "${RUST}" -eq "1" ]; then cargo clean; fi
|
2015-05-26 06:38:12 +02:00
|
|
|
|
2021-05-21 07:18:05 +02:00
|
|
|
# These must both be enabled for update-mocks
|
|
|
|
ifeq ($(DEVELOPER)$(EXPERIMENTAL_FEATURES),11)
|
2021-05-21 07:17:05 +02:00
|
|
|
update-mocks: $(ALL_TEST_PROGRAMS:%=update-mocks/%.c)
|
2021-05-21 07:18:05 +02:00
|
|
|
else
|
|
|
|
update-mocks:
|
|
|
|
@echo Need DEVELOPER=1 and EXPERIMENTAL_FEATURES=1 to regenerate mocks >&2; exit 1
|
|
|
|
endif
|
2021-05-21 07:17:05 +02:00
|
|
|
|
2022-07-16 06:55:09 +02:00
|
|
|
$(ALL_TEST_PROGRAMS:%=update-mocks/%.c): $(ALL_GEN_HEADERS) $(EXTERNAL_LIBS) libccan.a ccan/ccan/cdump/tools/cdump-enumstr config.vars
|
2021-05-21 07:17:05 +02:00
|
|
|
|
2017-01-04 04:39:20 +01:00
|
|
|
update-mocks/%: %
|
2020-05-19 05:11:25 +02:00
|
|
|
@MAKE=$(MAKE) tools/update-mocks.sh "$*" $(SUPPRESS_OUTPUT)
|
2017-01-04 04:39:20 +01:00
|
|
|
|
2016-12-02 08:40:13 +01:00
|
|
|
unittest/%: %
|
2018-06-06 22:40:24 +02:00
|
|
|
$(VG) $(VG_TEST_ARGS) $* > /dev/null
|
2016-12-02 08:40:13 +01:00
|
|
|
|
2017-12-06 15:12:04 +01:00
|
|
|
# Installation directories
|
2019-02-22 04:02:37 +01:00
|
|
|
exec_prefix = $(PREFIX)
|
2017-12-06 15:12:04 +01:00
|
|
|
bindir = $(exec_prefix)/bin
|
|
|
|
libexecdir = $(exec_prefix)/libexec
|
2017-12-31 17:30:40 +01:00
|
|
|
pkglibexecdir = $(libexecdir)/$(PKGNAME)
|
2018-12-04 04:04:14 +01:00
|
|
|
plugindir = $(pkglibexecdir)/plugins
|
2019-02-22 04:02:37 +01:00
|
|
|
datadir = $(PREFIX)/share
|
2017-12-06 15:12:04 +01:00
|
|
|
docdir = $(datadir)/doc/$(PKGNAME)
|
|
|
|
mandir = $(datadir)/man
|
|
|
|
man1dir = $(mandir)/man1
|
2018-07-25 16:42:36 +02:00
|
|
|
man5dir = $(mandir)/man5
|
2017-12-06 15:12:04 +01:00
|
|
|
man7dir = $(mandir)/man7
|
2019-08-07 15:41:15 +02:00
|
|
|
man8dir = $(mandir)/man8
|
2017-12-06 15:12:04 +01:00
|
|
|
|
|
|
|
# Commands
|
|
|
|
MKDIR_P = mkdir -p
|
|
|
|
INSTALL = install
|
|
|
|
INSTALL_PROGRAM = $(INSTALL)
|
|
|
|
INSTALL_DATA = $(INSTALL) -m 644
|
|
|
|
|
|
|
|
# Tags needed by some package systems.
|
|
|
|
PRE_INSTALL = :
|
|
|
|
NORMAL_INSTALL = :
|
|
|
|
POST_INSTALL = :
|
|
|
|
PRE_UNINSTALL = :
|
|
|
|
NORMAL_UNINSTALL = :
|
|
|
|
POST_UNINSTALL = :
|
|
|
|
|
|
|
|
# Target to create directories.
|
|
|
|
installdirs:
|
|
|
|
@$(NORMAL_INSTALL)
|
|
|
|
$(MKDIR_P) $(DESTDIR)$(bindir)
|
2018-01-03 12:44:42 +01:00
|
|
|
$(MKDIR_P) $(DESTDIR)$(pkglibexecdir)
|
2018-12-04 04:04:14 +01:00
|
|
|
$(MKDIR_P) $(DESTDIR)$(plugindir)
|
2017-12-06 15:12:04 +01:00
|
|
|
$(MKDIR_P) $(DESTDIR)$(man1dir)
|
2018-07-25 16:42:36 +02:00
|
|
|
$(MKDIR_P) $(DESTDIR)$(man5dir)
|
2017-12-06 15:12:04 +01:00
|
|
|
$(MKDIR_P) $(DESTDIR)$(man7dir)
|
2019-08-07 15:41:15 +02:00
|
|
|
$(MKDIR_P) $(DESTDIR)$(man8dir)
|
2017-12-06 15:12:04 +01:00
|
|
|
$(MKDIR_P) $(DESTDIR)$(docdir)
|
|
|
|
|
2020-06-19 08:22:25 +02:00
|
|
|
# $(PLUGINS) is defined in plugins/Makefile.
|
2017-12-06 15:12:04 +01:00
|
|
|
|
2019-01-31 00:08:44 +01:00
|
|
|
install-program: installdirs $(BIN_PROGRAMS) $(PKGLIBEXEC_PROGRAMS) $(PLUGINS)
|
2017-12-06 15:12:04 +01:00
|
|
|
@$(NORMAL_INSTALL)
|
|
|
|
$(INSTALL_PROGRAM) $(BIN_PROGRAMS) $(DESTDIR)$(bindir)
|
2018-01-03 12:44:42 +01:00
|
|
|
$(INSTALL_PROGRAM) $(PKGLIBEXEC_PROGRAMS) $(DESTDIR)$(pkglibexecdir)
|
2018-12-04 04:04:14 +01:00
|
|
|
[ -z "$(PLUGINS)" ] || $(INSTALL_PROGRAM) $(PLUGINS) $(DESTDIR)$(plugindir)
|
2017-12-06 15:12:04 +01:00
|
|
|
|
|
|
|
MAN1PAGES = $(filter %.1,$(MANPAGES))
|
2018-07-25 16:42:36 +02:00
|
|
|
MAN5PAGES = $(filter %.5,$(MANPAGES))
|
2017-12-06 15:12:04 +01:00
|
|
|
MAN7PAGES = $(filter %.7,$(MANPAGES))
|
2019-08-07 15:41:15 +02:00
|
|
|
MAN8PAGES = $(filter %.8,$(MANPAGES))
|
2017-12-06 15:12:04 +01:00
|
|
|
DOC_DATA = README.md doc/INSTALL.md doc/HACKING.md LICENSE
|
|
|
|
|
2019-08-07 15:41:15 +02:00
|
|
|
install-data: installdirs $(MAN1PAGES) $(MAN5PAGES) $(MAN7PAGES) $(MAN8PAGES) $(DOC_DATA)
|
2017-12-06 15:12:04 +01:00
|
|
|
@$(NORMAL_INSTALL)
|
|
|
|
$(INSTALL_DATA) $(MAN1PAGES) $(DESTDIR)$(man1dir)
|
2018-07-25 16:42:36 +02:00
|
|
|
$(INSTALL_DATA) $(MAN5PAGES) $(DESTDIR)$(man5dir)
|
2017-12-06 15:12:04 +01:00
|
|
|
$(INSTALL_DATA) $(MAN7PAGES) $(DESTDIR)$(man7dir)
|
2019-08-07 15:41:15 +02:00
|
|
|
$(INSTALL_DATA) $(MAN8PAGES) $(DESTDIR)$(man8dir)
|
2017-12-06 15:12:04 +01:00
|
|
|
$(INSTALL_DATA) $(DOC_DATA) $(DESTDIR)$(docdir)
|
|
|
|
|
|
|
|
install: install-program install-data
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
@$(NORMAL_UNINSTALL)
|
|
|
|
@for f in $(BIN_PROGRAMS); do \
|
2020-05-19 03:53:17 +02:00
|
|
|
$(ECHO) rm -f $(DESTDIR)$(bindir)/`basename $$f`; \
|
2017-12-06 15:12:04 +01:00
|
|
|
rm -f $(DESTDIR)$(bindir)/`basename $$f`; \
|
|
|
|
done
|
2018-12-04 04:04:14 +01:00
|
|
|
@for f in $(PLUGINS); do \
|
2020-05-19 03:53:17 +02:00
|
|
|
$(ECHO) rm -f $(DESTDIR)$(plugindir)/`basename $$f`; \
|
2018-12-04 04:04:14 +01:00
|
|
|
rm -f $(DESTDIR)$(plugindir)/`basename $$f`; \
|
|
|
|
done
|
2018-01-03 12:44:42 +01:00
|
|
|
@for f in $(PKGLIBEXEC_PROGRAMS); do \
|
2020-05-19 03:53:17 +02:00
|
|
|
$(ECHO) rm -f $(DESTDIR)$(pkglibexecdir)/`basename $$f`; \
|
2018-01-03 12:44:42 +01:00
|
|
|
rm -f $(DESTDIR)$(pkglibexecdir)/`basename $$f`; \
|
|
|
|
done
|
2017-12-06 15:12:04 +01:00
|
|
|
@for f in $(MAN1PAGES); do \
|
2020-05-19 03:53:17 +02:00
|
|
|
$(ECHO) rm -f $(DESTDIR)$(man1dir)/`basename $$f`; \
|
2017-12-06 15:12:04 +01:00
|
|
|
rm -f $(DESTDIR)$(man1dir)/`basename $$f`; \
|
|
|
|
done
|
2018-07-25 16:42:36 +02:00
|
|
|
@for f in $(MAN5PAGES); do \
|
2020-05-19 03:53:17 +02:00
|
|
|
$(ECHO) rm -f $(DESTDIR)$(man5dir)/`basename $$f`; \
|
2018-07-25 16:42:36 +02:00
|
|
|
rm -f $(DESTDIR)$(man5dir)/`basename $$f`; \
|
|
|
|
done
|
2017-12-06 15:12:04 +01:00
|
|
|
@for f in $(MAN7PAGES); do \
|
2020-05-19 03:53:17 +02:00
|
|
|
$(ECHO) rm -f $(DESTDIR)$(man7dir)/`basename $$f`; \
|
2017-12-06 15:12:04 +01:00
|
|
|
rm -f $(DESTDIR)$(man7dir)/`basename $$f`; \
|
|
|
|
done
|
2019-08-07 15:41:15 +02:00
|
|
|
@for f in $(MAN8PAGES); do \
|
2020-05-19 03:53:17 +02:00
|
|
|
$(ECHO) rm -f $(DESTDIR)$(man8dir)/`basename $$f`; \
|
2019-08-07 15:41:15 +02:00
|
|
|
rm -f $(DESTDIR)$(man8dir)/`basename $$f`; \
|
|
|
|
done
|
2017-12-06 15:12:04 +01:00
|
|
|
@for f in $(DOC_DATA); do \
|
2020-05-19 03:53:17 +02:00
|
|
|
$(ECHO) rm -f $(DESTDIR)$(docdir)/`basename $$f`; \
|
2017-12-06 15:12:04 +01:00
|
|
|
rm -f $(DESTDIR)$(docdir)/`basename $$f`; \
|
|
|
|
done
|
|
|
|
|
2019-08-22 08:17:24 +02:00
|
|
|
installcheck: all-programs
|
2017-12-31 02:42:27 +01:00
|
|
|
@rm -rf testinstall || true
|
2018-02-27 19:32:55 +01:00
|
|
|
$(MAKE) DESTDIR=$$(pwd)/testinstall install
|
2017-12-31 02:42:27 +01:00
|
|
|
testinstall$(bindir)/lightningd --test-daemons-only --lightning-dir=testinstall
|
2018-02-27 19:32:55 +01:00
|
|
|
$(MAKE) DESTDIR=$$(pwd)/testinstall uninstall
|
2017-12-31 02:42:27 +01:00
|
|
|
@if test `find testinstall '!' -type d | wc -l` -ne 0; then \
|
|
|
|
echo 'make uninstall left some files in testinstall directory!'; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
@rm -rf testinstall || true
|
|
|
|
|
|
|
|
.PHONY: installdirs install-program install-data install uninstall \
|
2020-05-01 11:19:11 +02:00
|
|
|
installcheck ncc bin-tarball show-flags
|
2018-06-21 02:39:15 +02:00
|
|
|
|
|
|
|
# Make a tarball of opt/clightning/, optionally with label for distribution.
|
2022-04-26 05:55:47 +02:00
|
|
|
ifneq ($(VERSION),)
|
2018-06-21 02:39:15 +02:00
|
|
|
bin-tarball: clightning-$(VERSION)-$(DISTRO).tar.xz
|
|
|
|
clightning-$(VERSION)-$(DISTRO).tar.xz: DESTDIR=$(shell pwd)/
|
|
|
|
clightning-$(VERSION)-$(DISTRO).tar.xz: prefix=opt/clightning
|
|
|
|
clightning-$(VERSION)-$(DISTRO).tar.xz: install
|
|
|
|
trap "rm -rf opt" 0; tar cvfa $@ opt/
|
2022-04-26 05:55:47 +02:00
|
|
|
endif
|
2017-12-06 15:12:04 +01:00
|
|
|
|
2017-01-04 03:46:47 +01:00
|
|
|
ccan-breakpoint.o: $(CCANDIR)/ccan/breakpoint/breakpoint.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2022-07-16 06:55:11 +02:00
|
|
|
ccan-base64.o: $(CCANDIR)/ccan/base64/base64.c
|
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2015-05-26 06:38:12 +02:00
|
|
|
ccan-tal.o: $(CCANDIR)/ccan/tal/tal.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2015-05-26 06:38:12 +02:00
|
|
|
ccan-tal-str.o: $(CCANDIR)/ccan/tal/str/str.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2018-02-18 13:55:46 +01:00
|
|
|
ccan-tal-link.o: $(CCANDIR)/ccan/tal/link/link.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2016-01-21 21:11:48 +01:00
|
|
|
ccan-tal-path.o: $(CCANDIR)/ccan/tal/path/path.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2015-05-28 23:38:27 +02:00
|
|
|
ccan-tal-grab_file.o: $(CCANDIR)/ccan/tal/grab_file/grab_file.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2015-05-26 06:38:12 +02:00
|
|
|
ccan-take.o: $(CCANDIR)/ccan/take/take.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2015-05-26 06:38:12 +02:00
|
|
|
ccan-list.o: $(CCANDIR)/ccan/list/list.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2016-06-14 17:25:07 +02:00
|
|
|
ccan-asort.o: $(CCANDIR)/ccan/asort/asort.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2018-01-22 15:49:09 +01:00
|
|
|
ccan-ptr_valid.o: $(CCANDIR)/ccan/ptr_valid/ptr_valid.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2015-05-26 06:38:12 +02:00
|
|
|
ccan-read_write_all.o: $(CCANDIR)/ccan/read_write_all/read_write_all.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2015-05-26 06:38:12 +02:00
|
|
|
ccan-str.o: $(CCANDIR)/ccan/str/str.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2015-05-26 06:38:12 +02:00
|
|
|
ccan-opt.o: $(CCANDIR)/ccan/opt/opt.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2015-05-26 06:38:12 +02:00
|
|
|
ccan-opt-helpers.o: $(CCANDIR)/ccan/opt/helpers.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2015-05-26 06:38:12 +02:00
|
|
|
ccan-opt-parse.o: $(CCANDIR)/ccan/opt/parse.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2015-05-26 06:38:12 +02:00
|
|
|
ccan-opt-usage.o: $(CCANDIR)/ccan/opt/usage.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2015-05-26 06:38:12 +02:00
|
|
|
ccan-err.o: $(CCANDIR)/ccan/err/err.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2015-05-28 23:38:27 +02:00
|
|
|
ccan-noerr.o: $(CCANDIR)/ccan/noerr/noerr.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2015-05-26 06:38:12 +02:00
|
|
|
ccan-str-hex.o: $(CCANDIR)/ccan/str/hex/hex.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2019-06-11 07:30:54 +02:00
|
|
|
ccan-crc32c.o: $(CCANDIR)/ccan/crc32c/crc32c.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2017-01-04 03:46:47 +01:00
|
|
|
ccan-crypto-hmac.o: $(CCANDIR)/ccan/crypto/hmac_sha256/hmac_sha256.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2017-01-04 03:46:47 +01:00
|
|
|
ccan-crypto-hkdf.o: $(CCANDIR)/ccan/crypto/hkdf_sha256/hkdf_sha256.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2017-08-28 18:10:01 +02:00
|
|
|
ccan-crypto-shachain.o: $(CCANDIR)/ccan/crypto/shachain/shachain.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $< -DSHACHAIN_BITS=48", $(CC) $(CFLAGS) -DSHACHAIN_BITS=48 -c -o $@ $<)
|
2015-05-26 06:38:12 +02:00
|
|
|
ccan-crypto-sha256.o: $(CCANDIR)/ccan/crypto/sha256/sha256.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2015-07-09 08:13:36 +02:00
|
|
|
ccan-crypto-ripemd160.o: $(CCANDIR)/ccan/crypto/ripemd160/ripemd160.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2015-09-25 04:21:18 +02:00
|
|
|
ccan-cdump.o: $(CCANDIR)/ccan/cdump/cdump.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2015-09-25 04:21:18 +02:00
|
|
|
ccan-strmap.o: $(CCANDIR)/ccan/strmap/strmap.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2021-11-14 18:59:46 +01:00
|
|
|
ccan-strset.o: $(CCANDIR)/ccan/strset/strset.c
|
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2016-06-28 23:19:20 +02:00
|
|
|
ccan-crypto-siphash24.o: $(CCANDIR)/ccan/crypto/siphash24/siphash24.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2015-09-25 04:21:18 +02:00
|
|
|
ccan-htable.o: $(CCANDIR)/ccan/htable/htable.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2016-01-21 21:08:09 +01:00
|
|
|
ccan-ilog.o: $(CCANDIR)/ccan/ilog/ilog.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2017-01-24 14:33:15 +01:00
|
|
|
ccan-intmap.o: $(CCANDIR)/ccan/intmap/intmap.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2016-01-21 21:08:09 +01:00
|
|
|
ccan-isaac.o: $(CCANDIR)/ccan/isaac/isaac.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2016-01-21 21:08:09 +01:00
|
|
|
ccan-isaac64.o: $(CCANDIR)/ccan/isaac/isaac64.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2016-01-21 21:08:09 +01:00
|
|
|
ccan-time.o: $(CCANDIR)/ccan/time/time.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2016-01-21 21:11:45 +01:00
|
|
|
ccan-timer.o: $(CCANDIR)/ccan/timer/timer.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2016-01-21 21:11:45 +01:00
|
|
|
ccan-io-io.o: $(CCANDIR)/ccan/io/io.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2016-01-21 21:11:45 +01:00
|
|
|
ccan-io-poll.o: $(CCANDIR)/ccan/io/poll.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2017-01-04 03:46:47 +01:00
|
|
|
ccan-io-fdpass.o: $(CCANDIR)/ccan/io/fdpass/fdpass.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2016-01-21 21:11:45 +01:00
|
|
|
ccan-pipecmd.o: $(CCANDIR)/ccan/pipecmd/pipecmd.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2016-05-04 08:44:22 +02:00
|
|
|
ccan-mem.o: $(CCANDIR)/ccan/mem/mem.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2017-01-04 03:46:47 +01:00
|
|
|
ccan-fdpass.o: $(CCANDIR)/ccan/fdpass/fdpass.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2018-04-06 09:36:51 +02:00
|
|
|
ccan-bitops.o: $(CCANDIR)/ccan/bitops/bitops.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2018-05-10 01:18:23 +02:00
|
|
|
ccan-rbuf.o: $(CCANDIR)/ccan/rbuf/rbuf.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2018-05-10 01:18:24 +02:00
|
|
|
ccan-str-base32.o: $(CCANDIR)/ccan/str/base32/base32.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2018-06-28 03:30:05 +02:00
|
|
|
ccan-utf8.o: $(CCANDIR)/ccan/utf8/utf8.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2018-11-05 02:22:03 +01:00
|
|
|
ccan-bitmap.o: $(CCANDIR)/ccan/bitmap/bitmap.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2018-10-18 02:48:36 +02:00
|
|
|
ccan-membuf.o: $(CCANDIR)/ccan/membuf/membuf.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2019-06-12 02:38:54 +02:00
|
|
|
ccan-json_escape.o: $(CCANDIR)/ccan/json_escape/json_escape.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2019-06-12 02:38:54 +02:00
|
|
|
ccan-json_out.o: $(CCANDIR)/ccan/json_out/json_out.c
|
2020-05-01 11:19:11 +02:00
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2021-10-19 03:51:43 +02:00
|
|
|
ccan-closefrom.o: $(CCANDIR)/ccan/closefrom/closefrom.c
|
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
2022-07-16 06:55:11 +02:00
|
|
|
ccan-rune-rune.o: $(CCANDIR)/ccan/rune/rune.c
|
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|
|
|
|
ccan-rune-coding.o: $(CCANDIR)/ccan/rune/coding.c
|
|
|
|
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
|