Manual merge of jaromil's source tree reorg commit.
[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 -DFOURWAYSSE2 -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=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
42     script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h
43
44 OBJS= \
45     obj/util.o \
46     obj/script.o \
47     obj/db.o \
48     obj/net.o \
49     obj/irc.o \
50     obj/main.o \
51     obj/rpc.o \
52     obj/init.o \
53     cryptopp/obj/sha.o \
54     cryptopp/obj/cpu.o
55
56
57 all: bitcoin
58
59
60 obj/%.o: %.cpp $(HEADERS)
61         $(CXX) -c $(CXXFLAGS) $(WXINCLUDEPATHS) -DGUI -o $@ $<
62
63 cryptopp/obj/%.o: cryptopp/%.cpp
64         $(CXX) -c $(CXXFLAGS) -O3 -o $@ $<
65
66 bitcoin: $(OBJS) obj/ui.o obj/uibase.o
67         $(CXX) $(CXXFLAGS) -o $@ $^ $(WXLIBS) $(LIBS)
68
69
70 obj/nogui/%.o: %.cpp $(HEADERS)
71         $(CXX) -c $(CXXFLAGS) -o $@ $<
72
73 bitcoind: $(OBJS:obj/%=obj/nogui/%)
74         $(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS)
75
76
77 clean:
78         -rm -f obj/*.o
79         -rm -f obj/nogui/*.o
80         -rm -f cryptopp/obj/*.o
81         -rm -f headers.h.gch
82         -rm -f bitcoin
83         -rm -f bitcoind