RFR: better support for cross compilation
Sergey Nazarkin
snazarkin at azul.com
Mon Jul 2 10:25:41 UTC 2018
So far I’ve got the only single response with the proposal to remove redundant PI_TOOLS variable. I’ve accepted it and new changeset would be
diff -r 1b3d9720d724 Makefile
--- a/Makefile Tue Jun 19 19:15:30 2018 +0300
+++ b/Makefile Mon Jul 02 13:20:46 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 \
More information about the dio-dev
mailing list