aboutsummaryrefslogtreecommitdiff
path: root/flow-native
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2014-03-29 13:02:50 +0100
committerJakob Odersky <jodersky@gmail.com>2014-03-29 13:02:50 +0100
commitc0c3647bbf64af754d3cc9b6d167c8ca2b736f74 (patch)
treebce4c8f8a8328fd0705e9ab1b7fc9ea423b56d64 /flow-native
parente1dbcd03d9c0504ef9d0e4172236481222ef70f2 (diff)
downloadakka-serial-c0c3647bbf64af754d3cc9b6d167c8ca2b736f74.tar.gz
akka-serial-c0c3647bbf64af754d3cc9b6d167c8ca2b736f74.tar.bz2
akka-serial-c0c3647bbf64af754d3cc9b6d167c8ca2b736f74.zip
update native build
Diffstat (limited to 'flow-native')
-rw-r--r--flow-native/Makefile66
-rw-r--r--flow-native/common.mk51
-rw-r--r--flow-native/debian/control2
-rw-r--r--flow-native/debian/libflow3-0.dirs (renamed from flow-native/debian/libflow3.dirs)0
-rw-r--r--flow-native/readme.md3
5 files changed, 89 insertions, 33 deletions
diff --git a/flow-native/Makefile b/flow-native/Makefile
index fb973f3..0a64190 100644
--- a/flow-native/Makefile
+++ b/flow-native/Makefile
@@ -1,56 +1,58 @@
# Build native binaries for flow.
# ===============================
+# This makefile is intended for linux based systems.
-# name of the library to produce
-NAME=flow
-MAJOR=3
-MINOR=0
-MICRO=0
+# Include common settings
+include common.mk
-SONAME=lib$(NAME).so.$(MAJOR)
-TARGET=$(SONAME).$(MINOR).$(MICRO)
-
-JAVA_HOME=/usr/lib/jvm/java-7-oracle
+# Name of library to build
+LIB=lib$(NAME).so
-# where the library should be installed
-PREFIX?=usr/lib
+# soname of library
+SONAME=$(LIB).$(MAJOR)
-# compiler and linker settings
-CC=$(CROSS_COMPILE)gcc
-LD=$(CROSS_COMPILE)ld
-CFLAGS= -O2 -fPIC -Wall
-
-# since java connot easily load a library with a specific
-# major version, the vesion is included in the library's name
+# Actual file name of library
+TARGET=$(SONAME).$(MINOR).$(MICRO)
+# Linux-specific linker flags
LDFLAGS+=-shared -Wl,-soname,$(SONAME)
-INCLUDES=./include/ $(JAVA_HOME)/include/ $(JAVA_HOME)/include/linux/
-OBJECTS=flow_jni.o posix/flow.o
+# All final products that should be installed
+PRODUCTS=$(TARGET) $(SONAME) $(LIB)
-# rules
-all: $(TARGET) $(SONAME)
+# Build library and all appropriate links
+all: $(PRODUCTS)
+
+# Build actual library
$(TARGET): $(OBJECTS)
$(CC) $(LDFLAGS) -o $@ $^
-
+
+# Create soname link
$(SONAME): $(TARGET)
- ln -s $(TARGET) $(SONAME)
+ ln -s $< $@
+# Create dev link
+$(LIB): $(SONAME)
+ ln -s $< $@
+
+# Compile objects
%.o: %.c
$(CC) $(CFLAGS) $(addprefix -I, $(INCLUDES)) -o $@ -c $<
-install:
- cp -P -t $(DESTDIR)/$(PREFIX)/ $(TARGET) $(SONAME)
+# Install resulting artifacts
+install: all
+ @for product in $(PRODUCTS); do cp -P -t $(DESTDIR)/$(PREFIX)/lib $${product}; done
+# Uninstall resulting artifacts
uninstall:
- rm $(DESTDIR)/$(PREFIX)/$(TARGET)
- rm $(DESTDIR)/$(PREFIX)/$(SONAME)
-
+ @for product in $(PRODUCTS); do rm $(DESTDIR)/$(PREFIX)/lib/$${product}; done
+
+# Clean build
clean:
rm -f posix/*.o
rm -f posix/*.so
- rm -f $(TARGET)
- rm -f $(SONAME)
+ rm -f *.o
+ $(foreach product, $(PRODUCTS), rm -f $(product);)
-.PHONY: clean install
+.PHONY: clean install uninstall \ No newline at end of file
diff --git a/flow-native/common.mk b/flow-native/common.mk
new file mode 100644
index 0000000..be9f980
--- /dev/null
+++ b/flow-native/common.mk
@@ -0,0 +1,51 @@
+# Common settings for flow native build
+# =====================================
+
+# Name of the library to produce
+#
+NAME=flow3
+
+
+# Library versions
+#
+# Note that MAJOR should always be set tozero
+# since java does not allow loading semantically
+# versioned libraries, include the major version
+# in the name instead.
+#
+MAJOR=0# always zero
+MINOR=0# backwards-compatible changes
+MICRO=0# bugfixes
+
+
+# Directory where the library will be installed
+#
+PREFIX?=/usr
+
+
+# Compiler and linker settings
+#
+# Set CROSS_COMPILE to a gcc triplet
+# when cross-compiling
+#
+CC=$(CROSS_COMPILE)gcc
+LD=$(CROSS_COMPILE)ld
+CFLAGS= -O2 -fPIC -Wall
+LDFLAGS=
+
+
+# JDK base directory
+#
+JAVA_HOME?=/usr/lib/jvm/java-7-oracle
+
+
+# Include directories
+#
+INCLUDES=./include/ $(JAVA_HOME)/include/ $(JAVA_HOME)/include/linux/
+
+
+# Objects that will be compiled from respective .c files
+#
+OBJECTS=flow_jni.o posix/flow.o
+
+
diff --git a/flow-native/debian/control b/flow-native/debian/control
index 5fc8b77..dea1f0f 100644
--- a/flow-native/debian/control
+++ b/flow-native/debian/control
@@ -7,7 +7,7 @@ Section: libs
Homepage: https://github.com/jodersky/flow
Vcs-Git: git://github.com/jodersky/flow.git
-Package: libflow3
+Package: libflow3-0
Section: libs
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
diff --git a/flow-native/debian/libflow3.dirs b/flow-native/debian/libflow3-0.dirs
index 6845771..6845771 100644
--- a/flow-native/debian/libflow3.dirs
+++ b/flow-native/debian/libflow3-0.dirs
diff --git a/flow-native/readme.md b/flow-native/readme.md
new file mode 100644
index 0000000..86987ed
--- /dev/null
+++ b/flow-native/readme.md
@@ -0,0 +1,3 @@
+# Native backend for flow
+
+Refer to documentation/building.md for information on how to build. \ No newline at end of file