The R Project SVN R

Rev

Rev 58676 | Rev 71736 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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