From 060fec26321c200e859de7ff958bc228831eacab Mon Sep 17 00:00:00 2001 From: Mick Jordan <mick.jordan@oracle.com> Date: Mon, 16 Nov 2015 16:13:03 -0800 Subject: [PATCH] native refactor step 2 --- .hgignore | 2 + com.oracle.truffle.r.native/fficall/Makefile | 5 ++- .../{common/src => src/common}/arithmetic.c | 0 .../fficall/{common/src => src/common}/util.c | 0 .../src => src/common}/variable_defs.h | 0 .../fficall/{jni/src => src/jni}/Applic.c | 0 .../{jni/src => src/jni}/Connections.c | 0 .../fficall/{jni/src => src/jni}/Defn.h | 0 .../fficall/{ => src}/jni/Makefile | 42 ++++++++++--------- .../fficall/{jni/src => src/jni}/Memory.c | 0 .../fficall/{jni/src => src/jni}/Parse.c | 0 .../fficall/{jni/src => src/jni}/Random.c | 0 .../fficall/{jni/src => src/jni}/Rdynload.c | 0 .../fficall/{jni/src => src/jni}/Rinternals.c | 0 .../fficall/{jni/src => src/jni}/Rmath.c | 0 .../fficall/{jni/src => src/jni}/Utils.c | 0 .../{jni/src => src/jni}/appl_pretty.c | 0 .../fficall/{jni/src => src/jni}/coerce.c | 0 .../fficall/{jni/src => src/jni}/inlined.c | 0 .../{jni/src => src/jni}/main_colors.c | 0 .../{jni/src => src/jni}/main_devices.c | 0 .../{jni/src => src/jni}/main_engine.c | 0 .../{jni/src => src/jni}/main_format.c | 0 .../{jni/src => src/jni}/main_graphics.c | 0 .../fficall/{jni/src => src/jni}/main_plot.c | 0 .../{jni/src => src/jni}/main_plot3d.c | 0 .../{jni/src => src/jni}/main_plotmath.c | 0 .../fficall/{jni/src => src/jni}/main_print.c | 0 .../{jni/src => src/jni}/main_rlocale.c | 0 .../fficall/{jni/src => src/jni}/main_sort.c | 0 .../fficall/{jni/src => src/jni}/rfficall.c | 0 .../fficall/{jni/src => src/jni}/rffiutils.c | 0 .../fficall/{jni/src => src/jni}/rffiutils.h | 0 .../fficall/{jni/src => src/jni}/sys.c | 0 .../{jni/src => src/jni}/unimplemented.c | 0 .../fficall/{jni/src => src/jni}/variables.c | 2 +- 36 files changed, 28 insertions(+), 23 deletions(-) rename com.oracle.truffle.r.native/fficall/{common/src => src/common}/arithmetic.c (100%) rename com.oracle.truffle.r.native/fficall/{common/src => src/common}/util.c (100%) rename com.oracle.truffle.r.native/fficall/{common/src => src/common}/variable_defs.h (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/Applic.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/Connections.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/Defn.h (100%) rename com.oracle.truffle.r.native/fficall/{ => src}/jni/Makefile (66%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/Memory.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/Parse.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/Random.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/Rdynload.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/Rinternals.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/Rmath.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/Utils.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/appl_pretty.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/coerce.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/inlined.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/main_colors.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/main_devices.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/main_engine.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/main_format.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/main_graphics.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/main_plot.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/main_plot3d.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/main_plotmath.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/main_print.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/main_rlocale.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/main_sort.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/rfficall.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/rffiutils.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/rffiutils.h (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/sys.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/unimplemented.c (100%) rename com.oracle.truffle.r.native/fficall/{jni/src => src/jni}/variables.c (99%) diff --git a/.hgignore b/.hgignore index e52c83ba9b..1b98950090 100644 --- a/.hgignore +++ b/.hgignore @@ -13,6 +13,8 @@ ^com.oracle.truffle.r.test/rpackages/testrlibs_user ^com.oracle.truffle.r.test.native/urand/lib/liburand.so ^com.oracle.truffle.r.native/gnur/R-* +com.oracle.truffle.r.native/fficall/src/jni/arithmetic.c +com.oracle.truffle.r.native/fficall/src/jni/util.c ^DEPARSE_ERROR ^Rpkgsource/* ^install.cran.logs/ diff --git a/com.oracle.truffle.r.native/fficall/Makefile b/com.oracle.truffle.r.native/fficall/Makefile index c5ae2b2bb6..50f72a6222 100644 --- a/com.oracle.truffle.r.native/fficall/Makefile +++ b/com.oracle.truffle.r.native/fficall/Makefile @@ -24,7 +24,8 @@ .PHONY: all clean all: - $(MAKE) -C jni + $(MAKE) -C src/jni links + $(MAKE) -C src/jni all clean: - $(MAKE) -C jni clean + $(MAKE) -C src/jni clean diff --git a/com.oracle.truffle.r.native/fficall/common/src/arithmetic.c b/com.oracle.truffle.r.native/fficall/src/common/arithmetic.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/common/src/arithmetic.c rename to com.oracle.truffle.r.native/fficall/src/common/arithmetic.c diff --git a/com.oracle.truffle.r.native/fficall/common/src/util.c b/com.oracle.truffle.r.native/fficall/src/common/util.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/common/src/util.c rename to com.oracle.truffle.r.native/fficall/src/common/util.c diff --git a/com.oracle.truffle.r.native/fficall/common/src/variable_defs.h b/com.oracle.truffle.r.native/fficall/src/common/variable_defs.h similarity index 100% rename from com.oracle.truffle.r.native/fficall/common/src/variable_defs.h rename to com.oracle.truffle.r.native/fficall/src/common/variable_defs.h diff --git a/com.oracle.truffle.r.native/fficall/jni/src/Applic.c b/com.oracle.truffle.r.native/fficall/src/jni/Applic.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/Applic.c rename to com.oracle.truffle.r.native/fficall/src/jni/Applic.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/Connections.c b/com.oracle.truffle.r.native/fficall/src/jni/Connections.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/Connections.c rename to com.oracle.truffle.r.native/fficall/src/jni/Connections.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/Defn.h b/com.oracle.truffle.r.native/fficall/src/jni/Defn.h similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/Defn.h rename to com.oracle.truffle.r.native/fficall/src/jni/Defn.h diff --git a/com.oracle.truffle.r.native/fficall/jni/Makefile b/com.oracle.truffle.r.native/fficall/src/jni/Makefile similarity index 66% rename from com.oracle.truffle.r.native/fficall/jni/Makefile rename to com.oracle.truffle.r.native/fficall/src/jni/Makefile index 4d3e358b0a..5787de86b0 100644 --- a/com.oracle.truffle.r.native/fficall/jni/Makefile +++ b/com.oracle.truffle.r.native/fficall/src/jni/Makefile @@ -22,40 +22,42 @@ # ifeq ($(TOPDIR),) - TOPDIR = $(abspath ../..) + TOPDIR = $(abspath ../../..) endif ifneq ($(MAKECMDGOALS),clean) include $(TOPDIR)/platform.mk endif -.PHONY: all clean common_links +.PHONY: all clean links -OBJ = ../lib -SRC = src -C_LOCAL_SOURCES := $(wildcard $(SRC)/*.c) -C_HDRS := $(wildcard $(SRC)/*.h) -C_LIBNAME := librfficall$(DYLIB_EXT) -C_LIB := $(TOPDIR)/../lib/$(C_LIBNAME) +OBJ = ../../lib COMMON = ../common -C_COMMON_SOURCES := $(notdir $(wildcard $(COMMON)/src/*.c)) +C_COMMON_SOURCES := $(notdir $(wildcard $(COMMON)/*.c)) +#$(info C_COMMON_SOURCE=$(C_COMMON_SOURCES)) + +# if link was already set, C_COMMON_SOURCES will be included twice without following filter +C_LOCAL_SOURCES := $(filter-out $(C_COMMON_SOURCES),$(wildcard *.c)) +#$(info C_LOCAL_SOURCES=$(C_LOCAL_SOURCES)) +C_HDRS := $(wildcard *.h) +C_LIBNAME := librfficall$(DYLIB_EXT) +C_LIB := $(TOPDIR)/../lib/$(C_LIBNAME) -C_SOURCES = $(C_LOCAL_SOURCES) $($(C_COMMON_SOURCES) -C_OBJECTS := $(subst $(SRC),$(OBJ),$(C_SOURCES:.c=.o)) -$(info C_SOURCES=$(C_SOURCES)) -$(info C_COMMON_SOURCE=$(C_COMMON_SOURCES)) -$(info C_OBJECTS=$(C_OBJECTS)) +C_SOURCES = $(C_LOCAL_SOURCES) $(C_COMMON_SOURCES) +#$(info C_SOURCES=$(C_SOURCES)) +C_OBJECTS := $(patsubst %.c,$(OBJ)/%.o,$(C_SOURCES)) +#$(info C_OBJECTS=$(C_OBJECTS)) JNI_INCLUDES = -I $(JAVA_HOME)/include -I $(JAVA_HOME)/include/$(JDK_OS_DIR) FFI_INCLUDES = -I$(TOPDIR)/include -I$(TOPDIR)/gnur/R-3.1.3/src/include -I$(TOPDIR)/include/R_ext INCLUDES := $(JNI_INCLUDES) $(FFI_INCLUDES) -all: Makefile common_links $(C_LIB) +all: Makefile $(C_COMMON_SOURCES) $(C_LIB) -common_links: - $(foreach file,$(C_COMMON_SOURCES),ln -sf ../$(COMMON)/$(file) $(SRC)/$(file);) +links: + $(foreach file,$(C_COMMON_SOURCES),ln -sf $(COMMON)/$(file) $(file);) $(C_LIB): $(OBJ) $(C_OBJECTS) $(DYLIB_LD) $(DYLIB_LDFLAGS) -o $(C_LIB) $(C_OBJECTS) @@ -63,12 +65,12 @@ $(C_LIB): $(OBJ) $(C_OBJECTS) $(OBJ): mkdir -p $(OBJ) -$(OBJ)/%.o: $(SRC)/%.c $(TOPDIR)/include/Rinternals.h $(C_HDRS) +$(OBJ)/%.o: %.c $(TOPDIR)/include/Rinternals.h $(C_HDRS) $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ -$(OBJ)/%.E: $(SRC)/%.c $(TOPDIR)/include/Rinternals.h +$(OBJ)/%.E: %.c $(TOPDIR)/include/Rinternals.h $(CC) -E $(CFLAGS) $(INCLUDES) -c $< > $@ clean: rm -rf $(OBJ) $(C_LIB) - $(foreach file,$(C_COMMON_SOURCES),rm -f $(SRC)/$(file);) + $(foreach file,$(C_COMMON_SOURCES),rm -f $(file);) diff --git a/com.oracle.truffle.r.native/fficall/jni/src/Memory.c b/com.oracle.truffle.r.native/fficall/src/jni/Memory.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/Memory.c rename to com.oracle.truffle.r.native/fficall/src/jni/Memory.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/Parse.c b/com.oracle.truffle.r.native/fficall/src/jni/Parse.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/Parse.c rename to com.oracle.truffle.r.native/fficall/src/jni/Parse.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/Random.c b/com.oracle.truffle.r.native/fficall/src/jni/Random.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/Random.c rename to com.oracle.truffle.r.native/fficall/src/jni/Random.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/Rdynload.c b/com.oracle.truffle.r.native/fficall/src/jni/Rdynload.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/Rdynload.c rename to com.oracle.truffle.r.native/fficall/src/jni/Rdynload.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/Rinternals.c b/com.oracle.truffle.r.native/fficall/src/jni/Rinternals.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/Rinternals.c rename to com.oracle.truffle.r.native/fficall/src/jni/Rinternals.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/Rmath.c b/com.oracle.truffle.r.native/fficall/src/jni/Rmath.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/Rmath.c rename to com.oracle.truffle.r.native/fficall/src/jni/Rmath.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/Utils.c b/com.oracle.truffle.r.native/fficall/src/jni/Utils.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/Utils.c rename to com.oracle.truffle.r.native/fficall/src/jni/Utils.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/appl_pretty.c b/com.oracle.truffle.r.native/fficall/src/jni/appl_pretty.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/appl_pretty.c rename to com.oracle.truffle.r.native/fficall/src/jni/appl_pretty.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/coerce.c b/com.oracle.truffle.r.native/fficall/src/jni/coerce.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/coerce.c rename to com.oracle.truffle.r.native/fficall/src/jni/coerce.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/inlined.c b/com.oracle.truffle.r.native/fficall/src/jni/inlined.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/inlined.c rename to com.oracle.truffle.r.native/fficall/src/jni/inlined.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/main_colors.c b/com.oracle.truffle.r.native/fficall/src/jni/main_colors.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/main_colors.c rename to com.oracle.truffle.r.native/fficall/src/jni/main_colors.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/main_devices.c b/com.oracle.truffle.r.native/fficall/src/jni/main_devices.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/main_devices.c rename to com.oracle.truffle.r.native/fficall/src/jni/main_devices.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/main_engine.c b/com.oracle.truffle.r.native/fficall/src/jni/main_engine.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/main_engine.c rename to com.oracle.truffle.r.native/fficall/src/jni/main_engine.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/main_format.c b/com.oracle.truffle.r.native/fficall/src/jni/main_format.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/main_format.c rename to com.oracle.truffle.r.native/fficall/src/jni/main_format.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/main_graphics.c b/com.oracle.truffle.r.native/fficall/src/jni/main_graphics.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/main_graphics.c rename to com.oracle.truffle.r.native/fficall/src/jni/main_graphics.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/main_plot.c b/com.oracle.truffle.r.native/fficall/src/jni/main_plot.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/main_plot.c rename to com.oracle.truffle.r.native/fficall/src/jni/main_plot.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/main_plot3d.c b/com.oracle.truffle.r.native/fficall/src/jni/main_plot3d.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/main_plot3d.c rename to com.oracle.truffle.r.native/fficall/src/jni/main_plot3d.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/main_plotmath.c b/com.oracle.truffle.r.native/fficall/src/jni/main_plotmath.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/main_plotmath.c rename to com.oracle.truffle.r.native/fficall/src/jni/main_plotmath.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/main_print.c b/com.oracle.truffle.r.native/fficall/src/jni/main_print.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/main_print.c rename to com.oracle.truffle.r.native/fficall/src/jni/main_print.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/main_rlocale.c b/com.oracle.truffle.r.native/fficall/src/jni/main_rlocale.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/main_rlocale.c rename to com.oracle.truffle.r.native/fficall/src/jni/main_rlocale.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/main_sort.c b/com.oracle.truffle.r.native/fficall/src/jni/main_sort.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/main_sort.c rename to com.oracle.truffle.r.native/fficall/src/jni/main_sort.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/rfficall.c b/com.oracle.truffle.r.native/fficall/src/jni/rfficall.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/rfficall.c rename to com.oracle.truffle.r.native/fficall/src/jni/rfficall.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/rffiutils.c b/com.oracle.truffle.r.native/fficall/src/jni/rffiutils.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/rffiutils.c rename to com.oracle.truffle.r.native/fficall/src/jni/rffiutils.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/rffiutils.h b/com.oracle.truffle.r.native/fficall/src/jni/rffiutils.h similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/rffiutils.h rename to com.oracle.truffle.r.native/fficall/src/jni/rffiutils.h diff --git a/com.oracle.truffle.r.native/fficall/jni/src/sys.c b/com.oracle.truffle.r.native/fficall/src/jni/sys.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/sys.c rename to com.oracle.truffle.r.native/fficall/src/jni/sys.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/unimplemented.c b/com.oracle.truffle.r.native/fficall/src/jni/unimplemented.c similarity index 100% rename from com.oracle.truffle.r.native/fficall/jni/src/unimplemented.c rename to com.oracle.truffle.r.native/fficall/src/jni/unimplemented.c diff --git a/com.oracle.truffle.r.native/fficall/jni/src/variables.c b/com.oracle.truffle.r.native/fficall/src/jni/variables.c similarity index 99% rename from com.oracle.truffle.r.native/fficall/jni/src/variables.c rename to com.oracle.truffle.r.native/fficall/src/jni/variables.c index f3e04dad94..971a8c8802 100644 --- a/com.oracle.truffle.r.native/fficall/jni/src/variables.c +++ b/com.oracle.truffle.r.native/fficall/src/jni/variables.c @@ -29,7 +29,7 @@ #include <jni.h> #include <Rinternals.h> #include "rffiutils.h" -#include "../../common/src/variable_defs.h" +#include "../common/variable_defs.h" jmethodID getGlobalEnvMethodID; jmethodID getBaseEnvMethodID; -- GitLab