diff --git a/com.oracle.truffle.r.native/Makefile b/com.oracle.truffle.r.native/Makefile index d78f9fec754cacc46aaacc6ab3ed96f787021b4e..1cbf8fde1154a932c27e0ce651ef6236b6545723 100644 --- a/com.oracle.truffle.r.native/Makefile +++ b/com.oracle.truffle.r.native/Makefile @@ -21,13 +21,16 @@ # questions. # -.PHONY: all clean +.PHONY: all clean makegnur cleangnur export TOPDIR = $(CURDIR) export R_VERSION = 3.1.3 -export GNUR_DIR = $(TOPDIR)/gnur/R-$(R_VERSION) -all: +ifndef GNUR_HOME +export GNUR_HOME = $(TOPDIR)/gnur/R-$(R_VERSION) +endif + +all: $(MAKE) -C gnur $(MAKE) -C include $(MAKE) -C builtinlibs @@ -35,10 +38,11 @@ all: $(MAKE) -C library $(MAKE) -C run -clean: +clean: $(MAKE) -C include clean $(MAKE) -C builtinlibs clean $(MAKE) -C fficall clean $(MAKE) -C library clean $(MAKE) -C run clean $(MAKE) -C gnur clean + diff --git a/com.oracle.truffle.r.native/builtinlibs/Makefile b/com.oracle.truffle.r.native/builtinlibs/Makefile index 723a87ff996a88ab959e4e90d4fde44c2d1cc328..7cc6a37eb5fffb72dc6c9c3f5855bd21aac86853 100644 --- a/com.oracle.truffle.r.native/builtinlibs/Makefile +++ b/com.oracle.truffle.r.native/builtinlibs/Makefile @@ -40,7 +40,7 @@ OBJ = lib C_SOURCES := $(wildcard $(SRC)/*.c) C_OBJECTS := $(subst $(SRC),$(OBJ),$(C_SOURCES:.c=.o)) -F_OBJECTS := $(wildcard $(GNUR_DIR)/src/appl/d*.o) +F_OBJECTS := $(wildcard $(GNUR_HOME)/src/appl/d*.o) LIBDIR := $(OBJ) LIB_APPL := $(OBJ)/libappl$(DYLIB_EXT) diff --git a/com.oracle.truffle.r.native/gnur/Makefile b/com.oracle.truffle.r.native/gnur/Makefile index 9772ef173788cd364ed4b3caf118a60fa470d51e..968ab096a09a9e76a61e5b4dd14825e05e0b0b16 100644 --- a/com.oracle.truffle.r.native/gnur/Makefile +++ b/com.oracle.truffle.r.native/gnur/Makefile @@ -23,12 +23,26 @@ .PHONY: all clean -all: +all: makegnur $(MAKE) -f Makefile.gnur $(MAKE) -f Makefile.platform $(MAKE) -f Makefile.libs -clean: - $(MAKE) -f Makefile.gnur clean +ifeq "$(origin GNUR_HOME)" "environment" +makegnur: +else +makegnur: + $(MAKE) -f Makefile.gnur +endif + +clean: cleangnur $(MAKE) -f Makefile.libs clean $(MAKE) -f Makefile.platform clean + +ifeq "$(origin GNUR_HOME)" "environment" +cleangnur: +else +cleangnur: + $(MAKE) -f Makefile.gnur clean +endif + \ No newline at end of file diff --git a/com.oracle.truffle.r.native/gnur/Makefile.gnur b/com.oracle.truffle.r.native/gnur/Makefile.gnur index 108538b086c6ca8e1a27d811fef703e16a1de343..713a88d81b49b38c7c9687a67c22dace7580cc36 100644 --- a/com.oracle.truffle.r.native/gnur/Makefile.gnur +++ b/com.oracle.truffle.r.native/gnur/Makefile.gnur @@ -36,9 +36,6 @@ # Portions of the Makeconf file are then extracted to use in building the native # parts of FastR, especially packages with native code. -# Building GnuR takes several minutes, so in some environments, e.g. repository gates, -# referring to a pre-built GnuR would be of value. This is TBD. - .PHONY: all config config_update build clean OSNAME := $(shell uname) @@ -51,37 +48,39 @@ all: @false endif -all: Makefile $(GNUR_DIR) config build +all: Makefile $(GNUR_HOME) config build -$(GNUR_DIR): +$(GNUR_HOME): tar xf $(TOPDIR)/../lib/R-$(R_VERSION).tar.gz -config: $(GNUR_DIR)/Makefile config_update +config: $(GNUR_HOME)/Makefile config_update ifeq ($(OSNAME), Linux) config_update: Makeconf.done Makeconf.done: edMakeconf - ed $(GNUR_DIR)/Makeconf < edMakeconf + ed $(GNUR_HOME)/Makeconf < edMakeconf touch Makeconf.done else config_update: endif -$(GNUR_DIR)/Makefile: - (cd $(GNUR_DIR); ./configure --with-x=no --without-recommended-packages >& gnur_configure.log) +$(GNUR_HOME)/Makefile: + (cd $(GNUR_HOME); ./configure --with-x=no --without-recommended-packages >& gnur_configure.log) -build: $(GNUR_DIR)/bin/R +build: $(GNUR_HOME)/bin/R -$(GNUR_DIR)/bin/R: $(GNUR_DIR)/Makeconf - (cd $(GNUR_DIR); make >& gnur_make.log) +$(GNUR_HOME)/bin/R: $(GNUR_HOME)/Makeconf + (cd $(GNUR_HOME); make >& gnur_make.log) -HAVE_MAKEFILE := $(shell [ -f $(GNUR_DIR)/Makefile ] && echo "Makefile.exists") -ifeq ($(HAVE_MAKEFILE),Makefile.exists) -clean: +HAVE_MAKEFILE := $(shell [ -f $(GNUR_HOME)/Makefile ] && echo "Makefile.exists") +clean: cleangnur rm -f Makeconf.done - (cd $(GNUR_DIR); make distclean) + +ifeq ($(HAVE_MAKEFILE),Makefile.exists) +cleangnur: + (cd $(GNUR_HOME); make distclean) else -clean: +cleangnur: endif diff --git a/com.oracle.truffle.r.native/gnur/Makefile.libs b/com.oracle.truffle.r.native/gnur/Makefile.libs index 43739766d25a33931b64a66ecc3cf120b5b94f43..3c9a7e511b34bf6c054d0cd90bb28c9c4f91750c 100644 --- a/com.oracle.truffle.r.native/gnur/Makefile.libs +++ b/com.oracle.truffle.r.native/gnur/Makefile.libs @@ -37,13 +37,13 @@ all: $(TARGET_DIR) $(BLAS_TARGET) $(LAPACK_TARGET) $(PCRE_TARGET) $(TARGET_DIR): mkdir -p $(TARGET_DIR) -$(BLAS_TARGET): $(GNUR_DIR)/lib/libRblas$(DYLIB_EXT) - cp $(GNUR_DIR)/lib/libRblas$(DYLIB_EXT) $(BLAS_TARGET) +$(BLAS_TARGET): $(GNUR_HOME)/lib/libRblas$(DYLIB_EXT) + cp $(GNUR_HOME)/lib/libRblas$(DYLIB_EXT) $(BLAS_TARGET) -$(LAPACK_TARGET): $(GNUR_DIR)/lib/libRlapack$(DYLIB_EXT) - cp $(GNUR_DIR)/lib/libRlapack$(DYLIB_EXT) $(LAPACK_TARGET) +$(LAPACK_TARGET): $(GNUR_HOME)/lib/libRlapack$(DYLIB_EXT) + cp $(GNUR_HOME)/lib/libRlapack$(DYLIB_EXT) $(LAPACK_TARGET) -PCRE_OBJS := $(wildcard $(GNUR_DIR)/src/extra/pcre/pcre_*.o) +PCRE_OBJS := $(wildcard $(GNUR_HOME)/src/extra/pcre/pcre_*.o) $(PCRE_TARGET): $(PCRE_OBJS) $(TOPDIR)/platform.mk $(DYLIB_LD) $(DYLIB_LDFLAGS) -o $(PCRE_TARGET) $(PCRE_OBJS) diff --git a/com.oracle.truffle.r.native/gnur/Makefile.platform b/com.oracle.truffle.r.native/gnur/Makefile.platform index e38dbff2ef381be5f9fcb8146d751eb388bdd0ff..6bfbcc2619f00fc5199153cb2451a98553e7954e 100644 --- a/com.oracle.truffle.r.native/gnur/Makefile.platform +++ b/com.oracle.truffle.r.native/gnur/Makefile.platform @@ -31,7 +31,7 @@ OS_DIR := $(shell echo $(OS_NAME) | tr '[:upper:]' '[:lower:]' ) all: $(TOPDIR)/platform.mk $(TOPDIR)/platform.mk: sedMakeconf - sed -f sedMakeconf $(GNUR_DIR)/Makeconf >& /dev/null + sed -f sedMakeconf $(GNUR_HOME)/Makeconf >& /dev/null echo OS_NAME = $(OS_NAME) >> platform.mk.temp echo OS_DIR = $(OS_DIR) >> platform.mk.temp mv platform.mk.temp $(TOPDIR)/platform.mk diff --git a/com.oracle.truffle.r.native/include/jni/Makefile b/com.oracle.truffle.r.native/include/jni/Makefile index 77442b1d075a8046372db2c8c025afb0fab6e6e1..76829fbb97c10a7f1dec3e287dedaf5cf3dfdcb5 100644 --- a/com.oracle.truffle.r.native/include/jni/Makefile +++ b/com.oracle.truffle.r.native/include/jni/Makefile @@ -27,12 +27,12 @@ SRC=src -R_EXT_HEADERS := $(wildcard $(GNUR_DIR)/include/R_ext/*.h) +R_EXT_HEADERS := $(wildcard $(GNUR_HOME)/include/R_ext/*.h) R_EXT_HEADERS_FILENAMES := $(notdir $(R_EXT_HEADERS)) R_EXT_HEADERS_LOCAL := $(wildcard $(SRC)/R_ext/*.h) R_EXT_HEADERS_TO_LINK := $(filter-out $(notdir $(R_EXT_HEADERS_LOCAL)),$(R_EXT_HEADERS_FILENAMES)) -R_HEADERS := $(wildcard $(GNUR_DIR)/include/*.h) +R_HEADERS := $(wildcard $(GNUR_HOME)/include/*.h) R_HEADERS_FILENAMES := $(notdir $(R_HEADERS)) #$(info R_HEADERS_FILENAMES=$(R_HEADERS_FILENAMES)) R_HEADERS_LOCAL := src/libintl.h src/Rinternals.h @@ -45,10 +45,10 @@ all: linked linked: mkdir -p include mkdir -p include/R_ext - $(foreach file,$(R_HEADERS_TO_LINK),ln -sf $(GNUR_DIR)/include/$(file) include/$(file);) + $(foreach file,$(R_HEADERS_TO_LINK),ln -sf $(GNUR_HOME)/include/$(file) include/$(file);) cp src/libintl.h include - ed $(GNUR_DIR)/include/Rinternals.h < ed_Rinternals - $(foreach file,$(R_EXT_HEADERS_TO_LINK),ln -sf $(GNUR_DIR)/include/R_ext/$(file) include/R_ext/$(file);) + ed $(GNUR_HOME)/include/Rinternals.h < ed_Rinternals + $(foreach file,$(R_EXT_HEADERS_TO_LINK),ln -sf $(GNUR_HOME)/include/R_ext/$(file) include/R_ext/$(file);) cp $(R_EXT_HEADERS_LOCAL) include/R_ext touch linked diff --git a/com.oracle.truffle.r.native/library/lib.mk b/com.oracle.truffle.r.native/library/lib.mk index 8a0c5b19a73b965aa0945d5314c11206c086b4ab..bf4c7e38a4728618212922ed5da3dc8d41ba7c44 100644 --- a/com.oracle.truffle.r.native/library/lib.mk +++ b/com.oracle.truffle.r.native/library/lib.mk @@ -39,7 +39,7 @@ endif PKG = $(PACKAGE) -ifeq ($(GNUR_DIR),) +ifeq ($(GNUR_HOME),) $(error must be run from top-level) endif @@ -72,8 +72,8 @@ endif libcommon: $(PKGDIR) -$(PKGDIR): $(GNUR_DIR)/library/$(PKG) - (cd $(GNUR_DIR)/library; tar cf - $(PKG)) | (cd $(FASTR_LIBDIR); tar xf -) +$(PKGDIR): $(GNUR_HOME)/library/$(PKG) + (cd $(GNUR_HOME)/library; tar cf - $(PKG)) | (cd $(FASTR_LIBDIR); tar xf -) touch $(FASTR_LIBDIR)/$(PKG) $(C_OBJECTS): | $(OBJ) diff --git a/com.oracle.truffle.r.native/library/stats/Makefile b/com.oracle.truffle.r.native/library/stats/Makefile index 57c77592ec6504b7e4ab34bb821c240b83f1dbc6..993a215031b6f44bca61c2c0522bf16719f6ee83 100644 --- a/com.oracle.truffle.r.native/library/stats/Makefile +++ b/com.oracle.truffle.r.native/library/stats/Makefile @@ -24,7 +24,7 @@ .PHONY: cleanfft LIB_PKG_PRE = $(OBJ)/fft.o -GNUR_FFT := $(GNUR_DIR)/src/library/stats/src/fft.c +GNUR_FFT := $(GNUR_HOME)/src/library/stats/src/fft.c CLEAN_PKG := cleanfft include ../lib.mk