@ -16,13 +16,15 @@ endif
LIBSODIUM_HEADERS := external/libsodium/src/libsodium/include/sodium.h
LIBWALLY_HEADERS := external/libwally-core/include/wally_bip32.h \
external/libwally-core/include/wally_core.h \
external/libwally-core/include/wally_psbt.h \
external/libwally-core/include/wally_crypto.h
LIBSECP_HEADERS := external/libwally-core/src/secp256k1/include/secp256k1_ecdh.h \
external/libwally-core/src/secp256k1/include/secp256k1.h
JSMN_HEADERS := external/jsmn/jsmn.h
GHEAP_HEADERS := external/gheap/gheap.h external/gheap/galgorithm.h
GHEAP_HEADERS := external/gheap/gheap.h
LIBBACKTRACE_HEADERS := external/libbacktrace/backtrace.h
EXTERNAL_HEADERS := $( LIBSODIUM_HEADERS) $( LIBWALLY_HEADERS) $( LIBSECP_HEADERS) $( JSMN_HEADERS) $( GHEAP_HEADERS)
EXTERNAL_HEADERS := $( LIBSODIUM_HEADERS) $( LIBWALLY_HEADERS) $( LIBSECP_HEADERS) $( JSMN_HEADERS) $( GHEAP_HEADERS) $( LIBBACKTRACE_HEADERS)
EXTERNAL_LIBS := ${ TARGET_DIR } /libwallycore.a ${ TARGET_DIR } /libsecp256k1.a ${ TARGET_DIR } /libjsmn.a ${ TARGET_DIR } /libbacktrace.a
EXTERNAL_INCLUDE_FLAGS := \
@ -47,19 +49,17 @@ EXTERNAL_LDLIBS := -L${TARGET_DIR} $(patsubst lib%.a,-l%,$(notdir $(EXTERNAL_LIB
submodcheck : FORCE
@tools/refresh-submodules.sh $( SUBMODULES)
$(EXTERNAL_HEADERS) : submodcheck
# We build libsodium, since Ubuntu xenial has one too old.
$(TARGET_DIR)/libsodium.a : $( TARGET_DIR ) /libsodium -build /src /libsodium /libsodium .la
$( MAKE) -C $( TARGET_DIR) /libsodium-build DESTDIR = $$ ( pwd ) /$( TARGET_DIR) install-exec
external/libsodium/src/libsodium/include/sodium.h : submodcheck
$(TARGET_DIR)/libsodium-build/src/libsodium/libsodium.la : external /libsodium /src /libsodium /include /sodium .h
cd external/libsodium && ./autogen.sh
mkdir -p ${ TARGET_DIR } /libsodium-build
cd $( TARGET_DIR) /libsodium-build && $( TOP) /libsodium/configure CC = " $( CC) " --enable-static= yes $( CROSSCOMPILE_OPTS) --enable-shared= no --prefix= / --libdir= / && $( MAKE)
$(LIBWALLY_HEADERS) $(LIBSECP_HEADERS) : submodcheck
# libsecp included in libwally.
# Wildcards here are magic. See http://stackoverflow.com/questions/2973445/gnu-makefile-rule-generating-a-few-targets-from-a-single-source-file
$(TARGET_DIR)/libsecp256k1.% $(TARGET_DIR)/libwallycore.% : $( TARGET_DIR ) /libwally -core -build /src /secp 256k 1/libsecp 256k 1.la $( TARGET_DIR ) /libwally -core -build /src /libwallycore .la
@ -75,8 +75,6 @@ $(TARGET_DIR)/libwally-core-build/src/libwallycore.% $(TARGET_DIR)/libwally-core
mkdir -p ${ TARGET_DIR } /libwally-core-build
cd ${ TARGET_DIR } /libwally-core-build && PYTHON_VERSION = 3 CFLAGS = -std= c99 ${ TOP } /libwally-core/configure CC = " $( CC) " --enable-static= yes $( CROSSCOMPILE_OPTS) --enable-module-recovery --enable-elements --enable-shared= no --prefix= / --libdir= / --enable-debug && $( MAKE)
external/jsmn/jsmn.h : submodcheck
# If we tell Make that the above builds both, it runs it twice in
# parallel. So we lie :(
external/jsmn/jsmn.c : external /jsmn /jsmn .h
@ -89,8 +87,6 @@ $(TARGET_DIR)/jsmn-build/jsmn.o: external/jsmn/jsmn.c Makefile
$(TARGET_DIR)/libjsmn.a : $( TARGET_DIR ) /jsmn -build /jsmn .o
$( AR) rc $@ $<
external/libbacktrace/backtrace.h : submodcheck
# Need separate build dir: changes inside submodule make git think it's dirty.
$(TARGET_DIR)/libbacktrace.a : external /libbacktrace /backtrace .h
@mkdir $( TARGET_DIR) /libbacktrace-build 2>/dev/null || true