Rev 42229 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#!/bin/sh## ${R_HOME}/bin/SHLIB# @configure_input@revision='$Rev: 42229 $'version=`set - ${revision}; echo ${2}`version="R shared library builder ${version}Copyright (C) 2000-2007 The R Core Development Team.This is free software; see the GNU General Public License version 2or later for copying conditions. There is NO warranty."usage="Usage: R CMD SHLIB [options] files|linker optionsBuild a shared library for dynamic loading from the specified source orobject files (which are automagically made from their sources) orlinker options. If not given via '--output', the name for the sharedlibrary is determined from the first source or object file.Options:-h, --help print short help message and exit-v, --version print SHLIB version info and exit-o, --output=LIB use LIB as (full) name for the built library-c, --clean remove files created during compilation--preclean remove files created during a previous runReport bugs to <r-bugs@r-project.org>."R_HOME=`echo ${R_HOME} | sed 's/ /\\\\ /g'`objs=shlib=makefiles="-f ${R_SHARE_DIR}/make/shlib.mk"shlib_libadd='@SHLIB_LIBADD@'with_cxx=falsewith_f77=falsewith_f9x=falsewith_objc=falsewith_objcxx=falsepkg_libs=clean=falsepreclean=falsewhile test -n "${1}"; docase ${1} in-h|--help)echo "${usage}"; exit 0 ;;-v|--version)echo "${version}"; exit 0 ;;-c|--clean)clean=true ;;--preclean)preclean=true ;;-o)shlib=${2}; shift ;;--output=*)shlib=`echo "${1}" | sed -e 's/[^=]*=//'` ;;*.cc|*.cpp|*.C)with_cxx=trueif test -z "${shlib}"; thenshlib="`echo ${1} | sed 's/\.[^\.][^\.]*$/@SHLIB_EXT@/'`"fiobjs="${objs} `echo ${1} | sed 's/\.[^\.][^\.]*$/.o/'`";;*.m)with_objc=trueif test -z "${shlib}"; thenshlib="`echo ${1} | sed 's/\.[^\.][^\.]*$/@SHLIB_EXT@/'`"fiobjs="${objs} `echo ${1} | sed 's/\.[^\.][^\.]*$/.o/'`";;*.mm|*.M)with_objcxx=true# ObjC++ implies ObjC because we need ObjC runtimewith_objc=true# ObjC++ implies C++ because we use C++ linkerwith_cxx=trueif test -z "${shlib}"; thenshlib="`echo ${1} | sed 's/\.[^\.][^\.]*$/@SHLIB_EXT@/'`"fiobjs="${objs} `echo ${1} | sed 's/\.[^\.][^\.]*$/.o/'`";;*.f)with_f77=trueif test -z "${shlib}"; thenshlib="`echo ${1} | sed 's/\.[^\.][^\.]*$/@SHLIB_EXT@/'`"fiobjs="${objs} `echo ${1} | sed 's/\.[^\.][^\.]*$/.o/'`";;*.f90|*.f95)with_f9x=trueif test -z "${shlib}"; thenshlib="`echo ${1} | sed 's/\.[^\.][^\.]*$/@SHLIB_EXT@/'`"fiobjs="${objs} `echo ${1} | sed 's/\.[^\.][^\.]*$/.o/'`";;*.[co])if test -z "${shlib}"; thenshlib="`echo ${1} | sed 's/\.[^\.][^\.]*$/@SHLIB_EXT@/'`"fiobjs="${objs} `echo ${1} | sed 's/\.[^\.][^\.]*$/.o/'`";;*)pkg_libs="${pkg_libs} ${1}";;esacshiftdoneif test -r "${HOME}/.R/Makevars-${R_PLATFORM}"; thenmakefiles="${makefiles} -f \"${HOME}/.R/Makevars-${R_PLATFORM}\""elif test -r "${HOME}/.R/Makevars"; thenmakefiles="${makefiles} -f \"${HOME}/.R/Makevars\""fimakeobjs="OBJECTS=\"${objs}\""if test -r Makevars; thenmakefiles="-f Makevars ${makefiles}"# use of OBJS was replaced by OBJECTS in Aug 2001#if grep '^ *OBJS *=' Makevars >/dev/null; then# makeobjs="OBJECTS='\$(OBJS)'"#fiif grep '^ *OBJECTS *=' Makevars >/dev/null; thenmakeobjs=fifimakeargs="SHLIB=\"${shlib}\""if ${with_f9x}; thenmakeargs="SHLIB_LDFLAGS='\$(SHLIB_FCLDFLAGS)' ${makeargs}"makeargs="SHLIB_LD='\$(SHLIB_FCLD)' ${makeargs}"elseif ${with_cxx}; thenmakeargs="SHLIB_LDFLAGS='\$(SHLIB_CXXLDFLAGS)' ${makeargs}"makeargs="SHLIB_LD='\$(SHLIB_CXXLD)' ${makeargs}"fiif ${with_f77}; thenif ${with_objc}; thenshlib_libadd="\$(OBJC_LIBS) ${shlib_libadd}"fiif test -z "${shlib_libadd}"; thenmakeargs="${makeargs} SHLIB_LIBADD='\$(FLIBS)'"elsemakeargs="${makeargs} SHLIB_LIBADD='\$(FLIBS) ${shlib_libadd}'"fielseif ${with_objc}; thenmakeargs="${makeargs} SHLIB_LIBADD='\$(OBJC_LIBS)'"fififiif test -n "${pkg_libs}"; thenmakeargs="${makeargs} PKG_LIBS='${pkg_libs}'"fiif ${preclean}; theneval ${MAKE} ${makefiles} ${makeargs} ${makeobjs} shlib-cleanfieval ${MAKE} ${makefiles} ${makeargs} ${makeobjs}exitstatus=$?if ${clean}; theneval ${MAKE} ${makefiles} ${makeargs} ${makeobjs} shlib-cleanfiexit ${exitstatus}### Local Variables: ***### mode: sh ***### sh-indentation: 2 ***### End: ***