Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "daemon/jsmn"]
path = daemon/jsmn
url = https://github.com/zserge/jsmn
[submodule "bitcoin/libbase58"]
path = bitcoin/libbase58
url = https://github.com/bitcoin/libbase58.git
3 changes: 1 addition & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ You will need several development libraries:
* libprotoc: the Google protocol buffer v2 library, 2.6.0 or above.
* protobuf-c: version 1.1.0 or above.
* libsodium: for crypto.
* libbase58: for bitcoin's base58 encoding.
* libsqlite3: for database support.
* libgmp: for secp256k1
* asciidoc: for formatting the man page (if you change them)
Expand All @@ -18,7 +17,7 @@ To Build on Ubuntu 16.04

Get dependencies:
```
sudo apt-get install autoconf libtool libprotobuf-c-dev libsodium-dev libbase58-dev libsqlite3-dev libgmp-dev libsqlite3-dev asciidoc
sudo apt-get install autoconf libtool libprotobuf-c-dev libsodium-dev libsqlite3-dev libgmp-dev libsqlite3-dev asciidoc
```

Clone lightning and initialize submodules:
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,14 @@ CWARNFLAGS := -Werror -Wall -Wundef -Wmissing-prototypes -Wmissing-declarations
CDEBUGFLAGS := -g -fstack-protector
CFLAGS := $(CWARNFLAGS) $(CDEBUGFLAGS) -I $(CCANDIR) -I secp256k1/include/ -I . $(FEATURES)

LDLIBS := -lprotobuf-c -lgmp -lsodium -lbase58 -lsqlite3
LDLIBS := -lprotobuf-c -lgmp -lsodium -lsqlite3
$(PROGRAMS): CFLAGS+=-I.

default: $(PROGRAMS) $(MANPAGES) daemon-all

include bitcoin/Makefile
include wire/Makefile

# Git doesn't maintain timestamps, so we only regen if git says we should.
CHANGED_FROM_GIT = [ x"`git log $@ | head -n1`" != x"`git log $< | head -n1`" -o x"`git diff $<`" != x"" ]

Expand All @@ -194,7 +197,7 @@ $(MANPAGES): doc/%: doc/%.txt
$(CCAN_OBJS) $(CDUMP_OBJS) $(HELPER_OBJS) $(BITCOIN_OBJS) $(TEST_PROGRAMS:=.o) ccan/ccan/cdump/tools/cdump-enumstr.o: $(CCAN_HEADERS)

# Except for CCAN, everything depends on bitcoin/ and core headers.
$(HELPER_OBJS) $(CORE_OBJS) $(BITCOIN_OBJS) $(TEST_PROGRAMS:=.o): $(BITCOIN_HEADERS) $(CORE_HEADERS) $(CCAN_HEADERS) $(GEN_HEADERS)
$(HELPER_OBJS) $(CORE_OBJS) $(BITCOIN_OBJS) $(LIBBASE58_OBJS) $(WIRE_OBJS) $(TEST_PROGRAMS:=.o): $(BITCOIN_HEADERS) $(CORE_HEADERS) $(CCAN_HEADERS) $(GEN_HEADERS) $(LIBBASE58_HEADERS)

test-protocol: test/test_protocol
set -e; TMP=`mktemp`; for f in test/commits/*.script; do if ! $(VALGRIND) test/test_protocol < $$f > $$TMP; then echo "test/test_protocol < $$f FAILED" >&2; exit 1; fi; diff -u $$TMP $$f.expected; done; rm $$TMP
Expand All @@ -206,9 +209,6 @@ protocol-diagrams: $(patsubst %.script, doc/protocol-%.svg, $(notdir $(wildcard

check: test-protocol

include bitcoin/Makefile
include wire/Makefile

# Keep includes in alpha order.
check-src-include-order/%: %
@if [ "$$(grep '^#include' < $<)" != "$$(grep '^#include' < $< | LC_ALL=C sort)" ]; then echo "$<:1: includes out of order"; grep '^#include' < $<; echo VERSUS; grep '^#include' < $< | LC_ALL=C sort; exit 1; fi
Expand Down Expand Up @@ -260,7 +260,7 @@ secp256k1/libsecp256k1.la:
lightning.pb-c.c lightning.pb-c.h: lightning.proto
@if $(CHANGED_FROM_GIT); then echo $(PROTOCC) lightning.proto --c_out=.; $(PROTOCC) lightning.proto --c_out=.; else touch $@; fi

$(TEST_PROGRAMS): % : %.o $(BITCOIN_OBJS) $(WIRE_OBJS) $(CCAN_OBJS) utils.o version.o libsecp256k1.a
$(TEST_PROGRAMS): % : %.o $(BITCOIN_OBJS) $(LIBBASE58_OBJS) $(WIRE_OBJS) $(CCAN_OBJS) utils.o version.o libsecp256k1.a

ccan/config.h: ccan/tools/configurator/configurator
if $< > $@.new; then mv $@.new $@; else rm $@.new; exit 1; fi
Expand Down
20 changes: 20 additions & 0 deletions bitcoin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,23 @@ $(BITCOIN_TEST_OBJS): $(CCAN_HEADERS) $(BITCOIN_HEADERS) $(BITCOIN_SRC)
check: bitcoin-tests

bitcoin-tests: $(BITCOIN_TEST_PROGRAMS:%=unittest/%)

LIBBASE58_HEADERS := bitcoin/libbase58/libbase58.h

LIBBASE58_SRC := bitcoin/libbase58/base58.c

# Can't be inside submodule, as that makes git think it's dirty.
LIBBASE58_OBJS := bitcoin/libbase58.o

# Git submodules are seriously broken.
bitcoin/libbase58/libbase58.h:
git submodule update bitcoin/libbase58/
[ -f $@ ] || git submodule update --init bitcoin/libbase58/

# If we tell Make that the above builds both, it runs it twice in
# parallel. So we lie :(
bitcoin/libbase58/base58.c: bitcoin/libbase58/libbase58.h
[ -f $@ ]

bitcoin/libbase58.o: bitcoin/libbase58/base58.c
$(COMPILE.c) $(OUTPUT_OPTION) $<
2 changes: 1 addition & 1 deletion bitcoin/base58.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "address.h"
#include "base58.h"
#include "libbase58/libbase58.h"
#include "privkey.h"
#include "pubkey.h"
#include "shadouble.h"
#include "utils.h"
#include <assert.h>
#include <ccan/build_assert/build_assert.h>
#include <ccan/tal/str/str.h>
#include <libbase58.h>
#include <secp256k1.h>
#include <string.h>

Expand Down
1 change: 1 addition & 0 deletions bitcoin/libbase58
Submodule libbase58 added at 16c252
4 changes: 2 additions & 2 deletions daemon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ daemon/jsmn/jsmn.c: daemon/jsmn/jsmn.h
daemon/jsmn.o: daemon/jsmn/jsmn.c
$(COMPILE.c) -DJSMN_STRICT=1 $(OUTPUT_OPTION) $<

daemon/lightningd: $(DAEMON_OBJS) $(DAEMON_LIB_OBJS) $(DAEMON_JSMN_OBJS) $(CORE_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(CCAN_OBJS) libsecp256k1.a
daemon/lightningd: $(DAEMON_OBJS) $(DAEMON_LIB_OBJS) $(DAEMON_JSMN_OBJS) $(CORE_OBJS) $(BITCOIN_OBJS) $(LIBBASE58_OBJS) $(WIRE_OBJS) $(CCAN_OBJS) libsecp256k1.a

daemon/lightning-cli: $(DAEMON_CLI_OBJS) $(DAEMON_LIB_OBJS) $(DAEMON_JSMN_OBJS) $(CORE_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(CCAN_OBJS) libsecp256k1.a
daemon/lightning-cli: $(DAEMON_CLI_OBJS) $(DAEMON_LIB_OBJS) $(DAEMON_JSMN_OBJS) $(CORE_OBJS) $(BITCOIN_OBJS) $(LIBBASE58_OBJS) $(WIRE_OBJS) $(CCAN_OBJS) libsecp256k1.a

daemon-clean:
$(RM) $(DAEMON_OBJS) $(DAEMON_LIB_OBJS) $(DAEMON_CLI_OBJS) $(DAEMON_JSMN_OBJS) $(DAEMON_GEN_HEADERS)
Expand Down
2 changes: 1 addition & 1 deletion daemon/test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ update-mocks-daemon/test/%: daemon/test/%

update-mocks: $(DAEMON_TEST_SRC:%=update-mocks-%)

$(DAEMON_TEST_PROGRAMS): $(CCAN_OBJS) $(BITCOIN_OBJS) libsecp256k1.a utils.o
$(DAEMON_TEST_PROGRAMS): $(CCAN_OBJS) $(BITCOIN_OBJS) $(LIBBASE58_OBJS) libsecp256k1.a utils.o

$(DAEMON_TEST_OBJS): $(DAEMON_HEADERS) $(DAEMON_JSMN_HEADERS) $(BITCOIN_HEADERS) $(CORE_HEADERS) $(GEN_HEADERS) $(DAEMON_GEN_HEADERS) $(CCAN_HEADERS)

Expand Down
2 changes: 1 addition & 1 deletion wire/test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ WIRE_TEST_PROGRAMS := $(WIRE_TEST_OBJS:.o=)

update-mocks: $(WIRE_TEST_SRC:%=update-mocks/%)

$(WIRE_TEST_PROGRAMS): $(CCAN_OBJS) $(BITCOIN_OBJS) libsecp256k1.a utils.o
$(WIRE_TEST_PROGRAMS): $(CCAN_OBJS) $(BITCOIN_OBJS) $(LIBBASE58_OBJS) libsecp256k1.a utils.o

$(WIRE_TEST_OBJS): $(WIRE_HEADERS) $(BITCOIN_HEADERS) $(CORE_HEADERS) $(GEN_HEADERS) $(WIRE_GEN_HEADERS) $(WIRE_GEN_SRC) $(CCAN_HEADERS)

Expand Down