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.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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
  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-paramter \
  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/script.o \
  76. obj/util.o \
  77. obj/wallet.o \
  78. obj/walletdb.o \
  79. obj/noui.o
  80. ifdef USE_UPNP
  81. DEFS += -DUSE_UPNP=$(USE_UPNP)
  82. ifdef STATIC
  83. LIBS += $(DEPSDIR)/lib/libminiupnpc.a
  84. else
  85. LIBS += -lminiupnpc
  86. endif
  87. endif
  88. all: bitcoind
  89. # auto-generated dependencies:
  90. -include obj/*.P
  91. -include obj-test/*.P
  92. obj/build.h: FORCE
  93. ../share/genbuild.sh obj/build.h
  94. version.cpp: obj/build.h
  95. DEFS += -DHAVE_BUILD_INFO
  96. obj/%.o: %.cpp
  97. $(CXX) -c $(CFLAGS) -MMD -o $@ $<
  98. @cp $(@:%.o=%.d) $(@:%.o=%.P); \
  99. sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
  100. -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
  101. rm -f $(@:%.o=%.d)
  102. bitcoind: $(OBJS:obj/%=obj/%)
  103. $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
  104. TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))
  105. obj-test/%.o: test/%.cpp
  106. $(CXX) -c $(TESTDEFS) $(CFLAGS) -MMD -o $@ $<
  107. @cp $(@:%.o=%.d) $(@:%.o=%.P); \
  108. sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
  109. -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
  110. rm -f $(@:%.o=%.d)
  111. test_bitcoin: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
  112. $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) $(TESTLIBS)
  113. clean:
  114. -rm -f bitcoind test_bitcoin
  115. -rm -f obj/*.o
  116. -rm -f obj-test/*.o
  117. -rm -f obj/*.P
  118. -rm -f obj-test/*.P
  119. -rm -f src/build.h
  120. FORCE: