SHARE
TWEET

makefile.unix

a guest Oct 9th, 2011 312 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 license.txt or http://www.opensource.org/licenses/mit-license.php.
  4.  
  5. CXX=g++
  6.  
  7. USE_UPNP:=0
  8.  
  9. DEFS=-DNOPCH -DUSE_SSL
  10.  
  11. # for boost 1.37, add -mt to the boost libraries
  12. LIBS= \
  13.  -Wl,-Bstatic \
  14.    -l boost_system \
  15.    -l boost_filesystem \
  16.    -l boost_program_options \
  17.    -l boost_thread \
  18.    -l db_cxx \
  19.    -l ssl \
  20.    -l crypto
  21.  
  22. ifdef USE_UPNP
  23.         LIBS += -l miniupnpc
  24.         DEFS += -DUSE_UPNP=$(USE_UPNP)
  25. endif
  26.  
  27. LIBS+= \
  28.  -Wl,-Bdynamic \
  29.    -l gthread-2.0 \
  30.    -l z \
  31.    -l dl \
  32.    -l pthread
  33.  
  34.  
  35. # Hardening
  36. # Make some classes of vulnerabilities unexploitable in case one is discovered.
  37. #
  38.     # Stack Canaries
  39.     # Put numbers at the beginning of each stack frame and check that they are the same.
  40.     # If a stack buffer if overflowed, it writes over the canary number and then on return
  41.     # when that number is checked, it won't be the same and the program will exit with
  42.     # a "Stack smashing detected" error instead of being exploited.
  43.     HARDENING=-fstack-protector-all -Wstack-protector
  44.  
  45.     # Make some important things such as the global offset table read only as soon as
  46.     # the dynamic linker is finished building it. This will prevent overwriting of addresses
  47.     # which would later be jumped to.
  48.     HARDENING+=-Wl,-z,relro -Wl,-z,now
  49.  
  50.     # Build position independent code to take advantage of Address Space Layout Randomization
  51.     # offered by some kernels.
  52.     # see doc/build-unix.txt for more information.
  53.     ifdef PIE
  54.         HARDENING+=-fPIE -pie
  55.     endif
  56.  
  57.     # -D_FORTIFY_SOURCE=2 does some checking for potentially exploitable code patterns in
  58.     # the source such overflowing a statically defined buffer.
  59.     HARDENING+=-D_FORTIFY_SOURCE=2
  60. #
  61.  
  62.  
  63. DEBUGFLAGS=-g
  64. CXXFLAGS=-O2 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(HARDENING)
  65. HEADERS = \
  66.     base58.h \
  67.     bignum.h \
  68.     crypter.h \
  69.     db.h \
  70.     headers.h \
  71.     init.h \
  72.     irc.h \
  73.     key.h \
  74.     keystore.h \
  75.     main.h \
  76.     net.h \
  77.     noui.h \
  78.     protocol.h \
  79.     bitcoinrpc.h \
  80.     script.h \
  81.     scrypt.h \
  82.     serialize.h \
  83.     strlcpy.h \
  84.     uint256.h \
  85.     util.h \
  86.     wallet.h
  87.  
  88. OBJS= \
  89.     obj/crypter.o \
  90.     obj/db.o \
  91.     obj/init.o \
  92.     obj/irc.o \
  93.     obj/keystore.o \
  94.     obj/main.o \
  95.     obj/net.o \
  96.     obj/protocol.o \
  97.     obj/bitcoinrpc.o \
  98.     obj/script.o \
  99.     obj/scrypt.o \
  100.     obj/util.o \
  101.     obj/wallet.o
  102.  
  103.  
  104. all: litecoind
  105.  
  106. # auto-generated dependencies:
  107. -include obj/nogui/*.P
  108. -include obj/test/*.P
  109.  
  110. obj/nogui/scrypt.o: scrypt.c
  111.         gcc -c -o $@ $^
  112.  
  113. obj/nogui/scrypt.o: scrypt.c
  114.         gcc -c -o $@ $^
  115.  
  116. obj/nogui/%.o: %.cpp
  117.         $(CXX) -c $(CXXFLAGS) -MMD -o $@ $<
  118.         @cp $(@:%.o=%.d) $(@:%.o=%.P); \
  119.           sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
  120.               -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
  121.           rm -f $(@:%.o=%.d)
  122.  
  123. litecoind: $(OBJS:obj/%=obj/nogui/%)
  124.         $(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS)
  125.  
  126. obj/test/%.o: test/%.cpp
  127.         $(CXX) -c $(CXXFLAGS) -MMD -o $@ $<
  128.         @cp $(@:%.o=%.d) $(@:%.o=%.P); \
  129.           sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
  130.               -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
  131.           rm -f $(@:%.o=%.d)
  132.  
  133. test_bitcoin: obj/test/test_bitcoin.o $(filter-out obj/nogui/init.o,$(OBJS:obj/%=obj/nogui/%))
  134.         $(CXX) $(CXXFLAGS) -o $@ $(LIBPATHS) $^ -Wl,-Bstatic -lboost_unit_test_framework $(LIBS)
  135.  
  136. clean:
  137.         -rm -f litecoind test_bitcoin
  138.         -rm -f obj/*.o
  139.         -rm -f obj/nogui/*.o
  140.         -rm -f obj/test/*.o
  141.         -rm -f obj/*.P
  142.         -rm -f obj/nogui/*.P
  143.         -rm -f obj/test/*.P
  144.  
  145.  
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top