c-kzg-4844/bindings/java/Makefile

43 lines
1.1 KiB
Makefile
Raw Normal View History

2022-11-24 17:16:15 +00:00
INCLUDE_DIRS = ../../src ../../blst/bindings
LIBRARY_FOLDER=src/main/resources/ethereum/ckzg4844/lib
2022-11-24 17:16:15 +00:00
ifeq ($(OS),Windows_NT)
2022-11-25 13:28:03 +00:00
CLANG_EXECUTABLE=clang
2022-11-24 19:18:24 +00:00
GRADLE_COMMAND=gradlew
2022-11-24 18:05:12 +00:00
CLANG_FLAGS=-shared
2022-11-24 17:16:15 +00:00
JNI_INCLUDE_FOLDER=win32
LIBRARY_RESOURCE=ckzg4844jni.dll
else
CLANG_EXECUTABLE=clang
2022-11-25 10:14:49 +00:00
GRADLE_COMMAND=./gradlew
2022-11-24 18:05:12 +00:00
UNAME_S := $(shell uname -s)
2022-11-24 20:38:38 +00:00
ifeq ($(UNAME_S),Linux)
2022-11-25 10:21:57 +00:00
CLANG_FLAGS=-fPIC -shared
JNI_INCLUDE_FOLDER=linux
LIBRARY_RESOURCE=libckzg4844jni.so
2022-11-24 20:38:38 +00:00
endif
2022-11-24 18:05:12 +00:00
ifeq ($(UNAME_S),Darwin)
ifeq ($(JAVA_HOME),)
JAVA_HOME := $(shell /usr/libexec/java_home)
endif
2022-11-25 10:20:47 +00:00
CLANG_FLAGS=-dynamiclib
JNI_INCLUDE_FOLDER=darwin
LIBRARY_RESOURCE=libckzg4844jni.dylib
2022-11-24 18:05:12 +00:00
endif
2022-11-24 17:16:15 +00:00
endif
2022-11-25 10:14:49 +00:00
ifeq ($(JAVA_HOME),)
2022-11-25 10:21:57 +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:
mkdir -p ${LIBRARY_FOLDER}
${CLANG_EXECUTABLE} ${CLANG_FLAGS} -O -Wall ${addprefix -I,${INCLUDE_DIRS}} -I"${JAVA_HOME}/include" -I"${JAVA_HOME}/include/${JNI_INCLUDE_FOLDER}" -o ${LIBRARY_FOLDER}/${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