2017-08-08 10:02:27 +00:00
|
|
|
JNAERATOR_VERSION=ac73c9e
|
|
|
|
JARS_DIR=./lib
|
|
|
|
JAR=$(JARS_DIR)/enry.jar
|
|
|
|
JNAERATOR_DIR=./.jnaerator
|
|
|
|
JNAERATOR_JAR=$(JNAERATOR_DIR)/jnaerator.jar
|
2017-08-08 15:36:52 +00:00
|
|
|
JNAERATOR_JAR_URL="https://jitpack.io/com/github/nativelibs4java/JNAerator/jnaerator/$(JNAERATOR_VERSION)/jnaerator-$(JNAERATOR_VERSION)-shaded.jar"
|
2017-08-08 10:02:27 +00:00
|
|
|
RESOURCES_SRC=../.shared
|
|
|
|
RESOURCES_DIR=./shared
|
|
|
|
HEADER_FILE=$(RESOURCES_DIR)/libenry.h
|
|
|
|
|
2017-08-08 10:32:32 +00:00
|
|
|
SHELL := /bin/bash
|
|
|
|
|
2017-08-08 10:02:27 +00:00
|
|
|
all: $(JAR)
|
|
|
|
|
|
|
|
$(JAR): $(RESOURCES_DIR) $(JNAERATOR_JAR)
|
|
|
|
mkdir -p lib && \
|
|
|
|
java -jar $(JNAERATOR_JAR) \
|
|
|
|
-package tech.sourced.enry.nativelib \
|
|
|
|
-library enry \
|
|
|
|
$(HEADER_FILE) \
|
2018-10-18 09:10:03 +00:00
|
|
|
-I/usr/lib/gcc/x86_64-linux-gnu/4.8/include \
|
2018-10-21 13:37:31 +00:00
|
|
|
-D__GNUC__=4 \
|
2017-08-08 10:02:27 +00:00
|
|
|
-o $(JARS_DIR) \
|
|
|
|
-mode StandaloneJar \
|
|
|
|
-runtime JNA;
|
|
|
|
|
|
|
|
$(RESOURCES_DIR): os-shared-lib
|
|
|
|
cp -R $(RESOURCES_SRC) $(RESOURCES_DIR)
|
|
|
|
|
|
|
|
$(JNAERATOR_JAR): $(RESOURCES_DIR)
|
2019-02-05 21:54:14 +00:00
|
|
|
mkdir -p $(JNAERATOR_DIR) && \
|
2017-08-08 15:36:52 +00:00
|
|
|
wget $(JNAERATOR_JAR_URL) -O $(JNAERATOR_JAR)
|
2017-08-08 10:02:27 +00:00
|
|
|
|
|
|
|
os-shared-lib:
|
|
|
|
@os_name="$(shell uname -s)" && \
|
|
|
|
if [ "$$os_name" == "Linux" ]; then \
|
|
|
|
$(MAKE) linux-shared; \
|
|
|
|
elif [ "$$os_name" == "Darwin" ]; then \
|
|
|
|
$(MAKE) darwin-shared; \
|
|
|
|
else \
|
|
|
|
echo "Unsupported operating system, can't build shared library"; \
|
|
|
|
exit 1; \
|
|
|
|
fi;
|
|
|
|
|
|
|
|
linux-shared:
|
|
|
|
cd .. && \
|
|
|
|
$(MAKE) linux-shared
|
|
|
|
|
|
|
|
darwin-shared:
|
|
|
|
cd .. && \
|
|
|
|
$(MAKE) darwin-shared
|
|
|
|
|
|
|
|
test:
|
2017-09-22 17:10:08 +00:00
|
|
|
./sbt clean test
|
2017-08-08 10:02:27 +00:00
|
|
|
|
|
|
|
package:
|
2017-09-22 17:10:08 +00:00
|
|
|
./sbt clean assembly
|
2017-08-08 10:02:27 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(JAR)
|
|
|
|
rm -rf $(RESOURCES_DIR)
|
2019-06-01 17:47:13 +00:00
|
|
|
rm -rf $(JNAERATOR_JAR)
|
2017-08-08 10:02:27 +00:00
|
|
|
|
2019-06-01 17:47:13 +00:00
|
|
|
.PHONY: test package clean linux-shared darwin-shared os-shared-lib
|