The R Project SVN R

Rev

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

Rev 31770 Rev 33112
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='$Revision: 1.15 $'
7
revision='$Revision: 1.15 $'
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-2004 The R Core Development Team.
11
Copyright (C) 2000-2005 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 Licence 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, C, C++, and FORTRAN files
18
library using 'R CMD SHLIB'.  Currently, C, C++, and FORTRAN files
19
(with extensions '.c', '.cc' or '.cpp' or '.C', and '.f', respectively),
19
(with extensions '.c', '.cc' or '.cpp' or '.C', and '.f', respectively),
20
are supported.
20
are supported.
21
 
21
 
22
Options:
22
Options:
23
  -h, --help		print short help message and exit
23
  -h, --help		print short help message and exit
24
  -v, --version		print COMPILE version info and exit
24
  -v, --version		print COMPILE version info and exit
25
 
25
 
26
Other options of the form '-DMACRO' or 'VAR=VALUE' are passed on to the
26
Other options of the form '-DMACRO' or 'VAR=VALUE' are passed on to the
27
compilation.
27
compilation.
28
 
28
 
29
Report bugs to <r-bugs@r-project.org>."
29
Report bugs to <r-bugs@r-project.org>."
30
 
30
 
31
makefiles="-f \"${R_HOME}/etc/Makeconf\""
31
makefiles="-f \"${R_HOME}/etc/Makeconf\""
-
 
32
if test -r "${HOME}/.R/Makevars-${R_PLATFORM}"; then
-
 
33
  makefiles="${makefiles} -f \"${HOME}/.R/Makevars-${R_PLATFORM}\""
32
if test -r "${HOME}/.Rmakeconf"; then
34
elif test -r "${HOME}/.R/Makevars"; then
33
  makefiles="${makefiles} -f \"${HOME}/.Rmakeconf\""
35
  makefiles="${makefiles} -f \"${HOME}/.R/Makevars\""
34
fi
36
fi
35
if test -r Makevars; then
37
if test -r Makevars; then
36
  makefiles="-f Makevars ${makefiles}"
38
  makefiles="-f Makevars ${makefiles}"
37
fi
39
fi
38
 
40
 
39
objs=
41
objs=
40
while test -n "${1}"; do
42
while test -n "${1}"; do
41
  case ${1} in
43
  case ${1} in
42
    -h|--help)
44
    -h|--help)
43
      echo "${usage}"; exit 0 ;;
45
      echo "${usage}"; exit 0 ;;
44
    -v|--version)
46
    -v|--version)
45
      echo "${version}"; exit 0 ;;
47
      echo "${version}"; exit 0 ;;
46
    *.[cfC]|*.cc|*.cpp)
48
    *.[cfC]|*.cc|*.cpp)
47
      objs="${objs} `echo ${1} | sed 's/\.[^\.][^\.]*$/.o/'`" ;;
49
      objs="${objs} `echo ${1} | sed 's/\.[^\.][^\.]*$/.o/'`" ;;
48
    -D*)
50
    -D*)
49
      MAKEFLAGS="${MAKEFLAGS} ${1}" ;;
51
      MAKEFLAGS="${MAKEFLAGS} ${1}" ;;
50
    *=*)
52
    *=*)
51
      argn=`echo "${1}" | sed -e 's/=.*//'`
53
      argn=`echo "${1}" | sed -e 's/=.*//'`
52
      argv=`echo "${1}" | \
54
      argv=`echo "${1}" | \
53
        sed -e 's/[^=]*=//; s/^\\"//; s/\\"$//; s/\\"/\\\\"/g'`
55
        sed -e 's/[^=]*=//; s/^\\"//; s/\\"$//; s/\\"/\\\\"/g'`
54
      MAKEFLAGS="${MAKEFLAGS} ${argn}=\"${argv}\""
56
      MAKEFLAGS="${MAKEFLAGS} ${argn}=\"${argv}\""
55
      ;;
57
      ;;
56
    *)
58
    *)
57
      echo "ERROR: don't know how to compile '${1}'"
59
      echo "ERROR: don't know how to compile '${1}'"
58
      exit 1
60
      exit 1
59
      ;;
61
      ;;
60
  esac
62
  esac
61
  shift
63
  shift
62
done
64
done
63
 
65
 
64
eval "${MAKE} ${makefiles} ${MAKEFLAGS} ${objs}"
66
eval "${MAKE} ${makefiles} ${MAKEFLAGS} ${objs}"
65
 
67
 
66
### Local Variables: ***
68
### Local Variables: ***
67
### mode: sh ***
69
### mode: sh ***
68
### sh-indentation: 2 ***
70
### sh-indentation: 2 ***
69
### End: ***
71
### End: ***