The R Project SVN R

Rev

Rev 17371 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17371 Rev 20002
1
#!/bin/sh
1
#!/bin/sh
2
#
2
#
3
# ${R_HOME}/bin/COMPILE
3
# ${R_HOME}/bin/COMPILE
4
 
4
 
5
# @configure_input@
5
# @configure_input@
6
 
6
 
7
revision='$Revision: 1.13 $'
7
revision='$Revision: 1.14 $'
8
version=`set - ${revision}; echo ${2}`
8
version=`set - ${revision}; echo ${2}`
9
version="R compilation front end ${version}
9
version="R compilation front end ${version}
10
 
10
 
11
Copyright (C) 2000 The R Core Development Team.
11
Copyright (C) 2000 The R Core Development Team.
12
This is free software; see the GNU General Public Licence version 2
12
This is free software; see the GNU General Public Licence version 2 or
13
or later for copying conditions.  There is NO warranty."
13
later for copying conditions.  There is NO warranty."
14
 
14
 
15
usage="Usage: R CMD COMPILE [options] files
15
usage="Usage: R CMD COMPILE [options] files
16
 
16
 
17
Compile the specified files for subsequent collection into a shared
17
Compile the specified files for subsequent collection into a shared
18
library using \`R CMD SHLIB'.  Currently, C, C++, and FORTRAN files
18
library using 'R CMD SHLIB'.  Currently, C, C++, and FORTRAN files
19
(with extensions \`.c', \`.cc' or \`.cpp' or \`.C', and \`.f',
19
(with extensions '.c', '.cc' or '.cpp' or '.C', and '.f', respectively),
20
respectively, are supported.
20
are supported.
21
 
21
 
22
Options:
22
Options:
23
  -h, --help		print short help message and exit
23
  -h, --help		print short help message and exit
24
  -v, --version		print version info and exit
24
  -v, --version		print version info and exit
25
 
25
 
26
Other options of the form \`-DMACRO' or \`VAR=VALUE' are passed on to
26
Other options of the form '-DMACRO' or 'VAR=VALUE' are passed on to the
27
the compilation.
27
compilation.
28
 
28
 
29
Report bugs to <r-bugs@r-project.org>."
29
Report bugs to <r-bugs@r-project.org>."
30
 
30
 
31
MAKE=${MAKE-'@MAKE@'}
31
MAKE=${MAKE-'@MAKE@'}
32
makefiles="-f ${R_HOME}/etc/Makeconf"
32
makefiles="-f ${R_HOME}/etc/Makeconf"
33
if test -r Makevars; then
33
if test -r Makevars; then
34
  makefiles="-f Makevars ${makefiles}"
34
  makefiles="-f Makevars ${makefiles}"
35
fi
35
fi
36
 
36
 
37
objs=
37
objs=
38
while test -n "${1}"; do
38
while test -n "${1}"; do
39
  case ${1} in
39
  case ${1} in
40
    -h|--help)
40
    -h|--help)
41
      echo "${usage}"; exit 0 ;;
41
      echo "${usage}"; exit 0 ;;
42
    -v|--version)
42
    -v|--version)
43
      echo "${version}"; exit 0 ;;
43
      echo "${version}"; exit 0 ;;
44
    *.[cfC]|*.cc|*.cpp)
44
    *.[cfC]|*.cc|*.cpp)
45
      objs="${objs} `echo ${1} | sed 's/\.[^\.][^\.]*$/.o/'`" ;;
45
      objs="${objs} `echo ${1} | sed 's/\.[^\.][^\.]*$/.o/'`" ;;
46
    -D*)
46
    -D*)
47
      MAKEFLAGS="${MAKEFLAGS} ${1}" ;;
47
      MAKEFLAGS="${MAKEFLAGS} ${1}" ;;
48
    *=*)
48
    *=*)
49
      argn=`echo "${1}" | sed -e 's/=.*//'`
49
      argn=`echo "${1}" | sed -e 's/=.*//'`
50
      argv=`echo "${1}" | \
50
      argv=`echo "${1}" | \
51
        sed -e 's/[^=]*=//; s/^\\"//; s/\\"$//; s/\\"/\\\\"/g'`
51
        sed -e 's/[^=]*=//; s/^\\"//; s/\\"$//; s/\\"/\\\\"/g'`
52
      MAKEFLAGS="${MAKEFLAGS} ${argn}=\"${argv}\""
52
      MAKEFLAGS="${MAKEFLAGS} ${argn}=\"${argv}\""
53
      ;;
53
      ;;
54
    *)
54
    *)
55
      echo "ERROR: don't know how to compile \`${1}'"
55
      echo "ERROR: don't know how to compile '${1}'"
56
      exit 1
56
      exit 1
57
      ;;
57
      ;;
58
  esac
58
  esac
59
  shift
59
  shift
60
done
60
done
61
 
61
 
62
eval "${MAKE} ${makefiles} ${MAKEFLAGS} ${objs}"
62
eval "${MAKE} ${makefiles} ${MAKEFLAGS} ${objs}"
63
 
63
 
64
### Local Variables: ***
64
### Local Variables: ***
65
### mode: sh ***
65
### mode: sh ***
66
### sh-indentation: 2 ***
66
### sh-indentation: 2 ***
67
### End: ***
67
### End: ***