Skip to content

Commit

Permalink
osxmake
Browse files Browse the repository at this point in the history
  • Loading branch information
oktoshi committed Feb 1, 2021
1 parent 49adc28 commit e5e70de
Showing 1 changed file with 48 additions and 37 deletions.
85 changes: 48 additions & 37 deletions src/makefile.osx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Mac OS X makefile for okcash
# Originally by Laszlo Hanyecz (solar@heliacal.net)
USE_UPNP:=0

CXX=llvm-g++
DEPSDIR=/opt/local

Expand All @@ -23,30 +23,44 @@ USE_UPNP:=1

LIBS= -dead_strip

ifdef STATIC
# Build STATIC if you are redistributing the okcashd binary
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 \
-lz
else
LIBS += \
-ldb_cxx-4.8 \
-lboost_system-mt \
-lboost_filesystem-mt \
-lboost_program_options-mt \
-lboost_thread-mt \
-lssl \
-lcrypto

-lcrypto \
-lz
endif

DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DBOOST_SPIRIT_THREADSAFE

ifdef RELEASE
# Compile for maximum compatibility and smallest size.
# This requires that dependencies are compiled
# the same way.
CFLAGS = -arch x86_64 -stdlib=libc++
CFLAGS = -mmacosx-version-min=10.5 -arch x86_64 -O3 -msse2
else
CFLAGS = -arch x86_64 -stdlib=libc++ -g -msse2
CFLAGS = -g -msse2
endif

# ppc doesn't work because we don't support big-endian
CFLAGS += -Wall -Wextra -Wformat -Wno-ignored-qualifiers -Wformat-security -Wno-unused-parameter \
$(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)

OBJS= \
obj/alert.o \
obj/version.o \
Expand Down Expand Up @@ -78,6 +92,9 @@ OBJS= \
obj/rpcextkey.o \
obj/rpcmnemonic.o \
obj/script.o \
obj/scrypt-arm.o \
obj/scrypt-x86.o \
obj/scrypt-x86_64.o \
obj/sync.o \
obj/util.o \
obj/hash.o \
Expand All @@ -87,9 +104,6 @@ OBJS= \
obj/kernel.o \
obj/pbkdf2.o \
obj/scrypt.o \
obj/scrypt-arm.o \
obj/scrypt-x86.o \
obj/scrypt-x86_64.o \
obj/smessage.o \
obj/stealth.o \
obj/ringsig.o \
Expand All @@ -99,33 +113,35 @@ OBJS= \
obj/state.o \
obj/bloom.o


ifndef USE_UPNP
override USE_UPNP = -
endif
ifneq (${USE_UPNP}, -)
DEFS += -DUSE_UPNP=$(USE_UPNP)
ifdef STATIC
LIBS += $(DEPSDIR)/lib/libminiupnpc.a
else
LIBS += -lminiupnpc
endif
endif

all: okcashd

test check: test_okcash FORCE
./test_okcash
LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a
DEFS += $(addprefix -I,$(CURDIR)/leveldb/include)
DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers)
OBJS += obj/txdb-leveldb.o
leveldb/libleveldb.a:
@echo "Building LevelDB ..."; cd leveldb; make libleveldb.a libmemenv.a; cd ..;
@echo "Building LevelDB ..."; cd leveldb; make libleveldb.a libmemenv.a; cd ..
obj/txdb-leveldb.o: leveldb/libleveldb.a

# auto-generated dependencies:
-include obj/*.P
-include obj/'*'.P

obj/build.h: FORCE
/bin/sh ../share/genbuild.sh obj/build.h
version.cpp: obj/build.h
DEFS += -DHAVE_BUILD_INFO
obj/scrypt-x86.o: scrypt-x86.S
$(CXX) -c $(CFLAGS) -MMD -o $@ $<
obj/scrypt-x86_64.o: scrypt-x86_64.S
$(CXX) -c $(CFLAGS) -MMD -o $@ $<
obj/scrypt-arm.o: scrypt-arm.S
$(CXX) -c $(CFLAGS) -MMD -o $@ $<

obj/%.o: %.cpp
$(CXX) -c $(CFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
Expand All @@ -134,33 +150,28 @@ obj/%.o: %.cpp
-e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
rm -f $(@:%.o=%.d)

okcashd: $(OBJS:obj/%=obj/%)
$(LINK) $(CFLAGS) -o $@ $^ $(xLDFLAGS) $(LIBS)


TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))

xTESTCXXFLAGS = -std=c++11

obj-test/%.o: test/%.cpp
$(CXX) -c $(TESTDEFS) $(xTESTCXXFLAGS) $(CFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
obj/zerocoin/%.o: zerocoin/%.cpp
$(CXX) -c $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -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_okcash: $(TESTOBJS) $(filter-out obj/init.o obj/okcashd.o,$(OBJS:obj/%=obj/%))
$(LINK) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(TESTLIBS) $(xLDFLAGS) $(LIBS)
obj/scrypt-x86.o: scrypt-x86.S
$(CXX) -c $(xCXXFLAGS) -MMD -o $@ $<

obj/scrypt-x86_64.o: scrypt-x86_64.S
$(CXX) -c $(xCXXFLAGS) -MMD -o $@ $<

okcashd: $(OBJS:obj/%=obj/%)
$(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)

clean:
-rm -f okcashd
-rm -f obj/*.o
-rm -f obj/zerocoin/*.o
-rm -f obj/*.P
-rm -f obj/zerocoin/*.P
-rm -f obj/build.h
-rm -f test_okcash
-rm -f obj-test/*.o
-rm -f obj-test/*.P
-cd leveldb && $(MAKE) clean || true


FORCE:
FORCE:

0 comments on commit e5e70de

Please sign in to comment.