-
+ DB27FA66049B17C4C68621529AD41DE8973051762F0A0A96DD87FD9C7D7801FEFB338342CE262124A0623EE319BF05CB3E25B5EB0CB50E27A918409EF90CA96Abitcoin/src/makefile.unix(0 . 0)(1 . 161)
14241 # Copyright (c) 2009-2010 Satoshi Nakamoto
14242 # Distributed under the MIT/X11 software license, see the accompanying
14243 # file license.txt or http://www.opensource.org/licenses/mit-license.php.
14244
14245 USE_UPNP:=0
14246
14247 DEFS=-DNOPCH
14248
14249 DEFS += $(addprefix -I,$(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH))
14250 LIBS = $(addprefix -L,$(BOOST_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH))
14251
14252 LMODE = dynamic
14253 LMODE2 = dynamic
14254 ifdef STATIC
14255 LMODE = static
14256 ifeq (${STATIC}, all)
14257 LMODE2 = static
14258 endif
14259 else
14260 TESTDEFS += -DBOOST_TEST_DYN_LINK
14261 endif
14262
14263 # for boost 1.37, add -mt to the boost libraries
14264 LIBS += \
14265 -Wl,-B$(LMODE) \
14266 -l boost_system$(BOOST_LIB_SUFFIX) \
14267 -l boost_filesystem$(BOOST_LIB_SUFFIX) \
14268 -l boost_program_options$(BOOST_LIB_SUFFIX) \
14269 -l boost_thread$(BOOST_LIB_SUFFIX) \
14270 -l db_cxx$(BDB_LIB_SUFFIX) \
14271 -l ssl \
14272 -l crypto
14273
14274 ifndef USE_UPNP
14275 override USE_UPNP = -
14276 endif
14277 ifneq (${USE_UPNP}, -)
14278 LIBS += -l miniupnpc
14279 DEFS += -DUSE_UPNP=$(USE_UPNP)
14280 endif
14281
14282 ifneq (${USE_SSL}, 0)
14283 DEFS += -DUSE_SSL
14284 endif
14285
14286 LIBS+= \
14287 -Wl,-B$(LMODE2) \
14288 -l z \
14289 -l dl \
14290 -l pthread
14291
14292
14293 # Hardening
14294 # Make some classes of vulnerabilities unexploitable in case one is discovered.
14295 #
14296 # This is a workaround for Ubuntu bug #691722, the default -fstack-protector causes
14297 # -fstack-protector-all to be ignored unless -fno-stack-protector is used first.
14298 # see: https://bugs.launchpad.net/ubuntu/+source/gcc-4.5/+bug/691722
14299 HARDENING=-fno-stack-protector
14300
14301 # Stack Canaries
14302 # Put numbers at the beginning of each stack frame and check that they are the same.
14303 # If a stack buffer if overflowed, it writes over the canary number and then on return
14304 # when that number is checked, it won't be the same and the program will exit with
14305 # a "Stack smashing detected" error instead of being exploited.
14306 HARDENING+=-fstack-protector-all -Wstack-protector
14307
14308 # Make some important things such as the global offset table read only as soon as
14309 # the dynamic linker is finished building it. This will prevent overwriting of addresses
14310 # which would later be jumped to.
14311 HARDENING+=-Wl,-z,relro -Wl,-z,now
14312
14313 # Build position independent code to take advantage of Address Space Layout Randomization
14314 # offered by some kernels.
14315 # see doc/build-unix.txt for more information.
14316 ifdef PIE
14317 HARDENING+=-fPIE -pie
14318 endif
14319
14320 # -D_FORTIFY_SOURCE=2 does some checking for potentially exploitable code patterns in
14321 # the source such overflowing a statically defined buffer.
14322 HARDENING+=-D_FORTIFY_SOURCE=2
14323 #
14324
14325
14326 DEBUGFLAGS=-g
14327 CXXFLAGS=-O2
14328 xCXXFLAGS=-pthread -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(HARDENING) $(CXXFLAGS)
14329 HEADERS = \
14330 base58.h \
14331 bignum.h \
14332 checkpoints.h \
14333 crypter.h \
14334 db.h \
14335 headers.h \
14336 init.h \
14337 irc.h \
14338 key.h \
14339 keystore.h \
14340 main.h \
14341 net.h \
14342 noui.h \
14343 protocol.h \
14344 bitcoinrpc.h \
14345 script.h \
14346 serialize.h \
14347 strlcpy.h \
14348 uint256.h \
14349 util.h \
14350 wallet.h
14351
14352 OBJS= \
14353 obj/checkpoints.o \
14354 obj/crypter.o \
14355 obj/db.o \
14356 obj/init.o \
14357 obj/irc.o \
14358 obj/keystore.o \
14359 obj/main.o \
14360 obj/net.o \
14361 obj/protocol.o \
14362 obj/bitcoinrpc.o \
14363 obj/script.o \
14364 obj/util.o \
14365 obj/wallet.o
14366
14367
14368 all: bitcoind
14369
14370 # auto-generated dependencies:
14371 -include obj/nogui/*.P
14372 -include obj-test/*.P
14373
14374 obj/nogui/%.o: %.cpp
14375 $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $<
14376 @cp $(@:%.o=%.d) $(@:%.o=%.P); \
14377 sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
14378 -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
14379 rm -f $(@:%.o=%.d)
14380
14381 bitcoind: $(OBJS:obj/%=obj/nogui/%)
14382 $(CXX) $(xCXXFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
14383
14384 obj-test/%.o: test/%.cpp
14385 $(CXX) -c $(TESTDEFS) $(xCXXFLAGS) -MMD -o $@ $<
14386 @cp $(@:%.o=%.d) $(@:%.o=%.P); \
14387 sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
14388 -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
14389 rm -f $(@:%.o=%.d)
14390
14391 test_bitcoin: obj-test/test_bitcoin.o $(filter-out obj/nogui/init.o,$(OBJS:obj/%=obj/nogui/%))
14392 $(CXX) $(xCXXFLAGS) -o $@ $(LIBPATHS) $^ -Wl,-B$(LMODE) -lboost_unit_test_framework $(LDFLAGS) $(LIBS)
14393
14394 clean:
14395 -rm -f bitcoind test_bitcoin
14396 -rm -f obj/*.o
14397 -rm -f obj/nogui/*.o
14398 -rm -f obj-test/*.o
14399 -rm -f obj/*.P
14400 -rm -f obj/nogui/*.P
14401 -rm -f obj-test/*.P