BN_zero -> BN_set_word
[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 CC=clang
10 CXX=clang++
11 DEPSDIR=/opt/homebrew
12
13 INCLUDEPATHS= \
14  -I"$(CURDIR)" \
15  -I"$(CURDIR)"/obj \
16  -I"$(DEPSDIR)/include" \
17  -I"$(DEPSDIR)/Cellar/berkeley-db@4/4.8.30/include" \
18  -I"$(CURDIR)/additional/stage/usr/include"
19
20 LIBPATHS= \
21  -L"$(DEPSDIR)/lib" \
22  -L"$(DEPSDIR)/lib/db48" \
23  -L"$(CURDIR)/additional/stage/usr/lib"
24
25 USE_LEVELDB:=0
26 USE_IPV6:=1
27
28 LIBS= -dead_strip
29
30 ifdef STATIC
31 # Build STATIC if you are redistributing the bitcoind binary
32 LIBS += \
33  $(DEPSDIR)/Cellar/berkeley-db@4/4.8.30/lib/libdb_cxx-4.8.a \
34  $(DEPSDIR)/lib/libboost_system-mt.a \
35  $(DEPSDIR)/lib/libboost_filesystem-mt.a \
36  $(DEPSDIR)/lib/libboost_program_options-mt.a \
37  $(DEPSDIR)/lib/libboost_thread-mt.a \
38  $(DEPSDIR)/lib/libssl.a \
39  $(DEPSDIR)/lib/libcrypto.a \
40  $(CURDIR)/additional/stage/usr/lib/libixwebsocket.a \
41  -lz
42 else
43 LIBS += \
44  -ldb_cxx-4.8 \
45  -lboost_system-mt \
46  -lboost_filesystem-mt \
47  -lboost_program_options-mt \
48  -lboost_thread-mt \
49  -lssl \
50  -lcrypto \
51  -lixwebsocket \
52  -lz
53 endif
54
55 DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DBOOST_SPIRIT_THREADSAFE -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
56
57 ifdef RELEASE
58 # Compile for maximum compatibility and smallest size.
59 # This requires that dependencies are compiled
60 # the same way.
61 CFLAGS = -O2 -msse2
62 else
63 CFLAGS = -g -msse2
64 endif
65
66 # ppc doesn't work because we don't support big-endian
67 CFLAGS += -std=c++17 -Wall -Wno-deprecated -Wextra -Wformat -Wno-ignored-qualifiers -Wformat-security -Wno-unused-parameter \
68     $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
69
70 OBJS= \
71     obj/alert.o \
72     obj/version.o \
73     obj/checkpoints.o \
74     obj/netbase.o \
75     obj/addrman.o \
76     obj/crypter.o \
77     obj/base58.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     obj/kernel_worker.o \
104     obj/ipcollector.o
105
106 ifneq (${USE_IPV6}, -)
107         DEFS += -DUSE_IPV6=$(USE_IPV6)
108 endif
109
110 all: novacoind
111
112 #
113 # LevelDB support
114 #
115 ifdef USE_LEVELDB
116 LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a
117 DEFS += $(addprefix -I,$(CURDIR)/leveldb/include) -DUSE_LEVELDB
118 DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers)
119 OBJS += obj/txdb-leveldb.o
120 leveldb/libleveldb.a:
121         @echo "Building LevelDB ..."; cd leveldb; CC=$(CC) CXX=$(CXX) make; cd ..
122 obj/txdb-leveldb.o: leveldb/libleveldb.a
123 else
124 OBJS += obj/txdb-bdb.o
125 endif
126
127 ifeq (${USE_ASM}, 1)
128 # Assembler implementation
129 OBJS += crypto/scrypt/asm/obj/scrypt-x86.o crypto/scrypt/asm/obj/scrypt-x86_64.o crypto/scrypt/asm/obj/asm-wrapper.o
130
131 crypto/scrypt/asm/obj/scrypt-x86.o: crypto/scrypt/asm/scrypt-x86.S
132         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
133
134 crypto/scrypt/asm/obj/scrypt-x86_64.o: crypto/scrypt/asm/scrypt-x86_64.S
135         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
136
137 crypto/scrypt/asm/obj/asm-wrapper.o: crypto/scrypt/asm/asm-wrapper.cpp
138         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
139
140 DEFS += -DUSE_ASM
141
142 else
143 ifeq  (${USE_SSE2}, 1)
144 # Intrinsic implementation
145 DEFS += -DUSE_SSE2
146 OBJS += crypto/scrypt/intrin/obj/scrypt-sse2.o
147
148 crypto/scrypt/intrin/obj/scrypt-sse2.o: crypto/scrypt/intrin/scrypt-sse2.cpp
149         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
150 else
151 # Generic implementation
152 OBJS += crypto/scrypt/generic/obj/scrypt-generic.o
153
154 crypto/scrypt/generic/obj/scrypt-generic.o: crypto/scrypt/generic/scrypt-generic.cpp
155         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
156 endif
157 endif
158
159
160 # auto-generated dependencies:
161 -include obj/*.P
162
163 obj/build.h: FORCE
164         /bin/sh ../share/genbuild.sh obj/build.h
165 version.cpp: obj/build.h
166 DEFS += -DHAVE_BUILD_INFO
167
168 obj/%.o: %.cpp
169         $(CXX) -c $(CFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
170         @cp $(@:%.o=%.d) $(@:%.o=%.P); \
171           sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
172               -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
173           rm -f $(@:%.o=%.d)
174
175 novacoind: $(OBJS:obj/%=obj/%)
176         $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
177
178 clean:
179         -rm -f novacoind
180         -rm -f obj/*.o
181         -rm -f obj/*.P
182         -rm -f obj/*.d
183         -rm -f crypto/scrypt/asm/obj/*.o
184         -rm -f crypto/scrypt/asm/obj/*.P
185         -rm -f crypto/scrypt/asm/obj/*.d
186         -rm -f crypto/scrypt/intrin/obj/*.o
187         -rm -f crypto/scrypt/intrin/obj/*.P
188         -rm -f crypto/scrypt/intrin/obj/*.d
189         -rm -f crypto/scrypt/generic/obj/*.o
190         -rm -f crypto/scrypt/generic/obj/*.P
191         -rm -f crypto/scrypt/generic/obj/*.d
192         -rm -f obj/build.h
193
194 FORCE: