]> Git Repo - VerusCoin.git/blame - src/makefile.unix
Use a messagebox to display the error when -server is provided without providing...
[VerusCoin.git] / src / makefile.unix
CommitLineData
0a61b0df 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
3f0950ea
MC
5USE_UPNP:=0
6
b4d0588d
LD
7DEFS=-DNOPCH
8
1466b8b7 9DEFS += $(addprefix -I,$(CURDIR) $(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH))
7dcd2004 10LIBS = $(addprefix -L,$(BOOST_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH))
b4d0588d
LD
11
12LMODE = dynamic
13LMODE2 = dynamic
14ifdef STATIC
15 LMODE = static
16 ifeq (${STATIC}, all)
17 LMODE2 = static
18 endif
ca9afa84
LD
19else
20 TESTDEFS += -DBOOST_TEST_DYN_LINK
b4d0588d 21endif
8bb5edc1 22
0a61b0df 23# for boost 1.37, add -mt to the boost libraries
7dcd2004 24LIBS += \
b4d0588d
LD
25 -Wl,-B$(LMODE) \
26 -l boost_system$(BOOST_LIB_SUFFIX) \
27 -l boost_filesystem$(BOOST_LIB_SUFFIX) \
28 -l boost_program_options$(BOOST_LIB_SUFFIX) \
29 -l boost_thread$(BOOST_LIB_SUFFIX) \
30 -l db_cxx$(BDB_LIB_SUFFIX) \
ed54768f 31 -l ssl \
8bb5edc1
MC
32 -l crypto
33
b4d0588d
LD
34ifndef USE_UPNP
35 override USE_UPNP = -
36endif
37ifneq (${USE_UPNP}, -)
3f0950ea
MC
38 LIBS += -l miniupnpc
39 DEFS += -DUSE_UPNP=$(USE_UPNP)
40endif
8bb5edc1 41
b4d0588d
LD
42ifneq (${USE_SSL}, 0)
43 DEFS += -DUSE_SSL
44endif
45
8bb5edc1 46LIBS+= \
b4d0588d 47 -Wl,-B$(LMODE2) \
2fad3d34 48 -l z \
1a5364bd
RC
49 -l dl \
50 -l pthread
0a61b0df 51
8bb5edc1 52
3f94dfa2 53# Hardening
54# Make some classes of vulnerabilities unexploitable in case one is discovered.
55#
1e5f9393 56 # This is a workaround for Ubuntu bug #691722, the default -fstack-protector causes
57 # -fstack-protector-all to be ignored unless -fno-stack-protector is used first.
58 # see: https://bugs.launchpad.net/ubuntu/+source/gcc-4.5/+bug/691722
59 HARDENING=-fno-stack-protector
60
3f94dfa2 61 # Stack Canaries
62 # Put numbers at the beginning of each stack frame and check that they are the same.
63 # If a stack buffer if overflowed, it writes over the canary number and then on return
64 # when that number is checked, it won't be the same and the program will exit with
65 # a "Stack smashing detected" error instead of being exploited.
1e5f9393 66 HARDENING+=-fstack-protector-all -Wstack-protector
3f94dfa2 67
68 # Make some important things such as the global offset table read only as soon as
69 # the dynamic linker is finished building it. This will prevent overwriting of addresses
70 # which would later be jumped to.
71 HARDENING+=-Wl,-z,relro -Wl,-z,now
72
73 # Build position independent code to take advantage of Address Space Layout Randomization
74 # offered by some kernels.
75 # see doc/build-unix.txt for more information.
76 ifdef PIE
77 HARDENING+=-fPIE -pie
78 endif
79
80 # -D_FORTIFY_SOURCE=2 does some checking for potentially exploitable code patterns in
81 # the source such overflowing a statically defined buffer.
82 HARDENING+=-D_FORTIFY_SOURCE=2
83#
84
85
565c4771 86DEBUGFLAGS=-g
a1e0bb5a 87CXXFLAGS=-O2
7868808b 88xCXXFLAGS=-pthread -Wextra -Wno-sign-compare -Wno-char-subscripts -Wno-invalid-offsetof -Wformat -Wformat-security \
a1de57a0 89 $(DEBUGFLAGS) $(DEFS) $(HARDENING) $(CXXFLAGS)
0a61b0df 90
91OBJS= \
eb5fff9e 92 obj/checkpoints.o \
67a42f92 93 obj/netbase.o \
5fee401f 94 obj/addrman.o \
e49b83bb 95 obj/crypter.o \
93db3fce 96 obj/key.o \
0a61b0df 97 obj/db.o \
e49b83bb 98 obj/init.o \
0a61b0df 99 obj/irc.o \
e89b9f6a 100 obj/keystore.o \
0a61b0df 101 obj/main.o \
e49b83bb 102 obj/net.o \
507fd9d1 103 obj/protocol.o \
e122e423 104 obj/bitcoinrpc.o \
95d888a6 105 obj/rpcdump.o \
e49b83bb
GS
106 obj/script.o \
107 obj/util.o \
6ccff2cb 108 obj/wallet.o
0a61b0df 109
110
565c4771 111all: bitcoind
0a61b0df 112
4ffbdcc0 113# auto-generated dependencies:
a1de57a0 114-include obj/*.P
34c69036 115-include obj-test/*.P
0a61b0df 116
a1de57a0 117obj/%.o: %.cpp
a1e0bb5a 118 $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $<
4ffbdcc0
GA
119 @cp $(@:%.o=%.d) $(@:%.o=%.P); \
120 sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
121 -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
122 rm -f $(@:%.o=%.d)
0a61b0df 123
a1de57a0 124bitcoind: $(OBJS:obj/%=obj/%)
a1e0bb5a 125 $(CXX) $(xCXXFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
0a61b0df 126
34c69036 127TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))
1466b8b7 128
34c69036 129obj-test/%.o: test/%.cpp
ca9afa84 130 $(CXX) -c $(TESTDEFS) $(xCXXFLAGS) -MMD -o $@ $<
4ffbdcc0
GA
131 @cp $(@:%.o=%.d) $(@:%.o=%.P); \
132 sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
133 -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
134 rm -f $(@:%.o=%.d)
8baf865c 135
a1de57a0 136test_bitcoin: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
ca9afa84 137 $(CXX) $(xCXXFLAGS) -o $@ $(LIBPATHS) $^ -Wl,-B$(LMODE) -lboost_unit_test_framework $(LDFLAGS) $(LIBS)
0a61b0df 138
139clean:
565c4771 140 -rm -f bitcoind test_bitcoin
0a61b0df 141 -rm -f obj/*.o
34c69036 142 -rm -f obj-test/*.o
4ffbdcc0 143 -rm -f obj/*.P
34c69036 144 -rm -f obj-test/*.P
This page took 0.076295 seconds and 4 git commands to generate.