The R Project SVN R

Rev

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

Rev 33112 Rev 37351
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='$Rev: 37351 $'
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-2005 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
32
if test -r "${HOME}/.R/Makevars-${R_PLATFORM}"; then
33
  makefiles="${makefiles} -f \"${HOME}/.R/Makevars-${R_PLATFORM}\""
33
  makefiles="${makefiles} -f \"${HOME}/.R/Makevars-${R_PLATFORM}\""
34
elif test -r "${HOME}/.R/Makevars"; then
34
elif test -r "${HOME}/.R/Makevars"; then
35
  makefiles="${makefiles} -f \"${HOME}/.R/Makevars\""
35
  makefiles="${makefiles} -f \"${HOME}/.R/Makevars\""
36
fi
36
fi
37
if test -r Makevars; then
37
if test -r Makevars; then
38
  makefiles="-f Makevars ${makefiles}"
38
  makefiles="-f Makevars ${makefiles}"
39
fi
39
fi
40
 
40
 
41
objs=
41
objs=
42
while test -n "${1}"; do
42
while test -n "${1}"; do
43
  case ${1} in
43
  case ${1} in
44
    -h|--help)
44
    -h|--help)
45
      echo "${usage}"; exit 0 ;;
45
      echo "${usage}"; exit 0 ;;
46
    -v|--version)
46
    -v|--version)
47
      echo "${version}"; exit 0 ;;
47
      echo "${version}"; exit 0 ;;
48
    *.[cfC]|*.cc|*.cpp)
48
    *.[cfC]|*.cc|*.cpp)
49
      objs="${objs} `echo ${1} | sed 's/\.[^\.][^\.]*$/.o/'`" ;;
49
      objs="${objs} `echo ${1} | sed 's/\.[^\.][^\.]*$/.o/'`" ;;
50
    -D*)
50
    -D*)
51
      MAKEFLAGS="${MAKEFLAGS} ${1}" ;;
51
      MAKEFLAGS="${MAKEFLAGS} ${1}" ;;
52
    *=*)
52
    *=*)
53
      argn=`echo "${1}" | sed -e 's/=.*//'`
53
      argn=`echo "${1}" | sed -e 's/=.*//'`
54
      argv=`echo "${1}" | \
54
      argv=`echo "${1}" | \
55
        sed -e 's/[^=]*=//; s/^\\"//; s/\\"$//; s/\\"/\\\\"/g'`
55
        sed -e 's/[^=]*=//; s/^\\"//; s/\\"$//; s/\\"/\\\\"/g'`
56
      MAKEFLAGS="${MAKEFLAGS} ${argn}=\"${argv}\""
56
      MAKEFLAGS="${MAKEFLAGS} ${argn}=\"${argv}\""
57
      ;;
57
      ;;
58
    *)
58
    *)
59
      echo "ERROR: don't know how to compile '${1}'"
59
      echo "ERROR: don't know how to compile '${1}'"
60
      exit 1
60
      exit 1
61
      ;;
61
      ;;
62
  esac
62
  esac
63
  shift
63
  shift
64
done
64
done
65
 
65
 
66
eval "${MAKE} ${makefiles} ${MAKEFLAGS} ${objs}"
66
eval "${MAKE} ${makefiles} ${MAKEFLAGS} ${objs}"
67
 
67
 
68
### Local Variables: ***
68
### Local Variables: ***
69
### mode: sh ***
69
### mode: sh ***
70
### sh-indentation: 2 ***
70
### sh-indentation: 2 ***
71
### End: ***
71
### End: ***