c-kzg-4844/bindings/java/Makefile

41 lines
1011 B
Makefile
Raw Normal View History

2022-11-24 17:16:15 +00:00
INCLUDE_DIRS = ../../src ../../blst/bindings
ifeq ($(OS),Windows_NT)
CLANG_EXECUTABLE=gcc
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:
2022-11-24 18:05:12 +00:00
${CLANG_EXECUTABLE} ${CLANG_FLAGS} -O -Wall ${addprefix -I,${INCLUDE_DIRS}} -I"${JAVA_HOME}/include" -I"${JAVA_HOME}/include/${JNI_INCLUDE_FOLDER}" -o src/main/resources/lib/${LIBRARY_RESOURCE} c_kzg_4844_jni.c c_kzg_4844.o ../../lib/libblst.a
2022-11-24 17:16:15 +00:00
test:
${GRADLE_COMMAND} clean test