aboutsummaryrefslogtreecommitdiff
path: root/src/main/native/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/native/Makefile')
-rw-r--r--src/main/native/Makefile30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main/native/Makefile b/src/main/native/Makefile
new file mode 100644
index 0000000000..6236e26f3d
--- /dev/null
+++ b/src/main/native/Makefile
@@ -0,0 +1,30 @@
+CC = gcc
+#JAVA_HOME = /usr/lib/jvm/java-6-sun
+OS_NAME = linux
+
+CFLAGS = -fPIC -O3 -funroll-all-loops
+
+SPARK = ../..
+
+LZF = $(SPARK)/third_party/liblzf-3.5
+
+LIB = libspark_native.so
+
+all: $(LIB)
+
+spark_compress_lzf_LZF.h: $(SPARK)/build/classes/spark/compress/lzf/LZF.class
+ifeq ($(JAVA_HOME),)
+ $(error JAVA_HOME is not set)
+else
+ $(JAVA_HOME)/bin/javah -classpath $(SPARK)/build/classes spark.compress.lzf.LZF
+endif
+
+$(LIB): spark_compress_lzf_LZF.h spark_compress_lzf_LZF.c
+ $(CC) $(CFLAGS) -shared -o $@ spark_compress_lzf_LZF.c \
+ -I $(JAVA_HOME)/include -I $(JAVA_HOME)/include/$(OS_NAME) \
+ -I $(LZF) $(LZF)/lzf_c.c $(LZF)/lzf_d.c
+
+clean:
+ rm -f spark_compress_lzf_LZF.h $(LIB)
+
+.PHONY: all clean