@@ -15,14 +15,23 @@ AM_LIBTOOLFLAGS = --preserve-dup-deps
15
15
PTHREAD_FLAGS = $(PTHREAD_CFLAGS ) $(PTHREAD_LIBS )
16
16
EXTRA_LIBRARIES =
17
17
18
+ lib_LTLIBRARIES =
19
+ noinst_LTLIBRARIES =
20
+
21
+ bin_PROGRAMS =
22
+ noinst_PROGRAMS =
23
+ TESTS =
24
+ BENCHMARKS =
25
+
18
26
BITCOIN_INCLUDES =-I$(builddir ) -I$(srcdir ) /$(MINISKETCH_INCLUDE_DIR_INT ) -I$(srcdir ) /secp256k1/include -I$(srcdir ) /$(UNIVALUE_INCLUDE_DIR_INT ) $(BDB_CPPFLAGS ) $(BOOST_CPPFLAGS ) $(LEVELDB_CPPFLAGS )
19
27
20
28
LIBBITCOIN_NODE =libbitcoin_node.a
21
29
LIBBITCOIN_COMMON =libbitcoin_common.a
22
30
LIBBITCOIN_CONSENSUS =libbitcoin_consensus.a
23
31
LIBBITCOIN_CLI =libbitcoin_cli.a
32
+ LIBBITCOIN_KERNEL =libbitcoin_kernel.a
24
33
LIBBITCOIN_UTIL =libbitcoin_util.a
25
- LIBBITCOIN_CRYPTO_BASE =crypto/libbitcoin_crypto_base.a
34
+ LIBBITCOIN_CRYPTO_BASE =crypto/libbitcoin_crypto_base.la
26
35
LIBBITCOINQT =qt/libbitcoinqt.a
27
36
LIBSECP256K1 =secp256k1/libsecp256k1.la
28
37
@@ -32,36 +41,39 @@ endif
32
41
if BUILD_BITCOIN_LIBS
33
42
LIBBITCOINCONSENSUS =libbitcoinconsensus.la
34
43
endif
44
+ if BUILD_BITCOIN_KERNEL_LIB
45
+ LIBBITCOINKERNEL =libbitcoinkernel.la
46
+ endif
35
47
if ENABLE_WALLET
36
48
LIBBITCOIN_WALLET =libbitcoin_wallet.a
37
49
LIBBITCOIN_WALLET_TOOL =libbitcoin_wallet_tool.a
38
50
endif
39
51
40
- LIBBITCOIN_CRYPTO = $(LIBBITCOIN_CRYPTO_BASE )
52
+ LIBBITCOIN_CRYPTO = $(LIBBITCOIN_CRYPTO_BASE )
41
53
if ENABLE_SSE41
42
- LIBBITCOIN_CRYPTO_SSE41 = crypto/libbitcoin_crypto_sse41.a
54
+ LIBBITCOIN_CRYPTO_SSE41 = crypto/libbitcoin_crypto_sse41.la
43
55
LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_SSE41 )
44
56
endif
45
57
if ENABLE_AVX2
46
- LIBBITCOIN_CRYPTO_AVX2 = crypto/libbitcoin_crypto_avx2.a
58
+ LIBBITCOIN_CRYPTO_AVX2 = crypto/libbitcoin_crypto_avx2.la
47
59
LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_AVX2 )
48
60
endif
49
61
if ENABLE_X86_SHANI
50
- LIBBITCOIN_CRYPTO_X86_SHANI = crypto/libbitcoin_crypto_x86_shani.a
62
+ LIBBITCOIN_CRYPTO_X86_SHANI = crypto/libbitcoin_crypto_x86_shani.la
51
63
LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_X86_SHANI )
52
64
endif
53
65
if ENABLE_ARM_SHANI
54
- LIBBITCOIN_CRYPTO_ARM_SHANI = crypto/libbitcoin_crypto_arm_shani.a
66
+ LIBBITCOIN_CRYPTO_ARM_SHANI = crypto/libbitcoin_crypto_arm_shani.la
55
67
LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_ARM_SHANI )
56
68
endif
69
+ noinst_LTLIBRARIES += $(LIBBITCOIN_CRYPTO )
57
70
58
71
$(LIBSECP256K1 ) : $(wildcard secp256k1/src/* .h) $(wildcard secp256k1/src/* .c) $(wildcard secp256k1/include/* )
59
72
$(AM_V_at )$(MAKE ) $(AM_MAKEFLAGS ) -C $(@D ) $(@F )
60
73
61
74
# Make is not made aware of per-object dependencies to avoid limiting building parallelization
62
75
# But to build the less dependent modules first, we manually select their order here:
63
76
EXTRA_LIBRARIES += \
64
- $(LIBBITCOIN_CRYPTO ) \
65
77
$(LIBBITCOIN_UTIL ) \
66
78
$(LIBBITCOIN_COMMON ) \
67
79
$(LIBBITCOIN_CONSENSUS ) \
@@ -72,14 +84,6 @@ EXTRA_LIBRARIES += \
72
84
$(LIBBITCOIN_WALLET_TOOL ) \
73
85
$(LIBBITCOIN_ZMQ )
74
86
75
- lib_LTLIBRARIES = $(LIBBITCOINCONSENSUS )
76
- noinst_LTLIBRARIES =
77
-
78
- bin_PROGRAMS =
79
- noinst_PROGRAMS =
80
- TESTS =
81
- BENCHMARKS =
82
-
83
87
if BUILD_BITCOIND
84
88
bin_PROGRAMS += bitcoind
85
89
endif
@@ -464,9 +468,16 @@ libbitcoin_wallet_tool_a_SOURCES = \
464
468
$(BITCOIN_CORE_H )
465
469
466
470
# crypto primitives library
467
- crypto_libbitcoin_crypto_base_a_CPPFLAGS = $(AM_CPPFLAGS )
468
- crypto_libbitcoin_crypto_base_a_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS )
469
- crypto_libbitcoin_crypto_base_a_SOURCES = \
471
+ crypto_libbitcoin_crypto_base_la_CPPFLAGS = $(AM_CPPFLAGS )
472
+
473
+ # Specify -static in both CXXFLAGS and LDFLAGS so libtool will only build a
474
+ # static version of this library. We don't need a dynamic version, and a dynamic
475
+ # version can't be used on windows anyway because the library doesn't currently
476
+ # export DLL symbols.
477
+ crypto_libbitcoin_crypto_base_la_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS ) -static
478
+ crypto_libbitcoin_crypto_base_la_LDFLAGS = $(AM_LDFLAGS ) -static
479
+
480
+ crypto_libbitcoin_crypto_base_la_SOURCES = \
470
481
crypto/aes.cpp \
471
482
crypto/aes.h \
472
483
crypto/chacha_poly_aead.h \
@@ -498,32 +509,44 @@ crypto_libbitcoin_crypto_base_a_SOURCES = \
498
509
crypto/siphash.h
499
510
500
511
if USE_ASM
501
- crypto_libbitcoin_crypto_base_a_SOURCES += crypto/sha256_sse4.cpp
512
+ crypto_libbitcoin_crypto_base_la_SOURCES += crypto/sha256_sse4.cpp
502
513
endif
503
514
504
- crypto_libbitcoin_crypto_sse41_a_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS )
505
- crypto_libbitcoin_crypto_sse41_a_CPPFLAGS = $(AM_CPPFLAGS )
506
- crypto_libbitcoin_crypto_sse41_a_CXXFLAGS += $(SSE41_CXXFLAGS )
507
- crypto_libbitcoin_crypto_sse41_a_CPPFLAGS += -DENABLE_SSE41
508
- crypto_libbitcoin_crypto_sse41_a_SOURCES = crypto/sha256_sse41.cpp
509
-
510
- crypto_libbitcoin_crypto_avx2_a_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS )
511
- crypto_libbitcoin_crypto_avx2_a_CPPFLAGS = $(AM_CPPFLAGS )
512
- crypto_libbitcoin_crypto_avx2_a_CXXFLAGS += $(AVX2_CXXFLAGS )
513
- crypto_libbitcoin_crypto_avx2_a_CPPFLAGS += -DENABLE_AVX2
514
- crypto_libbitcoin_crypto_avx2_a_SOURCES = crypto/sha256_avx2.cpp
515
-
516
- crypto_libbitcoin_crypto_x86_shani_a_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS )
517
- crypto_libbitcoin_crypto_x86_shani_a_CPPFLAGS = $(AM_CPPFLAGS )
518
- crypto_libbitcoin_crypto_x86_shani_a_CXXFLAGS += $(X86_SHANI_CXXFLAGS )
519
- crypto_libbitcoin_crypto_x86_shani_a_CPPFLAGS += -DENABLE_X86_SHANI
520
- crypto_libbitcoin_crypto_x86_shani_a_SOURCES = crypto/sha256_x86_shani.cpp
521
-
522
- crypto_libbitcoin_crypto_arm_shani_a_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS )
523
- crypto_libbitcoin_crypto_arm_shani_a_CPPFLAGS = $(AM_CPPFLAGS )
524
- crypto_libbitcoin_crypto_arm_shani_a_CXXFLAGS += $(ARM_SHANI_CXXFLAGS )
525
- crypto_libbitcoin_crypto_arm_shani_a_CPPFLAGS += -DENABLE_ARM_SHANI
526
- crypto_libbitcoin_crypto_arm_shani_a_SOURCES = crypto/sha256_arm_shani.cpp
515
+ # See explanation for -static in crypto_libbitcoin_crypto_base_la's LDFLAGS and
516
+ # CXXFLAGS above
517
+ crypto_libbitcoin_crypto_sse41_la_LDFLAGS = $(AM_LDFLAGS ) -static
518
+ crypto_libbitcoin_crypto_sse41_la_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS ) -static
519
+ crypto_libbitcoin_crypto_sse41_la_CPPFLAGS = $(AM_CPPFLAGS )
520
+ crypto_libbitcoin_crypto_sse41_la_CXXFLAGS += $(SSE41_CXXFLAGS )
521
+ crypto_libbitcoin_crypto_sse41_la_CPPFLAGS += -DENABLE_SSE41
522
+ crypto_libbitcoin_crypto_sse41_la_SOURCES = crypto/sha256_sse41.cpp
523
+
524
+ # See explanation for -static in crypto_libbitcoin_crypto_base_la's LDFLAGS and
525
+ # CXXFLAGS above
526
+ crypto_libbitcoin_crypto_avx2_la_LDFLAGS = $(AM_LDFLAGS ) -static
527
+ crypto_libbitcoin_crypto_avx2_la_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS ) -static
528
+ crypto_libbitcoin_crypto_avx2_la_CPPFLAGS = $(AM_CPPFLAGS )
529
+ crypto_libbitcoin_crypto_avx2_la_CXXFLAGS += $(AVX2_CXXFLAGS )
530
+ crypto_libbitcoin_crypto_avx2_la_CPPFLAGS += -DENABLE_AVX2
531
+ crypto_libbitcoin_crypto_avx2_la_SOURCES = crypto/sha256_avx2.cpp
532
+
533
+ # See explanation for -static in crypto_libbitcoin_crypto_base_la's LDFLAGS and
534
+ # CXXFLAGS above
535
+ crypto_libbitcoin_crypto_x86_shani_la_LDFLAGS = $(AM_LDFLAGS ) -static
536
+ crypto_libbitcoin_crypto_x86_shani_la_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS ) -static
537
+ crypto_libbitcoin_crypto_x86_shani_la_CPPFLAGS = $(AM_CPPFLAGS )
538
+ crypto_libbitcoin_crypto_x86_shani_la_CXXFLAGS += $(X86_SHANI_CXXFLAGS )
539
+ crypto_libbitcoin_crypto_x86_shani_la_CPPFLAGS += -DENABLE_X86_SHANI
540
+ crypto_libbitcoin_crypto_x86_shani_la_SOURCES = crypto/sha256_x86_shani.cpp
541
+
542
+ # See explanation for -static in crypto_libbitcoin_crypto_base_la's LDFLAGS and
543
+ # CXXFLAGS above
544
+ crypto_libbitcoin_crypto_arm_shani_la_LDFLAGS = $(AM_LDFLAGS ) -static
545
+ crypto_libbitcoin_crypto_arm_shani_la_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS ) -static
546
+ crypto_libbitcoin_crypto_arm_shani_la_CPPFLAGS = $(AM_CPPFLAGS )
547
+ crypto_libbitcoin_crypto_arm_shani_la_CXXFLAGS += $(ARM_SHANI_CXXFLAGS )
548
+ crypto_libbitcoin_crypto_arm_shani_la_CPPFLAGS += -DENABLE_ARM_SHANI
549
+ crypto_libbitcoin_crypto_arm_shani_la_SOURCES = crypto/sha256_arm_shani.cpp
527
550
528
551
# consensus: shared between all executables that validate any consensus rules.
529
552
libbitcoin_consensus_a_CPPFLAGS = $(AM_CPPFLAGS ) $(BITCOIN_INCLUDES )
@@ -683,7 +706,6 @@ bitcoin_bin_ldadd = \
683
706
$(LIBBITCOIN_CONSENSUS ) \
684
707
$(LIBBITCOIN_CRYPTO ) \
685
708
$(LIBLEVELDB ) \
686
- $(LIBLEVELDB_SSE42 ) \
687
709
$(LIBMEMENV ) \
688
710
$(LIBSECP256K1 )
689
711
@@ -782,8 +804,48 @@ bitcoin_util_LDADD = \
782
804
#
783
805
784
806
# bitcoin-chainstate binary #
785
- bitcoin_chainstate_SOURCES = \
786
- bitcoin-chainstate.cpp \
807
+ bitcoin_chainstate_SOURCES = bitcoin-chainstate.cpp
808
+ bitcoin_chainstate_CPPFLAGS = $(AM_CPPFLAGS ) $(BITCOIN_INCLUDES )
809
+ bitcoin_chainstate_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS )
810
+
811
+ # $(LIBTOOL_APP_LDFLAGS) deliberately omitted here so that we can test linking
812
+ # bitcoin-chainstate against libbitcoinkernel as a shared or static library by
813
+ # setting --{en,dis}able-shared.
814
+ bitcoin_chainstate_LDFLAGS = $(RELDFLAGS ) $(AM_LDFLAGS ) $(PTHREAD_FLAGS )
815
+ bitcoin_chainstate_LDADD = $(LIBBITCOINKERNEL )
816
+ #
817
+
818
+ # bitcoinkernel library #
819
+ if BUILD_BITCOIN_KERNEL_LIB
820
+ lib_LTLIBRARIES += $(LIBBITCOINKERNEL )
821
+
822
+ libbitcoinkernel_la_LDFLAGS = $(AM_LDFLAGS ) -no-undefined $(RELDFLAGS ) $(PTHREAD_FLAGS )
823
+ libbitcoinkernel_la_LIBADD = $(LIBBITCOIN_CRYPTO ) $(LIBUNIVALUE ) $(LIBLEVELDB ) $(LIBMEMENV ) $(LIBSECP256K1 )
824
+ libbitcoinkernel_la_CPPFLAGS = $(AM_CPPFLAGS ) -I$(builddir ) /obj -I$(srcdir ) /secp256k1/include -DBUILD_BITCOIN_INTERNAL $(BOOST_CPPFLAGS ) $(LEVELDB_CPPFLAGS ) -I$(srcdir ) /$(UNIVALUE_INCLUDE_DIR_INT )
825
+
826
+ # libbitcoinkernel requires default symbol visibility, explicitly specify that
827
+ # here so that things still work even when user configures with
828
+ # --enable-reduce-exports
829
+ #
830
+ # Note this is a quick hack that will be removed as we incrementally define what
831
+ # to export from the library.
832
+ libbitcoinkernel_la_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS ) -fvisibility=default
833
+
834
+ # TODO: For now, Specify -static in both CXXFLAGS and LDFLAGS when building for
835
+ # windows targets so libtool will only build a static version of this
836
+ # library. There are unresolved problems when building dll's for mingw-w64
837
+ # and attempting to statically embed libstdc++, libpthread, etc.
838
+ if TARGET_WINDOWS
839
+ libbitcoinkernel_la_LDFLAGS += -static
840
+ libbitcoinkernel_la_CXXFLAGS += -static
841
+ endif
842
+
843
+ # TODO: libbitcoinkernel is a work in progress consensus engine library, as more
844
+ # and more modules are decoupled from the consensus engine, this list will
845
+ # shrink to only those which are absolutely necessary. For example, things
846
+ # like index/*.cpp will be removed.
847
+ libbitcoinkernel_la_SOURCES = \
848
+ kernel/bitcoinkernel.cpp \
787
849
arith_uint256.cpp \
788
850
blockfilter.cpp \
789
851
chain.cpp \
@@ -862,26 +924,19 @@ bitcoin_chainstate_SOURCES = \
862
924
validationinterface.cpp \
863
925
versionbits.cpp \
864
926
warnings.cpp
865
- bitcoin_chainstate_CPPFLAGS = $(AM_CPPFLAGS ) $(BITCOIN_INCLUDES )
866
- bitcoin_chainstate_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS )
867
- bitcoin_chainstate_LDFLAGS = $(RELDFLAGS ) $(AM_LDFLAGS ) $(LIBTOOL_APP_LDFLAGS ) $(PTHREAD_FLAGS )
868
- bitcoin_chainstate_LDADD = \
869
- $(LIBBITCOIN_CRYPTO ) \
870
- $(LIBUNIVALUE ) \
871
- $(LIBSECP256K1 ) \
872
- $(LIBLEVELDB ) \
873
- $(LIBLEVELDB_SSE42 ) \
874
- $(LIBMEMENV )
875
927
876
928
# Required for obj/build.h to be generated first.
877
929
# More details: https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html
878
- bitcoin_chainstate-clientversion.$(OBJEXT ) : obj/build.h
930
+ libbitcoinkernel_la-clientversion.l$(OBJEXT ) : obj/build.h
931
+ endif # BUILD_BITCOIN_KERNEL_LIB
879
932
#
880
933
881
934
# bitcoinconsensus library #
882
935
if BUILD_BITCOIN_LIBS
936
+ lib_LTLIBRARIES += $(LIBBITCOINCONSENSUS )
937
+
883
938
include_HEADERS = script/bitcoinconsensus.h
884
- libbitcoinconsensus_la_SOURCES = support/cleanse.cpp $(crypto_libbitcoin_crypto_base_a_SOURCES ) $(libbitcoin_consensus_a_SOURCES )
939
+ libbitcoinconsensus_la_SOURCES = support/cleanse.cpp $(crypto_libbitcoin_crypto_base_la_SOURCES ) $(libbitcoin_consensus_a_SOURCES )
885
940
886
941
libbitcoinconsensus_la_LDFLAGS = $(AM_LDFLAGS ) -no-undefined $(RELDFLAGS )
887
942
libbitcoinconsensus_la_LIBADD = $(LIBSECP256K1 )
0 commit comments