Commit | Line | Data |
68dc0745 |
1 | package ExtUtils::MM_Win32; |
2 | |
b75c8c73 |
3 | |
68dc0745 |
4 | =head1 NAME |
5 | |
6 | ExtUtils::MM_Win32 - methods to override UN*X behaviour in ExtUtils::MakeMaker |
7 | |
8 | =head1 SYNOPSIS |
9 | |
10 | use ExtUtils::MM_Win32; # Done internally by ExtUtils::MakeMaker if needed |
11 | |
12 | =head1 DESCRIPTION |
13 | |
14 | See ExtUtils::MM_Unix for a documentation of the methods provided |
15 | there. This package overrides the implementation of these methods, not |
16 | the semantics. |
17 | |
bbc7dcd2 |
18 | =over 4 |
68dc0745 |
19 | |
20 | =cut |
21 | |
3e3baf6d |
22 | use Config; |
68dc0745 |
23 | use File::Basename; |
ecf68df6 |
24 | use File::Spec; |
f6d6199c |
25 | use ExtUtils::MakeMaker qw( neatvalue ); |
68dc0745 |
26 | |
f6d6199c |
27 | use vars qw(@ISA $VERSION $BORLAND $GCC $DMAKE $NMAKE $PERLMAKE); |
28 | |
29 | require ExtUtils::MM_Any; |
30 | require ExtUtils::MM_Unix; |
31 | @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); |
69ff8adf |
32 | $VERSION = '1.05'; |
68dc0745 |
33 | |
34 | $ENV{EMXSHELL} = 'sh'; # to run `commands` |
68dc0745 |
35 | |
3e3baf6d |
36 | $BORLAND = 1 if $Config{'cc'} =~ /^bcc/i; |
5b0d9cbe |
37 | $GCC = 1 if $Config{'cc'} =~ /^gcc/i; |
3e3baf6d |
38 | $DMAKE = 1 if $Config{'make'} =~ /^dmake/i; |
39 | $NMAKE = 1 if $Config{'make'} =~ /^nmake/i; |
dc0d354b |
40 | $PERLMAKE = 1 if $Config{'make'} =~ /^pmake/i; |
3e3baf6d |
41 | |
68dc0745 |
42 | sub dlsyms { |
43 | my($self,%attribs) = @_; |
44 | |
45 | my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {}; |
46 | my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || []; |
762efda7 |
47 | my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || []; |
68dc0745 |
48 | my($imports) = $attribs{IMPORTS} || $self->{IMPORTS} || {}; |
49 | my(@m); |
50 | (my $boot = $self->{NAME}) =~ s/:/_/g; |
51 | |
52 | if (not $self->{SKIPHASH}{'dynamic'}) { |
53 | push(@m," |
54 | $self->{BASEEXT}.def: Makefile.PL |
55 | ", |
f6d6199c |
56 | q! $(PERLRUN) -MExtUtils::Mksymlists \\ |
5e687e55 |
57 | -e "Mksymlists('NAME'=>\"!, $self->{NAME}, |
58 | q!\", 'DLBASE' => '!,$self->{DLBASE}, |
59 | # The above two lines quoted differently to work around |
60 | # a bug in the 4DOS/4NT command line interpreter. The visible |
61 | # result of the bug was files named q('extension_name',) *with the |
62 | # single quotes and the comma* in the extension build directories. |
68dc0745 |
63 | q!', 'DL_FUNCS' => !,neatvalue($funcs), |
762efda7 |
64 | q!, 'FUNCLIST' => !,neatvalue($funclist), |
68dc0745 |
65 | q!, 'IMPORTS' => !,neatvalue($imports), |
66 | q!, 'DL_VARS' => !, neatvalue($vars), q!);" |
67 | !); |
68 | } |
69 | join('',@m); |
70 | } |
71 | |
72 | sub replace_manpage_separator { |
73 | my($self,$man) = @_; |
74 | $man =~ s,/+,.,g; |
75 | $man; |
76 | } |
77 | |
78 | sub maybe_command { |
79 | my($self,$file) = @_; |
846f184a |
80 | my @e = exists($ENV{'PATHEXT'}) |
81 | ? split(/;/, $ENV{PATHEXT}) |
82 | : qw(.com .exe .bat .cmd); |
83 | my $e = ''; |
84 | for (@e) { $e .= "\Q$_\E|" } |
85 | chop $e; |
86 | # see if file ends in one of the known extensions |
2b2708c8 |
87 | if ($file =~ /($e)$/i) { |
846f184a |
88 | return $file if -e $file; |
89 | } |
90 | else { |
91 | for (@e) { |
92 | return "$file$_" if -e "$file$_"; |
93 | } |
94 | } |
68dc0745 |
95 | return; |
96 | } |
97 | |
68dc0745 |
98 | |
99 | sub find_perl { |
100 | my($self, $ver, $names, $dirs, $trace) = @_; |
39234879 |
101 | $trace ||= 0; |
102 | |
68dc0745 |
103 | my($name, $dir); |
104 | if ($trace >= 2){ |
105 | print "Looking for perl $ver by these names: |
106 | @$names |
107 | in these dirs: |
108 | @$dirs |
109 | "; |
110 | } |
111 | foreach $dir (@$dirs){ |
112 | next unless defined $dir; # $self->{PERL_SRC} may be undefined |
113 | foreach $name (@$names){ |
114 | my ($abs, $val); |
f6d6199c |
115 | if (File::Spec->file_name_is_absolute($name)) { # /foo/bar |
68dc0745 |
116 | $abs = $name; |
f6d6199c |
117 | } elsif (File::Spec->canonpath($name) eq |
118 | File::Spec->canonpath(basename($name))) # foo |
119 | { |
ecf68df6 |
120 | $abs = File::Spec->catfile($dir, $name); |
f6d6199c |
121 | } else { # foo/bar |
122 | $abs = File::Spec->canonpath( |
123 | File::Spec->catfile(File::Spec->curdir, $name) |
124 | ); |
68dc0745 |
125 | } |
126 | print "Checking $abs\n" if ($trace >= 2); |
127 | next unless $self->maybe_command($abs); |
128 | print "Executing $abs\n" if ($trace >= 2); |
f6d6199c |
129 | (my($safe_abs) = $abs) =~ s{(\s)}{\\$1}g; |
130 | $val = `$safe_abs -e "require $ver;" 2>&1`; |
68dc0745 |
131 | if ($? == 0) { |
132 | print "Using PERL=$abs\n" if $trace; |
133 | return $abs; |
134 | } elsif ($trace >= 2) { |
135 | print "Result: `$val'\n"; |
136 | } |
137 | } |
138 | } |
139 | print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n"; |
140 | 0; # false and not empty |
141 | } |
142 | |
45bc4d3a |
143 | |
144 | # This code was taken out of MM_Unix to avoid loading File::Glob |
145 | # unless necessary. |
146 | sub find_tests { |
147 | return join(' ', <t\\*.t>); |
148 | } |
149 | |
150 | |
68dc0745 |
151 | sub init_others |
152 | { |
153 | my ($self) = @_; |
f6d6199c |
154 | $self->SUPER::init_others; |
155 | $self->{'TOUCH'} = '$(PERLRUN) -MExtUtils::Command -e touch'; |
156 | $self->{'CHMOD'} = '$(PERLRUN) -MExtUtils::Command -e chmod'; |
157 | $self->{'CP'} = '$(PERLRUN) -MExtUtils::Command -e cp'; |
158 | $self->{'RM_F'} = '$(PERLRUN) -MExtUtils::Command -e rm_f'; |
159 | $self->{'RM_RF'} = '$(PERLRUN) -MExtUtils::Command -e rm_rf'; |
160 | $self->{'MV'} = '$(PERLRUN) -MExtUtils::Command -e mv'; |
68dc0745 |
161 | $self->{'NOOP'} = 'rem'; |
f6d6199c |
162 | $self->{'TEST_F'} = '$(PERLRUN) -MExtUtils::Command -e test_f'; |
3e3baf6d |
163 | $self->{'LD'} = $Config{'ld'} || 'link'; |
164 | $self->{'AR'} = $Config{'ar'} || 'lib'; |
944acd49 |
165 | $self->{'LDLOADLIBS'} ||= $Config{'libs'}; |
e47a9bbc |
166 | # -Lfoo must come first for Borland, so we put it in LDDLFLAGS |
944acd49 |
167 | if ($BORLAND) { |
168 | my $libs = $self->{'LDLOADLIBS'}; |
169 | my $libpath = ''; |
e47a9bbc |
170 | while ($libs =~ s/(?:^|\s)(("?)-L.+?\2)(?:\s|$)/ /) { |
944acd49 |
171 | $libpath .= ' ' if length $libpath; |
172 | $libpath .= $1; |
173 | } |
174 | $self->{'LDLOADLIBS'} = $libs; |
175 | $self->{'LDDLFLAGS'} ||= $Config{'lddlflags'}; |
176 | $self->{'LDDLFLAGS'} .= " $libpath"; |
177 | } |
68dc0745 |
178 | $self->{'DEV_NULL'} = '> NUL'; |
68dc0745 |
179 | } |
180 | |
3e3baf6d |
181 | |
182 | =item constants (o) |
183 | |
184 | Initializes lots of constants and .SUFFIXES and .PHONY |
185 | |
186 | =cut |
187 | |
188 | sub constants { |
189 | my($self) = @_; |
190 | my(@m,$tmp); |
191 | |
192 | for $tmp (qw/ |
3e3baf6d |
193 | AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION |
5c161494 |
194 | VERSION_SYM XS_VERSION |
195 | INST_BIN INST_LIB INST_ARCHLIB INST_SCRIPT |
196 | INSTALLDIRS |
197 | PREFIX SITEPREFIX VENDORPREFIX |
198 | INSTALLPRIVLIB INSTALLSITELIB INSTALLVENDORLIB |
199 | INSTALLARCHLIB INSTALLSITEARCH INSTALLVENDORARCH |
200 | INSTALLBIN INSTALLSITEBIN INSTALLVENDORBIN INSTALLSCRIPT |
201 | PERL_LIB PERL_ARCHLIB |
202 | SITELIBEXP SITEARCHEXP |
203 | LIBPERL_A MYEXTLIB |
3e3baf6d |
204 | FIRST_MAKEFILE MAKE_APERL_FILE PERLMAINCC PERL_SRC |
75e2e551 |
205 | PERL_INC PERL FULLPERL PERLRUN FULLPERLRUN PERLRUNINST |
80a5d8e7 |
206 | FULLPERLRUNINST ABSPERL ABSPERLRUN ABSPERLRUNINST |
207 | FULL_AR PERL_CORE |
3e3baf6d |
208 | |
209 | / ) { |
210 | next unless defined $self->{$tmp}; |
211 | push @m, "$tmp = $self->{$tmp}\n"; |
212 | } |
213 | |
214 | push @m, qq{ |
215 | VERSION_MACRO = VERSION |
216 | DEFINE_VERSION = -D\$(VERSION_MACRO)=\\\"\$(VERSION)\\\" |
217 | XS_VERSION_MACRO = XS_VERSION |
218 | XS_DEFINE_VERSION = -D\$(XS_VERSION_MACRO)=\\\"\$(XS_VERSION)\\\" |
219 | }; |
220 | |
221 | push @m, qq{ |
39234879 |
222 | MAKEMAKER = $INC{'ExtUtils/MakeMaker.pm'} |
3e3baf6d |
223 | MM_VERSION = $ExtUtils::MakeMaker::VERSION |
224 | }; |
225 | |
226 | push @m, q{ |
227 | # FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle). |
228 | # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle) |
3e3baf6d |
229 | # PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar) |
230 | # DLBASE = Basename part of dynamic library. May be just equal BASEEXT. |
231 | }; |
232 | |
233 | for $tmp (qw/ |
234 | FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT |
235 | LDFROM LINKTYPE |
236 | / ) { |
237 | next unless defined $self->{$tmp}; |
238 | push @m, "$tmp = $self->{$tmp}\n"; |
239 | } |
240 | |
241 | push @m, " |
242 | # Handy lists of source code files: |
243 | XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})." |
244 | C_FILES = ".join(" \\\n\t", @{$self->{C}})." |
245 | O_FILES = ".join(" \\\n\t", @{$self->{O_FILES}})." |
246 | H_FILES = ".join(" \\\n\t", @{$self->{H}})." |
247 | MAN1PODS = ".join(" \\\n\t", sort keys %{$self->{MAN1PODS}})." |
248 | MAN3PODS = ".join(" \\\n\t", sort keys %{$self->{MAN3PODS}})." |
249 | "; |
250 | |
251 | for $tmp (qw/ |
5c161494 |
252 | INST_MAN1DIR MAN1EXT |
253 | INSTALLMAN1DIR INSTALLSITEMAN1DIR INSTALLVENDORMAN1DIR |
254 | INST_MAN3DIR MAN3EXT |
255 | INSTALLMAN3DIR INSTALLSITEMAN3DIR INSTALLVENDORMAN3DIR |
3e3baf6d |
256 | /) { |
257 | next unless defined $self->{$tmp}; |
258 | push @m, "$tmp = $self->{$tmp}\n"; |
259 | } |
260 | |
261 | push @m, qq{ |
262 | .USESHELL : |
263 | } if $DMAKE; |
264 | |
265 | push @m, q{ |
266 | .NO_CONFIG_REC: Makefile |
267 | } if $ENV{CLEARCASE_ROOT}; |
268 | |
269 | # why not q{} ? -- emacs |
270 | push @m, qq{ |
271 | # work around a famous dec-osf make(1) feature(?): |
272 | makemakerdflt: all |
273 | |
274 | .SUFFIXES: .xs .c .C .cpp .cxx .cc \$(OBJ_EXT) |
275 | |
39234879 |
276 | # Nick wanted to get rid of .PRECIOUS. I don't remember why. I seem to |
277 | # recall, that some make implementations will delete the Makefile when we |
278 | # rebuild it. Because we call false(1) when we rebuild it. So make(1) is |
279 | # not completely wrong when it does so. Our milage may vary. |
3e3baf6d |
280 | # .PRECIOUS: Makefile # seems to be not necessary anymore |
281 | |
282 | .PHONY: all config static dynamic test linkext manifest |
283 | |
284 | # Where is the Config information that we are using/depend on |
285 | CONFIGDEP = \$(PERL_ARCHLIB)\\Config.pm \$(PERL_INC)\\config.h |
286 | }; |
287 | |
288 | my @parentdir = split(/::/, $self->{PARENT_NAME}); |
289 | push @m, q{ |
290 | # Where to put things: |
ecf68df6 |
291 | INST_LIBDIR = }. File::Spec->catdir('$(INST_LIB)',@parentdir) .q{ |
292 | INST_ARCHLIBDIR = }. File::Spec->catdir('$(INST_ARCHLIB)',@parentdir) .q{ |
3e3baf6d |
293 | |
ecf68df6 |
294 | INST_AUTODIR = }. File::Spec->catdir('$(INST_LIB)','auto','$(FULLEXT)') .q{ |
295 | INST_ARCHAUTODIR = }. File::Spec->catdir('$(INST_ARCHLIB)','auto','$(FULLEXT)') .q{ |
3e3baf6d |
296 | }; |
297 | |
298 | if ($self->has_link_code()) { |
299 | push @m, ' |
300 | INST_STATIC = $(INST_ARCHAUTODIR)\$(BASEEXT)$(LIB_EXT) |
301 | INST_DYNAMIC = $(INST_ARCHAUTODIR)\$(DLBASE).$(DLEXT) |
302 | INST_BOOT = $(INST_ARCHAUTODIR)\$(BASEEXT).bs |
303 | '; |
304 | } else { |
305 | push @m, ' |
306 | INST_STATIC = |
307 | INST_DYNAMIC = |
308 | INST_BOOT = |
309 | '; |
310 | } |
311 | |
312 | $tmp = $self->export_list; |
313 | push @m, " |
314 | EXPORT_LIST = $tmp |
315 | "; |
316 | $tmp = $self->perl_archive; |
317 | push @m, " |
318 | PERL_ARCHIVE = $tmp |
319 | "; |
320 | |
3e3baf6d |
321 | push @m, q{ |
322 | TO_INST_PM = }.join(" \\\n\t", sort keys %{$self->{PM}}).q{ |
323 | |
324 | PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{ |
325 | }; |
326 | |
327 | join('',@m); |
328 | } |
329 | |
330 | |
68dc0745 |
331 | =item static_lib (o) |
332 | |
333 | Defines how to produce the *.a (or equivalent) files. |
334 | |
335 | =cut |
336 | |
337 | sub static_lib { |
338 | my($self) = @_; |
339 | # Come to think of it, if there are subdirs with linkcode, we still have no INST_STATIC |
340 | # return '' unless $self->needs_linking(); #might be because of a subdir |
341 | |
342 | return '' unless $self->has_link_code; |
343 | |
344 | my(@m); |
345 | push(@m, <<'END'); |
3e3baf6d |
346 | $(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)\.exists |
68dc0745 |
347 | $(RM_RF) $@ |
348 | END |
022735b4 |
349 | # If this extension has its own library (eg SDBM_File) |
68dc0745 |
350 | # then copy that to $(INST_STATIC) and add $(OBJECT) into it. |
351 | push(@m, "\t$self->{CP} \$(MYEXTLIB) \$\@\n") if $self->{MYEXTLIB}; |
352 | |
353 | push @m, |
910dfcc8 |
354 | q{ $(AR) }.($BORLAND ? '$@ $(OBJECT:^"+")' |
355 | : ($GCC ? '-ru $@ $(OBJECT)' |
356 | : '-out:$@ $(OBJECT)')).q{ |
3e3baf6d |
357 | }.$self->{NOECHO}.q{echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)\extralibs.ld |
68dc0745 |
358 | $(CHMOD) 755 $@ |
359 | }; |
360 | |
361 | # Old mechanism - still available: |
362 | |
3e3baf6d |
363 | push @m, "\t$self->{NOECHO}".q{echo "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs}."\n\n" |
68dc0745 |
364 | if $self->{PERL_SRC}; |
365 | |
366 | push @m, $self->dir_target('$(INST_ARCHAUTODIR)'); |
367 | join('', "\n",@m); |
368 | } |
369 | |
3e3baf6d |
370 | =item dynamic_bs (o) |
371 | |
372 | Defines targets for bootstrap files. |
373 | |
374 | =cut |
68dc0745 |
375 | |
3e3baf6d |
376 | sub dynamic_bs { |
377 | my($self, %attribs) = @_; |
378 | return ' |
379 | BOOTSTRAP = |
380 | ' unless $self->has_link_code(); |
381 | |
382 | return ' |
383 | BOOTSTRAP = '."$self->{BASEEXT}.bs".' |
384 | |
385 | # As Mkbootstrap might not write a file (if none is required) |
386 | # we use touch to prevent make continually trying to remake it. |
387 | # The DynaLoader only reads a non-empty file. |
388 | $(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".' $(INST_ARCHAUTODIR)\.exists |
389 | '.$self->{NOECHO}.'echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))" |
f6d6199c |
390 | '.$self->{NOECHO}.'$(PERLRUN) \ |
3e3baf6d |
391 | -MExtUtils::Mkbootstrap \ |
392 | -e "Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');" |
393 | '.$self->{NOECHO}.'$(TOUCH) $(BOOTSTRAP) |
394 | $(CHMOD) 644 $@ |
395 | |
396 | $(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists |
397 | '."$self->{NOECHO}$self->{RM_RF}".' $(INST_BOOT) |
398 | -'.$self->{CP}.' $(BOOTSTRAP) $(INST_BOOT) |
399 | $(CHMOD) 644 $@ |
400 | '; |
401 | } |
68dc0745 |
402 | |
403 | =item dynamic_lib (o) |
404 | |
405 | Defines how to produce the *.so (or equivalent) files. |
406 | |
407 | =cut |
408 | |
409 | sub dynamic_lib { |
410 | my($self, %attribs) = @_; |
411 | return '' unless $self->needs_linking(); #might be because of a subdir |
412 | |
413 | return '' unless $self->has_link_code; |
414 | |
3e3baf6d |
415 | my($otherldflags) = $attribs{OTHERLDFLAGS} || ($BORLAND ? 'c0d32.obj': ''); |
68dc0745 |
416 | my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || ""; |
417 | my($ldfrom) = '$(LDFROM)'; |
418 | my(@m); |
7a958ec3 |
419 | |
5db10396 |
420 | # one thing for GCC/Mingw32: |
421 | # we try to overcome non-relocateable-DLL problems by generating |
7a958ec3 |
422 | # a (hopefully unique) image-base from the dll's name |
423 | # -- BKS, 10-19-1999 |
424 | if ($GCC) { |
7a958ec3 |
425 | my $dllname = $self->{BASEEXT} . "." . $self->{DLEXT}; |
426 | $dllname =~ /(....)(.{0,4})/; |
427 | my $baseaddr = unpack("n", $1 ^ $2); |
428 | $otherldflags .= sprintf("-Wl,--image-base,0x%x0000 ", $baseaddr); |
429 | } |
430 | |
68dc0745 |
431 | push(@m,' |
432 | # This section creates the dynamically loadable $(INST_DYNAMIC) |
433 | # from $(OBJECT) and possibly $(MYEXTLIB). |
434 | OTHERLDFLAGS = '.$otherldflags.' |
435 | INST_DYNAMIC_DEP = '.$inst_dynamic_dep.' |
436 | |
3e3baf6d |
437 | $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP) |
68dc0745 |
438 | '); |
5b0d9cbe |
439 | if ($GCC) { |
440 | push(@m, |
910dfcc8 |
441 | q{ dlltool --def $(EXPORT_LIST) --output-exp dll.exp |
442 | $(LD) -o $@ -Wl,--base-file -Wl,dll.base $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp |
5b0d9cbe |
443 | dlltool --def $(EXPORT_LIST) --base-file dll.base --output-exp dll.exp |
444 | $(LD) -o $@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp }); |
dc0d354b |
445 | } elsif ($BORLAND) { |
446 | push(@m, |
447 | q{ $(LD) $(LDDLFLAGS) $(OTHERLDFLAGS) }.$ldfrom.q{,$@,,} |
448 | .($DMAKE ? q{$(PERL_ARCHIVE:s,/,\,) $(LDLOADLIBS:s,/,\,) } |
449 | .q{$(MYEXTLIB:s,/,\,),$(EXPORT_LIST:s,/,\,)} |
450 | : q{$(subst /,\,$(PERL_ARCHIVE)) $(subst /,\,$(LDLOADLIBS)) } |
451 | .q{$(subst /,\,$(MYEXTLIB)),$(subst /,\,$(EXPORT_LIST))}) |
452 | .q{,$(RESFILES)}); |
453 | } else { # VC |
454 | push(@m, |
455 | q{ $(LD) -out:$@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) } |
456 | .q{$(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) -def:$(EXPORT_LIST)}); |
5b0d9cbe |
457 | } |
68dc0745 |
458 | push @m, ' |
459 | $(CHMOD) 755 $@ |
460 | '; |
461 | |
462 | push @m, $self->dir_target('$(INST_ARCHAUTODIR)'); |
463 | join('',@m); |
464 | } |
465 | |
562c1c19 |
466 | sub clean |
467 | { |
f6d6199c |
468 | my ($self) = shift; |
469 | my $s = $self->SUPER::clean(@_); |
1f50c5a9 |
470 | my $clean = $GCC ? 'dll.base dll.exp' : '*.pdb'; |
471 | $s .= <<END; |
562c1c19 |
472 | clean :: |
1f50c5a9 |
473 | -\$(RM_F) $clean |
562c1c19 |
474 | |
475 | END |
1f50c5a9 |
476 | return $s; |
562c1c19 |
477 | } |
478 | |
479 | |
480 | |
68dc0745 |
481 | sub perl_archive |
482 | { |
e3b8966e |
483 | my ($self) = @_; |
eda5ff31 |
484 | return '$(PERL_INC)\\'.$Config{'libperl'}; |
68dc0745 |
485 | } |
486 | |
487 | sub export_list |
488 | { |
489 | my ($self) = @_; |
490 | return "$self->{BASEEXT}.def"; |
491 | } |
492 | |
45bc4d3a |
493 | |
68dc0745 |
494 | =item perl_script |
495 | |
496 | Takes one argument, a file name, and returns the file name, if the |
497 | argument is likely to be a perl script. On MM_Unix this is true for |
498 | any ordinary, readable file. |
499 | |
500 | =cut |
501 | |
502 | sub perl_script { |
503 | my($self,$file) = @_; |
cae6c631 |
504 | return $file if -r $file && -f _; |
68dc0745 |
505 | return "$file.pl" if -r "$file.pl" && -f _; |
cae6c631 |
506 | return "$file.bat" if -r "$file.bat" && -f _; |
68dc0745 |
507 | return; |
508 | } |
509 | |
510 | =item pm_to_blib |
511 | |
512 | Defines target that copies all files in the hash PM to their |
513 | destination and autosplits them. See L<ExtUtils::Install/DESCRIPTION> |
514 | |
515 | =cut |
516 | |
517 | sub pm_to_blib { |
518 | my $self = shift; |
ecf68df6 |
519 | my($autodir) = File::Spec->catdir('$(INST_LIB)','auto'); |
68dc0745 |
520 | return q{ |
521 | pm_to_blib: $(TO_INST_PM) |
f6d6199c |
522 | }.$self->{NOECHO}.q{$(PERLRUNINST) -MExtUtils::Install \ |
dc0d354b |
523 | -e "pm_to_blib(}. |
524 | ($NMAKE ? 'qw[ <<pmfiles.dat ],' |
525 | : $DMAKE ? 'qw[ $(mktmp,pmfiles.dat $(PM_TO_BLIB:s,\\,\\\\,)\n) ],' |
526 | : '{ qw[$(PM_TO_BLIB)] },' |
131aa089 |
527 | ).q{'}.$autodir.q{','$(PM_FILTER)')" |
80a5d8e7 |
528 | }. ($NMAKE ? q{ |
68dc0745 |
529 | $(PM_TO_BLIB) |
530 | << |
da9d6c70 |
531 | } : '') . "\t".$self->{NOECHO}.q{$(TOUCH) $@ |
68dc0745 |
532 | }; |
533 | } |
534 | |
3e3baf6d |
535 | |
68dc0745 |
536 | =item tool_autosplit (override) |
537 | |
538 | Use Win32 quoting on command line. |
539 | |
540 | =cut |
541 | |
542 | sub tool_autosplit{ |
543 | my($self, %attribs) = @_; |
544 | my($asl) = ""; |
545 | $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN}; |
546 | q{ |
547 | # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto |
f6d6199c |
548 | AUTOSPLITFILE = $(PERLRUN) -MAutoSplit }.$asl.q{ -e "autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1);" |
68dc0745 |
549 | }; |
550 | } |
551 | |
552 | =item tools_other (o) |
553 | |
554 | Win32 overrides. |
555 | |
556 | Defines SHELL, LD, TOUCH, CP, MV, RM_F, RM_RF, CHMOD, UMASK_NULL in |
557 | the Makefile. Also defines the perl programs MKPATH, |
558 | WARN_IF_OLD_PACKLIST, MOD_INSTALL. DOC_INSTALL, and UNINSTALL. |
559 | |
560 | =cut |
561 | |
562 | sub tools_other { |
563 | my($self) = shift; |
564 | my @m; |
565 | my $bin_sh = $Config{sh} || 'cmd /c'; |
566 | push @m, qq{ |
567 | SHELL = $bin_sh |
3e3baf6d |
568 | } unless $DMAKE; # dmake determines its own shell |
68dc0745 |
569 | |
570 | for (qw/ CHMOD CP LD MV NOOP RM_F RM_RF TEST_F TOUCH UMASK_NULL DEV_NULL/ ) { |
571 | push @m, "$_ = $self->{$_}\n"; |
572 | } |
573 | |
574 | push @m, q{ |
575 | # The following is a portable way to say mkdir -p |
576 | # To see which directories are created, change the if 0 to if 1 |
f6d6199c |
577 | MKPATH = $(PERLRUN) -MExtUtils::Command -e mkpath |
68dc0745 |
578 | |
579 | # This helps us to minimize the effect of the .exists files A yet |
580 | # better solution would be to have a stable file in the perl |
581 | # distribution with a timestamp of zero. But this solution doesn't |
582 | # need any changes to the core distribution and works with older perls |
f6d6199c |
583 | EQUALIZE_TIMESTAMP = $(PERLRUN) -MExtUtils::Command -e eqtime |
68dc0745 |
584 | }; |
585 | |
586 | |
587 | return join "", @m if $self->{PARENT}; |
588 | |
589 | push @m, q{ |
590 | # Here we warn users that an old packlist file was found somewhere, |
591 | # and that they should call some uninstall routine |
592 | WARN_IF_OLD_PACKLIST = $(PERL) -lwe "exit unless -f $$ARGV[0];" \\ |
593 | -e "print 'WARNING: I have found an old package in';" \\ |
594 | -e "print ' ', $$ARGV[0], '.';" \\ |
595 | -e "print 'Please make sure the two installations are not conflicting';" |
596 | |
597 | UNINST=0 |
598 | VERBINST=1 |
599 | |
600 | MOD_INSTALL = $(PERL) -I$(INST_LIB) -I$(PERL_LIB) -MExtUtils::Install \ |
3e3baf6d |
601 | -e "install({ @ARGV },'$(VERBINST)',0,'$(UNINST)');" |
68dc0745 |
602 | |
603 | DOC_INSTALL = $(PERL) -e "$$\=\"\n\n\";" \ |
83bb2f05 |
604 | -e "print '=head2 ', scalar(localtime), ': C<', shift, '>', ' L<', $$arg=shift, '|', $$arg, '>';" \ |
68dc0745 |
605 | -e "print '=over 4';" \ |
3e3baf6d |
606 | -e "while (defined($$key = shift) and defined($$val = shift)) { print '=item *';print 'C<', \"$$key: $$val\", '>'; }" \ |
68dc0745 |
607 | -e "print '=back';" |
608 | |
609 | UNINSTALL = $(PERL) -MExtUtils::Install \ |
610 | -e "uninstall($$ARGV[0],1,1); print \"\nUninstall is deprecated. Please check the";" \ |
611 | -e "print \" packlist above carefully.\n There may be errors. Remove the\";" \ |
612 | -e "print \" appropriate files manually.\n Sorry for the inconveniences.\n\"" |
613 | }; |
614 | |
615 | return join "", @m; |
616 | } |
617 | |
3e3baf6d |
618 | =item xs_o (o) |
619 | |
620 | Defines suffix rules to go from XS to object files directly. This is |
621 | only intended for broken make implementations. |
622 | |
623 | =cut |
624 | |
625 | sub xs_o { # many makes are too dumb to use xs_c then c_o |
626 | my($self) = shift; |
627 | return '' |
628 | } |
629 | |
630 | =item top_targets (o) |
631 | |
632 | Defines the targets all, subdirs, config, and O_FILES |
633 | |
634 | =cut |
635 | |
636 | sub top_targets { |
637 | # --- Target Sections --- |
638 | |
639 | my($self) = shift; |
640 | my(@m); |
3e3baf6d |
641 | |
642 | push @m, ' |
f6d6199c |
643 | all :: pure_all manifypods |
3e3baf6d |
644 | '.$self->{NOECHO}.'$(NOOP) |
645 | ' |
646 | unless $self->{SKIPHASH}{'all'}; |
647 | |
648 | push @m, ' |
649 | pure_all :: config pm_to_blib subdirs linkext |
650 | '.$self->{NOECHO}.'$(NOOP) |
651 | |
652 | subdirs :: $(MYEXTLIB) |
653 | '.$self->{NOECHO}.'$(NOOP) |
654 | |
655 | config :: '.$self->{MAKEFILE}.' $(INST_LIBDIR)\.exists |
656 | '.$self->{NOECHO}.'$(NOOP) |
657 | |
658 | config :: $(INST_ARCHAUTODIR)\.exists |
659 | '.$self->{NOECHO}.'$(NOOP) |
660 | |
661 | config :: $(INST_AUTODIR)\.exists |
662 | '.$self->{NOECHO}.'$(NOOP) |
663 | '; |
664 | |
3e3baf6d |
665 | push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]); |
666 | |
667 | if (%{$self->{MAN1PODS}}) { |
668 | push @m, qq[ |
669 | config :: \$(INST_MAN1DIR)\\.exists |
670 | $self->{NOECHO}\$(NOOP) |
671 | |
672 | ]; |
673 | push @m, $self->dir_target(qw[$(INST_MAN1DIR)]); |
674 | } |
675 | if (%{$self->{MAN3PODS}}) { |
676 | push @m, qq[ |
677 | config :: \$(INST_MAN3DIR)\\.exists |
678 | $self->{NOECHO}\$(NOOP) |
679 | |
680 | ]; |
681 | push @m, $self->dir_target(qw[$(INST_MAN3DIR)]); |
682 | } |
683 | |
684 | push @m, ' |
685 | $(O_FILES): $(H_FILES) |
686 | ' if @{$self->{O_FILES} || []} && @{$self->{H} || []}; |
687 | |
688 | push @m, q{ |
689 | help: |
690 | perldoc ExtUtils::MakeMaker |
691 | }; |
692 | |
3e3baf6d |
693 | join('',@m); |
694 | } |
695 | |
68dc0745 |
696 | =item manifypods (o) |
697 | |
cae6c631 |
698 | We don't want manpage process. |
68dc0745 |
699 | |
700 | =cut |
701 | |
702 | sub manifypods { |
846f184a |
703 | my($self) = shift; |
68dc0745 |
704 | return "\nmanifypods :\n\t$self->{NOECHO}\$(NOOP)\n"; |
705 | } |
706 | |
707 | =item dist_ci (o) |
708 | |
709 | Same as MM_Unix version (changes command-line quoting). |
710 | |
711 | =cut |
712 | |
713 | sub dist_ci { |
714 | my($self) = shift; |
715 | my @m; |
716 | push @m, q{ |
717 | ci : |
f6d6199c |
718 | $(PERLRUN) -MExtUtils::Manifest=maniread \\ |
68dc0745 |
719 | -e "@all = keys %{ maniread() };" \\ |
720 | -e "print(\"Executing $(CI) @all\n\"); system(\"$(CI) @all\");" \\ |
721 | -e "print(\"Executing $(RCS_LABEL) ...\n\"); system(\"$(RCS_LABEL) @all\");" |
722 | }; |
723 | join "", @m; |
724 | } |
725 | |
726 | =item dist_core (o) |
727 | |
728 | Same as MM_Unix version (changes command-line quoting). |
729 | |
730 | =cut |
731 | |
732 | sub dist_core { |
733 | my($self) = shift; |
734 | my @m; |
735 | push @m, q{ |
736 | dist : $(DIST_DEFAULT) |
737 | }.$self->{NOECHO}.q{$(PERL) -le "print \"Warning: Makefile possibly out of date with $$vf\" if " \ |
738 | -e "-e ($$vf=\"$(VERSION_FROM)\") and -M $$vf < -M \"}.$self->{MAKEFILE}.q{\";" |
739 | |
740 | tardist : $(DISTVNAME).tar$(SUFFIX) |
741 | |
742 | zipdist : $(DISTVNAME).zip |
743 | |
744 | $(DISTVNAME).tar$(SUFFIX) : distdir |
745 | $(PREOP) |
746 | $(TO_UNIX) |
747 | $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME) |
748 | $(RM_RF) $(DISTVNAME) |
749 | $(COMPRESS) $(DISTVNAME).tar |
750 | $(POSTOP) |
751 | |
752 | $(DISTVNAME).zip : distdir |
753 | $(PREOP) |
754 | $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME) |
755 | $(RM_RF) $(DISTVNAME) |
756 | $(POSTOP) |
757 | |
758 | uutardist : $(DISTVNAME).tar$(SUFFIX) |
759 | uuencode $(DISTVNAME).tar$(SUFFIX) \\ |
760 | $(DISTVNAME).tar$(SUFFIX) > \\ |
761 | $(DISTVNAME).tar$(SUFFIX)_uu |
762 | |
763 | shdist : distdir |
764 | $(PREOP) |
765 | $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar |
766 | $(RM_RF) $(DISTVNAME) |
767 | $(POSTOP) |
768 | }; |
769 | join "", @m; |
770 | } |
771 | |
772 | =item pasthru (o) |
773 | |
774 | Defines the string that is passed to recursive make calls in |
775 | subdirectories. |
776 | |
777 | =cut |
778 | |
779 | sub pasthru { |
780 | my($self) = shift; |
3e3baf6d |
781 | return "PASTHRU = " . ($NMAKE ? "-nologo" : ""); |
68dc0745 |
782 | } |
783 | |
784 | |
68dc0745 |
785 | 1; |
786 | __END__ |
787 | |
788 | =back |
789 | |
790 | =cut |
791 | |
5b0d9cbe |
792 | |