Debian Codegraph @

src/Makevars

raw
1 ## -*- mode: Makefile; tab-width: 8 -*-
2 ##
3 ## Copyright (C) 2010 - 2023 Dirk Eddelbuettel and Romain Francois
4 ##
5 ## This file is part of RInside.
6 ##
7 ## RInside is free software: you can redistribute it and/or modify it
8 ## under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation, either version 2 of the License, or
10 ## (at your option) any later version.
11 ##
12 ## RInside is distributed in the hope that it will be useful, but
13 ## WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ## GNU General Public License for more details.
16 ##
17 ## You should have received a copy of the GNU General Public License
18 ## along with RInside. If not, see <http://www.gnu.org/licenses/>.
19
20 USERLIB=libRInside$(DYLIB_EXT)
21 USERLIBST=libRInside.a
22 USERDIR=../inst/lib
23
24 PKG_CPPFLAGS = -I. -I../inst/include/
25 PKG_LIBS =
26
27 all: headers $(SHLIB) userLibrary
28
29 headers: RInsideAutoloads.h RInsideEnvVars.h
30
31 RInsideAutoloads.h:
32 ${R_HOME}/bin/Rscript tools/RInsideAutoloads.r > RInsideAutoloads.h
33
34 RInsideEnvVars.h:
35 ${R_HOME}/bin/Rscript tools/RInsideEnvVars.r > RInsideEnvVars.h
36
37 RInside.cpp: headers
38
39 userLibrary: $(USERLIB) $(USERLIBST)
40 -@if test ! -e $(USERDIR)$(R_ARCH); then mkdir -p $(USERDIR)$(R_ARCH); fi
41 cp $(USERLIB) $(USERDIR)$(R_ARCH)
42 cp $(USERLIBST) $(USERDIR)$(R_ARCH)
43 rm $(USERLIB) $(USERLIBST)
44
45 $(USERLIB): $(OBJECTS)
46 $(SHLIB_CXXLD) -o $(USERLIB) $^ $(SHLIB_CXXLDFLAGS) $(LDFLAGS) $(ALL_LIBS)
47 # if we are
48 # - not on Window NT (a tip from data.table)
49 # - on macOS aka Darwin which needs this
50 # - the library is present (implying non-system library use)
51 # then let us call install_name_tool
52 @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
53
54 $(USERLIBST): $(OBJECTS)
55 $(AR) qc $(USERLIBST) $^
56 @if test -n "$(RANLIB)"; then $(RANLIB) $(USERLIBST); fi
57
58 .PHONY: all clean userLibrary headers
59
60 clean:
61 rm -f $(OBJECTS) $(SHLIB) $(USERLIB) $(USERLIBST)