Rev 14460 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#-*- perl -*-# Copyright (C) 2000, 2001 R Development Core Team## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2, or (at your option)# any later version.## This program is distributed in the hope that it will be useful, but# WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU# General Public License for more details.## A copy of the GNU General Public License is available via WWW at# http://www.gnu.org/copyleft/gpl.html. You can also obtain it by# writing to the Free Software Foundation, Inc., 59 Temple Place,# Suite 330, Boston, MA 02111-1307 USA.# Send any bug reports to r-bugs@r-project.orguse Cwd;use File::Basename;use File::Path;use Getopt::Long;my $revision = ' $Revision: 1.5 $ ';my $version;my $name;$revision =~ / ([\d\.]*) /;$version = $1;($name = $0) =~ s|.*/||;my @knownoptions = ("help|h", "version|v", "output|o:s", "debug|d");GetOptions (@knownoptions) || usage();R_version($name, $version) if $opt_version;usage() if $opt_help;my $R_HOME = $ENV{'R_HOME'} ||die "Error: Environment variable R_HOME not found\n";my $debug;$debug = "DEBUG=T" if($opt_debug);my $dllname;if($opt_output){$dllname = $opt_output;$dllname =~ s/\.dll$//;} else {$dllname = $ARGV[0];$dllname =~ s/\.[^\.]+$//;}my @cfsrcs;my @cxxsrcs;foreach $src (@ARGV) {if ($src =~ /\.(cc|cpp|C)$/) {push @cxxsrcs, $src;} else {push @cfsrcs, $src;}}my $srcs=join(" ", @cfsrcs);my $cxx=join(" ", @cxxsrcs);system("make -f $R_HOME/src/gnuwin32/MakeDll RHOME=$R_HOME $debug DLLNAME=$dllname CFSOURCES='$srcs' CXXSOURCES='$cxx' RCOBJ=");sub usage {print STDERR <<END;Usage: Rcmd $name [options] filesBuild a DLL (shared library) for dynamic loading from the specified sourceor object files (which are automagically made from their sources). If notgiven via \`--output\', the name for the DLL is determined from thefirst file.Options:-d, --debug build a debug DLL-h, --help print short help message and exit-o, --output=LIB use LIB as the name for the DLL-v, --version print version info and exitReport bugs to <r-bugs\@r-project.org>.ENDexit 0;}