xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/lib/ExtUtils/MM_Win95.pm (revision 0:68f95e015346)
1*0Sstevel@tonic-gatepackage ExtUtils::MM_Win95;
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gateuse vars qw($VERSION @ISA);
4*0Sstevel@tonic-gate$VERSION = 0.03_01;
5*0Sstevel@tonic-gate
6*0Sstevel@tonic-gaterequire ExtUtils::MM_Win32;
7*0Sstevel@tonic-gate@ISA = qw(ExtUtils::MM_Win32);
8*0Sstevel@tonic-gate
9*0Sstevel@tonic-gateuse Config;
10*0Sstevel@tonic-gatemy $DMAKE = $Config{'make'} =~ /^dmake/i;
11*0Sstevel@tonic-gatemy $NMAKE = $Config{'make'} =~ /^nmake/i;
12*0Sstevel@tonic-gate
13*0Sstevel@tonic-gate
14*0Sstevel@tonic-gate=head1 NAME
15*0Sstevel@tonic-gate
16*0Sstevel@tonic-gateExtUtils::MM_Win95 - method to customize MakeMaker for Win9X
17*0Sstevel@tonic-gate
18*0Sstevel@tonic-gate=head1 SYNOPSIS
19*0Sstevel@tonic-gate
20*0Sstevel@tonic-gate  You should not be using this module directly.
21*0Sstevel@tonic-gate
22*0Sstevel@tonic-gate=head1 DESCRIPTION
23*0Sstevel@tonic-gate
24*0Sstevel@tonic-gateThis is a subclass of ExtUtils::MM_Win32 containing changes necessary
25*0Sstevel@tonic-gateto get MakeMaker playing nice with command.com and other Win9Xisms.
26*0Sstevel@tonic-gate
27*0Sstevel@tonic-gate=head2 Overriden methods
28*0Sstevel@tonic-gate
29*0Sstevel@tonic-gateMost of these make up for limitations in the Win9x command shell.
30*0Sstevel@tonic-gateNamely the lack of && and that a chdir is global, so you have to chdir
31*0Sstevel@tonic-gateback at the end.
32*0Sstevel@tonic-gate
33*0Sstevel@tonic-gate=over 4
34*0Sstevel@tonic-gate
35*0Sstevel@tonic-gate=item dist_test
36*0Sstevel@tonic-gate
37*0Sstevel@tonic-gate&& and chdir problem.
38*0Sstevel@tonic-gate
39*0Sstevel@tonic-gate=cut
40*0Sstevel@tonic-gate
41*0Sstevel@tonic-gatesub dist_test {
42*0Sstevel@tonic-gate    my($self) = shift;
43*0Sstevel@tonic-gate    return q{
44*0Sstevel@tonic-gatedisttest : distdir
45*0Sstevel@tonic-gate	cd $(DISTVNAME)
46*0Sstevel@tonic-gate	$(ABSPERLRUN) Makefile.PL
47*0Sstevel@tonic-gate	$(MAKE) $(PASTHRU)
48*0Sstevel@tonic-gate	$(MAKE) test $(PASTHRU)
49*0Sstevel@tonic-gate	cd ..
50*0Sstevel@tonic-gate};
51*0Sstevel@tonic-gate}
52*0Sstevel@tonic-gate
53*0Sstevel@tonic-gate=item subdir_x
54*0Sstevel@tonic-gate
55*0Sstevel@tonic-gate&& and chdir problem.
56*0Sstevel@tonic-gate
57*0Sstevel@tonic-gateAlso, dmake has an odd way of making a command series silent.
58*0Sstevel@tonic-gate
59*0Sstevel@tonic-gate=cut
60*0Sstevel@tonic-gate
61*0Sstevel@tonic-gatesub subdir_x {
62*0Sstevel@tonic-gate    my($self, $subdir) = @_;
63*0Sstevel@tonic-gate
64*0Sstevel@tonic-gate    # Win-9x has nasty problem in command.com that can't cope with
65*0Sstevel@tonic-gate    # &&.  Also, Dmake has an odd way of making a commandseries silent:
66*0Sstevel@tonic-gate    if ($DMAKE) {
67*0Sstevel@tonic-gate      return sprintf <<'EOT', $subdir;
68*0Sstevel@tonic-gate
69*0Sstevel@tonic-gatesubdirs ::
70*0Sstevel@tonic-gate@[
71*0Sstevel@tonic-gate	cd %s
72*0Sstevel@tonic-gate	$(MAKE) all $(PASTHRU)
73*0Sstevel@tonic-gate	cd ..
74*0Sstevel@tonic-gate]
75*0Sstevel@tonic-gateEOT
76*0Sstevel@tonic-gate    }
77*0Sstevel@tonic-gate    else {
78*0Sstevel@tonic-gate        return sprintf <<'EOT', $subdir;
79*0Sstevel@tonic-gate
80*0Sstevel@tonic-gatesubdirs ::
81*0Sstevel@tonic-gate	$(NOECHO)cd %s
82*0Sstevel@tonic-gate	$(NOECHO)$(MAKE) all $(PASTHRU)
83*0Sstevel@tonic-gate	$(NOECHO)cd ..
84*0Sstevel@tonic-gateEOT
85*0Sstevel@tonic-gate    }
86*0Sstevel@tonic-gate}
87*0Sstevel@tonic-gate
88*0Sstevel@tonic-gate=item xs_c
89*0Sstevel@tonic-gate
90*0Sstevel@tonic-gateThe && problem.
91*0Sstevel@tonic-gate
92*0Sstevel@tonic-gate=cut
93*0Sstevel@tonic-gate
94*0Sstevel@tonic-gatesub xs_c {
95*0Sstevel@tonic-gate    my($self) = shift;
96*0Sstevel@tonic-gate    return '' unless $self->needs_linking();
97*0Sstevel@tonic-gate    '
98*0Sstevel@tonic-gate.xs.c:
99*0Sstevel@tonic-gate	$(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c
100*0Sstevel@tonic-gate	'
101*0Sstevel@tonic-gate}
102*0Sstevel@tonic-gate
103*0Sstevel@tonic-gate
104*0Sstevel@tonic-gate=item xs_cpp
105*0Sstevel@tonic-gate
106*0Sstevel@tonic-gateThe && problem
107*0Sstevel@tonic-gate
108*0Sstevel@tonic-gate=cut
109*0Sstevel@tonic-gate
110*0Sstevel@tonic-gatesub xs_cpp {
111*0Sstevel@tonic-gate    my($self) = shift;
112*0Sstevel@tonic-gate    return '' unless $self->needs_linking();
113*0Sstevel@tonic-gate    '
114*0Sstevel@tonic-gate.xs.cpp:
115*0Sstevel@tonic-gate	$(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.cpp
116*0Sstevel@tonic-gate	';
117*0Sstevel@tonic-gate}
118*0Sstevel@tonic-gate
119*0Sstevel@tonic-gate=item xs_o
120*0Sstevel@tonic-gate
121*0Sstevel@tonic-gateThe && problem.
122*0Sstevel@tonic-gate
123*0Sstevel@tonic-gate=cut
124*0Sstevel@tonic-gate
125*0Sstevel@tonic-gatesub xs_o {
126*0Sstevel@tonic-gate    my($self) = shift;
127*0Sstevel@tonic-gate    return '' unless $self->needs_linking();
128*0Sstevel@tonic-gate    # Having to choose between .xs -> .c -> .o and .xs -> .o confuses dmake.
129*0Sstevel@tonic-gate    return '' if $DMAKE;
130*0Sstevel@tonic-gate    '
131*0Sstevel@tonic-gate.xs$(OBJ_EXT):
132*0Sstevel@tonic-gate	$(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c
133*0Sstevel@tonic-gate	$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
134*0Sstevel@tonic-gate	';
135*0Sstevel@tonic-gate}
136*0Sstevel@tonic-gate
137*0Sstevel@tonic-gate=item clean_subdirs_target
138*0Sstevel@tonic-gate
139*0Sstevel@tonic-gate&& and chdir problem.
140*0Sstevel@tonic-gate
141*0Sstevel@tonic-gate=cut
142*0Sstevel@tonic-gate
143*0Sstevel@tonic-gatesub clean_subdirs_target {
144*0Sstevel@tonic-gate    my($self) = shift;
145*0Sstevel@tonic-gate
146*0Sstevel@tonic-gate    # No subdirectories, no cleaning.
147*0Sstevel@tonic-gate    return <<'NOOP_FRAG' unless @{$self->{DIR}};
148*0Sstevel@tonic-gateclean_subdirs :
149*0Sstevel@tonic-gate	$(NOECHO)$(NOOP)
150*0Sstevel@tonic-gateNOOP_FRAG
151*0Sstevel@tonic-gate
152*0Sstevel@tonic-gate
153*0Sstevel@tonic-gate    my $clean = "clean_subdirs :\n";
154*0Sstevel@tonic-gate
155*0Sstevel@tonic-gate    for my $dir (@{$self->{DIR}}) {
156*0Sstevel@tonic-gate        $clean .= sprintf <<'MAKE_FRAG', $dir;
157*0Sstevel@tonic-gate	cd %s
158*0Sstevel@tonic-gate	$(TEST_F) $(FIRST_MAKEFILE)
159*0Sstevel@tonic-gate	$(MAKE) clean
160*0Sstevel@tonic-gate	cd ..
161*0Sstevel@tonic-gateMAKE_FRAG
162*0Sstevel@tonic-gate    }
163*0Sstevel@tonic-gate
164*0Sstevel@tonic-gate    return $clean;
165*0Sstevel@tonic-gate}
166*0Sstevel@tonic-gate
167*0Sstevel@tonic-gate
168*0Sstevel@tonic-gate=item realclean_subdirs_target
169*0Sstevel@tonic-gate
170*0Sstevel@tonic-gate&& and chdir problem.
171*0Sstevel@tonic-gate
172*0Sstevel@tonic-gate=cut
173*0Sstevel@tonic-gate
174*0Sstevel@tonic-gatesub realclean_subdirs_target {
175*0Sstevel@tonic-gate    my $self = shift;
176*0Sstevel@tonic-gate
177*0Sstevel@tonic-gate    return <<'NOOP_FRAG' unless @{$self->{DIR}};
178*0Sstevel@tonic-gaterealclean_subdirs :
179*0Sstevel@tonic-gate	$(NOECHO)$(NOOP)
180*0Sstevel@tonic-gateNOOP_FRAG
181*0Sstevel@tonic-gate
182*0Sstevel@tonic-gate    my $rclean = "realclean_subdirs :\n";
183*0Sstevel@tonic-gate
184*0Sstevel@tonic-gate    foreach my $dir (@{$self->{DIR}}){
185*0Sstevel@tonic-gate        $rclean .= sprintf <<'RCLEAN', $dir;
186*0Sstevel@tonic-gate	-cd %s
187*0Sstevel@tonic-gate	-$(PERLRUN) -e "exit unless -f shift; system q{$(MAKE) realclean}" $(FIRST_MAKEFILE)
188*0Sstevel@tonic-gate	-cd ..
189*0Sstevel@tonic-gateRCLEAN
190*0Sstevel@tonic-gate
191*0Sstevel@tonic-gate    }
192*0Sstevel@tonic-gate
193*0Sstevel@tonic-gate    return $rclean;
194*0Sstevel@tonic-gate}
195*0Sstevel@tonic-gate
196*0Sstevel@tonic-gate
197*0Sstevel@tonic-gate=item os_flavor
198*0Sstevel@tonic-gate
199*0Sstevel@tonic-gateWin95 and Win98 and WinME are collectively Win9x and Win32
200*0Sstevel@tonic-gate
201*0Sstevel@tonic-gate=cut
202*0Sstevel@tonic-gate
203*0Sstevel@tonic-gatesub os_flavor {
204*0Sstevel@tonic-gate    my $self = shift;
205*0Sstevel@tonic-gate    return ($self->SUPER::os_flavor, 'Win9x');
206*0Sstevel@tonic-gate}
207*0Sstevel@tonic-gate
208*0Sstevel@tonic-gate
209*0Sstevel@tonic-gate=back
210*0Sstevel@tonic-gate
211*0Sstevel@tonic-gate
212*0Sstevel@tonic-gate=head1 AUTHOR
213*0Sstevel@tonic-gate
214*0Sstevel@tonic-gateCode originally inside MM_Win32.  Original author unknown.
215*0Sstevel@tonic-gate
216*0Sstevel@tonic-gateCurrently maintained by Michael G Schwern <schwern@pobox.com>.
217*0Sstevel@tonic-gate
218*0Sstevel@tonic-gateSend patches and ideas to <F<makemaker@perl.org>>.
219*0Sstevel@tonic-gate
220*0Sstevel@tonic-gateSee http://www.makemaker.org.
221*0Sstevel@tonic-gate
222*0Sstevel@tonic-gate=cut
223*0Sstevel@tonic-gate
224*0Sstevel@tonic-gate
225*0Sstevel@tonic-gate1;
226