The R Project SVN R

Rev

Details | Last modification | View Log | RSS feed

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