Skip to content

Commit

Permalink
fix Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Oct 29, 2019
1 parent f36ac1d commit 435d576
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 15 deletions.
34 changes: 31 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include ../mcl/common.mk
# ios
XCODEPATH=$(shell xcode-select -p)
IOS_CLANG=$(XCODEPATH)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
Expand All @@ -15,15 +16,42 @@ IOS_LIB=libbls$(CURVE_BIT)

GOMOBILE_ARCHS=armv7 arm64

MIN_CFLAGS=-std=c++03 -O3 -DNDEBUG -DMCL_DONT_USE_OPENSSL -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_FIXED_BUFFER -DMCL_MAX_BIT_SIZE=384 -DCYBOZU_DONT_USE_EXCEPTION -DCYBOZU_DONT_USE_STRING -I../bls/include -I../mcl/include
MIN_CFLAGS+=-DBLS_ETH -DBLS_SWAP_G
OBJ_DIR=obj
all:
ifeq ($(CPU),x86-64)
$(eval _ARCH=amd64)
ifeq ($(OS),mingw64)
$(eval _OS=windows)
endif
ifeq ($(OS),Linux)
$(eval _OS=linux)
$(eval MIN_CFLAGS=$(MIN_CFLAGS) -fPIC)
endif
ifeq ($(OS),mac)
$(eval _OS=darwin)
$(eval MIN_CFLAGS=$(MIN_CFLAGS) -fPIC)
endif
endif
$(eval LIB_DIR=bls/lib/$(_OS)/$(_ARCH))
-mkdir -p $(LIB_DIR)
$(CXX) -c -o $(OBJ_DIR)/fp.o ../mcl/src/fp.cpp $(MIN_CFLAGS)
$(CXX) -c -o $(OBJ_DIR)/bls_c384_256.o ../bls/src/bls_c384_256.cpp $(MIN_CFLAGS)
$(AR) $(LIB_DIR)/libbls384_256.a $(OBJ_DIR)/bls_c384_256.o $(OBJ_DIR)/fp.o

android:
$(MAKE) -C android

ios:
@for target in $(GOMOBILE_ARCHS); do \
$(MAKE) ios ARCH=$$target PLATFORM="iPhoneOS"; \
$(MAKE) each_ios ARCH=$$target PLATFORM="iPhoneOS"; \
done

../mcl/src/base64.ll:
$(MAKE) -C ../mcl src/base64.ll

ios: ../mcl/src/base64.ll
each_ios: ../mcl/src/base64.ll
@echo "Building iOS $(ARCH)..."
$(eval IOS_OUTDIR=ios/$(ARCH))
$(eval IOS_SDK_PATH=$(XCODEPATH)/Platforms/$(PLATFORM).platform/Developer/SDKs/$(PLATFORM).sdk)
Expand All @@ -44,4 +72,4 @@ update:
patch -o - -p0 ../bls/ffi/go/bls/mcl.go <patch/mcl.patch > bls/mcl.go
patch -o - -p0 ../bls/ffi/go/bls/bls.go <patch/bls.patch > bls/bls.go

.PHONY: ios
.PHONY: android ios each_ios
3 changes: 3 additions & 0 deletions android/mk.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ndk-build
copy obj/local/arm64-v8a/libbls384_256.a ../bls/lib/android/arm64-v8a/
rem copy obj/local/armeabi-v7a/libbls384_256.a ../bls/lib/android/armeabi-v7a/
Empty file added obj/.emptydir
Empty file.
20 changes: 8 additions & 12 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# bls for eth with compiled static library

# This is under construction!!!

This repository contains compiled static library of https://github.com/herumi/bls with `BLS_ETH=1`

Expand All @@ -16,24 +15,21 @@ The following steps are not necessary if you use compiled binary in this reposit
* Linux, Mac, Windows(mingw64)
```
mkdir work
git clone htpps://github.com/herumi/mcl (dev branch)
git clone htpps://github.com/herumi/bls (dev branch)
cd mcl
make src/base64.ll
make BIT=32 src/base32.ll
cd ../bls
make minimized_static BLS_ETH=1 MIN_WITH_XBYAK=1 LIB_DIR=${GOPATH}/src/github.com/herumi/bls-eth-go-binary/bls/lib/${GOOS}/${GOARCH}/
git clone https://github.com/herumi/mcl
git clone https://github.com/herumi/bls
git clone https://github.com/herumi/bls-eth-go-binary
cd bls-eth-go-binary
make
```

* Android
At first, setup Android SDK
```
cd android
ndk-build
make android
```

* iOS
```
make
make ios
```

Copy each static library `libbls384_256.a` to `src/bls/lib/<os>/<arch>/`.

0 comments on commit 435d576

Please sign in to comment.