7cc72e0ea281e6a08702b7bb89845c0f269d0778
[novacoin.git] / src / makefile.unix
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 WXINCLUDEPATHS=$(shell wx-config --cxxflags)
8
9 WXLIBS=$(shell wx-config --libs)
10
11 USE_UPNP:=0
12
13 DEFS=-DNOPCH -DUSE_SSL
14
15 # for boost 1.37, add -mt to the boost libraries
16 LIBS= \
17  -Wl,-Bstatic \
18    -l boost_system \
19    -l boost_filesystem \
20    -l boost_program_options \
21    -l boost_thread \
22    -l db_cxx \
23    -l ssl \
24    -l crypto
25
26 ifdef USE_UPNP
27         LIBS += -l miniupnpc
28         DEFS += -DUSE_UPNP=$(USE_UPNP)
29 endif
30
31 LIBS+= \
32  -Wl,-Bdynamic \
33    -l gthread-2.0 \
34    -l z \
35    -l dl \
36    -l pthread
37
38
39 DEBUGFLAGS=-g -D__WXDEBUG__
40 CXXFLAGS=-O2 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS)
41 HEADERS = \
42     base58.h \
43     bignum.h \
44     crypter.h \
45     db.h \
46     headers.h \
47     init.h \
48     irc.h \
49     key.h \
50     keystore.h \
51     main.h \
52     net.h \
53     noui.h \
54     rpc.h \
55     script.h \
56     serialize.h \
57     strlcpy.h \
58     ui.h \
59     uibase.h \
60     uint256.h \
61     util.h \
62     wallet.h
63
64 OBJS= \
65     obj/crypter.o \
66     obj/db.o \
67     obj/init.o \
68     obj/irc.o \
69     obj/keystore.o \
70     obj/main.o \
71     obj/net.o \
72     obj/rpc.o \
73     obj/script.o \
74     obj/util.o \
75     obj/wallet.o \
76     cryptopp/obj/sha.o \
77     cryptopp/obj/cpu.o
78
79
80 all: bitcoin
81
82
83 obj/%.o: %.cpp $(HEADERS)
84         $(CXX) -c $(CXXFLAGS) $(WXINCLUDEPATHS) -DGUI -o $@ $<
85
86 cryptopp/obj/%.o: cryptopp/%.cpp
87         $(CXX) -c $(CXXFLAGS) -O3 -o $@ $<
88
89 bitcoin: $(OBJS) obj/ui.o obj/uibase.o
90         $(CXX) $(CXXFLAGS) -o $@ $^ $(WXLIBS) $(LIBS)
91
92
93 obj/nogui/%.o: %.cpp $(HEADERS)
94         $(CXX) -c $(CXXFLAGS) -o $@ $<
95
96 bitcoind: $(OBJS:obj/%=obj/nogui/%)
97         $(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS)
98
99 obj/test/%.o: test/%.cpp $(HEADERS)
100         $(CXX) -c $(CXXFLAGS) -o $@ $<
101
102 test_bitcoin: obj/test/test_bitcoin.o $(filter-out obj/nogui/init.o,$(OBJS:obj/%=obj/nogui/%))
103         $(CXX) $(CXXFLAGS) -o $@ $(LIBPATHS) $^ -Wl,-Bstatic -lboost_unit_test_framework $(LIBS)
104
105 clean:
106         -rm -f bitcoin bitcoind test_bitcoin
107         -rm -f obj/*.o
108         -rm -f obj/nogui/*.o
109         -rm -f obj/test/*.o
110         -rm -f cryptopp/obj/*.o
111         -rm -f headers.h.gch