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