The R Project SVN R

Rev

Rev 74000 | 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: 75653 $'
7357 hornik 7
version=`set - ${revision}; echo ${2}`
47522 ripley 8
version="R compilation front end: ${R_VERSION} (r${version})
7357 hornik 9
 
74000 ripley 10
Copyright (C) 2000-2018 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
63539 ripley 17
library using 'R CMD SHLIB' or an executable program using 'R CMD
18
LINK'.  Currently, the following languages with associated source file
19
extensions are supported (provided that the respective compilers are
20
available and R was configured to use these): C ('.c'), C++ ('.cc' or
75653 ripley 21
'.cpp'), fixed-form Fortran ('.f'), free-form Fortran ('.f90' or'.f95'),
63539 ripley 22
Objective C ('.m'), and Objective C++ ('.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
 
71736 hornik 31
Report bugs at <https://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: ***