1 case $PERL_CONFIG_SH in
3 if test -f config.sh; then TOP=.;
4 elif test -f ../config.sh; then TOP=..;
5 elif test -f ../../config.sh; then TOP=../..;
6 elif test -f ../../../config.sh; then TOP=../../..;
7 elif test -f ../../../../config.sh; then TOP=../../../..;
9 echo "Can't find config.sh."; exit 1
14 : This forces SH files to create target in same directory as SH file.
15 : This is so that make depend always knows where to find SH derivatives.
17 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
19 echo "Extracting makeaperl (with variable substitutions)"
21 $spitshell >makeaperl <<!GROK!THIS!
23 eval 'exec $perlpath -S \$0 \${1+"\$@"}'
24 if \$running_under_some_shell;
27 $spitshell >>makeaperl <<'!NO!SUBS!'
31 makeaperl - create a new perl binary from static extensions
35 C<makeaperl -l library -m makefile -o target -t tempdir [object_files] [static_extensions] [search_directories]>
39 This utility is designed to build new perl binaries from existing
40 extensions on the fly. Called without any arguments it produces a new
41 binary with the name C<perl> in the current directory. Intermediate
42 files are produced in C</tmp>, if that is writeable, else in the
43 current directory. The most important intermediate file is a Makefile,
44 that is used internally to call C<make>. The new perl binary will consist
46 The C<-l> switch lets you specify the name of a perl library to be
47 linked into the new binary. If you do not specify a library, makeaperl
48 writes targets for any C<libperl*.a> it finds in the search path. The
49 topmost target will be the one related to C<libperl.a>.
51 With the C<-m> switch you can provide a name for the Makefile that
52 will be written (default C</tmp/Makefile.$$>). Likewise specifies the
53 C<-o> switch a name for the perl binary (default C<perl>). The C<-t>
54 switch lets you determine, in which directory the intermediate files
57 All object files and static extensions following on the command line
58 will be linked into the target file. If there are any directories
59 specified on the command line, these directories are searched for
60 C<*.a> files, and all of the found ones will be linked in, too. If
61 there is no directory named, then the contents of $INC[0] are
64 If the command fails, there is currently no other mechanism to adjust
65 the behaviour of the program than to alter the generated Makefile and
69 Tim Bunce <Tim.Bunce@ig.co.uk>, Andreas Koenig
70 <koenig@franz.ww.TU-Berlin.DE>;
73 First version, written 5 Feb 1995, is considered alpha.
77 use ExtUtils::MakeMaker;
79 use strict qw(subs refs);
88 $0: [options] [object_files] [static_extensions ...] [directories to search through]
89 -l perllibrary perl library to link from (the first libperl.a found)
90 -m makefilename name of the makefile to be written (/tmp/Makefile.\$\$)
91 -o name name for perl executable (perl)
92 -t directory directory where intermediate files reside (/tmp)
103 $opt_m = "$opt_t/Makefile.$$";
106 $Getopt::Long::ignorecase=0;
108 GetOptions('t=s', 'l=s', 'm=s', 'o=s') || die &usage;
110 @dirs = grep -d $_, @ARGV;
111 @fils = grep -f $_, @ARGV;
113 @dirs = $INC[0] unless @dirs;
115 open MAKE, ">$opt_m";
118 print MAKE MM->makeaperl('MAKE' => $opt_m,
127 (system "make -f $opt_m") == 0 or die "$0 failed: Please check file $opt_m and run make -f $opt_m\n";