diff options
Diffstat (limited to 'src/makefile.osx')
-rw-r--r-- | src/makefile.osx | 118 |
1 files changed, 71 insertions, 47 deletions
diff --git a/src/makefile.osx b/src/makefile.osx index af52636919..cbd51b049f 100644 --- a/src/makefile.osx +++ b/src/makefile.osx @@ -1,37 +1,58 @@ -# Copyright (c) 2010 Laszlo Hanyecz +# -*- mode: Makefile; -*- +# Copyright (c) 2011 Bitcoin Developers # Distributed under the MIT/X11 software license, see the accompanying # file license.txt or http://www.opensource.org/licenses/mit-license.php. # Mac OS X makefile for bitcoin -# Laszlo Hanyecz (solar@heliacal.net) +# Originally by Laszlo Hanyecz (solar@heliacal.net) CXX=llvm-g++ -DEPSDIR=/Users/macosuser/bitcoin/deps +DEPSDIR=/opt/local INCLUDEPATHS= \ - -I"$(DEPSDIR)/include" + -I"$(DEPSDIR)/include" \ + -I"$(DEPSDIR)/include/db48" LIBPATHS= \ - -L"$(DEPSDIR)/lib" - -WXLIBS=$(shell $(DEPSDIR)/bin/wx-config --libs --static) - -USE_UPNP:=0 - -LIBS= -dead_strip \ - $(DEPSDIR)/lib/libdb_cxx-4.8.a \ - $(DEPSDIR)/lib/libboost_system.a \ - $(DEPSDIR)/lib/libboost_filesystem.a \ - $(DEPSDIR)/lib/libboost_program_options.a \ - $(DEPSDIR)/lib/libboost_thread.a \ + -L"$(DEPSDIR)/lib" \ + -L"$(DEPSDIR)/lib/db48" + +USE_UPNP:=1 + +LIBS= -dead_strip +ifdef STATIC +# Build STATIC if you are redistributing the bitcoind binary +TESTLIBS += \ + $(DEPSDIR)/lib/libboost_unit_test_framework-mt.a +LIBS += \ + $(DEPSDIR)/lib/db48/libdb_cxx-4.8.a \ + $(DEPSDIR)/lib/libboost_system-mt.a \ + $(DEPSDIR)/lib/libboost_filesystem-mt.a \ + $(DEPSDIR)/lib/libboost_program_options-mt.a \ + $(DEPSDIR)/lib/libboost_thread-mt.a \ $(DEPSDIR)/lib/libssl.a \ - $(DEPSDIR)/lib/libcrypto.a + $(DEPSDIR)/lib/libcrypto.a \ + -lz +else +TESTLIBS += \ + -lboost_unit_test_framework-mt +LIBS += \ + -ldb_cxx-4.8 \ + -lboost_system-mt \ + -lboost_filesystem-mt \ + -lboost_program_options-mt \ + -lboost_thread-mt \ + -lssl \ + -lcrypto \ + -lz +TESTDEFS += -DBOOST_TEST_DYN_LINK +endif -DEFS=$(shell $(DEPSDIR)/bin/wx-config --cxxflags) -D__WXMAC_OSX__ -DNOPCH -DMSG_NOSIGNAL=0 -DUSE_SSL +DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DUSE_SSL -DEBUGFLAGS=-g -DwxDEBUG_LEVEL=0 +DEBUGFLAGS=-g # ppc doesn't work because we don't support big-endian -CFLAGS=-mmacosx-version-min=10.5 -arch i386 -arch x86_64 -O3 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) +CFLAGS=-mmacosx-version-min=10.5 -arch i386 -O3 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) HEADERS = \ base58.h \ bignum.h \ @@ -47,12 +68,10 @@ HEADERS = \ net.h \ noui.h \ protocol.h \ - rpc.h \ + bitcoinrpc.h \ script.h \ serialize.h \ strlcpy.h \ - ui.h \ - uibase.h \ uint256.h \ util.h \ wallet.h @@ -67,47 +86,52 @@ OBJS= \ obj/main.o \ obj/net.o \ obj/protocol.o \ - obj/rpc.o \ + obj/bitcoinrpc.o \ obj/script.o \ obj/util.o \ - obj/wallet.o \ - cryptopp/obj/sha.o \ - cryptopp/obj/cpu.o + obj/wallet.o ifdef USE_UPNP - LIBS += $(DEPSDIR)/lib/libminiupnpc.a DEFS += -DUSE_UPNP=$(USE_UPNP) +ifdef STATIC + LIBS += $(DEPSDIR)/lib/libminiupnpc.a +else + LIBS += -lminiupnpc +endif endif - - -all: bitcoin - - -obj/%.o: %.cpp $(HEADERS) - $(CXX) -c $(CFLAGS) -DGUI -o $@ $< -cryptopp/obj/%.o: cryptopp/%.cpp - $(CXX) -c $(CFLAGS) -O3 -DCRYPTOPP_DISABLE_ASM -o $@ $< -bitcoin: $(OBJS) obj/ui.o obj/uibase.o - $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS) +all: bitcoind +# auto-generated dependencies: +-include obj/nogui/*.P +-include obj-test/*.P -obj/nogui/%.o: %.cpp $(HEADERS) - $(CXX) -c $(CFLAGS) -o $@ $< +obj/nogui/%.o: %.cpp + $(CXX) -c $(CFLAGS) -MMD -o $@ $< + @cp $(@:%.o=%.d) $(@:%.o=%.P); \ + sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ + -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \ + rm -f $(@:%.o=%.d) bitcoind: $(OBJS:obj/%=obj/nogui/%) $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) -obj/test/test_bitcoin.o: $(wildcard test/*.cpp) $(HEADERS) - $(CXX) -c $(CFLAGS) -o $@ test/test_bitcoin.cpp +obj/test/%.o: test/%.cpp + $(CXX) -c $(TESTDEFS) $(CFLAGS) -MMD -o $@ $< + @cp $(@:%.o=%.d) $(@:%.o=%.P); \ + sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ + -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \ + rm -f $(@:%.o=%.d) test_bitcoin: obj/test/test_bitcoin.o $(filter-out obj/nogui/init.o,$(OBJS:obj/%=obj/nogui/%)) - $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) -lboost_unit_test_framework + $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) $(TESTLIBS) clean: - -rm -f bitcoin bitcoind test_bitcoin + -rm -f bitcoind test_bitcoin -rm -f obj/*.o -rm -f obj/nogui/*.o - -rm -f obj/test/*.o - -rm -f cryptopp/obj/*.o + -rm -f obj-test/*.o + -rm -f obj/*.P + -rm -f obj/nogui/*.P + -rm -f obj-test/*.P |