You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

makefile.osx 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. # -*- mode: Makefile; -*-
  2. # Copyright (c) 2011 Bitcoin Developers
  3. # Distributed under the MIT/X11 software license, see the accompanying
  4. # file license.txt or http://www.opensource.org/licenses/mit-license.php.
  5. # Mac OS X makefile for bitcoin
  6. # Originally by Laszlo Hanyecz (solar@heliacal.net)
  7. CXX=llvm-g++
  8. DEPSDIR=/opt/local
  9. INCLUDEPATHS= \
  10. -I"$(CURDIR)" \
  11. -I"$(CURDIR)"/obj \
  12. -I"$(DEPSDIR)/include" \
  13. -I"$(DEPSDIR)/include/db48"
  14. LIBPATHS= \
  15. -L"$(DEPSDIR)/lib" \
  16. -L"$(DEPSDIR)/lib/db48"
  17. USE_UPNP:=1
  18. LIBS= -dead_strip
  19. TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data)
  20. ifdef STATIC
  21. # Build STATIC if you are redistributing the bitcoind binary
  22. TESTLIBS += \
  23. $(DEPSDIR)/lib/libboost_unit_test_framework-mt.a
  24. LIBS += \
  25. $(DEPSDIR)/lib/db48/libdb_cxx-4.8.a \
  26. $(DEPSDIR)/lib/libboost_system-mt.a \
  27. $(DEPSDIR)/lib/libboost_filesystem-mt.a \
  28. $(DEPSDIR)/lib/libboost_program_options-mt.a \
  29. $(DEPSDIR)/lib/libboost_thread-mt.a \
  30. $(DEPSDIR)/lib/libssl.a \
  31. $(DEPSDIR)/lib/libcrypto.a \
  32. -lz
  33. else
  34. TESTLIBS += \
  35. -lboost_unit_test_framework-mt
  36. LIBS += \
  37. -ldb_cxx-4.8 \
  38. -lboost_system-mt \
  39. -lboost_filesystem-mt \
  40. -lboost_program_options-mt \
  41. -lboost_thread-mt \
  42. -lssl \
  43. -lcrypto \
  44. -lz
  45. TESTDEFS += -DBOOST_TEST_DYN_LINK
  46. endif
  47. DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6
  48. ifdef RELEASE
  49. # Compile for maximum compatibility and smallest size.
  50. # This requires that dependencies are compiled
  51. # the same way.
  52. CFLAGS = -mmacosx-version-min=10.5 -arch i386 -O3
  53. else
  54. CFLAGS = -g
  55. endif
  56. # ppc doesn't work because we don't support big-endian
  57. CFLAGS += -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter \
  58. $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
  59. OBJS= \
  60. obj/version.o \
  61. obj/checkpoints.o \
  62. obj/netbase.o \
  63. obj/addrman.o \
  64. obj/crypter.o \
  65. obj/key.o \
  66. obj/db.o \
  67. obj/init.o \
  68. obj/irc.o \
  69. obj/keystore.o \
  70. obj/main.o \
  71. obj/net.o \
  72. obj/protocol.o \
  73. obj/bitcoinrpc.o \
  74. obj/rpcdump.o \
  75. obj/rpcnet.o \
  76. obj/script.o \
  77. obj/sync.o \
  78. obj/util.o \
  79. obj/wallet.o \
  80. obj/walletdb.o \
  81. obj/noui.o
  82. ifdef USE_UPNP
  83. DEFS += -DUSE_UPNP=$(USE_UPNP)
  84. ifdef STATIC
  85. LIBS += $(DEPSDIR)/lib/libminiupnpc.a
  86. else
  87. LIBS += -lminiupnpc
  88. endif
  89. endif
  90. all: bitcoind
  91. # auto-generated dependencies:
  92. -include obj/*.P
  93. -include obj-test/*.P
  94. obj/build.h: FORCE
  95. /bin/sh ../share/genbuild.sh obj/build.h
  96. version.cpp: obj/build.h
  97. DEFS += -DHAVE_BUILD_INFO
  98. obj/%.o: %.cpp
  99. $(CXX) -c $(CFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
  100. @cp $(@:%.o=%.d) $(@:%.o=%.P); \
  101. sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
  102. -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
  103. rm -f $(@:%.o=%.d)
  104. bitcoind: $(OBJS:obj/%=obj/%)
  105. $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
  106. TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))
  107. obj-test/%.o: test/%.cpp
  108. $(CXX) -c $(TESTDEFS) $(CFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
  109. @cp $(@:%.o=%.d) $(@:%.o=%.P); \
  110. sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
  111. -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
  112. rm -f $(@:%.o=%.d)
  113. test_bitcoin: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
  114. $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) $(TESTLIBS)
  115. clean:
  116. -rm -f bitcoind test_bitcoin
  117. -rm -f obj/*.o
  118. -rm -f obj-test/*.o
  119. -rm -f obj/*.P
  120. -rm -f obj-test/*.P
  121. -rm -f src/build.h
  122. FORCE: