11DIST_SUBDIRS = secp256k1 univalue
2- AM_LDFLAGS = $(PTHREAD_CFLAGS ) $(LIBTOOL_LDFLAGS )
32
3+ AM_LDFLAGS = $(PTHREAD_CFLAGS ) $(LIBTOOL_LDFLAGS ) $(HARDENED_LDFLAGS )
4+ AM_CXXFLAGS = $(HARDENED_CXXFLAGS )
5+ AM_CPPFLAGS = $(HARDENED_CPPFLAGS )
46
57if EMBEDDED_LEVELDB
68LEVELDB_CPPFLAGS += -I$(srcdir ) /leveldb/include
@@ -14,7 +16,7 @@ $(LIBLEVELDB): $(LIBMEMENV)
1416$(LIBLEVELDB ) $(LIBMEMENV ) :
1517 @echo " Building LevelDB ..." && $(MAKE ) -C $(@D ) $(@F ) CXX=" $( CXX) " \
1618 CC=" $( CC) " PLATFORM=$(TARGET_OS ) AR=" $( AR) " $(LEVELDB_TARGET_FLAGS ) \
17- OPT ="$(CXXFLAGS ) $(CPPFLAGS ) -D__STDC_LIMIT_MACROS"
19+ OPT ="$(AM_CXXFLAGS ) $( PIE_FLAGS ) $( CXXFLAGS ) $( AM_CPPFLAGS ) $(CPPFLAGS ) -D__STDC_LIMIT_MACROS"
1820endif
1921
2022BITCOIN_CONFIG_INCLUDES =-I$(builddir ) /config
@@ -178,7 +180,8 @@ obj/build.h: FORCE
178180libbitcoin_util_a-clientversion.$(OBJEXT ) : obj/build.h
179181
180182# server: shared between bitcoind and bitcoin-qt
181- libbitcoin_server_a_CPPFLAGS = $(BITCOIN_INCLUDES ) $(MINIUPNPC_CPPFLAGS ) $(EVENT_CFLAGS ) $(EVENT_PTHREADS_CFLAGS )
183+ libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS ) $(BITCOIN_INCLUDES ) $(MINIUPNPC_CPPFLAGS ) $(EVENT_CFLAGS ) $(EVENT_PTHREADS_CFLAGS )
184+ libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS )
182185libbitcoin_server_a_SOURCES = \
183186 addrman.cpp \
184187 alert.cpp \
@@ -215,6 +218,7 @@ if ENABLE_ZMQ
215218LIBBITCOIN_ZMQ =libbitcoin_zmq.a
216219
217220libbitcoin_zmq_a_CPPFLAGS = $(BITCOIN_INCLUDES ) $(ZMQ_CFLAGS )
221+ libbitcoin_zmq_a_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS )
218222libbitcoin_zmq_a_SOURCES = \
219223 zmq/zmqabstractnotifier.cpp \
220224 zmq/zmqnotificationinterface.cpp \
@@ -224,7 +228,8 @@ endif
224228
225229# wallet: shared between bitcoind and bitcoin-qt, but only linked
226230# when wallet enabled
227- libbitcoin_wallet_a_CPPFLAGS = $(BITCOIN_INCLUDES )
231+ libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS ) $(BITCOIN_INCLUDES )
232+ libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS )
228233libbitcoin_wallet_a_SOURCES = \
229234 wallet/crypter.cpp \
230235 wallet/db.cpp \
@@ -236,7 +241,8 @@ libbitcoin_wallet_a_SOURCES = \
236241 $(BITCOIN_CORE_H )
237242
238243# crypto primitives library
239- crypto_libbitcoin_crypto_a_CPPFLAGS = $(BITCOIN_CONFIG_INCLUDES )
244+ crypto_libbitcoin_crypto_a_CPPFLAGS = $(AM_CPPFLAGS ) $(BITCOIN_CONFIG_INCLUDES )
245+ crypto_libbitcoin_crypto_a_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS )
240246crypto_libbitcoin_crypto_a_SOURCES = \
241247 crypto/common.h \
242248 crypto/hmac_sha256.cpp \
@@ -253,7 +259,8 @@ crypto_libbitcoin_crypto_a_SOURCES = \
253259 crypto/sha512.h
254260
255261# common: shared between bitcoind, and bitcoin-qt and non-server tools
256- libbitcoin_common_a_CPPFLAGS = $(BITCOIN_INCLUDES )
262+ libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS ) $(BITCOIN_INCLUDES )
263+ libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS )
257264libbitcoin_common_a_SOURCES = \
258265 amount.cpp \
259266 arith_uint256.cpp \
@@ -284,7 +291,8 @@ libbitcoin_common_a_SOURCES = \
284291# util: shared between all executables.
285292# This library *must* be included to make sure that the glibc
286293# backward-compatibility objects and their sanity checks are linked.
287- libbitcoin_util_a_CPPFLAGS = $(BITCOIN_INCLUDES )
294+ libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS ) $(BITCOIN_INCLUDES )
295+ libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS )
288296libbitcoin_util_a_SOURCES = \
289297 support/pagelocker.cpp \
290298 chainparamsbase.cpp \
@@ -308,7 +316,8 @@ libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
308316endif
309317
310318# cli: shared between bitcoin-cli and bitcoin-qt
311- libbitcoin_cli_a_CPPFLAGS = $(BITCOIN_INCLUDES )
319+ libbitcoin_cli_a_CPPFLAGS = $(AM_CPPFLAGS ) $(BITCOIN_INCLUDES )
320+ libbitcoin_cli_a_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS )
312321libbitcoin_cli_a_SOURCES = \
313322 rpcclient.cpp \
314323 $(BITCOIN_CORE_H )
@@ -318,7 +327,8 @@ nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
318327
319328# bitcoind binary #
320329bitcoind_SOURCES = bitcoind.cpp
321- bitcoind_CPPFLAGS = $(BITCOIN_INCLUDES )
330+ bitcoind_CPPFLAGS = $(AM_CPPFLAGS ) $(BITCOIN_INCLUDES )
331+ bitcoind_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS )
322332bitcoind_LDFLAGS = $(RELDFLAGS ) $(AM_LDFLAGS ) $(LIBTOOL_APP_LDFLAGS )
323333
324334if TARGET_WINDOWS
@@ -347,7 +357,8 @@ bitcoind_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPN
347357
348358# bitcoin-cli binary #
349359bitcoin_cli_SOURCES = bitcoin-cli.cpp
350- bitcoin_cli_CPPFLAGS = $(BITCOIN_INCLUDES ) $(EVENT_CFLAGS )
360+ bitcoin_cli_CPPFLAGS = $(AM_CPPFLAGS ) $(BITCOIN_INCLUDES ) $(EVENT_CFLAGS )
361+ bitcoin_cli_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS )
351362bitcoin_cli_LDFLAGS = $(RELDFLAGS ) $(AM_LDFLAGS ) $(LIBTOOL_APP_LDFLAGS )
352363
353364if TARGET_WINDOWS
@@ -364,7 +375,8 @@ bitcoin_cli_LDADD += $(BOOST_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(EVENT_LIBS)
364375
365376# bitcoin-tx binary #
366377bitcoin_tx_SOURCES = bitcoin-tx.cpp
367- bitcoin_tx_CPPFLAGS = $(BITCOIN_INCLUDES )
378+ bitcoin_tx_CPPFLAGS = $(AM_CPPFLAGS ) $(BITCOIN_INCLUDES )
379+ bitcoin_tx_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS )
368380bitcoin_tx_LDFLAGS = $(RELDFLAGS ) $(AM_LDFLAGS ) $(LIBTOOL_APP_LDFLAGS )
369381
370382if TARGET_WINDOWS
@@ -405,9 +417,10 @@ if GLIBC_BACK_COMPAT
405417 libbitcoinconsensus_la_SOURCES += compat/glibc_compat.cpp
406418endif
407419
408- libbitcoinconsensus_la_LDFLAGS = -no-undefined $(RELDFLAGS )
420+ libbitcoinconsensus_la_LDFLAGS = $( AM_LDFLAGS ) -no-undefined $(RELDFLAGS )
409421libbitcoinconsensus_la_LIBADD = $(CRYPTO_LIBS )
410- libbitcoinconsensus_la_CPPFLAGS = $(CRYPTO_CFLAGS ) -I$(builddir ) /obj -DBUILD_BITCOIN_INTERNAL
422+ libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS ) $(CRYPTO_CFLAGS ) -I$(builddir ) /obj -DBUILD_BITCOIN_INTERNAL
423+ libbitcoinconsensus_la_CXXFLAGS = $(AM_CXXFLAGS ) $(PIE_FLAGS )
411424
412425endif
413426#
@@ -443,7 +456,7 @@ clean-local:
443456
444457.mm.o :
445458 $(AM_V_CXX ) $(OBJCXX ) $(DEFS ) $(DEFAULT_INCLUDES ) $(INCLUDES ) $(AM_CPPFLAGS ) \
446- $(CPPFLAGS ) $(AM_CXXFLAGS ) $(QT_INCLUDES ) $(CXXFLAGS ) -c -o $@ $<
459+ $(CPPFLAGS ) $(AM_CXXFLAGS ) $(QT_INCLUDES ) $(AM_CXXFLAGS ) $( PIE_FLAGS ) $( CXXFLAGS ) -c -o $@ $<
447460
448461% .pb.cc % .pb.h : % .proto
449462 @test -f $(PROTOC )
0 commit comments