changeset 32:249f79a848af

8055784: Not Excluding Unimplemented Devices from DIO Build When STRIP_PACKAGES is defined Summary: Fixed mechanism for stripping out unimplemented devices. Also cleaned up some cross module dependencies. Added gpio to list of modules that can be excluded. Reviewed-by: raimandi
author jld
date Fri, 22 Aug 2014 12:44:34 -0400
parents 00b112fc9c19
children a60958f44b0c
files Makefile src/share/classes/jdk/dio/power/PowerManaged.java src/share/linux/native/com/oracle/dio/spibus/spi.c
diffstat 3 files changed, 25 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Thu Aug 21 16:17:17 2014 -0400
+++ b/Makefile	Fri Aug 22 12:44:34 2014 -0400
@@ -62,8 +62,8 @@
                        src/share/linux/native
 
 STRIP_PACKAGES ?=
-# always strip out these apis (not implemented)
-STRIP_PACKAGES += pwm counter
+# always strip out these apis (not yet implemented)
+STRIP_PACKAGES_INTERNAL = $(STRIP_PACKAGES) pwm counter mmio
 
 # specify sample java src directories
 DIO_SAM_JAVA_SRC_DIR := \
@@ -88,31 +88,41 @@
 DIO_INCLUDE_DIRS := $(sort $(dir $(call find-suffix-files, $(DIO_NATIVE_SRC_DIRS),h)))
 
 # filter out apis we don't want in this build
-ifneq (,$(findstring i2c, $(STRIP_PACKAGES)))
+ifneq (,$(findstring i2c, $(STRIP_PACKAGES_INTERNAL)))
   CPP_SRC_FILES := $(foreach f,$(CPP_SRC_FILES),$(if $(findstring i2c,$(f)),,$(f)))
   C_SRC_FILES := $(foreach f,$(C_SRC_FILES),$(if $(findstring i2c,$(f)),,$(f)))
   JAVA_SRC_FILES := $(foreach f,$(JAVA_SRC_FILES),$(if $(findstring i2c,$(f)),,$(f)))
 endif
-ifneq (,$(findstring spibus, $(STRIP_PACKAGES)))
+ifneq (,$(findstring spibus, $(STRIP_PACKAGES_INTERNAL)))
   CPP_SRC_FILES := $(foreach f,$(CPP_SRC_FILES),$(if $(findstring spibus,$(f)),,$(f)))
   C_SRC_FILES := $(foreach f,$(C_SRC_FILES),$(if $(findstring spibus,$(f)),,$(f)))
   JAVA_SRC_FILES := $(foreach f,$(JAVA_SRC_FILES),$(if $(findstring spibus,$(f)),,$(f)))
 endif
-ifneq (,$(findstring uart, $(STRIP_PACKAGES)))
+ifneq (,$(findstring uart, $(STRIP_PACKAGES_INTERNAL)))
   CPP_SRC_FILES := $(foreach f,$(CPP_SRC_FILES),$(if $(findstring uart,$(f)),,$(f)))
   C_SRC_FILES := $(foreach f,$(C_SRC_FILES),$(if $(findstring uart,$(f)),,$(f)))
   JAVA_SRC_FILES := $(foreach f,$(JAVA_SRC_FILES),$(if $(findstring uart,$(f)),,$(f)))
 endif
-ifneq (,$(findstring counter, $(STRIP_PACKAGES)))
+ifneq (,$(findstring counter, $(STRIP_PACKAGES_INTERNAL)))
   CPP_SRC_FILES := $(foreach f,$(CPP_SRC_FILES),$(if $(findstring counter,$(f)),,$(f)))
   C_SRC_FILES := $(foreach f,$(C_SRC_FILES),$(if $(findstring counter,$(f)),,$(f)))
   JAVA_SRC_FILES := $(foreach f,$(JAVA_SRC_FILES),$(if $(findstring counter,$(f)),,$(f)))
 endif
-ifneq (,$(findstring pwm, $(STRIP_PACKAGES)))
+ifneq (,$(findstring pwm, $(STRIP_PACKAGES_INTERNAL)))
   CPP_SRC_FILES := $(foreach f,$(CPP_SRC_FILES),$(if $(findstring pwm,$(f)),,$(f)))
   C_SRC_FILES := $(foreach f,$(C_SRC_FILES),$(if $(findstring pwm,$(f)),,$(f)))
   JAVA_SRC_FILES := $(foreach f,$(JAVA_SRC_FILES),$(if $(findstring pwm,$(f)),,$(f)))
 endif
+ifneq (,$(findstring gpio, $(STRIP_PACKAGES_INTERNAL)))
+  CPP_SRC_FILES := $(foreach f,$(CPP_SRC_FILES),$(if $(findstring gpio,$(f)),,$(f)))
+  C_SRC_FILES := $(foreach f,$(C_SRC_FILES),$(if $(findstring gpio,$(f)),,$(f)))
+  JAVA_SRC_FILES := $(foreach f,$(JAVA_SRC_FILES),$(if $(findstring gpio,$(f)),,$(f)))
+endif
+ifneq (,$(findstring mmio, $(STRIP_PACKAGES_INTERNAL)))
+  CPP_SRC_FILES := $(foreach f,$(CPP_SRC_FILES),$(if $(findstring mmio,$(f)),,$(f)))
+  C_SRC_FILES := $(foreach f,$(C_SRC_FILES),$(if $(findstring mmio,$(f)),,$(f)))
+  JAVA_SRC_FILES := $(foreach f,$(JAVA_SRC_FILES),$(if $(findstring mmio,$(f)),,$(f)))
+endif
 
 # calculate obj files needed
 CPP_OBJ_FILES := $(notdir $(subst .cpp,.o,$(CPP_SRC_FILES)))
@@ -142,6 +152,13 @@
           -Xlinker -rpath -Xlinker \$$ORIGIN -lpthread -lrt \
           -Xlinker -z -Xlinker muldefs -lstdc++
 
+ALL_TARGETS := dirs $(LIB_NAME).jar lib$(LIB_NAME).so device-io
+
+# Don't build samples if we're stripping extra packages. Build might fail.
+ifeq (,$(STRIP_PACKAGES))
+  ALL_TARGETS := $(ALL_TARGETS) $(LIB_NAME)-samples.jar
+endif
+
 #######################################################################################################
 #
 BUNDLE_NAME := device-io
@@ -151,7 +168,7 @@
 
 .PHONY: clean all dirs device-io bundle
 
-all: dirs $(LIB_NAME).jar lib$(LIB_NAME).so $(LIB_NAME)-samples.jar device-io
+all: $(ALL_TARGETS)
 
 dirs:
 	@echo "Creating output directories"
--- a/src/share/classes/jdk/dio/power/PowerManaged.java	Thu Aug 21 16:17:17 2014 -0400
+++ b/src/share/classes/jdk/dio/power/PowerManaged.java	Fri Aug 22 12:44:34 2014 -0400
@@ -27,7 +27,6 @@
 
 import jdk.dio.ClosedDeviceException;
 import jdk.dio.Device;
-import jdk.dio.gpio.GPIOPin;
 import java.io.IOException;
 
 /**
--- a/src/share/linux/native/com/oracle/dio/spibus/spi.c	Thu Aug 21 16:17:17 2014 -0400
+++ b/src/share/linux/native/com/oracle/dio/spibus/spi.c	Fri Aug 22 12:44:34 2014 -0400
@@ -24,9 +24,7 @@
  */
 
 #include "javacall_defs.h"
-#include "javacall_mmio.h"
 #include "javacall_spi.h"
-#include "javacall_gpio.h"
 #include "javacall_logging.h"
 #include "javacall_memory.h"
 #include <getopt.h>