## -*- mode: Makefile; tab-width: 8 -*- ## ## Copyright (C) 2010 - 2023 Dirk Eddelbuettel and Romain Francois ## ## This file is part of RInside. ## ## RInside is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## ## RInside is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with RInside. If not, see . USERLIB=libRInside$(DYLIB_EXT) USERLIBST=libRInside.a USERDIR=../inst/lib PKG_CPPFLAGS = -I. -I../inst/include/ PKG_LIBS = all: headers $(SHLIB) userLibrary headers: RInsideAutoloads.h RInsideEnvVars.h RInsideAutoloads.h: ${R_HOME}/bin/Rscript tools/RInsideAutoloads.r > RInsideAutoloads.h RInsideEnvVars.h: ${R_HOME}/bin/Rscript tools/RInsideEnvVars.r > RInsideEnvVars.h RInside.cpp: headers userLibrary: $(USERLIB) $(USERLIBST) -@if test ! -e $(USERDIR)$(R_ARCH); then mkdir -p $(USERDIR)$(R_ARCH); fi cp $(USERLIB) $(USERDIR)$(R_ARCH) cp $(USERLIBST) $(USERDIR)$(R_ARCH) rm $(USERLIB) $(USERLIBST) $(USERLIB): $(OBJECTS) $(SHLIB_CXXLD) -o $(USERLIB) $^ $(SHLIB_CXXLDFLAGS) $(LDFLAGS) $(ALL_LIBS) # if we are # - not on Window NT (a tip from data.table) # - on macOS aka Darwin which needs this # - the library is present (implying non-system library use) # then let us call install_name_tool @if [ "$(OS)" != "Windows_NT" ] && [ `uname -s` = 'Darwin' ] && test -e "/usr/bin/install_name_tool"; then /usr/bin/install_name_tool -add_rpath @loader_path/../lib$(R_ARCH) $(USERLIB); fi $(USERLIBST): $(OBJECTS) $(AR) qc $(USERLIBST) $^ @if test -n "$(RANLIB)"; then $(RANLIB) $(USERLIBST); fi .PHONY: all clean userLibrary headers clean: rm -f $(OBJECTS) $(SHLIB) $(USERLIB) $(USERLIBST)