]> Git Repo - VerusCoin.git/blob - src/Makefile.am
Remove libsnark from depends system and integrate it into build system.
[VerusCoin.git] / src / Makefile.am
1 DIST_SUBDIRS = secp256k1 snark univalue
2 AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS)
3
4
5 if EMBEDDED_LEVELDB
6 LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/include
7 LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/helpers/memenv
8 LIBLEVELDB += $(builddir)/leveldb/libleveldb.a
9 LIBMEMENV  += $(builddir)/leveldb/libmemenv.a
10
11 # NOTE: This dependency is not strictly necessary, but without it make may try to build both in parallel, which breaks the LevelDB build system in a race
12 $(LIBLEVELDB): $(LIBMEMENV)
13
14 $(LIBLEVELDB) $(LIBMEMENV):
15         @echo "Building LevelDB ..." && $(MAKE) -C $(@D) $(@F) CXX="$(CXX)" \
16           CC="$(CC)" PLATFORM=$(TARGET_OS) AR="$(AR)" $(LEVELDB_TARGET_FLAGS) \
17           OPT="$(CXXFLAGS) $(CPPFLAGS) -D__STDC_LIMIT_MACROS"
18 endif
19
20 BITCOIN_CONFIG_INCLUDES=-I$(builddir)/config
21 BITCOIN_INCLUDES=-I$(builddir) -I$(builddir)/obj $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) $(CRYPTO_CFLAGS) $(SSL_CFLAGS)
22
23 BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include
24 BITCOIN_INCLUDES += -I$(srcdir)/snark/build/include
25 BITCOIN_INCLUDES += -I$(srcdir)/snark/build/include/libsnark
26 BITCOIN_INCLUDES += -I$(srcdir)/univalue/include
27
28 LIBBITCOIN_SERVER=libbitcoin_server.a
29 LIBBITCOIN_WALLET=libbitcoin_wallet.a
30 LIBBITCOIN_COMMON=libbitcoin_common.a
31 LIBBITCOIN_CLI=libbitcoin_cli.a
32 LIBBITCOIN_UTIL=libbitcoin_util.a
33 LIBBITCOIN_CRYPTO=crypto/libbitcoin_crypto.a
34 LIBSECP256K1=secp256k1/libsecp256k1.la
35 LIBSNARK=snark/build/lib/libsnark.a
36 LIBUNIVALUE=univalue/libunivalue.la
37 LIBZCASH=libzcash.a
38
39 # libsnark is added as a dependency here solely to ensure it is built early, so
40 # that its header files are collated for use in later build steps.
41 $(LIBSECP256K1): $(LIBSNARK) $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*)
42         $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
43
44 $(LIBSNARK): $(wildcard snark/src/*)
45         CXXFLAGS="-fPIC -DBINARY_OUTPUT -DNO_PT_COMPRESSION=1" $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C snark/ install PREFIX=$(srcdir)/build DEPINST=$(prefix) CURVE=ALT_BN128 MULTICORE=1 NO_PROCPS=1 NO_GTEST=1 NO_DOCS=1 STATIC=1 NO_SUPERCOP=1 FEATUREFLAGS=-DMONTGOMERY_OUTPUT OPTFLAGS="-O2 -march=x86-64"
46
47 $(LIBUNIVALUE): $(wildcard univalue/lib/*)
48         $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C univalue/
49
50 # Make is not made aware of per-object dependencies to avoid limiting building parallelization
51 # But to build the less dependent modules first, we manually select their order here:
52 EXTRA_LIBRARIES = \
53   crypto/libbitcoin_crypto.a \
54   libbitcoin_util.a \
55   libbitcoin_common.a \
56   libbitcoin_server.a \
57   libbitcoin_cli.a \
58   libzcash.a
59 if ENABLE_WALLET
60 BITCOIN_INCLUDES += $(BDB_CPPFLAGS)
61 EXTRA_LIBRARIES += libbitcoin_wallet.a
62 endif
63 if ENABLE_ZMQ
64 EXTRA_LIBRARIES += libbitcoin_zmq.a
65 endif
66 if ENABLE_PROTON
67 EXTRA_LIBRARIES += libbitcoin_proton.a
68 endif
69
70 if BUILD_BITCOIN_LIBS
71 lib_LTLIBRARIES = libzcashconsensus.la
72 LIBZCASH_CONSENSUS=libzcashconsensus.la
73 else
74 LIBZCASH_CONSENSUS=
75 endif
76
77 bin_PROGRAMS =
78 noinst_PROGRAMS =
79 TESTS =
80
81 if BUILD_BITCOIND
82   bin_PROGRAMS += zcashd
83 endif
84
85 if BUILD_BITCOIN_UTILS
86   bin_PROGRAMS += zcash-cli zcash-tx
87 endif
88
89 LIBZCASH_H = \
90   zcash/IncrementalMerkleTree.hpp \
91   zcash/NoteEncryption.hpp \
92   zcash/Address.hpp \
93   zcash/JoinSplit.hpp \
94   zcash/Note.hpp \
95   zcash/prf.h \
96   zcash/Proof.hpp \
97   zcash/util.h \
98   zcash/Zcash.h
99
100 .PHONY: FORCE check-symbols check-security
101 # bitcoin core #
102 BITCOIN_CORE_H = \
103   addrman.h \
104   alert.h \
105   amount.h \
106   amqp/amqpabstractnotifier.h \
107   amqp/amqpconfig.h \
108   amqp/amqpnotificationinterface.h \
109   amqp/amqppublishnotifier.h \
110   amqp/amqpsender.h \
111   arith_uint256.h \
112   asyncrpcoperation.h \
113   asyncrpcqueue.h \
114   base58.h \
115   bloom.h \
116   chain.h \
117   chainparams.h \
118   chainparamsbase.h \
119   chainparamsseeds.h \
120   checkpoints.h \
121   checkqueue.h \
122   clientversion.h \
123   coincontrol.h \
124   coins.h \
125   compat.h \
126   compat/byteswap.h \
127   compat/endian.h \
128   compat/sanity.h \
129   compressor.h \
130   consensus/consensus.h \
131   consensus/params.h \
132   consensus/validation.h \
133   core_io.h \
134   core_memusage.h \
135   deprecation.h \
136   hash.h \
137   httprpc.h \
138   httpserver.h \
139   init.h \
140   key.h \
141   keystore.h \
142   leveldbwrapper.h \
143   limitedmap.h \
144   main.h \
145   memusage.h \
146   merkleblock.h \
147   metrics.h \
148   miner.h \
149   mruset.h \
150   net.h \
151   netbase.h \
152   noui.h \
153   policy/fees.h \
154   pow.h \
155   primitives/block.h \
156   primitives/transaction.h \
157   protocol.h \
158   pubkey.h \
159   random.h \
160   reverselock.h \
161   rpcclient.h \
162   rpcprotocol.h \
163   rpcserver.h \
164   scheduler.h \
165   script/interpreter.h \
166   script/script.h \
167   script/script_error.h \
168   script/sigcache.h \
169   script/sign.h \
170   script/standard.h \
171   serialize.h \
172   streams.h \
173   support/allocators/secure.h \
174   support/allocators/zeroafterfree.h \
175   support/cleanse.h \
176   support/events.h \
177   support/pagelocker.h \
178   sync.h \
179   threadsafety.h \
180   timedata.h \
181   tinyformat.h \
182   torcontrol.h \
183   txdb.h \
184   txmempool.h \
185   ui_interface.h \
186   uint256.h \
187   uint252.h \
188   undo.h \
189   util.h \
190   utilmoneystr.h \
191   utilstrencodings.h \
192   utiltime.h \
193   validationinterface.h \
194   version.h \
195   wallet/asyncrpcoperation_sendmany.h \
196   wallet/crypter.h \
197   wallet/db.h \
198   wallet/wallet.h \
199   wallet/wallet_ismine.h \
200   wallet/walletdb.h \
201   zmq/zmqabstractnotifier.h \
202   zmq/zmqconfig.h\
203   zmq/zmqnotificationinterface.h \
204   zmq/zmqpublishnotifier.h
205
206
207 obj/build.h: FORCE
208         @$(MKDIR_P) $(builddir)/obj
209         @$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \
210           $(abs_top_srcdir)
211 libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
212
213 # server: zcashd
214 libbitcoin_server_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
215 libbitcoin_server_a_SOURCES = \
216   sendalert.cpp \
217   addrman.cpp \
218   alert.cpp \
219   alertkeys.h \
220   asyncrpcoperation.cpp \
221   asyncrpcqueue.cpp \
222   bloom.cpp \
223   chain.cpp \
224   checkpoints.cpp \
225   deprecation.cpp \
226   httprpc.cpp \
227   httpserver.cpp \
228   init.cpp \
229   leveldbwrapper.cpp \
230   main.cpp \
231   merkleblock.cpp \
232   metrics.cpp \
233   miner.cpp \
234   net.cpp \
235   noui.cpp \
236   policy/fees.cpp \
237   pow.cpp \
238   rest.cpp \
239   rpcblockchain.cpp \
240   rpcmining.cpp \
241   rpcmisc.cpp \
242   rpcnet.cpp \
243   rpcrawtransaction.cpp \
244   rpcserver.cpp \
245   script/sigcache.cpp \
246   timedata.cpp \
247   torcontrol.cpp \
248   txdb.cpp \
249   txmempool.cpp \
250   validationinterface.cpp \
251   $(BITCOIN_CORE_H) \
252   $(LIBZCASH_H)
253
254 if ENABLE_ZMQ
255 LIBBITCOIN_ZMQ=libbitcoin_zmq.a
256
257 libbitcoin_zmq_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(ZMQ_CFLAGS)
258 libbitcoin_zmq_a_SOURCES = \
259   zmq/zmqabstractnotifier.cpp \
260   zmq/zmqnotificationinterface.cpp \
261   zmq/zmqpublishnotifier.cpp
262 endif
263
264 if ENABLE_PROTON
265 LIBBITCOIN_PROTON=libbitcoin_proton.a
266
267 libbitcoin_proton_a_CPPFLAGS = $(BITCOIN_INCLUDES)
268 libbitcoin_proton_a_SOURCES = \
269   amqp/amqpabstractnotifier.cpp \
270   amqp/amqpnotificationinterface.cpp \
271   amqp/amqppublishnotifier.cpp
272 endif
273
274 # wallet: zcashd, but only linked when wallet enabled
275 libbitcoin_wallet_a_CPPFLAGS = $(BITCOIN_INCLUDES)
276 libbitcoin_wallet_a_SOURCES = \
277   utiltest.cpp \
278   utiltest.h \
279   zcbenchmarks.cpp \
280   zcbenchmarks.h \
281   wallet/asyncrpcoperation_sendmany.cpp \
282   wallet/crypter.cpp \
283   wallet/db.cpp \
284   wallet/rpcdump.cpp \
285   wallet/rpcwallet.cpp \
286   wallet/wallet.cpp \
287   wallet/wallet_ismine.cpp \
288   wallet/walletdb.cpp \
289   $(BITCOIN_CORE_H) \
290   $(LIBZCASH_H)
291
292 # crypto primitives library
293 crypto_libbitcoin_crypto_a_CPPFLAGS = $(BITCOIN_CONFIG_INCLUDES)
294 crypto_libbitcoin_crypto_a_SOURCES = \
295   crypto/common.h \
296   crypto/equihash.cpp \
297   crypto/equihash.h \
298   crypto/equihash.tcc \
299   crypto/hmac_sha256.cpp \
300   crypto/hmac_sha256.h \
301   crypto/hmac_sha512.cpp \
302   crypto/hmac_sha512.h \
303   crypto/ripemd160.cpp \
304   crypto/ripemd160.h \
305   crypto/sha1.cpp \
306   crypto/sha1.h \
307   crypto/sha256.cpp \
308   crypto/sha256.h \
309   crypto/sha512.cpp \
310   crypto/sha512.h
311
312 if ENABLE_MINING
313 EQUIHASH_TROMP_SOURCES = \
314   pow/tromp/equi_miner.h \
315   pow/tromp/equi.h \
316   pow/tromp/osx_barrier.h
317
318 crypto_libbitcoin_crypto_a_CPPFLAGS += \
319   -DEQUIHASH_TROMP_ATOMIC
320 crypto_libbitcoin_crypto_a_SOURCES += \
321   ${EQUIHASH_TROMP_SOURCES}
322 endif
323
324 # common: shared between zcashd and non-server tools
325 libbitcoin_common_a_CPPFLAGS = $(BITCOIN_INCLUDES)
326 libbitcoin_common_a_SOURCES = \
327   amount.cpp \
328   arith_uint256.cpp \
329   base58.cpp \
330   chainparams.cpp \
331   coins.cpp \
332   compressor.cpp \
333   core_read.cpp \
334   core_write.cpp \
335   hash.cpp \
336   key.cpp \
337   keystore.cpp \
338   netbase.cpp \
339   primitives/block.cpp \
340   primitives/transaction.cpp \
341   protocol.cpp \
342   pubkey.cpp \
343   scheduler.cpp \
344   script/interpreter.cpp \
345   script/script.cpp \
346   script/script_error.cpp \
347   script/sign.cpp \
348   script/standard.cpp \
349   $(BITCOIN_CORE_H) \
350   $(LIBZCASH_H)
351
352 # util: shared between all executables.
353 # This library *must* be included to make sure that the glibc
354 # backward-compatibility objects and their sanity checks are linked.
355 libbitcoin_util_a_CPPFLAGS = $(BITCOIN_INCLUDES)
356 libbitcoin_util_a_SOURCES = \
357   support/pagelocker.cpp \
358   chainparamsbase.cpp \
359   clientversion.cpp \
360   compat/glibc_sanity.cpp \
361   compat/glibcxx_sanity.cpp \
362   compat/strnlen.cpp \
363   random.cpp \
364   rpcprotocol.cpp \
365   support/cleanse.cpp \
366   sync.cpp \
367   uint256.cpp \
368   util.cpp \
369   utilmoneystr.cpp \
370   utilstrencodings.cpp \
371   utiltime.cpp \
372   $(BITCOIN_CORE_H) \
373   $(LIBZCASH_H)
374
375 if GLIBC_BACK_COMPAT
376 libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
377 endif
378
379 # cli: zcash-cli
380 libbitcoin_cli_a_CPPFLAGS = $(BITCOIN_INCLUDES)
381 libbitcoin_cli_a_SOURCES = \
382   rpcclient.cpp \
383   $(BITCOIN_CORE_H) \
384   $(LIBZCASH_H)
385
386 nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
387 #
388
389 # bitcoind binary #
390 zcashd_SOURCES = bitcoind.cpp
391 zcashd_CPPFLAGS = $(BITCOIN_INCLUDES)
392 zcashd_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
393
394 if TARGET_WINDOWS
395 zcashd_SOURCES += bitcoind-res.rc
396 endif
397
398 zcashd_LDADD = \
399   $(LIBBITCOIN_SERVER) \
400   $(LIBBITCOIN_COMMON) \
401   $(LIBUNIVALUE) \
402   $(LIBBITCOIN_UTIL) \
403   $(LIBBITCOIN_CRYPTO) \
404   $(LIBZCASH) \
405   $(LIBSNARK) \
406   $(LIBLEVELDB) \
407   $(LIBMEMENV) \
408   $(LIBSECP256K1)
409
410 if ENABLE_ZMQ
411 zcashd_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
412 endif
413
414 if ENABLE_WALLET
415 zcashd_LDADD += libbitcoin_wallet.a
416 endif
417
418 zcashd_LDADD += \
419   $(BOOST_LIBS) \
420   $(BDB_LIBS) \
421   $(SSL_LIBS) \
422   $(CRYPTO_LIBS) \
423   $(EVENT_PTHREADS_LIBS) \
424   $(EVENT_LIBS) \
425   $(LIBBITCOIN_CRYPTO) \
426   $(LIBZCASH_LIBS)
427
428 if ENABLE_PROTON
429 zcashd_LDADD += $(LIBBITCOIN_PROTON) $(PROTON_LIBS)
430 endif
431
432 # bitcoin-cli binary #
433 zcash_cli_SOURCES = bitcoin-cli.cpp
434 zcash_cli_CPPFLAGS = $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
435 zcash_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
436
437 if TARGET_WINDOWS
438 zcash_cli_SOURCES += bitcoin-cli-res.rc
439 endif
440
441 zcash_cli_LDADD = \
442   $(LIBBITCOIN_CLI) \
443   $(LIBUNIVALUE) \
444   $(LIBBITCOIN_UTIL) \
445   $(BOOST_LIBS) \
446   $(SSL_LIBS) \
447   $(CRYPTO_LIBS) \
448   $(EVENT_LIBS) \
449   $(LIBZCASH) \
450   $(LIBSNARK) \
451   $(LIBBITCOIN_CRYPTO) \
452   $(LIBZCASH_LIBS)
453 #
454
455 # zcash-tx binary #
456 zcash_tx_SOURCES = bitcoin-tx.cpp
457 zcash_tx_CPPFLAGS = $(BITCOIN_INCLUDES)
458 zcash_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
459
460 if TARGET_WINDOWS
461 zcash_tx_SOURCES += bitcoin-tx-res.rc
462 endif
463
464 # FIXME: Is libzcash needed for zcash_tx?
465 zcash_tx_LDADD = \
466   $(LIBUNIVALUE) \
467   $(LIBBITCOIN_COMMON) \
468   $(LIBBITCOIN_UTIL) \
469   $(LIBSECP256K1) \
470   $(LIBZCASH) \
471   $(LIBSNARK) \
472   $(LIBBITCOIN_CRYPTO) \
473   $(LIBZCASH_LIBS)
474
475 zcash_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
476 #
477
478 # zcash protocol primitives #
479 libzcash_a_SOURCES = \
480   zcash/IncrementalMerkleTree.cpp \
481   zcash/NoteEncryption.cpp \
482   zcash/Address.cpp \
483   zcash/JoinSplit.cpp \
484   zcash/Proof.cpp \
485   zcash/Note.cpp \
486   zcash/prf.cpp \
487   zcash/util.cpp \
488   zcash/circuit/commitment.tcc \
489   zcash/circuit/gadget.tcc \
490   zcash/circuit/merkle.tcc \
491   zcash/circuit/note.tcc \
492   zcash/circuit/prfs.tcc \
493   zcash/circuit/utils.tcc
494
495 libzcash_a_CPPFLAGS = -DMULTICORE -fopenmp -fPIC -DBINARY_OUTPUT -DCURVE_ALT_BN128 -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS $(HARDENED_CPPFLAGS) -pipe -O1 -g -Wstack-protector -fstack-protector-all -fPIE -fvisibility=hidden -DSTATIC $(BITCOIN_INCLUDES)
496
497 libzcash_a_CXXFLAGS = $(HARDENED_CXXFLAGS) -fwrapv -fno-strict-aliasing
498
499 libzcash_a_LDFLAGS = $(HARDENED_LDFLAGS)
500
501 libzcash_a_CPPFLAGS += -DMONTGOMERY_OUTPUT
502
503 # zcashconsensus library #
504 if BUILD_BITCOIN_LIBS
505 include_HEADERS = script/zcashconsensus.h
506 libzcashconsensus_la_SOURCES = \
507   crypto/equihash.cpp \
508   crypto/hmac_sha512.cpp \
509   crypto/ripemd160.cpp \
510   crypto/sha1.cpp \
511   crypto/sha256.cpp \
512   crypto/sha512.cpp \
513   hash.cpp \
514   primitives/transaction.cpp \
515   pubkey.cpp \
516   script/zcashconsensus.cpp \
517   script/interpreter.cpp \
518   script/script.cpp \
519   uint256.cpp \
520   utilstrencodings.cpp
521
522 if GLIBC_BACK_COMPAT
523   libzcashconsensus_la_SOURCES += compat/glibc_compat.cpp
524 endif
525
526 libzcashconsensus_la_LDFLAGS = -no-undefined $(RELDFLAGS)
527 libzcashconsensus_la_LIBADD = $(LIBSECP256K1)
528 libzcashconsensus_la_CPPFLAGS = -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
529
530 endif
531 #
532
533 CLEANFILES = leveldb/libleveldb.a leveldb/libmemenv.a *.gcda *.gcno */*.gcno wallet/*/*.gcno
534
535 DISTCLEANFILES = obj/build.h
536
537 EXTRA_DIST = leveldb
538
539 clean-local:
540         -$(MAKE) -C leveldb clean
541         -$(MAKE) -C secp256k1 clean
542         rm -f leveldb/*/*.gcno leveldb/helpers/memenv/*.gcno
543         -rm -f config.h
544
545 .rc.o:
546         @test -f $(WINDRES)
547         $(AM_V_GEN) $(WINDRES) -DWINDRES_PREPROC -i $< -o $@
548
549 .mm.o:
550         $(AM_V_CXX) $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
551           $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)  -c -o $@ $<
552
553 check-symbols: $(bin_PROGRAMS)
554 if GLIBC_BACK_COMPAT
555         @echo "Checking glibc back compat of [$(bin_PROGRAMS)]..."
556         $(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(top_srcdir)/contrib/devtools/symbol-check.py < $(bin_PROGRAMS)
557 endif
558
559 check-security: $(bin_PROGRAMS)
560 if HARDEN
561         @echo "Checking binary security of [$(bin_PROGRAMS)]..."
562         $(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(top_srcdir)/contrib/devtools/security-check.py < $(bin_PROGRAMS)
563 endif
564
565 %.pb.cc %.pb.h: %.proto
566         @test -f $(PROTOC)
567         $(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(abspath $(<D) $<)
568
569 if ENABLE_TESTS
570 include Makefile.test.include
571 include Makefile.gtest.include
572 endif
573
574 include Makefile.zcash.include
This page took 0.053397 seconds and 4 git commands to generate.