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.
6 # Mac OS X makefile for bitcoin
15 -I"$(DEPSDIR)/include" \
16 -I"$(DEPSDIR)/include/db48"
20 -L"$(DEPSDIR)/lib/db48"
27 TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data)
30 # Build STATIC if you are redistributing the bitcoind binary
32 $(DEPSDIR)/lib/libboost_unit_test_framework-mt.a
34 $(DEPSDIR)/lib/db48/libdb_cxx-4.8.a \
35 $(DEPSDIR)/lib/libboost_system-mt.a \
36 $(DEPSDIR)/lib/libboost_filesystem-mt.a \
37 $(DEPSDIR)/lib/libboost_program_options-mt.a \
38 $(DEPSDIR)/lib/libboost_thread-mt.a \
39 $(DEPSDIR)/lib/libssl.a \
40 $(DEPSDIR)/lib/libcrypto.a \
44 -lboost_unit_test_framework-mt
48 -lboost_filesystem-mt \
49 -lboost_program_options-mt \
54 TESTDEFS += -DBOOST_TEST_DYN_LINK
57 DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DBOOST_SPIRIT_THREADSAFE
60 # Compile for maximum compatibility and smallest size.
61 # This requires that dependencies are compiled
63 CFLAGS = -mmacosx-version-min=10.5 -arch i386 -O3
68 # ppc doesn't work because we don't support big-endian
69 CFLAGS += -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter \
70 $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
73 leveldb/libleveldb.a \
94 obj/rpcrawtransaction.o \
107 override USE_UPNP = -
109 ifneq (${USE_UPNP}, -)
110 DEFS += -DUSE_UPNP=$(USE_UPNP)
112 LIBS += $(DEPSDIR)/lib/libminiupnpc.a
118 ifneq (${USE_IPV6}, -)
119 DEFS += -DUSE_IPV6=$(USE_IPV6)
124 test check: test_bitcoin FORCE
130 LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a
131 DEFS += $(addprefix -I,$(CURDIR)/leveldb/include)
132 DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers)
133 leveldb/libleveldb.a:
134 @echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(CFLAGS)" libleveldb.a libmemenv.a && cd ..
136 # auto-generated dependencies:
138 -include obj-test/*.P
141 /bin/sh ../share/genbuild.sh obj/build.h
142 version.cpp: obj/build.h
143 DEFS += -DHAVE_BUILD_INFO
146 $(CXX) -c $(CFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
147 @cp $(@:%.o=%.d) $(@:%.o=%.P); \
148 sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
149 -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
152 bitcoind: $(OBJS:obj/%=obj/%)
153 $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
155 TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))
157 obj-test/%.o: test/%.cpp
158 $(CXX) -c $(TESTDEFS) $(CFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
159 @cp $(@:%.o=%.d) $(@:%.o=%.P); \
160 sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
161 -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
164 test_bitcoin: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
165 $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) $(TESTLIBS)
168 -rm -f bitcoind test_bitcoin
174 -cd leveldb && $(MAKE) clean || true