Skip to content
Snippets Groups Projects
Commit 060fec26 authored by Mick Jordan's avatar Mick Jordan
Browse files

native refactor step 2

parent 98d82e33
No related branches found
No related tags found
No related merge requests found
Showing
with 27 additions and 22 deletions
......@@ -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/
......
......@@ -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
......@@ -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);)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment