changeset 113:3e046a6fbeec

Merge
author jld
date Wed, 25 Feb 2015 16:47:31 -0500
parents 380a1d95976d a21b352d2f53
children 16557858a60c
files Makefile
diffstat 2 files changed, 48 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Feb 25 20:05:40 2015 +0400
+++ b/Makefile	Wed Feb 25 16:47:31 2015 -0500
@@ -72,8 +72,32 @@
 DIO_SAM_JAVA_SRC_DIR := \
                         samples/gpio/src
 
+# define variables needed for dir setup
+TARGET_CPU_LEGACY_LIB ?= arm
+DIO_VERSION := 1.0.1
+BUILD_NUMBER ?= dev
+
+ifneq ($(BUILD_NUMBER),dev)
+  # only include 'b' when you have an actual build number 
+  B := b
+endif
+  
+
+ifeq ($(TARGET_CPU_LEGACY_LIB),arm)
+  OSGI_ARCH := armv6hf
+  ARCH := armv6hf
+else
+  OSGI_ARCH := x86
+  ARCH := i586
+endif
+
+
+
 # Output directorires
 BUILD_DIR := $(CURDIR)/build
+OSGI_BUILD_DIR := $(CURDIR)/build/osgi
+OSGI_DIST_DIR := $(CURDIR)/build/dist/osgi
+OSGI_JAR := $(OSGI_DIST_DIR)/dio-$(DIO_VERSION)-$(B)$(BUILD_NUMBER)-linux-$(ARCH).jar
 SO_OUT_DIR := $(BUILD_DIR)/so
 JAVA_OUT_DIR := $(BUILD_DIR)/classes
 SAM_JAVA_OUT_DIR := $(BUILD_DIR)/samples/classes
@@ -147,7 +171,6 @@
 JAVAC := $(JAVA_HOME)/bin/javac
 JAR := $(JAVA_HOME)/bin/jar
 MKDIR := mkdir -p
-TARGET_CPU_LEGACY_LIB = arm
 TARGET_C_FLAGS = $(USER_C_FLAGS) -fPIC -Wno-psabi -DJAVACALL_REPORT_LEVEL=0 -DENABLE_DEVICEACCESS -c -MMD -MF $(NATIVE_OUT_DIR)/$(@).d
 TARGET_INCLUDES = $(foreach d,$(DIO_INCLUDE_DIRS),-I$(d)) -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
 TARGET_CXX_FLAGS = $(USER_CXX_FLAGS) -fPIC -Wno-psabi -DJAVACALL_REPORT_LEVEL=4 -DENABLE_DEVICEACCESS -c
@@ -170,7 +193,7 @@
 #######################################################################################################
 # targets
 
-.PHONY: clean all dirs device-io bundle
+.PHONY: clean all dirs device-io bundle osgi
 
 all: $(ALL_TARGETS)
 
@@ -199,7 +222,7 @@
 $(LIB_NAME).jar: $(JAVA_IMPL_FILES) $(JAVA_API_FILES) dirs
 	@echo Compiling Java source files to $(JAR_OUT_DIR)/$@
 	@$(JAVAC) -d $(JAVA_OUT_DIR) $(JAVA_IMPL_FILES) $(JAVA_API_FILES)
-	@sed -e  "s/BUILD_NUMBER/b$(BUILD_NUMBER)/g" src/se/manifest.mf > $(BUILD_DIR)/manifest.mf
+	@sed -e  "s/BUILD_NUMBER/$(B)$(BUILD_NUMBER)/g" src/se/manifest.mf > $(BUILD_DIR)/manifest.mf
 	@$(JAR) cfm $(JAR_OUT_DIR)/$@ $(BUILD_DIR)/manifest.mf -C $(JAVA_OUT_DIR) .
 
 $(LIB_NAME)-samples.jar: $(SAM_JAVA_SRC_FILES) dirs $(LIB_NAME).jar
@@ -218,6 +241,16 @@
 	@cp jrecreate/* $(BUILD_DIR)/deviceio
 	@(cd $(BUILD_DIR) ; zip -r $(BUNDLE_OUT_DIR)/$(BUNDLE_NAME).zip deviceio )
 
+osgi: $(LIB_NAME).jar lib$(LIB_NAME).so
+	rm -rf $(OSGI_BUILD_DIR)/*
+	rm -rf $(OSGI_DIST_DIR)/*
+	mkdir -p $(OSGI_DIST_DIR)
+	mkdir -p $(OSGI_BUILD_DIR)/lib
+	sed -e  "s/BUILD_NUMBER/$(B)$(BUILD_NUMBER)/g;s/OSGI_ARCH/$(OSGI_ARCH)/g;s/DIO_VERSION/$(DIO_VERSION)/g" src/se/manifest.mf-osgi > $(OSGI_BUILD_DIR)/manifest.mf
+	cp $(JAR_OUT_DIR)/$(LIB_NAME).jar $(OSGI_JAR)
+	cp $(SO_OUT_DIR)/lib$(LIB_NAME).so $(OSGI_BUILD_DIR)/lib
+	$(JAR) ufm $(OSGI_JAR) $(OSGI_BUILD_DIR)/manifest.mf -C $(OSGI_BUILD_DIR) lib/lib$(LIB_NAME).so
+
 clean:
 	@echo "clean: removing $(BUILD_DIR)"
 	@rm -rf $(BUILD_DIR)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/se/manifest.mf-osgi	Wed Feb 25 16:47:31 2015 -0500
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-SymbolicName: Device IO on Linux/OSGI_ARCH
+Bundle-Name: Device IO on Linux/OSGI_ARCH
+Bundle-Version: DIO_VERSION-BUILD_NUMBER
+Bundle-NativeCode: lib/libdio.so;osname=Linux;processor=OSGI_ARCH
+Specification-Title: Device I/O 
+Specification-Version: DIO_VERSION
+Specification-Vendor: Oracle Corporation 
+Implementation-Title: Device IO on Linux/OSGI_ARCH
+Implementation-Version: DIO_VERSION-BUILD_NUMBER
+Implementation-Vendor: Oracle Corporation
+Export-Package: jdk.dio, jdk.dio.generic, jdk.dio.spibus, jdk.dio.gpio, jdk.dio.i2cbus, jdk.dio.spi, jdk.dio.uart