Code style fix (no "tab" symbol).
[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 # ppc doesn't work because we don't support big-endian
62 CFLAGS += -Wall -Wextra -Wformat -Wno-ignored-qualifiers -Wformat-security -Wno-unused-parameter \
63     $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
64
65 OBJS= \
66     obj/alert.o \
67     obj/version.o \
68     obj/checkpoints.o \
69     obj/netbase.o \
70     obj/addrman.o \
71     obj/crypter.o \
72     obj/base58.o \
73     obj/key.o \
74     obj/db.o \
75     obj/init.o \
76     obj/irc.o \
77     obj/keystore.o \
78     obj/main.o \
79     obj/miner.o \
80     obj/net.o \
81     obj/ntp.o \
82     obj/stun.o \
83     obj/protocol.o \
84     obj/bitcoinrpc.o \
85     obj/rpccrypt.o \
86     obj/rpcdump.o \
87     obj/rpcnet.o \
88     obj/rpcmining.o \
89     obj/rpcwallet.o \
90     obj/rpcblockchain.o \
91     obj/rpcrawtransaction.o \
92     obj/script.o \
93     obj/sync.o \
94     obj/util.o \
95     obj/wallet.o \
96     obj/walletdb.o \
97     obj/noui.o \
98     obj/kernel.o \
99     obj/kernel_worker.o \
100     obj/ecies.o \
101     obj/cryptogram.o
102
103 ifneq (${USE_IPV6}, -)
104         DEFS += -DUSE_IPV6=$(USE_IPV6)
105 endif
106
107 all: novacoind
108
109 #
110 # LevelDB support
111 #
112 ifdef USE_LEVELDB
113 LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a
114 DEFS += $(addprefix -I,$(CURDIR)/leveldb/include) -DUSE_LEVELDB
115 DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers)
116 OBJS += obj/txdb-leveldb.o
117 leveldb/libleveldb.a:
118         @echo "Building LevelDB ..."; cd leveldb; make; cd ..
119 obj/txdb-leveldb.o: leveldb/libleveldb.a
120 else
121 OBJS += obj/txdb-bdb.o
122 endif
123
124 ifeq (${USE_ASM}, 1)
125 # Assembler implementation
126 OBJS += crypto/scrypt/asm/obj/scrypt-x86.o crypto/scrypt/asm/obj/scrypt-x86_64.o crypto/scrypt/asm/obj/asm-wrapper.o
127
128 crypto/scrypt/asm/obj/scrypt-x86.o: crypto/scrypt/asm/scrypt-x86.S
129         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
130
131 crypto/scrypt/asm/obj/scrypt-x86_64.o: crypto/scrypt/asm/scrypt-x86_64.S
132         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
133
134 crypto/scrypt/asm/obj/asm-wrapper.o: crypto/scrypt/asm/asm-wrapper.cpp
135         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
136
137 DEFS += -DUSE_ASM
138
139 else
140 ifeq  (${USE_SSE2}, 1)
141 # Intrinsic implementation
142 DEFS += -DUSE_SSE2
143 OBJS += crypto/scrypt/intrin/obj/scrypt-sse2.o
144
145 crypto/scrypt/intrin/obj/scrypt-sse2.o: crypto/scrypt/intrin/scrypt-sse2.cpp
146         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
147 else
148 # Generic implementation
149 OBJS += crypto/scrypt/generic/obj/scrypt-generic.o
150
151 crypto/scrypt/generic/obj/scrypt-generic.o: crypto/scrypt/generic/scrypt-generic.cpp
152         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
153 endif
154 endif
155
156
157 # auto-generated dependencies:
158 -include obj/*.P
159
160 obj/build.h: FORCE
161         /bin/sh ../share/genbuild.sh obj/build.h
162 version.cpp: obj/build.h
163 DEFS += -DHAVE_BUILD_INFO
164
165 obj/%.o: %.cpp
166         $(CXX) -c $(CFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
167         @cp $(@:%.o=%.d) $(@:%.o=%.P); \
168           sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
169               -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
170           rm -f $(@:%.o=%.d)
171
172 novacoind: $(OBJS:obj/%=obj/%)
173         $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
174
175 clean:
176         -rm -f novacoind
177         -rm -f obj/*.o
178         -rm -f obj/*.P
179         -rm -f obj/*.d
180         -rm -f crypto/scrypt/asm/obj/*.o
181         -rm -f crypto/scrypt/asm/obj/*.P
182         -rm -f crypto/scrypt/asm/obj/*.d
183         -rm -f crypto/scrypt/intrin/obj/*.o
184         -rm -f crypto/scrypt/intrin/obj/*.P
185         -rm -f crypto/scrypt/intrin/obj/*.d
186         -rm -f crypto/scrypt/generic/obj/*.o
187         -rm -f crypto/scrypt/generic/obj/*.P
188         -rm -f crypto/scrypt/generic/obj/*.d
189         -rm -f obj/build.h
190
191 FORCE: