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
 
29654 hornik 11
Copyright (C) 2000-2004 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
24
  -v, --version		print version info and exit
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
 
7699 hornik 31
makefiles="-f ${R_HOME}/etc/Makeconf"
32
if test -r Makevars; then
33
  makefiles="-f Makevars ${makefiles}"
34
fi
3076 pd 35
 
7357 hornik 36
objs=
37
while test -n "${1}"; do
38
  case ${1} in
39
    -h|--help)
40
      echo "${usage}"; exit 0 ;;
41
    -v|--version)
42
      echo "${version}"; exit 0 ;;
11258 hornik 43
    *.[cfC]|*.cc|*.cpp)
7357 hornik 44
      objs="${objs} `echo ${1} | sed 's/\.[^\.][^\.]*$/.o/'`" ;;
15421 hornik 45
    -D*)
7357 hornik 46
      MAKEFLAGS="${MAKEFLAGS} ${1}" ;;
15421 hornik 47
    *=*)
48
      argn=`echo "${1}" | sed -e 's/=.*//'`
49
      argv=`echo "${1}" | \
50
        sed -e 's/[^=]*=//; s/^\\"//; s/\\"$//; s/\\"/\\\\"/g'`
51
      MAKEFLAGS="${MAKEFLAGS} ${argn}=\"${argv}\""
52
      ;;
2195 hornik 53
    *)
20002 hornik 54
      echo "ERROR: don't know how to compile '${1}'"
2195 hornik 55
      exit 1
56
      ;;
57
  esac
7357 hornik 58
  shift
2195 hornik 59
done
60
 
15421 hornik 61
eval "${MAKE} ${makefiles} ${MAKEFLAGS} ${objs}"
3076 pd 62
 
2195 hornik 63
### Local Variables: ***
64
### mode: sh ***
7218 hornik 65
### sh-indentation: 2 ***
2195 hornik 66
### End: ***