2015-05-26 06:38:12 +02:00
|
|
|
#! /usr/bin/make
|
|
|
|
|
|
|
|
# Needs to have oneof support: Ubuntu vivid's is too old :(
|
|
|
|
PROTOCC:=protoc-c
|
|
|
|
|
2015-06-12 04:49:59 +02:00
|
|
|
PROGRAMS := test-cli/open-channel test-cli/open-anchor-scriptsigs test-cli/leak-anchor-sigs test-cli/open-commit-sig test-cli/check-commit-sig test-cli/check-anchor-scriptsigs test-cli/get-anchor-depth test-cli/create-steal-tx test-cli/create-commit-spend-tx test-cli/close-channel test-cli/create-close-tx test-cli/update-channel test-cli/update-channel-accept test-cli/update-channel-signature test-cli/update-channel-complete test-cli/create-commit-tx
|
2015-05-26 06:38:12 +02:00
|
|
|
|
2015-06-12 04:23:27 +02:00
|
|
|
BITCOIN_OBJS := bitcoin/address.o bitcoin/base58.o bitcoin/pubkey.o bitcoin/script.o bitcoin/shadouble.o bitcoin/signature.o bitcoin/tx.o
|
|
|
|
|
2015-06-12 04:39:05 +02:00
|
|
|
HELPER_OBJS := lightning.pb-c.o pkt.o permute_tx.o anchor.o commit_tx.o opt_bits.o close_tx.o find_p2sh_out.o protobuf_convert.o
|
2015-05-29 03:49:48 +02:00
|
|
|
|
2015-05-28 23:38:27 +02:00
|
|
|
CCAN_OBJS := ccan-crypto-sha256.o ccan-crypto-shachain.o ccan-err.o ccan-tal.o ccan-tal-str.o ccan-take.o ccan-list.o ccan-str.o ccan-opt-helpers.o ccan-opt.o ccan-opt-parse.o ccan-opt-usage.o ccan-read_write_all.o ccan-str-hex.o ccan-tal-grab_file.o ccan-noerr.o
|
2015-05-26 06:38:12 +02:00
|
|
|
|
2015-05-28 23:38:27 +02:00
|
|
|
HEADERS := $(wildcard *.h)
|
2015-05-26 06:38:12 +02:00
|
|
|
|
2015-06-12 05:59:06 +02:00
|
|
|
CCANDIR := ccan/
|
2015-06-24 08:45:34 +02:00
|
|
|
CFLAGS := -g -Wall -I $(CCANDIR) -DVALGRIND_HEADERS=1
|
2015-05-26 06:38:12 +02:00
|
|
|
LDLIBS := -lcrypto -lprotobuf-c
|
2015-06-12 04:49:59 +02:00
|
|
|
$(PROGRAMS): CFLAGS+=-I.
|
2015-05-26 06:38:12 +02:00
|
|
|
|
2015-05-28 23:38:27 +02:00
|
|
|
default: $(PROGRAMS)
|
2015-05-26 06:38:12 +02:00
|
|
|
|
2015-06-04 08:16:39 +02:00
|
|
|
TAGS: FORCE
|
2015-06-12 05:14:31 +02:00
|
|
|
$(RM) TAGS; find . -name '*.[ch]' | xargs etags --append
|
2015-06-04 08:16:39 +02:00
|
|
|
FORCE::
|
|
|
|
|
2015-05-26 06:38:12 +02:00
|
|
|
lightning.pb-c.c lightning.pb-c.h: lightning.proto
|
|
|
|
$(PROTOCC) lightning.proto --c_out=.
|
|
|
|
|
2015-06-12 04:23:27 +02:00
|
|
|
$(PROGRAMS): % : %.o $(HELPER_OBJS) $(BITCOIN_OBJS) $(CCAN_OBJS)
|
2015-06-05 03:35:05 +02:00
|
|
|
$(PROGRAMS:=.o) $(HELPER_OBJS): $(HEADERS)
|
2015-06-04 06:18:11 +02:00
|
|
|
|
2015-06-12 05:59:06 +02:00
|
|
|
$(CCAN_OBJS) $(HELPER_OBJS) $(PROGRAM_OBJS) $(BITCOIN_OBJS): ccan/config.h
|
|
|
|
|
|
|
|
ccan/config.h: ccan/tools/configurator/configurator
|
|
|
|
$< > $@
|
|
|
|
|
2015-05-26 06:38:12 +02:00
|
|
|
distclean: clean
|
2015-06-12 05:59:06 +02:00
|
|
|
$(RM) lightning.pb-c.c lightning.pb-c.h ccan/config.h
|
2015-05-26 06:38:12 +02:00
|
|
|
|
|
|
|
clean:
|
2015-05-28 23:38:27 +02:00
|
|
|
$(RM) $(PROGRAMS)
|
2015-06-12 04:23:27 +02:00
|
|
|
$(RM) bitcoin/*.o *.o $(CCAN_OBJS)
|
2015-05-26 06:38:12 +02:00
|
|
|
|
|
|
|
ccan-tal.o: $(CCANDIR)/ccan/tal/tal.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
ccan-tal-str.o: $(CCANDIR)/ccan/tal/str/str.c
|
|
|
|
$(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
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
2015-05-26 06:38:12 +02:00
|
|
|
ccan-take.o: $(CCANDIR)/ccan/take/take.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
ccan-list.o: $(CCANDIR)/ccan/list/list.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
ccan-read_write_all.o: $(CCANDIR)/ccan/read_write_all/read_write_all.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
ccan-str.o: $(CCANDIR)/ccan/str/str.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
ccan-opt.o: $(CCANDIR)/ccan/opt/opt.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
ccan-opt-helpers.o: $(CCANDIR)/ccan/opt/helpers.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
ccan-opt-parse.o: $(CCANDIR)/ccan/opt/parse.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
ccan-opt-usage.o: $(CCANDIR)/ccan/opt/usage.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
ccan-err.o: $(CCANDIR)/ccan/err/err.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
2015-05-28 23:38:27 +02:00
|
|
|
ccan-noerr.o: $(CCANDIR)/ccan/noerr/noerr.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
2015-05-26 06:38:12 +02:00
|
|
|
ccan-str-hex.o: $(CCANDIR)/ccan/str/hex/hex.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
ccan-crypto-shachain.o: $(CCANDIR)/ccan/crypto/shachain/shachain.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
ccan-crypto-sha256.o: $(CCANDIR)/ccan/crypto/sha256/sha256.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
|