-
Notifications
You must be signed in to change notification settings - Fork 315
/
SHLIB.in
107 lines (93 loc) · 2.66 KB
/
SHLIB.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/sh
#
# ${R_HOME}/bin/SHLIB
# @configure_input@
revision='$Revision: 1.28 $'
version=`set - ${revision}; echo ${2}`
version="R shared library builder ${version}
Copyright (C) 2000-2003 The R Core Development Team.
This is free software; see the GNU General Public Licence version 2
or later for copying conditions. There is NO warranty."
usage="Usage: R CMD SHLIB [options] files
Build a shared library for dynamic loading from the specified source or
object files (which are automagically made from their sources). If not
given via '--output', the name for the library is determined from the
first file.
Options:
-h, --help print short help message and exit
-v, --version print version info and exit
-o, --output=LIB use LIB as (full) name for the built library
Report bugs to <r-bugs@r-project.org>."
objs=
shlib=
MAKE=${MAKE-'@MAKE@'}
makefiles="-f ${R_HOME}/share/make/shlib.mk"
shlib_libadd='@SHLIB_LIBADD@'
with_cxx=false
with_f77=false
while test -n "${1}"; do
case ${1} in
-h|--help)
echo "${usage}"; exit 0 ;;
-v|--version)
echo "${version}"; exit 0 ;;
-o)
shlib=${2}; shift ;;
--output=*)
shlib=`echo "${1}" | sed -e 's/[^=]*=//'` ;;
*.cc|*.cpp|*.C)
with_cxx=true
if test -z "${shlib}"; then
shlib="`echo ${1} | sed 's/\.[^\.][^\.]*$/@SHLIB_EXT@/'`"
fi
objs="${objs} `echo ${1} | sed 's/\.[^\.][^\.]*$/.o/'`"
;;
*.f)
with_f77=true
if test -z "${shlib}"; then
shlib="`echo ${1} | sed 's/\.[^\.][^\.]*$/@SHLIB_EXT@/'`"
fi
objs="${objs} `echo ${1} | sed 's/\.[^\.][^\.]*$/.o/'`"
;;
*.[co])
if test -z "${shlib}"; then
shlib="`echo ${1} | sed 's/\.[^\.][^\.]*$/@SHLIB_EXT@/'`"
fi
objs="${objs} `echo ${1} | sed 's/\.[^\.][^\.]*$/.o/'`"
;;
esac
shift
done
makeobjs="OBJECTS=\"${objs}\""
if test -r Makevars; then
makefiles="-f Makevars ${makefiles}"
if grep '^ *OBJS *=' Makevars >/dev/null; then
makeobjs="OBJECTS='\$(OBJS)'"
fi
if grep '^ *OBJECTS *=' Makevars >/dev/null; then
makeobjs=
fi
fi
makeargs="SHLIB=\"${shlib}\""
if ${with_cxx}; then
makeargs="SHLIB_LDFLAGS='\$(SHLIB_CXXLDFLAGS)' ${makeargs}"
makeargs="SHLIB_LD='\$(SHLIB_CXXLD)' ${makeargs}"
fi
if ${with_f77}; then
if test -z "${shlib_libadd}"; then
makeargs="${makeargs} SHLIB_LIBADD='\$(FLIBS)'"
else
makeargs="${makeargs} SHLIB_LIBADD='\$(FLIBS) ${shlib_libadd}'"
fi
fi
if test -f ${R_HOME}/bin/libR@DYLIB_EXT@; then
LIBR="-L${R_HOME}/bin -lR"
else
LIBR=
fi
makeargs="${makeargs} LIBR=\"${LIBR}\""
eval ${MAKE} ${makefiles} ${makeargs} ${makeobjs}
### Local Variables: ***
### mode: sh ***
### sh-indentation: 2 ***
### End: ***