The R Project SVN R

Rev

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

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