The R Project SVN R

Rev

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

Rev 40010 Rev 42192
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='$Rev: 40010 $'
7
revision='$Rev: 42192 $'
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-2006 The R Core Development Team.
11
Copyright (C) 2000-2006 The R Core Development Team.
12
This is free software; see the GNU General Public Licence version 2 or
12
This is free software; see the GNU General Public License version 2 or
13
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, the following languages with
18
library using 'R CMD SHLIB'.  Currently, the following languages with
19
associated source file extensions are supported (provided that the
19
associated source file extensions are supported (provided that the
20
respective compilers are available and R was configured to use these):
20
respective compilers are available and R was configured to use these):
21
C ('.c'), C++ ('.cc' or '.cpp' or '.C'), FORTRAN 77 ('.f'), FORTRAN 90
21
C ('.c'), C++ ('.cc' or '.cpp' or '.C'), FORTRAN 77 ('.f'), FORTRAN 90
22
('.f90'), FORTRAN 95 ('.f95'), Objective C ('.m'), and Objective C++
22
('.f90'), FORTRAN 95 ('.f95'), Objective C ('.m'), and Objective C++
23
('.M' or '.mm').
23
('.M' or '.mm').
24
 
24
 
25
Options:
25
Options:
26
  -h, --help		print short help message and exit
26
  -h, --help		print short help message and exit
27
  -v, --version		print COMPILE version info and exit
27
  -v, --version		print COMPILE version info and exit
28
 
28
 
29
Other options of the form '-DMACRO' or 'VAR=VALUE' are passed on to the
29
Other options of the form '-DMACRO' or 'VAR=VALUE' are passed on to the
30
compilation.
30
compilation.
31
 
31
 
32
Report bugs to <r-bugs@r-project.org>."
32
Report bugs to <r-bugs@r-project.org>."
33
 
33
 
34
makefiles="-f \"${R_HOME}/etc${R_ARCH}/Makeconf\""
34
makefiles="-f \"${R_HOME}/etc${R_ARCH}/Makeconf\""
35
if test -r "${HOME}/.R/Makevars-${R_PLATFORM}"; then
35
if test -r "${HOME}/.R/Makevars-${R_PLATFORM}"; then
36
  makefiles="${makefiles} -f \"${HOME}/.R/Makevars-${R_PLATFORM}\""
36
  makefiles="${makefiles} -f \"${HOME}/.R/Makevars-${R_PLATFORM}\""
37
elif test -r "${HOME}/.R/Makevars"; then
37
elif test -r "${HOME}/.R/Makevars"; then
38
  makefiles="${makefiles} -f \"${HOME}/.R/Makevars\""
38
  makefiles="${makefiles} -f \"${HOME}/.R/Makevars\""
39
fi
39
fi
40
if test -r Makevars; then
40
if test -r Makevars; then
41
  makefiles="-f Makevars ${makefiles}"
41
  makefiles="-f Makevars ${makefiles}"
42
fi
42
fi
43
 
43
 
44
objs=
44
objs=
45
while test -n "${1}"; do
45
while test -n "${1}"; do
46
  case ${1} in
46
  case ${1} in
47
    -h|--help)
47
    -h|--help)
48
      echo "${usage}"; exit 0 ;;
48
      echo "${usage}"; exit 0 ;;
49
    -v|--version)
49
    -v|--version)
50
      echo "${version}"; exit 0 ;;
50
      echo "${version}"; exit 0 ;;
51
    *.[cfmCM]|*.cc|*.cpp|*.f90|*.f95|*.mm)
51
    *.[cfmCM]|*.cc|*.cpp|*.f90|*.f95|*.mm)
52
      objs="${objs} `echo ${1} | sed 's/\.[^\.][^\.]*$/.o/'`" ;;
52
      objs="${objs} `echo ${1} | sed 's/\.[^\.][^\.]*$/.o/'`" ;;
53
    -D*)
53
    -D*)
54
      MAKEFLAGS="${MAKEFLAGS} ${1}" ;;
54
      MAKEFLAGS="${MAKEFLAGS} ${1}" ;;
55
    *=*)
55
    *=*)
56
      argn=`echo "${1}" | sed -e 's/=.*//'`
56
      argn=`echo "${1}" | sed -e 's/=.*//'`
57
      argv=`echo "${1}" | \
57
      argv=`echo "${1}" | \
58
        sed -e 's/[^=]*=//; s/^\\"//; s/\\"$//; s/\\"/\\\\"/g'`
58
        sed -e 's/[^=]*=//; s/^\\"//; s/\\"$//; s/\\"/\\\\"/g'`
59
      MAKEFLAGS="${MAKEFLAGS} ${argn}=\"${argv}\""
59
      MAKEFLAGS="${MAKEFLAGS} ${argn}=\"${argv}\""
60
      ;;
60
      ;;
61
    *)
61
    *)
62
      echo "ERROR: don't know how to compile '${1}'"
62
      echo "ERROR: don't know how to compile '${1}'"
63
      exit 1
63
      exit 1
64
      ;;
64
      ;;
65
  esac
65
  esac
66
  shift
66
  shift
67
done
67
done
68
 
68
 
69
eval "${MAKE} ${makefiles} ${MAKEFLAGS} ${objs}"
69
eval "${MAKE} ${makefiles} ${MAKEFLAGS} ${objs}"
70
 
70
 
71
### Local Variables: ***
71
### Local Variables: ***
72
### mode: sh ***
72
### mode: sh ***
73
### sh-indentation: 2 ***
73
### sh-indentation: 2 ***
74
### End: ***
74
### End: ***