a portable and fast pairing-based cryptography library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mcl/ffi/java/Makefile

66 lines
1.9 KiB

TOP_DIR=../..
include $(TOP_DIR)/common.mk
9 years ago
ifeq ($(UNAME_S),Darwin)
JAVA_INC=-I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/
else
JAVA_INC=-I/usr/lib/jvm/default-java/include
#JAVA_INC=-I/usr/lib/jvm/java-7-openjdk-amd64/include
CFLAGS+=-z noexecstack
9 years ago
LDFLAGS+=-lrt
9 years ago
endif
CFLAGS+=$(JAVA_INC) $(JAVA_INC)/linux -I $(TOP_DIR)/include -I $(TOP_DIR)/../xbyak -I $(TOP_DIR)/../cybozulib/include -Wno-strict-aliasing
CFLAGS+=-std=c++03
MCL_LIB=$(TOP_DIR)/lib/libmcl.a
9 years ago
PACKAGE_NAME=com.herumi.mcl
PACKAGE_DIR=$(subst .,/,$(PACKAGE_NAME))
ELGAMAL_LIB=$(TOP_DIR)/bin/libmcl_elgamal.$(LIB_SUF)
BN256_LIB=$(TOP_DIR)/bin/libmcl_bn256.$(LIB_SUF)
JAVA_EXE=cd $(TOP_DIR)/bin && LD_LIBRARY_PATH=./:$(LD_LIBRARY_PATH) java -classpath ../ffi/java
8 years ago
all: $(ELGAMAL_LIB)
9 years ago
8 years ago
elgamal_wrap.cxx: elgamal.i elgamal_impl.hpp
$(MKDIR) $(PACKAGE_DIR)
swig -java -package $(PACKAGE_NAME) -outdir $(PACKAGE_DIR) -c++ -Wall elgamal.i
9 years ago
8 years ago
bn256_wrap.cxx: bn256.i bn256_impl.hpp
$(MKDIR) $(PACKAGE_DIR)
swig -java -package $(PACKAGE_NAME) -outdir $(PACKAGE_DIR) -c++ -Wall bn256.i
$(MCL_LIB):
make -C $(TOP_DIR)
8 years ago
$(ELGAMAL_LIB): elgamal_wrap.cxx $(MCL_LIB)
$(PRE)$(CXX) $< -o $@ $(CFLAGS) $(LDFLAGS) $(MCL_LIB) -shared
9 years ago
8 years ago
$(BN256_LIB): bn256_wrap.cxx $(MCL_LIB)
$(PRE)$(CXX) $< -o $@ $(CFLAGS) $(LDFLAGS) $(MCL_LIB) -shared
9 years ago
%.class: %.java
javac $<
8 years ago
ElgamalTest.class: ElgamalTest.java $(ELGAMAL_LIB)
Bn256Test.class: Bn256Test.java $(BN256_LIB)
9 years ago
jar:
8 years ago
jar cvf mcl.jar com
8 years ago
test_elgamal: ElgamalTest.class $(ELGAMAL_LIB)
$(JAVA_EXE) ElgamalTest
$(JAVA_EXE) ElgamalTest -e NIST_P192
$(JAVA_EXE) ElgamalTest -e NIST_P256 -h sha256
$(JAVA_EXE) ElgamalTest -e NIST_P384 -h sha384
$(JAVA_EXE) ElgamalTest -e NIST_P521 -h sha512
9 years ago
8 years ago
test_bn256: Bn256Test.class $(BN256_LIB)
$(JAVA_EXE) Bn256Test
test:
$(MAKE) test_elgamal
$(MAKE) test_bn256
9 years ago
clean:
8 years ago
rm -rf *.class $(ELGAMAL_LIB) $(PACKAGE_DIR)/*.class *_wrap.cxx
9 years ago