daily pastebin goal
40%
SHARE
TWEET

Untitled

a guest Jan 29th, 2018 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Copyright (c) 2009-2010 Satoshi Nakamoto
  2. # Distributed under the MIT/X11 software license, see the accompanying
  3. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
  4.  
  5. # :=1 --> Enable IPv6 support
  6. # :=0 --> Disable IPv6 support
  7. USE_IPV6:=1
  8. USE_DEBUG:=0
  9.  
  10. LINK:=$(CXX)
  11.  
  12. DEFS=-DBOOST_SPIRIT_THREADSAFE -DBOOST_NO_CXX11_SCOPED_ENUMS -D_FILE_OFFSET_BITS=64 -DUSE_NATIVE_I2P
  13.  
  14. DEFS += $(addprefix -I,$(CURDIR) $(CURDIR)/obj $(CURDIR)/i2psam $(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH))
  15. LIBS = $(addprefix -L,$(BOOST_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH))
  16.  
  17. TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data)
  18.  
  19. LMODE = dynamic
  20. LMODE2 = dynamic
  21. ifdef STATIC
  22.     LMODE = static
  23.     ifeq (${STATIC}, all)
  24.         LMODE2 = static
  25.     endif
  26. else
  27.     TESTDEFS += -DBOOST_TEST_DYN_LINK
  28. endif
  29.  
  30. # for boost 1.37, add -mt to the boost libraries
  31. LIBS += \
  32.     -Wl,-B$(LMODE) \
  33.     -lboost_system$(BOOST_LIB_SUFFIX) \
  34.     -lboost_filesystem$(BOOST_LIB_SUFFIX) \
  35.     -lboost_program_options$(BOOST_LIB_SUFFIX) \
  36.     -lboost_thread$(BOOST_LIB_SUFFIX) \
  37.     -ldb_cxx$(BDB_LIB_SUFFIX) \
  38.     -lssl \
  39.     -lcrypto
  40.  
  41. TESTLIBS += \
  42.     -Wl,-B$(LMODE) \
  43.     -lboost_unit_test_framework$(BOOST_LIB_SUFFIX)
  44.  
  45. ifneq (${USE_IPV6}, -)
  46.     DEFS += -DUSE_IPV6=$(USE_IPV6)
  47. endif
  48.  
  49. LIBS += \
  50.     -Wl,-B$(LMODE2) \
  51.     -lz \
  52.     -ldl \
  53.     -lpthread
  54.  
  55. # Hardening
  56. # Make some classes of vulnerabilities unexploitable in case one is discovered.
  57. #
  58.     # This is a workaround for Ubuntu bug #691722, the default -fstack-protector causes
  59.     # -fstack-protector-all to be ignored unless -fno-stack-protector is used first.
  60.     # see: https://bugs.launchpad.net/ubuntu/+source/gcc-4.5/+bug/691722
  61.     HARDENING=-fno-stack-protector
  62.  
  63.     # Stack Canaries
  64.     # Put numbers at the beginning of each stack frame and check that they are the same.
  65.     # If a stack buffer if overflowed, it writes over the canary number and then on return
  66.     # when that number is checked, it won't be the same and the program will exit with
  67.     # a "Stack smashing detected" error instead of being exploited.
  68.     HARDENING+=-fstack-protector-all -Wstack-protector
  69.  
  70.     # Make some important things such as the global offset table read only as soon as
  71.     # the dynamic linker is finished building it. This will prevent overwriting of addresses
  72.     # which would later be jumped to.
  73.     LDHARDENING+=-Wl,-z,relro -Wl,-z,now
  74.  
  75.     # Build position independent code to take advantage of Address Space Layout Randomization
  76.     # offered by some kernels.
  77.     # see doc/build-unix.txt for more information.
  78.     ifdef PIE
  79.         HARDENING+=-fPIE
  80.         LDHARDENING+=-pie
  81.     endif
  82.  
  83.     # -D_FORTIFY_SOURCE=2 does some checking for potentially exploitable code patterns in
  84.     # the source such overflowing a statically defined buffer.
  85.     HARDENING+=-D_FORTIFY_SOURCE=2
  86. #
  87.  
  88. ifneq (${USE_DEBUG}, 0)
  89.     DEBUGFLAGS=-g
  90. endif
  91.  
  92. # CXXFLAGS can be specified on the make command line, so we use xCXXFLAGS that only
  93. # adds some defaults in front. Unfortunately, CXXFLAGS=... $(CXXFLAGS) does not work.
  94. xCXXFLAGS = -std=c++11 -O2 -pthread -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter \
  95.     $(DEBUGFLAGS) $(DEFS) $(HARDENING) $(CXXFLAGS)
  96.  
  97. # LDFLAGS can be specified on the make command line, so we use xLDFLAGS that only
  98. # adds some defaults in front. Unfortunately, LDFLAGS=... $(LDFLAGS) does not work.
  99. xLDFLAGS=$(LDHARDENING) $(LDFLAGS)
  100.  
  101. OBJS = \
  102.     leveldb/libleveldb.a \
  103.     obj/alert.o \
  104.     obj/version.o \
  105.     obj/checkpoints.o \
  106.     obj/netbase.o \
  107.     obj/addrman.o \
  108.     obj/crypter.o \
  109.     obj/key.o \
  110.     obj/db.o \
  111.     obj/init.o \
  112.     obj/keystore.o \
  113.     obj/i2p.o \
  114.     obj/i2psam.o \
  115.     obj/Gost.o \
  116.     obj/main.o \
  117.     obj/net.o \
  118.     obj/protocol.o \
  119.     obj/bitcoinrpc.o \
  120.     obj/rpcdump.o \
  121.     obj/rpcnet.o \
  122.     obj/rpcmining.o \
  123.     obj/rpcwallet.o \
  124.     obj/rpcblockchain.o \
  125.     obj/rpcrawtransaction.o \
  126.     obj/script.o \
  127.     obj/sync.o \
  128.     obj/util.o \
  129.     obj/wallet.o \
  130.     obj/walletdb.o \
  131.     obj/hash.o \
  132.     obj/bloom.o \
  133.     obj/noui.o \
  134.     obj/leveldb.o \
  135.     obj/txdb.o
  136.  
  137. all: gostcoind
  138.  
  139. test check: test_gostcoin FORCE
  140.     ./test_gostcoin
  141.  
  142. #
  143. # LevelDB support
  144. #
  145. MAKEOVERRIDES =
  146. LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a
  147. DEFS += $(addprefix -I,$(CURDIR)/leveldb/include)
  148. DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers)
  149.  
  150. leveldb/libleveldb.a:
  151.     @echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libleveldb.a libmemenv.a && cd ..
  152.  
  153. # auto-generated dependencies:
  154. -include obj/*.P
  155. -include obj-test/*.P
  156.  
  157. obj/build.h: FORCE
  158.     /bin/sh ../share/genbuild.sh obj/build.h
  159.  
  160. version.cpp: obj/build.h
  161.  
  162. DEFS += -DHAVE_BUILD_INFO
  163.  
  164. obj/%.o: %.cpp
  165.     $(CXX) -c $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
  166.     @cp $(@:%.o=%.d) $(@:%.o=%.P); \
  167.         sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
  168.         -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
  169.         rm -f $(@:%.o=%.d)
  170.  
  171. obj/%.o: i2psam/%.cpp
  172.     $(CXX) -c $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
  173.     @cp $(@:%.o=%.d) $(@:%.o=%.P); \
  174.         sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
  175.         -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
  176.         rm -f $(@:%.o=%.d)
  177.  
  178. gostcoind: $(OBJS:obj/%=obj/%)
  179.     $(LINK) $(xCXXFLAGS) -o $@ $^ $(xLDFLAGS) $(LIBS)
  180.  
  181. TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))
  182.  
  183. obj-test/%.o: test/%.cpp
  184.     $(CXX) -c $(TESTDEFS) $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
  185.     @cp $(@:%.o=%.d) $(@:%.o=%.P); \
  186.         sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
  187.         -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
  188.         rm -f $(@:%.o=%.d)
  189.  
  190. test_gostcoin: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
  191.     $(LINK) $(xCXXFLAGS) -o $@ $(LIBPATHS) $^ $(TESTLIBS) $(xLDFLAGS) $(LIBS)
  192.  
  193. clean:
  194.     $(RM) -f gostcoind test_gostcoin
  195.     $(RM) -f obj/*.o
  196.     $(RM) -f obj-test/*.o
  197.     $(RM) -f obj/*.P
  198.     $(RM) -f obj-test/*.P
  199.     $(RM) -f obj/build.h
  200.     -cd leveldb && $(MAKE) clean || true
  201.  
  202. FORCE:
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top