2022-11-24 17:16:15 +00:00
|
|
|
INCLUDE_DIRS = ../../src ../../blst/bindings
|
|
|
|
|
2022-11-25 13:48:27 +00:00
|
|
|
LIBRARY_FOLDER=src/main/resources/ethereum/ckzg4844/lib
|
|
|
|
|
2022-11-29 20:47:44 +00:00
|
|
|
FIELD_ELEMENTS_PER_BLOB ?= 4096
|
|
|
|
|
|
|
|
CC_FLAGS = -DFIELD_ELEMENTS_PER_BLOB=$(FIELD_ELEMENTS_PER_BLOB)
|
2022-11-29 10:56:31 +00:00
|
|
|
|
2022-11-24 17:16:15 +00:00
|
|
|
ifeq ($(OS),Windows_NT)
|
2022-11-29 20:15:19 +00:00
|
|
|
CLANG_EXECUTABLE=clang
|
|
|
|
GRADLE_COMMAND=gradlew
|
|
|
|
CLANG_FLAGS=-shared
|
|
|
|
JNI_INCLUDE_FOLDER=win32
|
|
|
|
OS_ARCH=amd64
|
|
|
|
LIBRARY_RESOURCE=ckzg4844jni.dll
|
2022-11-24 17:16:15 +00:00
|
|
|
else
|
2022-11-29 20:15:19 +00:00
|
|
|
CLANG_EXECUTABLE=clang
|
|
|
|
GRADLE_COMMAND=./gradlew
|
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
ifeq ($(UNAME_S),Linux)
|
|
|
|
CLANG_FLAGS=-fPIC -shared
|
|
|
|
JNI_INCLUDE_FOLDER=linux
|
|
|
|
OS_ARCH=amd64
|
|
|
|
LIBRARY_RESOURCE=libckzg4844jni.so
|
|
|
|
endif
|
|
|
|
ifeq ($(UNAME_S),Darwin)
|
|
|
|
ifeq ($(JAVA_HOME),)
|
|
|
|
JAVA_HOME := $(shell /usr/libexec/java_home)
|
|
|
|
endif
|
|
|
|
CLANG_FLAGS=-dynamiclib
|
|
|
|
JNI_INCLUDE_FOLDER=darwin
|
|
|
|
OS_ARCH=x86_64
|
|
|
|
LIBRARY_RESOURCE=libckzg4844jni.dylib
|
|
|
|
endif
|
2022-11-24 17:16:15 +00:00
|
|
|
endif
|
|
|
|
|
2022-11-25 10:14:49 +00:00
|
|
|
ifeq ($(JAVA_HOME),)
|
2022-11-29 20:15:19 +00:00
|
|
|
$(error JAVA_HOME is not set and autodetection failed)
|
2022-11-25 10:14:49 +00:00
|
|
|
endif
|
|
|
|
|
2022-11-24 19:46:47 +00:00
|
|
|
all: build test
|
|
|
|
|
|
|
|
build:
|
2022-11-29 10:56:31 +00:00
|
|
|
mkdir -p ${LIBRARY_FOLDER}/${OS_ARCH}
|
|
|
|
${CLANG_EXECUTABLE} ${CC_FLAGS} ${CLANG_FLAGS} -O -Wall ${addprefix -I,${INCLUDE_DIRS}} -I"${JAVA_HOME}/include" -I"${JAVA_HOME}/include/${JNI_INCLUDE_FOLDER}" -o ${LIBRARY_FOLDER}/${OS_ARCH}/${LIBRARY_RESOURCE} c_kzg_4844_jni.c c_kzg_4844.o ../../lib/libblst.a
|
2022-11-24 18:05:12 +00:00
|
|
|
|
2022-11-24 17:16:15 +00:00
|
|
|
test:
|
|
|
|
${GRADLE_COMMAND} clean test
|
|
|
|
|