xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/lib/ExtUtils/MM_Any.pm (revision 0:68f95e015346)
1*0Sstevel@tonic-gatepackage ExtUtils::MM_Any;
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gateuse strict;
4*0Sstevel@tonic-gateuse vars qw($VERSION @ISA);
5*0Sstevel@tonic-gate$VERSION = 0.07;
6*0Sstevel@tonic-gate@ISA = qw(File::Spec);
7*0Sstevel@tonic-gate
8*0Sstevel@tonic-gateuse Config;
9*0Sstevel@tonic-gateuse File::Spec;
10*0Sstevel@tonic-gate
11*0Sstevel@tonic-gate
12*0Sstevel@tonic-gate=head1 NAME
13*0Sstevel@tonic-gate
14*0Sstevel@tonic-gateExtUtils::MM_Any - Platform-agnostic MM methods
15*0Sstevel@tonic-gate
16*0Sstevel@tonic-gate=head1 SYNOPSIS
17*0Sstevel@tonic-gate
18*0Sstevel@tonic-gate  FOR INTERNAL USE ONLY!
19*0Sstevel@tonic-gate
20*0Sstevel@tonic-gate  package ExtUtils::MM_SomeOS;
21*0Sstevel@tonic-gate
22*0Sstevel@tonic-gate  # Temporarily, you have to subclass both.  Put MM_Any first.
23*0Sstevel@tonic-gate  require ExtUtils::MM_Any;
24*0Sstevel@tonic-gate  require ExtUtils::MM_Unix;
25*0Sstevel@tonic-gate  @ISA = qw(ExtUtils::MM_Any ExtUtils::Unix);
26*0Sstevel@tonic-gate
27*0Sstevel@tonic-gate=head1 DESCRIPTION
28*0Sstevel@tonic-gate
29*0Sstevel@tonic-gateB<FOR INTERNAL USE ONLY!>
30*0Sstevel@tonic-gate
31*0Sstevel@tonic-gateExtUtils::MM_Any is a superclass for the ExtUtils::MM_* set of
32*0Sstevel@tonic-gatemodules.  It contains methods which are either inherently
33*0Sstevel@tonic-gatecross-platform or are written in a cross-platform manner.
34*0Sstevel@tonic-gate
35*0Sstevel@tonic-gateSubclass off of ExtUtils::MM_Any I<and> ExtUtils::MM_Unix.  This is a
36*0Sstevel@tonic-gatetemporary solution.
37*0Sstevel@tonic-gate
38*0Sstevel@tonic-gateB<THIS MAY BE TEMPORARY!>
39*0Sstevel@tonic-gate
40*0Sstevel@tonic-gate=head1 Inherently Cross-Platform Methods
41*0Sstevel@tonic-gate
42*0Sstevel@tonic-gateThese are methods which are by their nature cross-platform and should
43*0Sstevel@tonic-gatealways be cross-platform.
44*0Sstevel@tonic-gate
45*0Sstevel@tonic-gate=over 4
46*0Sstevel@tonic-gate
47*0Sstevel@tonic-gate=item installvars
48*0Sstevel@tonic-gate
49*0Sstevel@tonic-gate    my @installvars = $mm->installvars;
50*0Sstevel@tonic-gate
51*0Sstevel@tonic-gateA list of all the INSTALL* variables without the INSTALL prefix.  Useful
52*0Sstevel@tonic-gatefor iteration or building related variable sets.
53*0Sstevel@tonic-gate
54*0Sstevel@tonic-gate=cut
55*0Sstevel@tonic-gate
56*0Sstevel@tonic-gatesub installvars {
57*0Sstevel@tonic-gate    return qw(PRIVLIB SITELIB  VENDORLIB
58*0Sstevel@tonic-gate              ARCHLIB SITEARCH VENDORARCH
59*0Sstevel@tonic-gate              BIN     SITEBIN  VENDORBIN
60*0Sstevel@tonic-gate              SCRIPT
61*0Sstevel@tonic-gate              MAN1DIR SITEMAN1DIR VENDORMAN1DIR
62*0Sstevel@tonic-gate              MAN3DIR SITEMAN3DIR VENDORMAN3DIR
63*0Sstevel@tonic-gate             );
64*0Sstevel@tonic-gate}
65*0Sstevel@tonic-gate
66*0Sstevel@tonic-gate=item os_flavor_is
67*0Sstevel@tonic-gate
68*0Sstevel@tonic-gate    $mm->os_flavor_is($this_flavor);
69*0Sstevel@tonic-gate    $mm->os_flavor_is(@one_of_these_flavors);
70*0Sstevel@tonic-gate
71*0Sstevel@tonic-gateChecks to see if the current operating system is one of the given flavors.
72*0Sstevel@tonic-gate
73*0Sstevel@tonic-gateThis is useful for code like:
74*0Sstevel@tonic-gate
75*0Sstevel@tonic-gate    if( $mm->os_flavor_is('Unix') ) {
76*0Sstevel@tonic-gate        $out = `foo 2>&1`;
77*0Sstevel@tonic-gate    }
78*0Sstevel@tonic-gate    else {
79*0Sstevel@tonic-gate        $out = `foo`;
80*0Sstevel@tonic-gate    }
81*0Sstevel@tonic-gate
82*0Sstevel@tonic-gate=cut
83*0Sstevel@tonic-gate
84*0Sstevel@tonic-gatesub os_flavor_is {
85*0Sstevel@tonic-gate    my $self = shift;
86*0Sstevel@tonic-gate    my %flavors = map { ($_ => 1) } $self->os_flavor;
87*0Sstevel@tonic-gate    return (grep { $flavors{$_} } @_) ? 1 : 0;
88*0Sstevel@tonic-gate}
89*0Sstevel@tonic-gate
90*0Sstevel@tonic-gate=back
91*0Sstevel@tonic-gate
92*0Sstevel@tonic-gate=head2 File::Spec wrappers
93*0Sstevel@tonic-gate
94*0Sstevel@tonic-gateExtUtils::MM_Any is a subclass of File::Spec.  The methods noted here
95*0Sstevel@tonic-gateoverride File::Spec.
96*0Sstevel@tonic-gate
97*0Sstevel@tonic-gate=over 4
98*0Sstevel@tonic-gate
99*0Sstevel@tonic-gate=item catfile
100*0Sstevel@tonic-gate
101*0Sstevel@tonic-gateFile::Spec <= 0.83 has a bug where the file part of catfile is not
102*0Sstevel@tonic-gatecanonicalized.  This override fixes that bug.
103*0Sstevel@tonic-gate
104*0Sstevel@tonic-gate=cut
105*0Sstevel@tonic-gate
106*0Sstevel@tonic-gatesub catfile {
107*0Sstevel@tonic-gate    my $self = shift;
108*0Sstevel@tonic-gate    return $self->canonpath($self->SUPER::catfile(@_));
109*0Sstevel@tonic-gate}
110*0Sstevel@tonic-gate
111*0Sstevel@tonic-gate=back
112*0Sstevel@tonic-gate
113*0Sstevel@tonic-gate=head1 Thought To Be Cross-Platform Methods
114*0Sstevel@tonic-gate
115*0Sstevel@tonic-gateThese are methods which are thought to be cross-platform by virtue of
116*0Sstevel@tonic-gatehaving been written in a way to avoid incompatibilities.  They may
117*0Sstevel@tonic-gaterequire partial overrides.
118*0Sstevel@tonic-gate
119*0Sstevel@tonic-gate=over 4
120*0Sstevel@tonic-gate
121*0Sstevel@tonic-gate=item B<split_command>
122*0Sstevel@tonic-gate
123*0Sstevel@tonic-gate    my @cmds = $MM->split_command($cmd, @args);
124*0Sstevel@tonic-gate
125*0Sstevel@tonic-gateMost OS have a maximum command length they can execute at once.  Large
126*0Sstevel@tonic-gatemodules can easily generate commands well past that limit.  Its
127*0Sstevel@tonic-gatenecessary to split long commands up into a series of shorter commands.
128*0Sstevel@tonic-gate
129*0Sstevel@tonic-gatesplit_command() will return a series of @cmds each processing part of
130*0Sstevel@tonic-gatethe args.  Collectively they will process all the arguments.  Each
131*0Sstevel@tonic-gateindividual line in @cmds will not be longer than the
132*0Sstevel@tonic-gate$self->max_exec_len being careful to take into account macro expansion.
133*0Sstevel@tonic-gate
134*0Sstevel@tonic-gate$cmd should include any switches and repeated initial arguments.
135*0Sstevel@tonic-gate
136*0Sstevel@tonic-gateIf no @args are given, no @cmds will be returned.
137*0Sstevel@tonic-gate
138*0Sstevel@tonic-gatePairs of arguments will always be preserved in a single command, this
139*0Sstevel@tonic-gateis a heuristic for things like pm_to_blib and pod2man which work on
140*0Sstevel@tonic-gatepairs of arguments.  This makes things like this safe:
141*0Sstevel@tonic-gate
142*0Sstevel@tonic-gate    $self->split_command($cmd, %pod2man);
143*0Sstevel@tonic-gate
144*0Sstevel@tonic-gate
145*0Sstevel@tonic-gate=cut
146*0Sstevel@tonic-gate
147*0Sstevel@tonic-gatesub split_command {
148*0Sstevel@tonic-gate    my($self, $cmd, @args) = @_;
149*0Sstevel@tonic-gate
150*0Sstevel@tonic-gate    my @cmds = ();
151*0Sstevel@tonic-gate    return(@cmds) unless @args;
152*0Sstevel@tonic-gate
153*0Sstevel@tonic-gate    # If the command was given as a here-doc, there's probably a trailing
154*0Sstevel@tonic-gate    # newline.
155*0Sstevel@tonic-gate    chomp $cmd;
156*0Sstevel@tonic-gate
157*0Sstevel@tonic-gate    # set aside 20% for macro expansion.
158*0Sstevel@tonic-gate    my $len_left = int($self->max_exec_len * 0.80);
159*0Sstevel@tonic-gate    $len_left -= length $self->_expand_macros($cmd);
160*0Sstevel@tonic-gate
161*0Sstevel@tonic-gate    do {
162*0Sstevel@tonic-gate        my $arg_str = '';
163*0Sstevel@tonic-gate        my @next_args;
164*0Sstevel@tonic-gate        while( @next_args = splice(@args, 0, 2) ) {
165*0Sstevel@tonic-gate            # Two at a time to preserve pairs.
166*0Sstevel@tonic-gate            my $next_arg_str = "\t  ". join ' ', @next_args, "\n";
167*0Sstevel@tonic-gate
168*0Sstevel@tonic-gate            if( !length $arg_str ) {
169*0Sstevel@tonic-gate                $arg_str .= $next_arg_str
170*0Sstevel@tonic-gate            }
171*0Sstevel@tonic-gate            elsif( length($arg_str) + length($next_arg_str) > $len_left ) {
172*0Sstevel@tonic-gate                unshift @args, @next_args;
173*0Sstevel@tonic-gate                last;
174*0Sstevel@tonic-gate            }
175*0Sstevel@tonic-gate            else {
176*0Sstevel@tonic-gate                $arg_str .= $next_arg_str;
177*0Sstevel@tonic-gate            }
178*0Sstevel@tonic-gate        }
179*0Sstevel@tonic-gate        chop $arg_str;
180*0Sstevel@tonic-gate
181*0Sstevel@tonic-gate        push @cmds, $self->escape_newlines("$cmd\n$arg_str");
182*0Sstevel@tonic-gate    } while @args;
183*0Sstevel@tonic-gate
184*0Sstevel@tonic-gate    return @cmds;
185*0Sstevel@tonic-gate}
186*0Sstevel@tonic-gate
187*0Sstevel@tonic-gate
188*0Sstevel@tonic-gatesub _expand_macros {
189*0Sstevel@tonic-gate    my($self, $cmd) = @_;
190*0Sstevel@tonic-gate
191*0Sstevel@tonic-gate    $cmd =~ s{\$\((\w+)\)}{
192*0Sstevel@tonic-gate        defined $self->{$1} ? $self->{$1} : "\$($1)"
193*0Sstevel@tonic-gate    }e;
194*0Sstevel@tonic-gate    return $cmd;
195*0Sstevel@tonic-gate}
196*0Sstevel@tonic-gate
197*0Sstevel@tonic-gate
198*0Sstevel@tonic-gate=item B<echo>
199*0Sstevel@tonic-gate
200*0Sstevel@tonic-gate    my @commands = $MM->echo($text);
201*0Sstevel@tonic-gate    my @commands = $MM->echo($text, $file);
202*0Sstevel@tonic-gate    my @commands = $MM->echo($text, $file, $appending);
203*0Sstevel@tonic-gate
204*0Sstevel@tonic-gateGenerates a set of @commands which print the $text to a $file.
205*0Sstevel@tonic-gate
206*0Sstevel@tonic-gateIf $file is not given, output goes to STDOUT.
207*0Sstevel@tonic-gate
208*0Sstevel@tonic-gateIf $appending is true the $file will be appended to rather than
209*0Sstevel@tonic-gateoverwritten.
210*0Sstevel@tonic-gate
211*0Sstevel@tonic-gate=cut
212*0Sstevel@tonic-gate
213*0Sstevel@tonic-gatesub echo {
214*0Sstevel@tonic-gate    my($self, $text, $file, $appending) = @_;
215*0Sstevel@tonic-gate    $appending ||= 0;
216*0Sstevel@tonic-gate
217*0Sstevel@tonic-gate    my @cmds = map { '$(NOECHO) $(ECHO) '.$self->quote_literal($_) }
218*0Sstevel@tonic-gate               split /\n/, $text;
219*0Sstevel@tonic-gate    if( $file ) {
220*0Sstevel@tonic-gate        my $redirect = $appending ? '>>' : '>';
221*0Sstevel@tonic-gate        $cmds[0] .= " $redirect $file";
222*0Sstevel@tonic-gate        $_ .= " >> $file" foreach @cmds[1..$#cmds];
223*0Sstevel@tonic-gate    }
224*0Sstevel@tonic-gate
225*0Sstevel@tonic-gate    return @cmds;
226*0Sstevel@tonic-gate}
227*0Sstevel@tonic-gate
228*0Sstevel@tonic-gate
229*0Sstevel@tonic-gate=item init_VERSION
230*0Sstevel@tonic-gate
231*0Sstevel@tonic-gate    $mm->init_VERSION
232*0Sstevel@tonic-gate
233*0Sstevel@tonic-gateInitialize macros representing versions of MakeMaker and other tools
234*0Sstevel@tonic-gate
235*0Sstevel@tonic-gateMAKEMAKER: path to the MakeMaker module.
236*0Sstevel@tonic-gate
237*0Sstevel@tonic-gateMM_VERSION: ExtUtils::MakeMaker Version
238*0Sstevel@tonic-gate
239*0Sstevel@tonic-gateMM_REVISION: ExtUtils::MakeMaker version control revision (for backwards
240*0Sstevel@tonic-gate             compat)
241*0Sstevel@tonic-gate
242*0Sstevel@tonic-gateVERSION: version of your module
243*0Sstevel@tonic-gate
244*0Sstevel@tonic-gateVERSION_MACRO: which macro represents the version (usually 'VERSION')
245*0Sstevel@tonic-gate
246*0Sstevel@tonic-gateVERSION_SYM: like version but safe for use as an RCS revision number
247*0Sstevel@tonic-gate
248*0Sstevel@tonic-gateDEFINE_VERSION: -D line to set the module version when compiling
249*0Sstevel@tonic-gate
250*0Sstevel@tonic-gateXS_VERSION: version in your .xs file.  Defaults to $(VERSION)
251*0Sstevel@tonic-gate
252*0Sstevel@tonic-gateXS_VERSION_MACRO: which macro represents the XS version.
253*0Sstevel@tonic-gate
254*0Sstevel@tonic-gateXS_DEFINE_VERSION: -D line to set the xs version when compiling.
255*0Sstevel@tonic-gate
256*0Sstevel@tonic-gateCalled by init_main.
257*0Sstevel@tonic-gate
258*0Sstevel@tonic-gate=cut
259*0Sstevel@tonic-gate
260*0Sstevel@tonic-gatesub init_VERSION {
261*0Sstevel@tonic-gate    my($self) = shift;
262*0Sstevel@tonic-gate
263*0Sstevel@tonic-gate    $self->{MAKEMAKER}  = $ExtUtils::MakeMaker::Filename;
264*0Sstevel@tonic-gate    $self->{MM_VERSION} = $ExtUtils::MakeMaker::VERSION;
265*0Sstevel@tonic-gate    $self->{MM_REVISION}= $ExtUtils::MakeMaker::Revision;
266*0Sstevel@tonic-gate    $self->{VERSION_FROM} ||= '';
267*0Sstevel@tonic-gate
268*0Sstevel@tonic-gate    if ($self->{VERSION_FROM}){
269*0Sstevel@tonic-gate        $self->{VERSION} = $self->parse_version($self->{VERSION_FROM});
270*0Sstevel@tonic-gate        if( $self->{VERSION} eq 'undef' ) {
271*0Sstevel@tonic-gate            require Carp;
272*0Sstevel@tonic-gate            Carp::carp("WARNING: Setting VERSION via file ".
273*0Sstevel@tonic-gate                       "'$self->{VERSION_FROM}' failed\n");
274*0Sstevel@tonic-gate        }
275*0Sstevel@tonic-gate    }
276*0Sstevel@tonic-gate
277*0Sstevel@tonic-gate    # strip blanks
278*0Sstevel@tonic-gate    if (defined $self->{VERSION}) {
279*0Sstevel@tonic-gate        $self->{VERSION} =~ s/^\s+//;
280*0Sstevel@tonic-gate        $self->{VERSION} =~ s/\s+$//;
281*0Sstevel@tonic-gate    }
282*0Sstevel@tonic-gate    else {
283*0Sstevel@tonic-gate        $self->{VERSION} = '';
284*0Sstevel@tonic-gate    }
285*0Sstevel@tonic-gate
286*0Sstevel@tonic-gate
287*0Sstevel@tonic-gate    $self->{VERSION_MACRO}  = 'VERSION';
288*0Sstevel@tonic-gate    ($self->{VERSION_SYM} = $self->{VERSION}) =~ s/\W/_/g;
289*0Sstevel@tonic-gate    $self->{DEFINE_VERSION} = '-D$(VERSION_MACRO)=\"$(VERSION)\"';
290*0Sstevel@tonic-gate
291*0Sstevel@tonic-gate
292*0Sstevel@tonic-gate    # Graham Barr and Paul Marquess had some ideas how to ensure
293*0Sstevel@tonic-gate    # version compatibility between the *.pm file and the
294*0Sstevel@tonic-gate    # corresponding *.xs file. The bottomline was, that we need an
295*0Sstevel@tonic-gate    # XS_VERSION macro that defaults to VERSION:
296*0Sstevel@tonic-gate    $self->{XS_VERSION} ||= $self->{VERSION};
297*0Sstevel@tonic-gate
298*0Sstevel@tonic-gate    $self->{XS_VERSION_MACRO}  = 'XS_VERSION';
299*0Sstevel@tonic-gate    $self->{XS_DEFINE_VERSION} = '-D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\"';
300*0Sstevel@tonic-gate
301*0Sstevel@tonic-gate}
302*0Sstevel@tonic-gate
303*0Sstevel@tonic-gate=item wraplist
304*0Sstevel@tonic-gate
305*0Sstevel@tonic-gateTakes an array of items and turns them into a well-formatted list of
306*0Sstevel@tonic-gatearguments.  In most cases this is simply something like:
307*0Sstevel@tonic-gate
308*0Sstevel@tonic-gate    FOO \
309*0Sstevel@tonic-gate    BAR \
310*0Sstevel@tonic-gate    BAZ
311*0Sstevel@tonic-gate
312*0Sstevel@tonic-gate=cut
313*0Sstevel@tonic-gate
314*0Sstevel@tonic-gatesub wraplist {
315*0Sstevel@tonic-gate    my $self = shift;
316*0Sstevel@tonic-gate    return join " \\\n\t", @_;
317*0Sstevel@tonic-gate}
318*0Sstevel@tonic-gate
319*0Sstevel@tonic-gate=item manifypods
320*0Sstevel@tonic-gate
321*0Sstevel@tonic-gateDefines targets and routines to translate the pods into manpages and
322*0Sstevel@tonic-gateput them into the INST_* directories.
323*0Sstevel@tonic-gate
324*0Sstevel@tonic-gate=cut
325*0Sstevel@tonic-gate
326*0Sstevel@tonic-gatesub manifypods {
327*0Sstevel@tonic-gate    my $self          = shift;
328*0Sstevel@tonic-gate
329*0Sstevel@tonic-gate    my $POD2MAN_macro = $self->POD2MAN_macro();
330*0Sstevel@tonic-gate    my $manifypods_target = $self->manifypods_target();
331*0Sstevel@tonic-gate
332*0Sstevel@tonic-gate    return <<END_OF_TARGET;
333*0Sstevel@tonic-gate
334*0Sstevel@tonic-gate$POD2MAN_macro
335*0Sstevel@tonic-gate
336*0Sstevel@tonic-gate$manifypods_target
337*0Sstevel@tonic-gate
338*0Sstevel@tonic-gateEND_OF_TARGET
339*0Sstevel@tonic-gate
340*0Sstevel@tonic-gate}
341*0Sstevel@tonic-gate
342*0Sstevel@tonic-gate
343*0Sstevel@tonic-gate=item manifypods_target
344*0Sstevel@tonic-gate
345*0Sstevel@tonic-gate  my $manifypods_target = $self->manifypods_target;
346*0Sstevel@tonic-gate
347*0Sstevel@tonic-gateGenerates the manifypods target.  This target generates man pages from
348*0Sstevel@tonic-gateall POD files in MAN1PODS and MAN3PODS.
349*0Sstevel@tonic-gate
350*0Sstevel@tonic-gate=cut
351*0Sstevel@tonic-gate
352*0Sstevel@tonic-gatesub manifypods_target {
353*0Sstevel@tonic-gate    my($self) = shift;
354*0Sstevel@tonic-gate
355*0Sstevel@tonic-gate    my $man1pods      = '';
356*0Sstevel@tonic-gate    my $man3pods      = '';
357*0Sstevel@tonic-gate    my $dependencies  = '';
358*0Sstevel@tonic-gate
359*0Sstevel@tonic-gate    # populate manXpods & dependencies:
360*0Sstevel@tonic-gate    foreach my $name (keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}}) {
361*0Sstevel@tonic-gate        $dependencies .= " \\\n\t$name";
362*0Sstevel@tonic-gate    }
363*0Sstevel@tonic-gate
364*0Sstevel@tonic-gate    foreach my $name (keys %{$self->{MAN3PODS}}) {
365*0Sstevel@tonic-gate        $dependencies .= " \\\n\t$name"
366*0Sstevel@tonic-gate    }
367*0Sstevel@tonic-gate
368*0Sstevel@tonic-gate    my $manify = <<END;
369*0Sstevel@tonic-gatemanifypods : pure_all $dependencies
370*0Sstevel@tonic-gateEND
371*0Sstevel@tonic-gate
372*0Sstevel@tonic-gate    my @man_cmds;
373*0Sstevel@tonic-gate    foreach my $section (qw(1 3)) {
374*0Sstevel@tonic-gate        my $pods = $self->{"MAN${section}PODS"};
375*0Sstevel@tonic-gate        push @man_cmds, $self->split_command(<<CMD, %$pods);
376*0Sstevel@tonic-gate	\$(NOECHO) \$(POD2MAN) --section=$section --perm_rw=\$(PERM_RW)
377*0Sstevel@tonic-gateCMD
378*0Sstevel@tonic-gate    }
379*0Sstevel@tonic-gate
380*0Sstevel@tonic-gate    $manify .= "\t\$(NOECHO) \$(NOOP)\n" unless @man_cmds;
381*0Sstevel@tonic-gate    $manify .= join '', map { "$_\n" } @man_cmds;
382*0Sstevel@tonic-gate
383*0Sstevel@tonic-gate    return $manify;
384*0Sstevel@tonic-gate}
385*0Sstevel@tonic-gate
386*0Sstevel@tonic-gate
387*0Sstevel@tonic-gate=item makemakerdflt_target
388*0Sstevel@tonic-gate
389*0Sstevel@tonic-gate  my $make_frag = $mm->makemakerdflt_target
390*0Sstevel@tonic-gate
391*0Sstevel@tonic-gateReturns a make fragment with the makemakerdeflt_target specified.
392*0Sstevel@tonic-gateThis target is the first target in the Makefile, is the default target
393*0Sstevel@tonic-gateand simply points off to 'all' just in case any make variant gets
394*0Sstevel@tonic-gateconfused or something gets snuck in before the real 'all' target.
395*0Sstevel@tonic-gate
396*0Sstevel@tonic-gate=cut
397*0Sstevel@tonic-gate
398*0Sstevel@tonic-gatesub makemakerdflt_target {
399*0Sstevel@tonic-gate    return <<'MAKE_FRAG';
400*0Sstevel@tonic-gatemakemakerdflt: all
401*0Sstevel@tonic-gate	$(NOECHO) $(NOOP)
402*0Sstevel@tonic-gateMAKE_FRAG
403*0Sstevel@tonic-gate
404*0Sstevel@tonic-gate}
405*0Sstevel@tonic-gate
406*0Sstevel@tonic-gate
407*0Sstevel@tonic-gate=item special_targets
408*0Sstevel@tonic-gate
409*0Sstevel@tonic-gate  my $make_frag = $mm->special_targets
410*0Sstevel@tonic-gate
411*0Sstevel@tonic-gateReturns a make fragment containing any targets which have special
412*0Sstevel@tonic-gatemeaning to make.  For example, .SUFFIXES and .PHONY.
413*0Sstevel@tonic-gate
414*0Sstevel@tonic-gate=cut
415*0Sstevel@tonic-gate
416*0Sstevel@tonic-gatesub special_targets {
417*0Sstevel@tonic-gate    my $make_frag = <<'MAKE_FRAG';
418*0Sstevel@tonic-gate.SUFFIXES: .xs .c .C .cpp .i .s .cxx .cc $(OBJ_EXT)
419*0Sstevel@tonic-gate
420*0Sstevel@tonic-gate.PHONY: all config static dynamic test linkext manifest
421*0Sstevel@tonic-gate
422*0Sstevel@tonic-gateMAKE_FRAG
423*0Sstevel@tonic-gate
424*0Sstevel@tonic-gate    $make_frag .= <<'MAKE_FRAG' if $ENV{CLEARCASE_ROOT};
425*0Sstevel@tonic-gate.NO_CONFIG_REC: Makefile
426*0Sstevel@tonic-gate
427*0Sstevel@tonic-gateMAKE_FRAG
428*0Sstevel@tonic-gate
429*0Sstevel@tonic-gate    return $make_frag;
430*0Sstevel@tonic-gate}
431*0Sstevel@tonic-gate
432*0Sstevel@tonic-gate=item POD2MAN_macro
433*0Sstevel@tonic-gate
434*0Sstevel@tonic-gate  my $pod2man_macro = $self->POD2MAN_macro
435*0Sstevel@tonic-gate
436*0Sstevel@tonic-gateReturns a definition for the POD2MAN macro.  This is a program
437*0Sstevel@tonic-gatewhich emulates the pod2man utility.  You can add more switches to the
438*0Sstevel@tonic-gatecommand by simply appending them on the macro.
439*0Sstevel@tonic-gate
440*0Sstevel@tonic-gateTypical usage:
441*0Sstevel@tonic-gate
442*0Sstevel@tonic-gate    $(POD2MAN) --section=3 --perm_rw=$(PERM_RW) podfile1 man_page1 ...
443*0Sstevel@tonic-gate
444*0Sstevel@tonic-gate=cut
445*0Sstevel@tonic-gate
446*0Sstevel@tonic-gatesub POD2MAN_macro {
447*0Sstevel@tonic-gate    my $self = shift;
448*0Sstevel@tonic-gate
449*0Sstevel@tonic-gate# Need the trailing '--' so perl stops gobbling arguments and - happens
450*0Sstevel@tonic-gate# to be an alternative end of line seperator on VMS so we quote it
451*0Sstevel@tonic-gate    return <<'END_OF_DEF';
452*0Sstevel@tonic-gatePOD2MAN_EXE = $(PERLRUN) "-MExtUtils::Command::MM" -e pod2man "--"
453*0Sstevel@tonic-gatePOD2MAN = $(POD2MAN_EXE)
454*0Sstevel@tonic-gateEND_OF_DEF
455*0Sstevel@tonic-gate}
456*0Sstevel@tonic-gate
457*0Sstevel@tonic-gate
458*0Sstevel@tonic-gate=item test_via_harness
459*0Sstevel@tonic-gate
460*0Sstevel@tonic-gate  my $command = $mm->test_via_harness($perl, $tests);
461*0Sstevel@tonic-gate
462*0Sstevel@tonic-gateReturns a $command line which runs the given set of $tests with
463*0Sstevel@tonic-gateTest::Harness and the given $perl.
464*0Sstevel@tonic-gate
465*0Sstevel@tonic-gateUsed on the t/*.t files.
466*0Sstevel@tonic-gate
467*0Sstevel@tonic-gate=cut
468*0Sstevel@tonic-gate
469*0Sstevel@tonic-gatesub test_via_harness {
470*0Sstevel@tonic-gate    my($self, $perl, $tests) = @_;
471*0Sstevel@tonic-gate
472*0Sstevel@tonic-gate    return qq{\t$perl "-MExtUtils::Command::MM" }.
473*0Sstevel@tonic-gate           qq{"-e" "test_harness(\$(TEST_VERBOSE), '\$(INST_LIB)', '\$(INST_ARCHLIB)')" $tests\n};
474*0Sstevel@tonic-gate}
475*0Sstevel@tonic-gate
476*0Sstevel@tonic-gate=item test_via_script
477*0Sstevel@tonic-gate
478*0Sstevel@tonic-gate  my $command = $mm->test_via_script($perl, $script);
479*0Sstevel@tonic-gate
480*0Sstevel@tonic-gateReturns a $command line which just runs a single test without
481*0Sstevel@tonic-gateTest::Harness.  No checks are done on the results, they're just
482*0Sstevel@tonic-gateprinted.
483*0Sstevel@tonic-gate
484*0Sstevel@tonic-gateUsed for test.pl, since they don't always follow Test::Harness
485*0Sstevel@tonic-gateformatting.
486*0Sstevel@tonic-gate
487*0Sstevel@tonic-gate=cut
488*0Sstevel@tonic-gate
489*0Sstevel@tonic-gatesub test_via_script {
490*0Sstevel@tonic-gate    my($self, $perl, $script) = @_;
491*0Sstevel@tonic-gate    return qq{\t$perl "-I\$(INST_LIB)" "-I\$(INST_ARCHLIB)" $script\n};
492*0Sstevel@tonic-gate}
493*0Sstevel@tonic-gate
494*0Sstevel@tonic-gate=item libscan
495*0Sstevel@tonic-gate
496*0Sstevel@tonic-gate  my $wanted = $self->libscan($path);
497*0Sstevel@tonic-gate
498*0Sstevel@tonic-gateTakes a path to a file or dir and returns an empty string if we don't
499*0Sstevel@tonic-gatewant to include this file in the library.  Otherwise it returns the
500*0Sstevel@tonic-gatethe $path unchanged.
501*0Sstevel@tonic-gate
502*0Sstevel@tonic-gateMainly used to exclude RCS, CVS, and SCCS directories from
503*0Sstevel@tonic-gateinstallation.
504*0Sstevel@tonic-gate
505*0Sstevel@tonic-gate=cut
506*0Sstevel@tonic-gate
507*0Sstevel@tonic-gatesub libscan {
508*0Sstevel@tonic-gate    my($self,$path) = @_;
509*0Sstevel@tonic-gate    my($dirs,$file) = ($self->splitpath($path))[1,2];
510*0Sstevel@tonic-gate    return '' if grep /^(?:RCS|CVS|SCCS|\.svn)$/,
511*0Sstevel@tonic-gate                     $self->splitdir($dirs), $file;
512*0Sstevel@tonic-gate
513*0Sstevel@tonic-gate    return $path;
514*0Sstevel@tonic-gate}
515*0Sstevel@tonic-gate
516*0Sstevel@tonic-gate=item tool_autosplit
517*0Sstevel@tonic-gate
518*0Sstevel@tonic-gateDefines a simple perl call that runs autosplit. May be deprecated by
519*0Sstevel@tonic-gatepm_to_blib soon.
520*0Sstevel@tonic-gate
521*0Sstevel@tonic-gate=cut
522*0Sstevel@tonic-gate
523*0Sstevel@tonic-gatesub tool_autosplit {
524*0Sstevel@tonic-gate    my($self, %attribs) = @_;
525*0Sstevel@tonic-gate
526*0Sstevel@tonic-gate    my $maxlen = $attribs{MAXLEN} ? '$$AutoSplit::Maxlen=$attribs{MAXLEN};'
527*0Sstevel@tonic-gate                                  : '';
528*0Sstevel@tonic-gate
529*0Sstevel@tonic-gate    my $asplit = $self->oneliner(sprintf <<'PERL_CODE', $maxlen);
530*0Sstevel@tonic-gateuse AutoSplit; %s autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1)
531*0Sstevel@tonic-gatePERL_CODE
532*0Sstevel@tonic-gate
533*0Sstevel@tonic-gate    return sprintf <<'MAKE_FRAG', $asplit;
534*0Sstevel@tonic-gate# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
535*0Sstevel@tonic-gateAUTOSPLITFILE = %s
536*0Sstevel@tonic-gate
537*0Sstevel@tonic-gateMAKE_FRAG
538*0Sstevel@tonic-gate
539*0Sstevel@tonic-gate}
540*0Sstevel@tonic-gate
541*0Sstevel@tonic-gate
542*0Sstevel@tonic-gate=item all_target
543*0Sstevel@tonic-gate
544*0Sstevel@tonic-gateGenerate the default target 'all'.
545*0Sstevel@tonic-gate
546*0Sstevel@tonic-gate=cut
547*0Sstevel@tonic-gate
548*0Sstevel@tonic-gatesub all_target {
549*0Sstevel@tonic-gate    my $self = shift;
550*0Sstevel@tonic-gate
551*0Sstevel@tonic-gate    return <<'MAKE_EXT';
552*0Sstevel@tonic-gateall :: pure_all
553*0Sstevel@tonic-gate	$(NOECHO) $(NOOP)
554*0Sstevel@tonic-gateMAKE_EXT
555*0Sstevel@tonic-gate
556*0Sstevel@tonic-gate}
557*0Sstevel@tonic-gate
558*0Sstevel@tonic-gate
559*0Sstevel@tonic-gate=item metafile_target
560*0Sstevel@tonic-gate
561*0Sstevel@tonic-gate    my $target = $mm->metafile_target;
562*0Sstevel@tonic-gate
563*0Sstevel@tonic-gateGenerate the metafile target.
564*0Sstevel@tonic-gate
565*0Sstevel@tonic-gateWrites the file META.yml, YAML encoded meta-data about the module.  The
566*0Sstevel@tonic-gateformat follows Module::Build's as closely as possible.  Additionally, we
567*0Sstevel@tonic-gateinclude:
568*0Sstevel@tonic-gate
569*0Sstevel@tonic-gate    version_from
570*0Sstevel@tonic-gate    installdirs
571*0Sstevel@tonic-gate
572*0Sstevel@tonic-gate=cut
573*0Sstevel@tonic-gate
574*0Sstevel@tonic-gatesub metafile_target {
575*0Sstevel@tonic-gate    my $self = shift;
576*0Sstevel@tonic-gate
577*0Sstevel@tonic-gate    return <<'MAKE_FRAG' if $self->{NO_META};
578*0Sstevel@tonic-gatemetafile:
579*0Sstevel@tonic-gate	$(NOECHO) $(NOOP)
580*0Sstevel@tonic-gateMAKE_FRAG
581*0Sstevel@tonic-gate
582*0Sstevel@tonic-gate    my $prereq_pm = '';
583*0Sstevel@tonic-gate    foreach my $mod ( sort { lc $a cmp lc $b } keys %{$self->{PREREQ_PM}} ) {
584*0Sstevel@tonic-gate        my $ver = $self->{PREREQ_PM}{$mod};
585*0Sstevel@tonic-gate        $prereq_pm .= sprintf "    %-30s %s\n", "$mod:", $ver;
586*0Sstevel@tonic-gate    }
587*0Sstevel@tonic-gate
588*0Sstevel@tonic-gate    my $meta = <<YAML;
589*0Sstevel@tonic-gate# http://module-build.sourceforge.net/META-spec.html
590*0Sstevel@tonic-gate#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
591*0Sstevel@tonic-gatename:         $self->{DISTNAME}
592*0Sstevel@tonic-gateversion:      $self->{VERSION}
593*0Sstevel@tonic-gateversion_from: $self->{VERSION_FROM}
594*0Sstevel@tonic-gateinstalldirs:  $self->{INSTALLDIRS}
595*0Sstevel@tonic-gaterequires:
596*0Sstevel@tonic-gate$prereq_pm
597*0Sstevel@tonic-gatedistribution_type: module
598*0Sstevel@tonic-gategenerated_by: ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION
599*0Sstevel@tonic-gateYAML
600*0Sstevel@tonic-gate
601*0Sstevel@tonic-gate    my @write_meta = $self->echo($meta, 'META.yml');
602*0Sstevel@tonic-gate    return sprintf <<'MAKE_FRAG', join "\n\t", @write_meta;
603*0Sstevel@tonic-gatemetafile :
604*0Sstevel@tonic-gate	%s
605*0Sstevel@tonic-gateMAKE_FRAG
606*0Sstevel@tonic-gate
607*0Sstevel@tonic-gate}
608*0Sstevel@tonic-gate
609*0Sstevel@tonic-gate
610*0Sstevel@tonic-gate=item metafile_addtomanifest_target
611*0Sstevel@tonic-gate
612*0Sstevel@tonic-gate  my $target = $mm->metafile_addtomanifest_target
613*0Sstevel@tonic-gate
614*0Sstevel@tonic-gateAdds the META.yml file to the MANIFEST.
615*0Sstevel@tonic-gate
616*0Sstevel@tonic-gate=cut
617*0Sstevel@tonic-gate
618*0Sstevel@tonic-gatesub metafile_addtomanifest_target {
619*0Sstevel@tonic-gate    my $self = shift;
620*0Sstevel@tonic-gate
621*0Sstevel@tonic-gate    return <<'MAKE_FRAG' if $self->{NO_META};
622*0Sstevel@tonic-gatemetafile_addtomanifest:
623*0Sstevel@tonic-gate	$(NOECHO) $(NOOP)
624*0Sstevel@tonic-gateMAKE_FRAG
625*0Sstevel@tonic-gate
626*0Sstevel@tonic-gate    my $add_meta = $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']);
627*0Sstevel@tonic-gateeval { maniadd({q{META.yml} => q{Module meta-data (added by MakeMaker)}}) }
628*0Sstevel@tonic-gate    or print "Could not add META.yml to MANIFEST: $${'@'}\n"
629*0Sstevel@tonic-gateCODE
630*0Sstevel@tonic-gate
631*0Sstevel@tonic-gate    return sprintf <<'MAKE_FRAG', $add_meta;
632*0Sstevel@tonic-gatemetafile_addtomanifest:
633*0Sstevel@tonic-gate	$(NOECHO) %s
634*0Sstevel@tonic-gateMAKE_FRAG
635*0Sstevel@tonic-gate
636*0Sstevel@tonic-gate}
637*0Sstevel@tonic-gate
638*0Sstevel@tonic-gate
639*0Sstevel@tonic-gate=back
640*0Sstevel@tonic-gate
641*0Sstevel@tonic-gate=head2 Abstract methods
642*0Sstevel@tonic-gate
643*0Sstevel@tonic-gateMethods which cannot be made cross-platform and each subclass will
644*0Sstevel@tonic-gatehave to do their own implementation.
645*0Sstevel@tonic-gate
646*0Sstevel@tonic-gate=over 4
647*0Sstevel@tonic-gate
648*0Sstevel@tonic-gate=item oneliner
649*0Sstevel@tonic-gate
650*0Sstevel@tonic-gate  my $oneliner = $MM->oneliner($perl_code);
651*0Sstevel@tonic-gate  my $oneliner = $MM->oneliner($perl_code, \@switches);
652*0Sstevel@tonic-gate
653*0Sstevel@tonic-gateThis will generate a perl one-liner safe for the particular platform
654*0Sstevel@tonic-gateyou're on based on the given $perl_code and @switches (a -e is
655*0Sstevel@tonic-gateassumed) suitable for using in a make target.  It will use the proper
656*0Sstevel@tonic-gateshell quoting and escapes.
657*0Sstevel@tonic-gate
658*0Sstevel@tonic-gate$(PERLRUN) will be used as perl.
659*0Sstevel@tonic-gate
660*0Sstevel@tonic-gateAny newlines in $perl_code will be escaped.  Leading and trailing
661*0Sstevel@tonic-gatenewlines will be stripped.  Makes this idiom much easier:
662*0Sstevel@tonic-gate
663*0Sstevel@tonic-gate    my $code = $MM->oneliner(<<'CODE', [...switches...]);
664*0Sstevel@tonic-gatesome code here
665*0Sstevel@tonic-gateanother line here
666*0Sstevel@tonic-gateCODE
667*0Sstevel@tonic-gate
668*0Sstevel@tonic-gateUsage might be something like:
669*0Sstevel@tonic-gate
670*0Sstevel@tonic-gate    # an echo emulation
671*0Sstevel@tonic-gate    $oneliner = $MM->oneliner('print "Foo\n"');
672*0Sstevel@tonic-gate    $make = '$oneliner > somefile';
673*0Sstevel@tonic-gate
674*0Sstevel@tonic-gateAll dollar signs must be doubled in the $perl_code if you expect them
675*0Sstevel@tonic-gateto be interpreted normally, otherwise it will be considered a make
676*0Sstevel@tonic-gatemacro.  Also remember to quote make macros else it might be used as a
677*0Sstevel@tonic-gatebareword.  For example:
678*0Sstevel@tonic-gate
679*0Sstevel@tonic-gate    # Assign the value of the $(VERSION_FROM) make macro to $vf.
680*0Sstevel@tonic-gate    $oneliner = $MM->oneliner('$$vf = "$(VERSION_FROM)"');
681*0Sstevel@tonic-gate
682*0Sstevel@tonic-gateIts currently very simple and may be expanded sometime in the figure
683*0Sstevel@tonic-gateto include more flexible code and switches.
684*0Sstevel@tonic-gate
685*0Sstevel@tonic-gate
686*0Sstevel@tonic-gate=item B<quote_literal>
687*0Sstevel@tonic-gate
688*0Sstevel@tonic-gate    my $safe_text = $MM->quote_literal($text);
689*0Sstevel@tonic-gate
690*0Sstevel@tonic-gateThis will quote $text so it is interpreted literally in the shell.
691*0Sstevel@tonic-gate
692*0Sstevel@tonic-gateFor example, on Unix this would escape any single-quotes in $text and
693*0Sstevel@tonic-gateput single-quotes around the whole thing.
694*0Sstevel@tonic-gate
695*0Sstevel@tonic-gate
696*0Sstevel@tonic-gate=item B<escape_newlines>
697*0Sstevel@tonic-gate
698*0Sstevel@tonic-gate    my $escaped_text = $MM->escape_newlines($text);
699*0Sstevel@tonic-gate
700*0Sstevel@tonic-gateShell escapes newlines in $text.
701*0Sstevel@tonic-gate
702*0Sstevel@tonic-gate
703*0Sstevel@tonic-gate=item max_exec_len
704*0Sstevel@tonic-gate
705*0Sstevel@tonic-gate    my $max_exec_len = $MM->max_exec_len;
706*0Sstevel@tonic-gate
707*0Sstevel@tonic-gateCalculates the maximum command size the OS can exec.  Effectively,
708*0Sstevel@tonic-gatethis is the max size of a shell command line.
709*0Sstevel@tonic-gate
710*0Sstevel@tonic-gate=for _private
711*0Sstevel@tonic-gate$self->{_MAX_EXEC_LEN} is set by this method, but only for testing purposes.
712*0Sstevel@tonic-gate
713*0Sstevel@tonic-gate=item B<init_others>
714*0Sstevel@tonic-gate
715*0Sstevel@tonic-gate    $MM->init_others();
716*0Sstevel@tonic-gate
717*0Sstevel@tonic-gateInitializes the macro definitions used by tools_other() and places them
718*0Sstevel@tonic-gatein the $MM object.
719*0Sstevel@tonic-gate
720*0Sstevel@tonic-gateIf there is no description, its the same as the parameter to
721*0Sstevel@tonic-gateWriteMakefile() documented in ExtUtils::MakeMaker.
722*0Sstevel@tonic-gate
723*0Sstevel@tonic-gateDefines at least these macros.
724*0Sstevel@tonic-gate
725*0Sstevel@tonic-gate  Macro             Description
726*0Sstevel@tonic-gate
727*0Sstevel@tonic-gate  NOOP              Do nothing
728*0Sstevel@tonic-gate  NOECHO            Tell make not to display the command itself
729*0Sstevel@tonic-gate
730*0Sstevel@tonic-gate  MAKEFILE
731*0Sstevel@tonic-gate  FIRST_MAKEFILE
732*0Sstevel@tonic-gate  MAKEFILE_OLD
733*0Sstevel@tonic-gate  MAKE_APERL_FILE   File used by MAKE_APERL
734*0Sstevel@tonic-gate
735*0Sstevel@tonic-gate  SHELL             Program used to run
736*0Sstevel@tonic-gate                    shell commands
737*0Sstevel@tonic-gate
738*0Sstevel@tonic-gate  ECHO              Print text adding a newline on the end
739*0Sstevel@tonic-gate  RM_F              Remove a file
740*0Sstevel@tonic-gate  RM_RF             Remove a directory
741*0Sstevel@tonic-gate  TOUCH             Update a file's timestamp
742*0Sstevel@tonic-gate  TEST_F            Test for a file's existence
743*0Sstevel@tonic-gate  CP                Copy a file
744*0Sstevel@tonic-gate  MV                Move a file
745*0Sstevel@tonic-gate  CHMOD             Change permissions on a
746*0Sstevel@tonic-gate                    file
747*0Sstevel@tonic-gate
748*0Sstevel@tonic-gate  UMASK_NULL        Nullify umask
749*0Sstevel@tonic-gate  DEV_NULL          Supress all command output
750*0Sstevel@tonic-gate
751*0Sstevel@tonic-gate=item init_DIRFILESEP
752*0Sstevel@tonic-gate
753*0Sstevel@tonic-gate  $MM->init_DIRFILESEP;
754*0Sstevel@tonic-gate  my $dirfilesep = $MM->{DIRFILESEP};
755*0Sstevel@tonic-gate
756*0Sstevel@tonic-gateInitializes the DIRFILESEP macro which is the seperator between the
757*0Sstevel@tonic-gatedirectory and filename in a filepath.  ie. / on Unix, \ on Win32 and
758*0Sstevel@tonic-gatenothing on VMS.
759*0Sstevel@tonic-gate
760*0Sstevel@tonic-gateFor example:
761*0Sstevel@tonic-gate
762*0Sstevel@tonic-gate    # instead of $(INST_ARCHAUTODIR)/extralibs.ld
763*0Sstevel@tonic-gate    $(INST_ARCHAUTODIR)$(DIRFILESEP)extralibs.ld
764*0Sstevel@tonic-gate
765*0Sstevel@tonic-gateSomething of a hack but it prevents a lot of code duplication between
766*0Sstevel@tonic-gateMM_* variants.
767*0Sstevel@tonic-gate
768*0Sstevel@tonic-gateDo not use this as a seperator between directories.  Some operating
769*0Sstevel@tonic-gatesystems use different seperators between subdirectories as between
770*0Sstevel@tonic-gatedirectories and filenames (for example:  VOLUME:[dir1.dir2]file on VMS).
771*0Sstevel@tonic-gate
772*0Sstevel@tonic-gate=item init_linker
773*0Sstevel@tonic-gate
774*0Sstevel@tonic-gate    $mm->init_linker;
775*0Sstevel@tonic-gate
776*0Sstevel@tonic-gateInitialize macros which have to do with linking.
777*0Sstevel@tonic-gate
778*0Sstevel@tonic-gatePERL_ARCHIVE: path to libperl.a equivalent to be linked to dynamic
779*0Sstevel@tonic-gateextensions.
780*0Sstevel@tonic-gate
781*0Sstevel@tonic-gatePERL_ARCHIVE_AFTER: path to a library which should be put on the
782*0Sstevel@tonic-gatelinker command line I<after> the external libraries to be linked to
783*0Sstevel@tonic-gatedynamic extensions.  This may be needed if the linker is one-pass, and
784*0Sstevel@tonic-gatePerl includes some overrides for C RTL functions, such as malloc().
785*0Sstevel@tonic-gate
786*0Sstevel@tonic-gateEXPORT_LIST: name of a file that is passed to linker to define symbols
787*0Sstevel@tonic-gateto be exported.
788*0Sstevel@tonic-gate
789*0Sstevel@tonic-gateSome OSes do not need these in which case leave it blank.
790*0Sstevel@tonic-gate
791*0Sstevel@tonic-gate
792*0Sstevel@tonic-gate=item init_platform
793*0Sstevel@tonic-gate
794*0Sstevel@tonic-gate    $mm->init_platform
795*0Sstevel@tonic-gate
796*0Sstevel@tonic-gateInitialize any macros which are for platform specific use only.
797*0Sstevel@tonic-gate
798*0Sstevel@tonic-gateA typical one is the version number of your OS specific mocule.
799*0Sstevel@tonic-gate(ie. MM_Unix_VERSION or MM_VMS_VERSION).
800*0Sstevel@tonic-gate
801*0Sstevel@tonic-gate=item platform_constants
802*0Sstevel@tonic-gate
803*0Sstevel@tonic-gate    my $make_frag = $mm->platform_constants
804*0Sstevel@tonic-gate
805*0Sstevel@tonic-gateReturns a make fragment defining all the macros initialized in
806*0Sstevel@tonic-gateinit_platform() rather than put them in constants().
807*0Sstevel@tonic-gate
808*0Sstevel@tonic-gate=cut
809*0Sstevel@tonic-gate
810*0Sstevel@tonic-gatesub init_platform {
811*0Sstevel@tonic-gate    return '';
812*0Sstevel@tonic-gate}
813*0Sstevel@tonic-gate
814*0Sstevel@tonic-gatesub platform_constants {
815*0Sstevel@tonic-gate    return '';
816*0Sstevel@tonic-gate}
817*0Sstevel@tonic-gate
818*0Sstevel@tonic-gate=item os_flavor
819*0Sstevel@tonic-gate
820*0Sstevel@tonic-gate    my @os_flavor = $mm->os_flavor;
821*0Sstevel@tonic-gate
822*0Sstevel@tonic-gate@os_flavor is the style of operating system this is, usually
823*0Sstevel@tonic-gatecorresponding to the MM_*.pm file we're using.
824*0Sstevel@tonic-gate
825*0Sstevel@tonic-gateThe first element of @os_flavor is the major family (ie. Unix,
826*0Sstevel@tonic-gateWindows, VMS, OS/2, MacOS, etc...) and the rest are sub families.
827*0Sstevel@tonic-gate
828*0Sstevel@tonic-gateSome examples:
829*0Sstevel@tonic-gate
830*0Sstevel@tonic-gate    Cygwin98       ('Unix',  'Cygwin', 'Cygwin9x')
831*0Sstevel@tonic-gate    Windows NT     ('Win32', 'WinNT')
832*0Sstevel@tonic-gate    Win98          ('Win32', 'Win9x')
833*0Sstevel@tonic-gate    Linux          ('Unix',  'Linux')
834*0Sstevel@tonic-gate    MacOS Classic  ('MacOS', 'MacOS Classic')
835*0Sstevel@tonic-gate    MacOS X        ('Unix',  'Darwin', 'MacOS', 'MacOS X')
836*0Sstevel@tonic-gate    OS/2           ('OS/2')
837*0Sstevel@tonic-gate
838*0Sstevel@tonic-gateThis is used to write code for styles of operating system.
839*0Sstevel@tonic-gateSee os_flavor_is() for use.
840*0Sstevel@tonic-gate
841*0Sstevel@tonic-gate
842*0Sstevel@tonic-gate=back
843*0Sstevel@tonic-gate
844*0Sstevel@tonic-gate=head1 AUTHOR
845*0Sstevel@tonic-gate
846*0Sstevel@tonic-gateMichael G Schwern <schwern@pobox.com> and the denizens of
847*0Sstevel@tonic-gatemakemaker@perl.org with code from ExtUtils::MM_Unix and
848*0Sstevel@tonic-gateExtUtils::MM_Win32.
849*0Sstevel@tonic-gate
850*0Sstevel@tonic-gate
851*0Sstevel@tonic-gate=cut
852*0Sstevel@tonic-gate
853*0Sstevel@tonic-gate1;
854