|
| 1 | +#! /usr/bin/make |
| 2 | + |
| 3 | +# Designed to be run at the top |
| 4 | +rmthsmd-wrongdir: |
| 5 | + $(MAKE) -C ../.. lightningd/hsm-all |
| 6 | + |
| 7 | +default: rmthsmd-all |
| 8 | + |
| 9 | +LIGHTNINGD_RMTHSM_SRC := contrib/remote_hsmd/hsmd.c \ |
| 10 | + contrib/remote_hsmd/gen_hsm_wire.c \ |
| 11 | + contrib/remote_hsmd/remotesigner.pb.cc \ |
| 12 | + contrib/remote_hsmd/remotesigner.grpc.pb.cc \ |
| 13 | + contrib/remote_hsmd/dump.cc \ |
| 14 | + contrib/remote_hsmd/proxy.cc |
| 15 | +LIGHTNINGD_RMTHSM_HEADERS := contrib/remote_hsmd/gen_hsm_wire.h \ |
| 16 | + contrib/remote_hsmd/remotesigner.pb.h \ |
| 17 | + contrib/remote_hsmd/remotesigner.grpc.pb.h |
| 18 | +LIGHTNINGD_RMTHSM_CCOBJS := $(LIGHTNINGD_RMTHSM_SRC:.cc=.o) |
| 19 | +LIGHTNINGD_RMTHSM_OBJS := $(LIGHTNINGD_RMTHSM_CCOBJS:.c=.o) |
| 20 | + |
| 21 | +HOST_SYSTEM = $(shell uname | cut -f 1 -d_) |
| 22 | +SYSTEM ?= $(HOST_SYSTEM) |
| 23 | +CXX = g++ |
| 24 | +CXXFLAGS += -std=c++11 \ |
| 25 | + -I. \ |
| 26 | + -Iccan \ |
| 27 | + -Iexternal/libwally-core/include \ |
| 28 | + -Iexternal/libwally-core/src/secp256k1/include \ |
| 29 | + -g |
| 30 | +PROTOC = protoc |
| 31 | +GRPC_CPP_PLUGIN = grpc_cpp_plugin |
| 32 | +GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)` |
| 33 | +PROTOS_PATH = contrib/remote_hsmd |
| 34 | + |
| 35 | +# Common source we use. |
| 36 | +RMTHSMD_COMMON_OBJS := \ |
| 37 | + common/amount.o \ |
| 38 | + common/bigsize.o \ |
| 39 | + common/bip32.o \ |
| 40 | + common/daemon.o \ |
| 41 | + common/daemon_conn.o \ |
| 42 | + common/derive_basepoints.o \ |
| 43 | + common/funding_tx.o \ |
| 44 | + common/gen_status_wire.o \ |
| 45 | + common/hash_u5.o \ |
| 46 | + common/key_derive.o \ |
| 47 | + common/memleak.o \ |
| 48 | + common/msg_queue.o \ |
| 49 | + common/node_id.o \ |
| 50 | + common/permute_tx.o \ |
| 51 | + common/status.o \ |
| 52 | + common/status_wire.o \ |
| 53 | + common/subdaemon.o \ |
| 54 | + common/type_to_string.o \ |
| 55 | + common/utils.o \ |
| 56 | + common/utxo.o \ |
| 57 | + common/version.o \ |
| 58 | + common/withdraw_tx.o |
| 59 | + |
| 60 | +# For checking |
| 61 | +LIGHTNINGD_RMTHSM_ALLSRC_NOGEN := $(filter-out contrib/remote_hsmd/gen_%, $(LIGHTNINGD_RMTHSM_SRC) $(LIGHTNINGD_RMTHSM_SRC)) |
| 62 | +LIGHTNINGD_RMTHSM_ALLHEADERS_NOGEN := $(filter-out contrib/remote_hsmd/gen_%, $(LIGHTNINGD_RMTHSM_HEADERS)) |
| 63 | + |
| 64 | +$(LIGHTNINGD_RMTHSM_OBJS): $(LIGHTNINGD_HEADERS) |
| 65 | + |
| 66 | +# Make sure these depend on everything. |
| 67 | +ALL_OBJS += $(LIGHTNINGD_RMTHSM_OBJS) |
| 68 | +ALL_PROGRAMS += lightningd/remote_hsmd |
| 69 | +ALL_GEN_HEADERS += contrib/remote_hsmd/gen_hsm_wire.h |
| 70 | +ALL_GEN_HEADERS += contrib/remote_hsmd/remotesigner.pb.h contrib/remote_hsmd/remotesigner.grpc.pb.h |
| 71 | + |
| 72 | +rmthsmd-all: lightningd/remote_hsmd |
| 73 | + |
| 74 | +lightningd/remote_hsmd: $(LIGHTNINGD_RMTHSM_OBJS) $(LIGHTNINGD_LIB_OBJS) $(RMTHSMD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) |
| 75 | + |
| 76 | +contrib/remote_hsmd/remotesigner.pb.o: $(ALL_GEN_HEADERS) |
| 77 | + |
| 78 | +contrib/remote_hsmd/remotesigner.grpc.pb.o contrib/remote_hsmd/remotesigner.pb.o contrib/remote_hsmd/proxy.o contrib/remote_hsmd/dump.o : CPPFLAGS += $(CMNFLAGS) `pkg-config --cflags protobuf grpc` |
| 79 | +lightningd/remote_hsmd: LDLIBS += -L/usr/local/lib \ |
| 80 | + `pkg-config --libs protobuf grpc++`\ |
| 81 | + -pthread\ |
| 82 | + -Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed\ |
| 83 | + -ldl |
| 84 | +lightningd/remote_hsmd: LDLIBS += -lstdc++ |
| 85 | + |
| 86 | +contrib/remote_hsmd/gen_hsm_wire.h: $(WIRE_GEN) contrib/remote_hsmd/hsm_wire.csv |
| 87 | + $(WIRE_GEN) --page header $@ hsm_wire_type < contrib/remote_hsmd/hsm_wire.csv > $@ |
| 88 | + |
| 89 | +contrib/remote_hsmd/gen_hsm_wire.c: $(WIRE_GEN) contrib/remote_hsmd/hsm_wire.csv |
| 90 | + $(WIRE_GEN) --page impl ${@:.c=.h} hsm_wire_type < contrib/remote_hsmd/hsm_wire.csv > $@ |
| 91 | + |
| 92 | +check-source: $(LIGHTNINGD_RMTHSM_ALLSRC_NOGEN:%=check-src-include-order/%) $(LIGHTNINGD_RMTHSM_ALLHEADERS_NOGEN:%=check-hdr-include-order/%) |
| 93 | +check-source-bolt: $(LIGHTNINGD_RMTHSM_SRC:%=bolt-check/%) |
| 94 | + |
| 95 | +check-whitespace: $(LIGHTNINGD_RMTHSM_ALLSRC_NOGEN:%=check-whitespace/%) $(LIGHTNINGD_RMTHSM_ALLHEADERS_NOGEN:%=check-whitespace/%) |
| 96 | + |
| 97 | +clean: lightningd/rmthsm-clean |
| 98 | + |
| 99 | +lightningd/rmthsm-clean: |
| 100 | + $(RM) $(LIGHTNINGD_RMTHSM_OBJS) contrib/remote_hsmd/gen_* |
| 101 | + $(RM) contrib/remote_hsmd/*.pb.cc contrib/remote_hsmd/*.pb.h |
| 102 | + |
| 103 | +.PRECIOUS: %.grpc.pb.cc |
| 104 | +%.grpc.pb.cc: %.proto |
| 105 | + $(PROTOC) -I $(PROTOS_PATH) --grpc_out=contrib/remote_hsmd --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) $< |
| 106 | + |
| 107 | +.PRECIOUS: %.pb.cc |
| 108 | +%.pb.cc: %.proto |
| 109 | + $(PROTOC) -I $(PROTOS_PATH) --cpp_out=contrib/remote_hsmd $< |
| 110 | + |
| 111 | +-include contrib/remote_hsmd/test/Makefile |
0 commit comments