diff --git a/src/cc/Makefile b/src/cc/Makefile new file mode 100644 index 000000000..a3c54d81d --- /dev/null +++ b/src/cc/Makefile @@ -0,0 +1,33 @@ +SHELL = /bin/sh +CC = gcc +CC_DARWIN = g++-6 +CC_WIN = x86_64-w64-mingw32-gcc-posix +CFLAGS_DARWIN = -std=c++11 -arch x86_64 -I/usr/local/Cellar/gcc\@6/6.4.0_2/include/c++/6.4.0/ -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -c -Wl,-undefined -Wl,dynamic_lookup +CFLAGS = -std=c++11 -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -shared -c +CFLAGS_WIN = -std=c++11 -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -shared -c +DEBUGFLAGS = -O0 -D _DEBUG +RELEASEFLAGS = -O2 -D NDEBUG -combine -fwhole-program +$(info $(OS)) +OS := $(shell uname -s) +$(info $(OS)) +TARGET = ../cclib.so +TARGET_WIN = ../cclib.dll +SOURCES = cclib.cpp +#HEADERS = $(shell echo ../cryptoconditions/include/*.h) + +all: $(TARGET) + +$(TARGET): $(SOURCES) + $(info Building cclib to src/) +ifeq ($(OS),Darwin) + $(CC_DARWIN) $(CFLAGS_DARWIN) $(DEBUGFLAGS) -o $(TARGET) $(SOURCES) +else ifeq ($(OS),Linux) + $(CC) $(CFLAGS) $(DEBUGFLAGS) -o $(TARGET) $(SOURCES) +#else ifeq ($(WIN_HOST),True) - todo: pass ENV var from build.sh if WIN host +else + $(info WINDOWS) + $(CC_WIN) $(CFLAGS_WIN) $(DEBUGFLAGS) -o $(TARGET_WIN) $(SOURCES) +endif + +clean: + rm -rf $(TARGET) diff --git a/zcutil/build-mac.sh b/zcutil/build-mac.sh index 138508cb5..a3619111f 100755 --- a/zcutil/build-mac.sh +++ b/zcutil/build-mac.sh @@ -42,6 +42,21 @@ PREFIX="$(pwd)/depends/$TRIPLET" make "$@" -C ./depends/ V=1 NO_QT=1 NO_PROTON=1 +#BUILD CCLIB + +WD=$PWD +cd src/cc +echo $PWD + +if make "$@"; then + echo CCLIB BUILD SUCCESSFUL +else + echo CCLIB BUILD FAILED + exit 1 +fi + +cd $WD + ./autogen.sh CPPFLAGS="-I$PREFIX/include -arch x86_64" LDFLAGS="-L$PREFIX/lib -arch x86_64 -Wl,-no_pie" \ CXXFLAGS='-arch x86_64 -I/usr/local/Cellar/gcc\@6/6.4.0_2/include/c++/6.4.0/ -I$PREFIX/include -fwrapv -fno-strict-aliasing -Werror -g -Wl,-undefined -Wl,dynamic_lookup' \ diff --git a/zcutil/build.sh b/zcutil/build.sh index 08517475c..68239e16e 100755 --- a/zcutil/build.sh +++ b/zcutil/build.sh @@ -101,6 +101,21 @@ eval "$MAKE" --version as --version ld -v +#BUILD CCLIB + +WD=$PWD +cd src/cc +echo $PWD + +if make "$@"; then + echo CCLIB BUILD SUCCESSFUL +else + echo CCLIB BUILD FAILED + exit 1 +fi + +cd $WD + HOST="$HOST" BUILD="$BUILD" NO_PROTON="$PROTON_ARG" "$MAKE" "$@" -C ./depends/ V=1 ./autogen.sh