changeset 261:e9febb974bec tip

DIO-27: Better support of cross-compilation
author snazarki
date Fri, 13 Jul 2018 22:30:16 +0300
parents 1b3d9720d724
children
files Makefile
diffstat 1 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Tue Jun 19 19:15:30 2018 +0300
+++ b/Makefile	Fri Jul 13 22:30:16 2018 +0300
@@ -40,14 +40,19 @@
 
 ###########################################################
 # check for required env vars
+
 ifeq ($(CROSS_TOOL),)
-  $(error "CROSS_TOOL is not defined. Please set CROSS_TOOL to point to the location of the raspberry pi GNU toolchain")
+  $(error "CROSS_TOOL is not defined. Please set CROSS_TOOL to point to the location of the cross compilation GNU toolchain")
 endif
 
 ifeq ($(JAVA_HOME),)
   $(error "JAVA_HOME is not defined. Please set JAVA_HOME to point to the location of the JDK8 installation")
 endif
 
+# Target device JDK build, required for cross compilation, should contain "include /jni.h" and "inlude/linux/jni_md.h"
+# Default value points to host JDK
+TARGET_JDK_PATH ?= $(JAVA_HOME)
+
 BUILD_DEVICEACCESS := true
 
 DIO_JAVA_API_DIRS := \
@@ -79,10 +84,10 @@
 BUILD_NUMBER ?= dev
 
 ifneq ($(BUILD_NUMBER),dev)
-  # only include 'b' when you have an actual build number 
+  # only include 'b' when you have an actual build number
   B := b
 endif
-  
+
 
 ifeq ($(TARGET_CPU_LEGACY_LIB),arm)
   OSGI_ARCH := arm
@@ -165,15 +170,15 @@
 
 #######################################################################################################
 # tool and flag setup for arm (rasp pi) build
-TARGET_TOOLCHAIN := $(CROSS_TOOL)
-TARGET_CC := $(TARGET_TOOLCHAIN)gcc
-TARGET_CXX := $(TARGET_TOOLCHAIN)g++
-TARGET_LD := $(TARGET_TOOLCHAIN)gcc
+TARGET_CC := $(CROSS_TOOL)gcc
+TARGET_CXX := $(CROSS_TOOL)g++
+TARGET_LD := $(CROSS_TOOL)gcc
+
 JAVAC := $(JAVA_HOME)/bin/javac
 JAR := $(JAVA_HOME)/bin/jar
 MKDIR := mkdir -p
 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_TARGET_HOME)/include -I$(JAVA_TARGET_HOME)/include/linux
+TARGET_INCLUDES = $(foreach d,$(DIO_INCLUDE_DIRS),-I$(d)) -I$(TARGET_JDK_PATH)/include -I$(TARGET_JDK_PATH)/include/linux
 TARGET_CXX_FLAGS = $(USER_CXX_FLAGS) -fPIC -Wno-psabi -DJAVACALL_REPORT_LEVEL=4 -DENABLE_DEVICEACCESS -c
 TARGET_LD_FLAGS= $(USER_LD_FLAGS) -Xlinker -z -Xlinker defs -Xlinker -O1 \
           -shared \