Remove UPNP support & do some cleanup.
[novacoin.git] / src / makefile.osx
1 # -*- mode: Makefile; -*-
2 # Copyright (c) 2011 Bitcoin Developers
3 # Distributed under the MIT/X11 software license, see the accompanying
4 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6 # Mac OS X makefile for bitcoin
7 # Originally by Laszlo Hanyecz (solar@heliacal.net)
8
9 CXX=llvm-g++
10 DEPSDIR=/opt/local
11
12 INCLUDEPATHS= \
13  -I"$(CURDIR)" \
14  -I"$(CURDIR)"/obj \
15  -I"$(DEPSDIR)/include" \
16  -I"$(DEPSDIR)/include/db48"
17
18 LIBPATHS= \
19  -L"$(DEPSDIR)/lib" \
20  -L"$(DEPSDIR)/lib/db48"
21
22 USE_LEVELDB:=0
23 USE_IPV6:=1
24
25 LIBS= -dead_strip
26
27 ifdef STATIC
28 # Build STATIC if you are redistributing the bitcoind binary
29 LIBS += \
30  $(DEPSDIR)/lib/db48/libdb_cxx-4.8.a \
31  $(DEPSDIR)/lib/libboost_system-mt.a \
32  $(DEPSDIR)/lib/libboost_filesystem-mt.a \
33  $(DEPSDIR)/lib/libboost_program_options-mt.a \
34  $(DEPSDIR)/lib/libboost_thread-mt.a \
35  $(DEPSDIR)/lib/libssl.a \
36  $(DEPSDIR)/lib/libcrypto.a \
37  -lz
38 else
39 LIBS += \
40  -ldb_cxx-4.8 \
41  -lboost_system-mt \
42  -lboost_filesystem-mt \
43  -lboost_program_options-mt \
44  -lboost_thread-mt \
45  -lssl \
46  -lcrypto \
47  -lz
48 endif
49
50 DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DBOOST_SPIRIT_THREADSAFE -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
51
52 ifdef RELEASE
53 # Compile for maximum compatibility and smallest size.
54 # This requires that dependencies are compiled
55 # the same way.
56 CFLAGS = -O2 -msse2
57 else
58 CFLAGS = -g -msse2
59 endif
60
61 ifeq  (${USE_SSSE3}, 1)
62 # Intrinsic implementation of block copy
63 DEFS += -DUSE_SSSE3
64 CFLAGS += -mssse3
65 endif
66
67 # ppc doesn't work because we don't support big-endian
68 CFLAGS += -Wall -Wextra -Wformat -Wno-ignored-qualifiers -Wformat-security -Wno-unused-parameter \
69     $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
70
71 OBJS= \
72     obj/alert.o \
73     obj/version.o \
74     obj/checkpoints.o \
75     obj/netbase.o \
76     obj/addrman.o \
77     obj/crypter.o \
78     obj/key.o \
79     obj/db.o \
80     obj/init.o \
81     obj/irc.o \
82     obj/keystore.o \
83     obj/main.o \
84     obj/miner.o \
85     obj/net.o \
86     obj/ntp.o \
87     obj/stun.o \
88     obj/protocol.o \
89     obj/bitcoinrpc.o \
90     obj/rpcdump.o \
91     obj/rpcnet.o \
92     obj/rpcmining.o \
93     obj/rpcwallet.o \
94     obj/rpcblockchain.o \
95     obj/rpcrawtransaction.o \
96     obj/script.o \
97     obj/sync.o \
98     obj/util.o \
99     obj/wallet.o \
100     obj/walletdb.o \
101     obj/noui.o \
102     obj/kernel.o
103
104 ifneq (${USE_IPV6}, -)
105         DEFS += -DUSE_IPV6=$(USE_IPV6)
106 endif
107
108 all: novacoind
109
110 #
111 # LevelDB support
112 #
113 ifdef USE_LEVELDB
114 LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a
115 DEFS += $(addprefix -I,$(CURDIR)/leveldb/include) -DUSE_LEVELDB
116 DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers)
117 OBJS += obj/txdb-leveldb.o
118 leveldb/libleveldb.a:
119         @echo "Building LevelDB ..."; cd leveldb; make; cd ..
120 obj/txdb-leveldb.o: leveldb/libleveldb.a
121 else
122 OBJS += obj/txdb-bdb.o
123 endif
124
125 ifeq (${USE_ASM}, 1)
126 # Assembler implementation
127 OBJS += crypto/scrypt/asm/obj/scrypt-arm.o crypto/scrypt/asm/obj/scrypt-x86.o crypto/scrypt/asm/obj/scrypt-x86_64.o crypto/scrypt/asm/obj/asm-wrapper.o
128 OBJS += crypto/sha2/asm/obj/sha2-arm.o crypto/sha2/asm/obj/sha2-x86.o crypto/sha2/asm/obj/sha2-x86_64.o
129
130 crypto/scrypt/asm/obj/scrypt-x86.o: crypto/scrypt/asm/scrypt-x86.S
131         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
132
133 crypto/scrypt/asm/obj/scrypt-x86_64.o: crypto/scrypt/asm/scrypt-x86_64.S
134         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
135
136 crypto/scrypt/asm/obj/scrypt-arm.o: crypto/scrypt/asm/scrypt-arm.S
137         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
138
139 crypto/scrypt/asm/obj/asm-wrapper.o: crypto/scrypt/asm/asm-wrapper.cpp
140         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
141
142 crypto/sha2/asm/obj/sha2-x86.o: crypto/sha2/asm/sha2-x86.S
143         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
144
145 crypto/sha2/asm/obj/sha2-x86_64.o: crypto/sha2/asm/sha2-x86_64.S
146         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
147
148 crypto/sha2/asm/obj/sha2-arm.o: crypto/sha2/asm/sha2-arm.S
149         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
150
151 DEFS += -DUSE_ASM
152
153 else
154 ifeq  (${USE_SSE2}, 1)
155 # Intrinsic implementation
156 DEFS += -DUSE_SSE2
157 OBJS += crypto/scrypt/intrin/obj/scrypt-sse2.o
158
159 crypto/scrypt/intrin/obj/scrypt-sse2.o: crypto/scrypt/intrin/scrypt-sse2.cpp
160         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
161 else
162 # Generic implementation
163 OBJS += crypto/scrypt/generic/obj/scrypt-generic.o
164
165 crypto/scrypt/generic/obj/scrypt-generic.o: crypto/scrypt/generic/scrypt-generic.cpp
166         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
167 endif
168 endif
169
170
171 # auto-generated dependencies:
172 -include obj/*.P
173
174 obj/build.h: FORCE
175         /bin/sh ../share/genbuild.sh obj/build.h
176 version.cpp: obj/build.h
177 DEFS += -DHAVE_BUILD_INFO
178
179 obj/%.o: %.cpp
180         $(CXX) -c $(CFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
181         @cp $(@:%.o=%.d) $(@:%.o=%.P); \
182           sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
183               -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
184           rm -f $(@:%.o=%.d)
185
186 novacoind: $(OBJS:obj/%=obj/%)
187         $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
188
189 clean:
190         -rm -f novacoind
191         -rm -f obj/*.o
192         -rm -f obj/*.P
193         -rm -f obj/*.d
194         -rm -f crypto/scrypt/asm/obj/*.o
195         -rm -f crypto/scrypt/asm/obj/*.P
196         -rm -f crypto/scrypt/asm/obj/*.d
197         -rm -f crypto/scrypt/intrin/obj/*.o
198         -rm -f crypto/scrypt/intrin/obj/*.P
199         -rm -f crypto/scrypt/intrin/obj/*.d
200         -rm -f crypto/scrypt/generic/obj/*.o
201         -rm -f crypto/scrypt/generic/obj/*.P
202         -rm -f crypto/scrypt/generic/obj/*.d
203         -rm -f crypto/sha2/asm/obj/*.o
204         -rm -f crypto/sha2/asm/obj/*.P
205         -rm -f crypto/sha2/asm/obj/*.d
206         -rm -f obj/build.h
207
208 FORCE: