This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Insure that installed C header files are world-readable
[perl5.git] / lib / ExtUtils / MakeMaker.pm
CommitLineData
3b03c0f3
PP
1require 5.002; # MakeMaker 5.17 was the last MakeMaker that was compatible with perl5.001m
2
e05e23b1
PP
3package main;
4use vars qw(%att);
5
8e07c86e
AD
6package ExtUtils::MakeMaker::TieAtt;
7# this package will go away again, when we don't have modules around
8# anymore that import %att It ties an empty %att and records in which
9# object this %att was tied. FETCH and STORE return/store-to the
10# appropriate value from %$self
005c1a0e 11
8e07c86e
AD
12# the warndirectuse method warns if somebody calls MM->something. It
13# has nothing to do with the tie'd %att.
005c1a0e 14
8e07c86e 15$Enough_limit = 5;
a0d0e21e 16
e05e23b1
PP
17package ExtUtils::MakeMaker;
18
3b03c0f3 19$Version = $VERSION = "5.26";
e05e23b1 20$Version_OK = "5.05"; # Makefiles older than $Version_OK will die
8e07c86e 21 # (Will be checked from MakeMaker version 4.13 onwards)
3b03c0f3 22($Revision = substr(q$Revision: 1.187 $, 10)) =~ s/\s+$//;
e05e23b1
PP
23
24
005c1a0e 25
8e07c86e 26require Exporter;
3b03c0f3
PP
27use Config;
28use Carp ();
29#use FileHandle ();
e05e23b1
PP
30
31use vars qw(
32 $VERSION $Version_OK $Revision
3b03c0f3 33 $Verbose %MM_Sections $ISA_TTY
e05e23b1
PP
34 @MM_Sections %Recognized_Att_Keys @Get_from_Config
35 %Prepend_dot_dot %Config @Parent %NORMAL_INC
3b03c0f3
PP
36 $Setup_done %Keep_after_flush
37 @Overridable
e05e23b1 38 );
8e07c86e 39#use strict qw(refs);
005c1a0e 40
8e07c86e
AD
41eval {require DynaLoader;}; # Get mod2fname, if defined. Will fail
42 # with miniperl.
005c1a0e 43
e05e23b1
PP
44#
45# Set up the inheritance before we pull in the MM_* packages, because they
46# import variables and functions from here
47#
48@ISA = qw(Exporter);
49@EXPORT = qw(&WriteMakefile &writeMakefile $Verbose &prompt);
3b03c0f3 50@EXPORT_OK = qw($VERSION &Version_check &neatvalue &mkbootstrap &mksymlists
e05e23b1
PP
51 $Version %att); ## Import of %att is deprecated, please use OO features!
52 # $Version in mixed case will go away!
005c1a0e 53
e05e23b1
PP
54#
55# Dummy package MM inherits actual methods from OS-specific
56# default packages. We use this intermediate package so
57# MY::XYZ->func() can call MM->func() and get the proper
58# default routine without having to know under what OS
59# it's running.
60#
61@MM::ISA = qw[ExtUtils::MM_Unix ExtUtils::Liblist ExtUtils::MakeMaker];
42793c05 62
e05e23b1
PP
63#
64# Setup dummy package:
65# MY exists for overriding methods to be defined within
66#
67{
68 package MY;
69 @ISA = qw(MM);
e05e23b1 70 package MM;
e05e23b1
PP
71 sub DESTROY {}
72}
42793c05 73
3b03c0f3
PP
74# "predeclare the package: we only load it via AUTOLOAD
75# but we have already mentioned it in @ISA
76package ExtUtils::Liblist;
77
78package ExtUtils::MakeMaker;
e05e23b1 79#
a5f75d66 80# Now we can can pull in the friends
e05e23b1 81#
3b03c0f3
PP
82$Is_VMS = $^O eq 'VMS';
83$Is_OS2 = $^O eq 'os2';
a5f75d66 84
e05e23b1 85require ExtUtils::MM_Unix;
3b03c0f3 86
a5f75d66 87if ($Is_VMS) {
0d8023a2 88 require ExtUtils::MM_VMS;
0d8023a2 89}
a5f75d66 90if ($Is_OS2) {
e05e23b1
PP
91 require ExtUtils::MM_OS2;
92}
75f92628 93
e05e23b1 94%NORMAL_INC = %INC;
3b03c0f3
PP
95@NORMAL_INC{qw|File/Find.pm Cwd.pm ExtUtils/Manifest.pm ExtUtils/Liblist.pm|} = (1) x 4;
96
97
98# This has to go one day...
99$SIG{__WARN__} = sub {
100 $_[0] =~ /^Use of uninitialized value/ && return;
101 $_[0] =~ /used only once/ && return;
102 $_[0] =~ /^Subroutine\s+[\w:]+\s+redefined/ && return;
103 warn @_;
104};
105
106# The SelfLoader would bring a lot of overhead for MakeMaker, because
107# we know for sure we will use most of the autoloaded functions once
108# we have to use one of them. So we write our own loader
109
110sub AUTOLOAD {
111 my $code;
112 if (defined fileno(DATA)) {
113 while (<DATA>) {
114 last if /^__END__/;
115 $code .= $_;
116 }
117 close DATA;
118 eval $code;
119 if ($@) {
120 $@ =~ s/ at .*\n//;
121 Carp::croak $@;
122 }
123 } else {
124 warn "AUTOLOAD called unexpectedly for $AUTOLOAD";
125 }
126 defined(&$AUTOLOAD) or die "Myloader inconsistency error";
127 goto &$AUTOLOAD;
128}
864a5fa8 129
e05e23b1
PP
130# The only subroutine we do not SelfLoad is Version_Check because it's
131# called so often. Loading this minimum still requires 1.2 secs on my
132# Indy :-(
e05e23b1
PP
133
134sub Version_check {
135 my($checkversion) = @_;
136 die "Your Makefile was built with ExtUtils::MakeMaker v $checkversion.
137Current Version is $ExtUtils::MakeMaker::VERSION. There have been considerable
138changes in the meantime.
139Please rerun 'perl Makefile.PL' to regenerate the Makefile.\n"
140 if $checkversion < $Version_OK;
141 printf STDOUT "%s %s %s %s.\n", "Makefile built with ExtUtils::MakeMaker v",
142 $checkversion, "Current Version is", $VERSION
143 unless $checkversion == $VERSION;
8e07c86e 144}
e05e23b1 145
3b03c0f3
PP
146sub ExtUtils::MakeMaker::eval_in_subdirs ;
147sub ExtUtils::MakeMaker::eval_in_x ;
148sub ExtUtils::MakeMaker::full_setup ;
149sub ExtUtils::MakeMaker::writeMakefile ;
150sub ExtUtils::MakeMaker::new ;
151sub ExtUtils::MakeMaker::check_manifest ;
152sub ExtUtils::MakeMaker::parse_args ;
153sub ExtUtils::MakeMaker::check_hints ;
154sub ExtUtils::MakeMaker::mv_all_methods ;
155sub ExtUtils::MakeMaker::skipcheck ;
156sub ExtUtils::MakeMaker::flush ;
157sub ExtUtils::MakeMaker::mkbootstrap ;
158sub ExtUtils::MakeMaker::mksymlists ;
159sub ExtUtils::MakeMaker::neatvalue ;
160sub ExtUtils::MakeMaker::selfdocument ;
161sub ExtUtils::MakeMaker::WriteMakefile ;
162sub ExtUtils::MakeMaker::prompt ;
163sub ExtUtils::MakeMaker::TieAtt::TIEHASH ;
164sub ExtUtils::MakeMaker::TieAtt::FETCH ;
165sub ExtUtils::MakeMaker::TieAtt::STORE ;
166sub ExtUtils::MakeMaker::TieAtt::FIRSTKEY ;
167sub ExtUtils::MakeMaker::TieAtt::NEXTKEY ;
168sub ExtUtils::MakeMaker::TieAtt::DESTROY ;
169sub ExtUtils::MakeMaker::TieAtt::warndirectuse ;
170
171__DATA__
172package ExtUtils::MakeMaker;
173
174sub WriteMakefile {
175 Carp::croak "WriteMakefile: Need even number of args" if @_ % 2;
176 unless ($Setup_done++){
177 full_setup();
178 undef &ExtUtils::MakeMaker::full_setup; #safe memory
179 }
180 my %att = @_;
181 MM->new(\%att)->flush;
182}
183
184sub prompt {
185 my($mess,$def)=@_;
186 $ISA_TTY = -t STDIN && -t STDOUT ;
187 Carp::confess("prompt function called without an argument") unless defined $mess;
188 $def = "" unless defined $def;
189 my $dispdef = "[$def] ";
190 my $ans;
191 if ($ISA_TTY) {
192 local $|=1;
193 print "$mess $dispdef";
194 chop($ans = <STDIN>);
195 }
196 return $ans if defined $ans;
197 return $def;
198}
199
e05e23b1
PP
200sub eval_in_subdirs {
201 my($self) = @_;
202 my($dir);
3b03c0f3 203 use Cwd 'cwd';
e05e23b1
PP
204 my $pwd = cwd();
205
e05e23b1 206 foreach $dir (@{$self->{DIR}}){
e05e23b1
PP
207 my($abs) = $self->catdir($pwd,$dir);
208 $self->eval_in_x($abs);
209 }
e05e23b1 210 chdir $pwd;
864a5fa8 211}
42793c05 212
e05e23b1
PP
213sub eval_in_x {
214 my($self,$dir) = @_;
215 package main;
3b03c0f3
PP
216 chdir $dir or Carp::carp("Couldn't change to directory $dir: $!");
217# use FileHandle ();
218# my $fh = new FileHandle;
219# $fh->open("Makefile.PL") or Carp::carp("Couldn't open Makefile.PL in $dir");
220 local *FH;
221 open(FH,"Makefile.PL") or Carp::carp("Couldn't open Makefile.PL in $dir");
222# my $eval = join "", <$fh>;
223 my $eval = join "", <FH>;
224# $fh->close;
225 close FH;
e05e23b1
PP
226 eval $eval;
227 warn "WARNING from evaluation of $dir/Makefile.PL: $@" if $@;
228}
229
e05e23b1
PP
230sub full_setup {
231 $Verbose ||= 0;
232 $^W=1;
3b03c0f3
PP
233
234# package name for the classes into which the first object will be blessed
235 $PACKNAME = "PACK000";
236
237 @Attrib_help = qw/
238
239 C CONFIG CONFIGURE DEFINE DIR DISTNAME DL_FUNCS DL_VARS EXE_FILES
240 NO_VC FIRST_MAKEFILE FULLPERL H INC INSTALLARCHLIB INSTALLBIN
241 INSTALLDIRS INSTALLMAN1DIR INSTALLMAN3DIR INSTALLPRIVLIB
242 INSTALLSITEARCH INSTALLSITELIB INST_ARCHLIB INST_EXE INST_LIB
243 INST_MAN1DIR INST_MAN3DIR LDFROM LIBPERL_A LIBS LINKTYPE MAKEAPERL
244 MAKEFILE MAN1PODS MAN3PODS MAP_TARGET MYEXTLIB NAME NEEDS_LINKING
245 NOECHO NORECURS OBJECT OPTIMIZE PERL PERLMAINCC PERL_ARCHLIB
246 PERL_LIB PERL_SRC PL_FILES PM PMLIBDIRS PREFIX PREREQ SKIP
247 TYPEMAPS VERSION VERSION_FROM XS XSOPT XSPROTOARG XS_VERSION clean
248 depend dist dynamic_lib linkext macro realclean tool_autosplit
249
250 installpm
251
252 /;
253
254
255 # @Overridable is close to MM_Sections
e05e23b1
PP
256
257 @MM_Sections =
258 qw(
3b03c0f3
PP
259
260 post_initialize const_config constants tool_autosplit
261 tool_xsubpp tools_other dist macro depend post_constants
262 pasthru c_o xs_c xs_o top_targets linkext dlsyms dynamic
263 dynamic_bs dynamic_lib static static_lib manifypods processPL
264 installbin subdirs clean realclean dist_basics dist_core
265 dist_dir dist_test dist_ci install force perldepend makefile
266 staticmake test postamble
267
e05e23b1
PP
268 ); # loses section ordering
269
3b03c0f3
PP
270 @Overridable = @MM_Sections;
271 push @Overridable, qw[ dir_target
272 libscan makeaperl
273 needs_linking subdir_x test_via_harness
274 test_via_script ];
275 push @MM_Sections, qw[
276 pm_to_blib selfdocument cflags const_loadlibs
277 const_cccmd
278 ];
279
280
281 #### Can we drop this?
282 #### @MM_Sections{@MM_Sections} = {} x @MM_Sections;
e05e23b1
PP
283
284 # All sections are valid keys.
3b03c0f3 285 @Recognized_Att_Keys{@MM_Sections} = (1) x @MM_Sections;
e05e23b1
PP
286
287 # we will use all these variables in the Makefile
288 @Get_from_Config =
289 qw(
290 ar cc cccdlflags ccdlflags dlext dlsrc ld lddlflags ldflags libc
291 lib_ext obj_ext ranlib sitelibexp sitearchexp so
292 );
293
294 my $item;
3b03c0f3
PP
295 foreach $item (@Attrib_help){
296 $Recognized_Att_Keys{$item} = 1;
e05e23b1
PP
297 }
298 foreach $item (@Get_from_Config) {
299 $Recognized_Att_Keys{uc $item} = $Config{$item};
300 print "Attribute '\U$item\E' => '$Config{$item}'\n"
301 if ($Verbose >= 2);
302 }
303
304 #
3b03c0f3
PP
305 # When we eval a Makefile.PL in a subdirectory, that one will ask
306 # us (the parent) for the values and will prepend "..", so that
307 # all files to be installed end up below OUR ./blib
e05e23b1
PP
308 #
309 %Prepend_dot_dot =
310 qw(
311 INST_LIB 1 INST_ARCHLIB 1 INST_EXE 1 MAP_TARGET 1 INST_MAN1DIR 1 INST_MAN3DIR 1
312 PERL_SRC 1 PERL 1 FULLPERL 1
313 );
314
3b03c0f3
PP
315 my @keep = qw/
316 NEEDS_LINKING HAS_LINK_CODE
317 /;
318 @Keep_after_flush{@keep} = (1) x @keep;
e05e23b1 319}
42793c05 320
8e07c86e
AD
321sub writeMakefile {
322 die <<END;
232e078e 323
8e07c86e
AD
324The extension you are trying to build apparently is rather old and
325most probably outdated. We detect that from the fact, that a
326subroutine "writeMakefile" is called, and this subroutine is not
327supported anymore since about October 1994.
40000a8c 328
4633a7c4
LW
329Please contact the author or look into CPAN (details about CPAN can be
330found in the FAQ and at http:/www.perl.com) for a more recent version
331of the extension. If you're really desperate, you can try to change
332the subroutine name from writeMakefile to WriteMakefile and rerun
333'perl Makefile.PL', but you're most probably left alone, when you do
334so.
42793c05 335
8e07c86e 336The MakeMaker team
1aef975c 337
42793c05 338END
8e07c86e 339}
42793c05 340
3b03c0f3 341sub ExtUtils::MakeMaker::new {
8e07c86e
AD
342 my($class,$self) = @_;
343 my($key);
42793c05 344
e05e23b1 345 print STDOUT "MakeMaker (v$VERSION)\n" if $Verbose;
8e07c86e
AD
346 if (-f "MANIFEST" && ! -f "Makefile"){
347 check_manifest();
1aef975c 348 }
42793c05 349
8e07c86e 350 $self = {} unless (defined $self);
005c1a0e 351
864a5fa8 352 check_hints($self);
4633a7c4 353
8e07c86e 354 my(%initial_att) = %$self; # record initial attributes
005c1a0e 355
8e07c86e
AD
356 if (defined $self->{CONFIGURE}) {
357 if (ref $self->{CONFIGURE} eq 'CODE') {
358 $self = { %$self, %{&{$self->{CONFIGURE}}}};
005c1a0e 359 } else {
3b03c0f3 360 Carp::croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n";
005c1a0e
AD
361 }
362 }
a0d0e21e 363
8e07c86e
AD
364 # This is for old Makefiles written pre 5.00, will go away
365 if ( Carp::longmess("") =~ /runsubdirpl/s ){
e05e23b1 366 #$self->{Correct_relativ_directories}++;
3b03c0f3 367 Carp::carp("WARNING: Please rerun 'perl Makefile.PL' to regenerate your Makefiles\n");
8e07c86e
AD
368 } else {
369 $self->{Correct_relativ_directories}=0;
370 }
5d94fbed 371
8e07c86e
AD
372 my $class = ++$PACKNAME;
373 {
374# no strict;
e05e23b1 375 print "Blessing Object into class [$class]\n" if $Verbose>=2;
8e07c86e
AD
376 mv_all_methods("MY",$class);
377 bless $self, $class;
e05e23b1 378 push @Parent, $self;
8e07c86e
AD
379 @{"$class\:\:ISA"} = 'MM';
380 }
5d94fbed 381
e05e23b1
PP
382 if (defined $Parent[-2]){
383 $self->{PARENT} = $Parent[-2];
8e07c86e 384 my $key;
e05e23b1 385 for $key (keys %Prepend_dot_dot) {
4633a7c4 386 next unless defined $self->{PARENT}{$key};
8e07c86e
AD
387 $self->{$key} = $self->{PARENT}{$key};
388 $self->{$key} = $self->catdir("..",$self->{$key})
3b03c0f3 389 unless $self->file_name_is_absolute($self->{$key});
8e07c86e
AD
390 }
391 $self->{PARENT}->{CHILDREN}->{$class} = $self if $self->{PARENT};
392 } else {
393 parse_args($self,@ARGV);
394 }
a0d0e21e 395
8e07c86e 396 $self->{NAME} ||= $self->guess_name;
a0d0e21e 397
8e07c86e 398 ($self->{NAME_SYM} = $self->{NAME}) =~ s/\W+/_/g;
a0d0e21e 399
8e07c86e
AD
400 $self->init_main();
401
0d8023a2
PP
402 if (! $self->{PERL_SRC} ) {
403 my($pthinks) = $INC{'Config.pm'};
3b03c0f3 404 $pthinks = VMS::Filespec::vmsify($pthinks) if $Is_VMS;
e05e23b1 405 if ($pthinks ne $self->catfile($Config{archlibexp},'Config.pm')){
0d8023a2
PP
406 $pthinks =~ s!/Config\.pm$!!;
407 $pthinks =~ s!.*/!!;
408 print STDOUT <<END;
005c1a0e
AD
409Your perl and your Config.pm seem to have different ideas about the architecture
410they are running on.
8e07c86e 411Perl thinks: [$pthinks]
e05e23b1 412Config says: [$Config{archname}]
005c1a0e
AD
413This may or may not cause problems. Please check your installation of perl if you
414have problems building this extension.
415END
0d8023a2 416 }
005c1a0e
AD
417 }
418
8e07c86e
AD
419 $self->init_dirscan();
420 $self->init_others();
75f92628 421
8e07c86e
AD
422 push @{$self->{RESULT}}, <<END;
423# This Makefile is for the $self->{NAME} extension to perl.
424#
e05e23b1
PP
425# It was generated automatically by MakeMaker version
426# $VERSION (Revision: $Revision) from the contents of
427# Makefile.PL. Don't edit this file, edit Makefile.PL instead.
8e07c86e
AD
428#
429# ANY CHANGES MADE HERE WILL BE LOST!
430#
431# MakeMaker Parameters:
432END
a0d0e21e 433
42793c05
TB
434 foreach $key (sort keys %initial_att){
435 my($v) = neatvalue($initial_att{$key});
8e07c86e 436 $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
42793c05 437 $v =~ tr/\n/ /s;
8e07c86e 438 push @{$self->{RESULT}}, "# $key => $v";
42793c05 439 }
a0d0e21e 440
8e07c86e
AD
441 # turn the SKIP array into a SKIPHASH hash
442 my (%skip,$skip);
443 for $skip (@{$self->{SKIP} || []}) {
444 $self->{SKIPHASH}{$skip} = 1;
445 }
3b03c0f3
PP
446 delete $self->{SKIP}; # free memory
447
448 if ($self->{PARENT}) {
449 for (qw/install dist dist_basics dist_core dist_dir dist_test dist_ci/) {
450 $self->{SKIPHASH}{$_} = 1;
451 }
452 }
42793c05 453
8e07c86e
AD
454 # We run all the subdirectories now. They don't have much to query
455 # from the parent, but the parent has to query them: if they need linking!
8e07c86e 456 unless ($self->{NORECURS}) {
e05e23b1 457 $self->eval_in_subdirs if @{$self->{DIR}};
42793c05 458 }
a0d0e21e 459
8e07c86e
AD
460 tie %::att, ExtUtils::MakeMaker::TieAtt, $self;
461 my $section;
e05e23b1
PP
462 foreach $section ( @MM_Sections ){
463 print "Processing Makefile '$section' section\n" if ($Verbose >= 2);
8e07c86e
AD
464 my($skipit) = $self->skipcheck($section);
465 if ($skipit){
466 push @{$self->{RESULT}}, "\n# --- MakeMaker $section section $skipit.";
4e68a208 467 } else {
8e07c86e
AD
468 my(%a) = %{$self->{$section} || {}};
469 push @{$self->{RESULT}}, "\n# --- MakeMaker $section section:";
e05e23b1 470 push @{$self->{RESULT}}, "# " . join ", ", %a if $Verbose && %a;
8e07c86e 471 push @{$self->{RESULT}}, $self->nicetext($self->$section( %a ));
e05e23b1 472 }
232e078e 473 }
8e07c86e 474
e05e23b1
PP
475 push @{$self->{RESULT}}, "\n# End.";
476 pop @Parent;
8e07c86e 477
e05e23b1 478 $self;
232e078e
AD
479}
480
e05e23b1
PP
481sub check_manifest {
482 print STDOUT "Checking if your kit is complete...\n";
3b03c0f3 483 require ExtUtils::Manifest;
e05e23b1
PP
484 $ExtUtils::Manifest::Quiet=$ExtUtils::Manifest::Quiet=1; #avoid warning
485 my(@missed)=ExtUtils::Manifest::manicheck();
486 if (@missed){
487 print STDOUT "Warning: the following files are missing in your kit:\n";
488 print "\t", join "\n\t", @missed;
489 print STDOUT "\n";
490 print STDOUT "Please inform the author.\n";
8e07c86e 491 } else {
e05e23b1 492 print STDOUT "Looks good\n";
8e07c86e 493 }
8e07c86e
AD
494}
495
e05e23b1
PP
496sub parse_args{
497 my($self, @args) = @_;
498 foreach (@args){
499 unless (m/(.*?)=(.*)/){
500 help(),exit 1 if m/^help$/;
501 ++$Verbose if m/^verb/;
502 next;
503 }
504 my($name, $value) = ($1, $2);
505 if ($value =~ m/^~(\w+)?/){ # tilde with optional username
506 $value =~ s [^~(\w*)]
507 [$1 ?
508 ((getpwnam($1))[7] || "~$1") :
509 (getpwuid($>))[7]
510 ]ex;
511 }
512 # This may go away, in mid 1996
513 if ($self->{Correct_relativ_directories}){
514 $value = $self->catdir("..",$value)
3b03c0f3 515 if $Prepend_dot_dot{$name} && ! $self->file_name_is_absolute($value);
e05e23b1 516 }
a5f75d66 517 $self->{uc($name)} = $value;
8e07c86e 518 }
e05e23b1
PP
519 # This may go away, in mid 1996
520 delete $self->{Correct_relativ_directories};
8e07c86e 521
e05e23b1
PP
522 # catch old-style 'potential_libs' and inform user how to 'upgrade'
523 if (defined $self->{potential_libs}){
524 my($msg)="'potential_libs' => '$self->{potential_libs}' should be";
525 if ($self->{potential_libs}){
526 print STDOUT "$msg changed to:\n\t'LIBS' => ['$self->{potential_libs}']\n";
527 } else {
528 print STDOUT "$msg deleted.\n";
529 }
530 $self->{LIBS} = [$self->{potential_libs}];
531 delete $self->{potential_libs};
8e07c86e 532 }
e05e23b1
PP
533 # catch old-style 'ARMAYBE' and inform user how to 'upgrade'
534 if (defined $self->{ARMAYBE}){
535 my($armaybe) = $self->{ARMAYBE};
536 print STDOUT "ARMAYBE => '$armaybe' should be changed to:\n",
537 "\t'dynamic_lib' => {ARMAYBE => '$armaybe'}\n";
538 my(%dl) = %{$self->{dynamic_lib} || {}};
539 $self->{dynamic_lib} = { %dl, ARMAYBE => $armaybe};
540 delete $self->{ARMAYBE};
8e07c86e 541 }
e05e23b1
PP
542 if (defined $self->{LDTARGET}){
543 print STDOUT "LDTARGET should be changed to LDFROM\n";
544 $self->{LDFROM} = $self->{LDTARGET};
545 delete $self->{LDTARGET};
8e07c86e 546 }
e05e23b1
PP
547 # Turn a DIR argument on the command line into an array
548 if (defined $self->{DIR} && ref \$self->{DIR} eq 'SCALAR') {
549 # So they can choose from the command line, which extensions they want
550 # the grep enables them to have some colons too much in case they
551 # have to build a list with the shell
552 $self->{DIR} = [grep $_, split ":", $self->{DIR}];
8e07c86e 553 }
e05e23b1
PP
554 my $mmkey;
555 foreach $mmkey (sort keys %$self){
556 print STDOUT " $mmkey => ", neatvalue($self->{$mmkey}), "\n" if $Verbose;
557 print STDOUT "'$mmkey' is not a known MakeMaker parameter name.\n"
558 unless exists $Recognized_Att_Keys{$mmkey};
559 }
560}
8e07c86e 561
e05e23b1
PP
562sub check_hints {
563 my($self) = @_;
564 # We allow extension-specific hints files.
864a5fa8 565
e05e23b1 566 return unless -d "hints";
8e07c86e 567
e05e23b1
PP
568 # First we look for the best hintsfile we have
569 my(@goodhints);
570 my($hint)="$Config{osname}_$Config{osvers}";
571 $hint =~ s/\./_/g;
572 $hint =~ s/_$//;
573 return unless $hint;
fed7345c 574
e05e23b1
PP
575 # Also try without trailing minor version numbers.
576 while (1) {
577 last if -f "hints/$hint.pl"; # found
578 } continue {
579 last unless $hint =~ s/_[^_]*$//; # nothing to cut off
580 }
581 return unless -f "hints/$hint.pl"; # really there
fed7345c 582
e05e23b1 583 # execute the hintsfile:
3b03c0f3
PP
584# use FileHandle ();
585# my $fh = new FileHandle;
586# $fh->open("hints/$hint.pl");
587 local *FH;
588 open(FH,"hints/$hint.pl");
589# @goodhints = <$fh>;
590 @goodhints = <FH>;
591# $fh->close;
592 close FH;
e05e23b1
PP
593 print STDOUT "Processing hints file hints/$hint.pl\n";
594 eval join('',@goodhints);
595 print STDOUT $@ if $@;
596}
8e07c86e 597
e05e23b1
PP
598sub mv_all_methods {
599 my($from,$to) = @_;
600 my($method);
601 my($symtab) = \%{"${from}::"};
602# no strict;
fed7345c 603
e05e23b1
PP
604 # Here you see the *current* list of methods that are overridable
605 # from Makefile.PL via MY:: subroutines. As of VERSION 5.07 I'm
606 # still trying to reduce the list to some reasonable minimum --
607 # because I want to make it easier for the user. A.K.
40000a8c 608
3b03c0f3 609 foreach $method (@Overridable) {
fed7345c 610
e05e23b1
PP
611 # We cannot say "next" here. Nick might call MY->makeaperl
612 # which isn't defined right now
fed7345c 613
3b03c0f3
PP
614 # Above statement was written at 4.23 time when Tk-b8 was
615 # around. As Tk-b9 only builds with 5.002something and MM 5 is
616 # standard, we try to enable the next line again. It was
617 # commented out until MM 5.23
618
619 next unless defined &{"${from}::$method"};
fed7345c 620
e05e23b1 621 *{"${to}::$method"} = \&{"${from}::$method"};
8e07c86e 622
e05e23b1
PP
623 # delete would do, if we were sure, nobody ever called
624 # MY->makeaperl directly
3b03c0f3 625
e05e23b1 626 # delete $symtab->{$method};
3b03c0f3 627
e05e23b1
PP
628 # If we delete a method, then it will be undefined and cannot
629 # be called. But as long as we have Makefile.PLs that rely on
630 # %MY:: being intact, we have to fill the hole with an
631 # inheriting method:
fed7345c 632
e05e23b1 633 eval "package MY; sub $method {local *$method; shift->MY::$method(\@_); }";
5d94fbed
AD
634 }
635
e05e23b1
PP
636 # We have to clean out %INC also, because the current directory is
637 # changed frequently and Graham Barr prefers to get his version
638 # out of a History.pl file which is "required" so woudn't get
639 # loaded again in another extension requiring a History.pl
a0d0e21e 640
e05e23b1
PP
641 my $inc;
642 foreach $inc (keys %INC) {
643 next if $NORMAL_INC{$inc};
644 #warn "***$inc*** deleted";
645 delete $INC{$inc};
8e07c86e 646 }
a0d0e21e 647
8e07c86e
AD
648}
649
3b03c0f3 650sub skipcheck {
8e07c86e 651 my($self) = shift;
e05e23b1
PP
652 my($section) = @_;
653 if ($section eq 'dynamic') {
654 print STDOUT "Warning (non-fatal): Target 'dynamic' depends on targets ",
655 "in skipped section 'dynamic_bs'\n"
656 if $self->{SKIPHASH}{dynamic_bs} && $Verbose;
657 print STDOUT "Warning (non-fatal): Target 'dynamic' depends on targets ",
658 "in skipped section 'dynamic_lib'\n"
659 if $self->{SKIPHASH}{dynamic_lib} && $Verbose;
8e07c86e 660 }
e05e23b1
PP
661 if ($section eq 'dynamic_lib') {
662 print STDOUT "Warning (non-fatal): Target '\$(INST_DYNAMIC)' depends on ",
663 "targets in skipped section 'dynamic_bs'\n"
664 if $self->{SKIPHASH}{dynamic_bs} && $Verbose;
665 }
666 if ($section eq 'static') {
667 print STDOUT "Warning (non-fatal): Target 'static' depends on targets ",
668 "in skipped section 'static_lib'\n"
669 if $self->{SKIPHASH}{static_lib} && $Verbose;
8e07c86e 670 }
e05e23b1
PP
671 return 'skipped' if $self->{SKIPHASH}{$section};
672 return '';
8e07c86e
AD
673}
674
e05e23b1
PP
675sub flush {
676 my $self = shift;
677 my($chunk);
3b03c0f3
PP
678# use FileHandle ();
679# my $fh = new FileHandle;
680 local *FH;
e05e23b1 681 print STDOUT "Writing $self->{MAKEFILE} for $self->{NAME}\n";
8e07c86e 682
e05e23b1 683 unlink($self->{MAKEFILE}, "MakeMaker.tmp", $Is_VMS ? 'Descrip.MMS' : '');
3b03c0f3
PP
684# $fh->open(">MakeMaker.tmp") or die "Unable to open MakeMaker.tmp: $!";
685 open(FH,">MakeMaker.tmp") or die "Unable to open MakeMaker.tmp: $!";
8e07c86e 686
e05e23b1 687 for $chunk (@{$self->{RESULT}}) {
3b03c0f3
PP
688# print $fh "$chunk\n";
689 print FH "$chunk\n";
8e07c86e 690 }
e05e23b1 691
3b03c0f3
PP
692# $fh->close;
693 close FH;
e05e23b1
PP
694 my($finalname) = $self->{MAKEFILE};
695 rename("MakeMaker.tmp", $finalname);
696 chmod 0644, $finalname unless $Is_VMS;
3b03c0f3
PP
697
698 if ($self->{PARENT}) {
699 foreach (keys %$self) { # safe memory
700 delete $self->{$_} unless $Keep_after_flush{$_};
701 }
702 }
703
e05e23b1 704 system("$Config::Config{eunicefix} $finalname") unless $Config::Config{eunicefix} eq ":";
40000a8c
AD
705}
706
e05e23b1
PP
707# The following mkbootstrap() is only for installations that are calling
708# the pre-4.1 mkbootstrap() from their old Makefiles. This MakeMaker
709# writes Makefiles, that use ExtUtils::Mkbootstrap directly.
710sub mkbootstrap {
711 die <<END;
712!!! Your Makefile has been built such a long time ago, !!!
713!!! that is unlikely to work with current MakeMaker. !!!
714!!! Please rebuild your Makefile !!!
715END
8e07c86e 716}
005c1a0e 717
e05e23b1
PP
718# Ditto for mksymlists() as of MakeMaker 5.17
719sub mksymlists {
720 die <<END;
721!!! Your Makefile has been built such a long time ago, !!!
722!!! that is unlikely to work with current MakeMaker. !!!
723!!! Please rebuild your Makefile !!!
724END
4633a7c4
LW
725}
726
e05e23b1
PP
727sub neatvalue {
728 my($v) = @_;
729 return "undef" unless defined $v;
730 my($t) = ref $v;
731 return "q[$v]" unless $t;
732 if ($t eq 'ARRAY') {
733 my(@m, $elem, @neat);
734 push @m, "[";
735 foreach $elem (@$v) {
736 push @neat, "q[$elem]";
737 }
738 push @m, join ", ", @neat;
739 push @m, "]";
740 return join "", @m;
741 }
742 return "$v" unless $t eq 'HASH';
743 my(@m, $key, $val);
3b03c0f3
PP
744 while (($key,$val) = each %$v){
745 last unless defined $key; # cautious programming in case (undef,undef) is true
746 push(@m,"$key=>".neatvalue($val)) ;
747 }
e05e23b1 748 return "{ ".join(', ',@m)." }";
4e68a208
AD
749}
750
e05e23b1
PP
751sub selfdocument {
752 my($self) = @_;
753 my(@m);
754 if ($Verbose){
755 push @m, "\n# Full list of MakeMaker attribute values:";
756 foreach $key (sort keys %$self){
757 next if $key eq 'RESULT' || $key =~ /^[A-Z][a-z]/;
758 my($v) = neatvalue($self->{$key});
759 $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
760 $v =~ tr/\n/ /s;
761 push @m, "# $key => $v";
762 }
763 }
764 join "\n", @m;
765}
4e68a208 766
3b03c0f3 767package ExtUtils::MakeMaker::TieAtt;
005c1a0e 768
3b03c0f3
PP
769sub TIEHASH {
770 bless { SECRETHASH => $_[1]};
771}
772
773sub FETCH {
774 print "Warning (non-fatal): Importing of %att is deprecated [$_[1]]
775 use \$self instead\n" unless ++$Enough>$Enough_limit;
776 print "Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n" if $Enough==$Enough_limit;
777 $_[0]->{SECRETHASH}->{$_[1]};
778}
e05e23b1 779
3b03c0f3
PP
780sub STORE {
781 print "Warning (non-fatal): Importing of %att is deprecated [$_[1]][$_[2]]
782 use \$self instead\n" unless ++$Enough>$Enough_limit;
783 print "Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n" if $Enough==$Enough_limit;
784 $_[0]->{SECRETHASH}->{$_[1]} = $_[2];
785}
e05e23b1 786
3b03c0f3
PP
787sub FIRSTKEY {
788 print "Warning (non-fatal): Importing of %att is deprecated [FIRSTKEY]
789 use \$self instead\n" unless ++$Enough>$Enough_limit;
790 print "Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n" if $Enough==$Enough_limit;
791 each %{$_[0]->{SECRETHASH}};
792}
e05e23b1 793
3b03c0f3
PP
794sub NEXTKEY {
795 each %{$_[0]->{SECRETHASH}};
796}
797
798sub DESTROY {
799}
800
801sub warndirectuse {
802 my($caller) = @_;
803 return if $Enough>$Enough_limit;
804 print STDOUT "Warning (non-fatal): Direct use of class methods deprecated; use\n";
805 my($method) = $caller =~ /.*:(\w+)$/;
806 print STDOUT
807' my $self = shift;
808 $self->MM::', $method, "();
809 instead\n";
810 print "Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n"
811 if ++$Enough==$Enough_limit;
812}
813
814package ExtUtils::MakeMaker;
8151;
816
817__END__
005c1a0e
AD
818
819=head1 NAME
820
821ExtUtils::MakeMaker - create an extension Makefile
822
823=head1 SYNOPSIS
824
825C<use ExtUtils::MakeMaker;>
826
827C<WriteMakefile( ATTRIBUTE =E<gt> VALUE [, ...] );>
828
8e07c86e
AD
829which is really
830
831C<MM-E<gt>new(\%att)-E<gt>flush;>
832
005c1a0e
AD
833=head1 DESCRIPTION
834
835This utility is designed to write a Makefile for an extension module
836from a Makefile.PL. It is based on the Makefile.SH model provided by
837Andy Dougherty and the perl5-porters.
838
839It splits the task of generating the Makefile into several subroutines
840that can be individually overridden. Each subroutine returns the text
841it wishes to have written to the Makefile.
842
4633a7c4
LW
843=head2 Hintsfile support
844
005c1a0e 845MakeMaker.pm uses the architecture specific information from
8e07c86e
AD
846Config.pm. In addition it evaluates architecture specific hints files
847in a C<hints/> directory. The hints files are expected to be named
848like their counterparts in C<PERL_SRC/hints>, but with an C<.pl> file
849name extension (eg. C<next_3_2.pl>). They are simply C<eval>ed by
850MakeMaker within the WriteMakefile() subroutine, and can be used to
851execute commands as well as to include special variables. The rules
852which hintsfile is chosen are the same as in Configure.
853
4633a7c4
LW
854The hintsfile is eval()ed immediately after the arguments given to
855WriteMakefile are stuffed into a hash reference $self but before this
856reference becomes blessed. So if you want to do the equivalent to
857override or create an attribute you would say something like
858
859 $self->{LIBS} = ['-ldbm -lucb -lc'];
860
8e07c86e
AD
861=head2 What's new in version 5 of MakeMaker
862
863MakeMaker 5 is pure object oriented. This allows us to write an
864unlimited number of Makefiles with a single perl process. 'perl
865Makefile.PL' with MakeMaker 5 goes through all subdirectories
866immediately and evaluates any Makefile.PL found in the next level
867subdirectories. The benefit of this approach comes in useful for both
868single and multi directories extensions.
869
870Multi directory extensions have an immediately visible speed
871advantage, because there's no startup penalty for any single
872subdirectory Makefile.
873
874Single directory packages benefit from the much improved
875needs_linking() method. As the main Makefile knows everything about
876the subdirectories, a needs_linking() method can now query all
877subdirectories if there is any linking involved down in the tree. The
878speedup for PM-only Makefiles seems to be around 1 second on my
879Indy 100 MHz.
880
881=head2 Incompatibilities between MakeMaker 5.00 and 4.23
882
883There are no incompatibilities in the short term, as all changes are
884accompanied by short-term workarounds that guarantee full backwards
885compatibility.
886
4633a7c4 887You are likely to face a few warnings that expose deprecations which
8e07c86e
AD
888will result in incompatibilities in the long run:
889
890You should not use %att directly anymore. Instead any subroutine you
891override in the MY package will be called by the object method, so you
892can access all object attributes directly via the object in $_[0].
893
894You should not call the class methos MM->something anymore. Instead
895you should call the superclass. Something like
896
897 sub MY::constants {
898 my $self = shift;
8e07c86e
AD
899 $self->MM::constants();
900 }
901
902Especially the libscan() and exescan() methods should be altered
903towards OO programming, that means do not expect that $_ to contain
904the path but rather $_[1].
905
8e07c86e 906Try to build several extensions simultanously to debug your
e05e23b1
PP
907Makefile.PL. You can unpack a bunch of distributed packages within one
908directory and run
8e07c86e 909
e05e23b1 910 perl -MExtUtils::MakeMaker -e 'WriteMakefile()'
8e07c86e
AD
911
912That's actually fun to watch :)
913
3b03c0f3
PP
914Do not use exit() in your Makefile.PL. MakeMaker tries hard to enable
915multi-module builds in one go.
916
8e07c86e
AD
917Final suggestion: Try to delete all of your MY:: subroutines and
918watch, if you really still need them. MakeMaker might already do what
3b03c0f3
PP
919you want without them. If you see no way to avoid your own subroutine
920solution, please let us know about the problem.
8e07c86e 921
005c1a0e
AD
922
923=head2 Default Makefile Behaviour
924
925The automatically generated Makefile enables the user of the extension
926to invoke
927
928 perl Makefile.PL # optionally "perl Makefile.PL verbose"
929 make
8e07c86e
AD
930 make test # optionally set TEST_VERBOSE=1
931 make install # See below
005c1a0e
AD
932
933The Makefile to be produced may be altered by adding arguments of the
e05e23b1 934form C<KEY=VALUE>. E.g.
005c1a0e 935
e05e23b1 936 perl Makefile.PL PREFIX=/tmp/myperl5
005c1a0e
AD
937
938Other interesting targets in the generated Makefile are
939
940 make config # to check if the Makefile is up-to-date
8e07c86e
AD
941 make clean # delete local temp files (Makefile gets renamed)
942 make realclean # delete derived files (including ./blib)
e05e23b1 943 make ci # check in all the files in the MANIFEST file
005c1a0e
AD
944 make dist # see below the Distribution Support section
945
e05e23b1
PP
946=head2 make test
947
948MakeMaker checks for the existence of a file named "test.pl" in the
949current directory and if it exists it adds commands to the test target
950of the generated Makefile that will execute the script with the proper
951set of perl C<-I> options.
952
953MakeMaker also checks for any files matching glob("t/*.t"). It will
954add commands to the test target of the generated Makefile that execute
955all matching files via the L<Test::Harness> module with the C<-I>
956switches set correctly.
957
958=head2 make install
005c1a0e 959
8e07c86e
AD
960make alone puts all relevant files into directories that are named by
961the macros INST_LIB, INST_ARCHLIB, INST_EXE, INST_MAN1DIR, and
e05e23b1 962INST_MAN3DIR. All these default to something below ./blib if
8e07c86e
AD
963you are I<not> building below the perl source directory. If you I<are>
964building below the perl source, INST_LIB and INST_ARCHLIB default to
4633a7c4 965 ../../lib, and INST_EXE is not defined.
005c1a0e 966
e05e23b1
PP
967The I<install> target of the generated Makefile copies the files found
968below each of the INST_* directories to their INSTALL*
969counterparts. Which counterparts are chosen depends on the setting of
970INSTALLDIRS according to the following table:
005c1a0e 971
e05e23b1
PP
972 INSTALLDIRS set to
973 perl site
974
e05e23b1 975 INST_ARCHLIB INSTALLARCHLIB INSTALLSITEARCH
3b03c0f3 976 INST_LIB INSTALLPRIVLIB INSTALLSITELIB
e05e23b1
PP
977 INST_EXE INSTALLBIN
978 INST_MAN1DIR INSTALLMAN1DIR
979 INST_MAN3DIR INSTALLMAN3DIR
005c1a0e 980
8e07c86e
AD
981The INSTALL... macros in turn default to their %Config
982($Config{installprivlib}, $Config{installarchlib}, etc.) counterparts.
005c1a0e 983
3b03c0f3
PP
984You can check the values of these variables on your system with
985
986 perl -MConfig -le 'print join $/, map
987 sprintf("%20s: %s", $_, $Config{$_}),
988 grep /^install/, keys %Config'
989
e05e23b1
PP
990If you don't want to keep the defaults, MakeMaker helps you to
991minimize the typing needed: the usual relationship between
992INSTALLPRIVLIB and INSTALLARCHLIB is determined by Configure at perl
993compilation time. MakeMaker supports the user who sets
994INSTALLPRIVLIB. If INSTALLPRIVLIB is set, but INSTALLARCHLIB not, then
995MakeMaker defaults the latter to be the same subdirectory of
996INSTALLPRIVLIB as Configure decided for the counterparts in %Config ,
997otherwise it defaults to INSTALLPRIVLIB. The same relationship holds
998for INSTALLSITELIB and INSTALLSITEARCH.
005c1a0e
AD
999
1000MakeMaker gives you much more freedom than needed to configure
1001internal variables and get different results. It is worth to mention,
1002that make(1) also lets you configure most of the variables that are
1003used in the Makefile. But in the majority of situations this will not
1004be necessary, and should only be done, if the author of a package
3b03c0f3
PP
1005recommends it (or you know what you're doing).
1006
1007=cut
005c1a0e 1008
3b03c0f3 1009#'
005c1a0e 1010
8e07c86e 1011=head2 PREFIX attribute
005c1a0e 1012
0d8023a2
PP
1013The PREFIX attribute can be used to set the INSTALL* attributes in one
1014go. The quickest way to install a module in a non-standard place
005c1a0e 1015
8e07c86e 1016 perl Makefile.PL PREFIX=~
005c1a0e 1017
0d8023a2
PP
1018This will replace the string specified by $Config{prefix} in all
1019$Config{install*} values.
005c1a0e
AD
1020
1021Note, that the tilde expansion is done by MakeMaker, not by perl by
8e07c86e 1022default, nor by make.
005c1a0e 1023
005c1a0e
AD
1024If the user has superuser privileges, and is not working on AFS
1025(Andrew File System) or relatives, then the defaults for
8e07c86e 1026INSTALLPRIVLIB, INSTALLARCHLIB, INSTALLBIN, etc. will be appropriate,
005c1a0e
AD
1027and this incantation will be the best:
1028
1029 perl Makefile.PL; make; make test
1030 make install
1031
8e07c86e 1032make install per default writes some documentation of what has been
e05e23b1
PP
1033done into the file C<$(INSTALLARCHLIB)/perllocal.pod>. This feature
1034can be bypassed by calling make pure_install.
8e07c86e
AD
1035
1036=head2 AFS users
1037
1038will have to specify the installation directories as these most
1039probably have changed since perl itself has been installed. They will
1040have to do this by calling
1041
e05e23b1 1042 perl Makefile.PL INSTALLSITELIB=/afs/here/today \
8e07c86e
AD
1043 INSTALLBIN=/afs/there/now INSTALLMAN3DIR=/afs/for/manpages
1044 make
1045
e05e23b1
PP
1046Be careful to repeat this procedure every time you recompile an
1047extension, unless you are sure the AFS installation directories are
1048still valid.
005c1a0e 1049
8e07c86e 1050=head2 Static Linking of a new Perl Binary
005c1a0e
AD
1051
1052An extension that is built with the above steps is ready to use on
1053systems supporting dynamic loading. On systems that do not support
1054dynamic loading, any newly created extension has to be linked together
1055with the available resources. MakeMaker supports the linking process
1056by creating appropriate targets in the Makefile whenever an extension
1057is built. You can invoke the corresponding section of the makefile with
1058
1059 make perl
1060
1061That produces a new perl binary in the current directory with all
e05e23b1
PP
1062extensions linked in that can be found in INST_ARCHLIB , SITELIBEXP,
1063and PERL_ARCHLIB. To do that, MakeMaker writes a new Makefile, on
1064UNIX, this is called Makefile.aperl (may be system dependent). If you
1065want to force the creation of a new perl, it is recommended, that you
1066delete this Makefile.aperl, so the directories are searched-through
1067for linkable libraries again.
005c1a0e
AD
1068
1069The binary can be installed into the directory where perl normally
1070resides on your machine with
1071
1072 make inst_perl
1073
1074To produce a perl binary with a different name than C<perl>, either say
1075
1076 perl Makefile.PL MAP_TARGET=myperl
1077 make myperl
1078 make inst_perl
1079
1080or say
1081
1082 perl Makefile.PL
1083 make myperl MAP_TARGET=myperl
1084 make inst_perl MAP_TARGET=myperl
1085
1086In any case you will be prompted with the correct invocation of the
1087C<inst_perl> target that installs the new binary into INSTALLBIN.
1088
8e07c86e
AD
1089make inst_perl per default writes some documentation of what has been
1090done into the file C<$(INSTALLARCHLIB)/perllocal.pod>. This
1091can be bypassed by calling make pure_inst_perl.
005c1a0e 1092
e05e23b1
PP
1093Warning: the inst_perl: target will most probably overwrite your
1094existing perl binary. Use with care!
005c1a0e 1095
8e07c86e
AD
1096Sometimes you might want to build a statically linked perl although
1097your system supports dynamic loading. In this case you may explicitly
1098set the linktype with the invocation of the Makefile.PL or make:
1099
1100 perl Makefile.PL LINKTYPE=static # recommended
1101
1102or
1103
1104 make LINKTYPE=static # works on most systems
1105
005c1a0e
AD
1106=head2 Determination of Perl Library and Installation Locations
1107
1108MakeMaker needs to know, or to guess, where certain things are
e05e23b1
PP
1109located. Especially INST_LIB and INST_ARCHLIB (where to put the files
1110during the make(1) run), PERL_LIB and PERL_ARCHLIB (where to read
1111existing modules from), and PERL_INC (header files and C<libperl*.*>).
005c1a0e
AD
1112
1113Extensions may be built either using the contents of the perl source
e05e23b1
PP
1114directory tree or from the installed perl library. The recommended way
1115is to build extensions after you have run 'make install' on perl
1116itself. You can do that in any directory on your hard disk that is not
1117below the perl source tree. The support for extensions below the ext
1118directory of the perl distribution is only good for the standard
1119extensions that come with perl.
005c1a0e
AD
1120
1121If an extension is being built below the C<ext/> directory of the perl
e05e23b1
PP
1122source then MakeMaker will set PERL_SRC automatically (e.g.,
1123C<../..>). If PERL_SRC is defined and the extension is recognized as
1124a standard extension, then other variables default to the following:
005c1a0e
AD
1125
1126 PERL_INC = PERL_SRC
1127 PERL_LIB = PERL_SRC/lib
1128 PERL_ARCHLIB = PERL_SRC/lib
1129 INST_LIB = PERL_LIB
1130 INST_ARCHLIB = PERL_ARCHLIB
1131
1132If an extension is being built away from the perl source then MakeMaker
1133will leave PERL_SRC undefined and default to using the installed copy
1134of the perl library. The other variables default to the following:
1135
e05e23b1
PP
1136 PERL_INC = $archlibexp/CORE
1137 PERL_LIB = $privlibexp
1138 PERL_ARCHLIB = $archlibexp
1139 INST_LIB = ./blib/lib
1140 INST_ARCHLIB = ./blib/arch
005c1a0e
AD
1141
1142If perl has not yet been installed then PERL_SRC can be defined on the
1143command line as shown in the previous section.
1144
1145=head2 Useful Default Makefile Macros
1146
1147FULLEXT = Pathname for extension directory (eg DBD/Oracle).
1148
1149BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
1150
1151ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD)
1152
005c1a0e
AD
1153INST_LIBDIR = C<$(INST_LIB)$(ROOTEXT)>
1154
1155INST_AUTODIR = C<$(INST_LIB)/auto/$(FULLEXT)>
1156
1157INST_ARCHAUTODIR = C<$(INST_ARCHLIB)/auto/$(FULLEXT)>
1158
e05e23b1 1159=head2 Using Attributes and Parameters
005c1a0e
AD
1160
1161The following attributes can be specified as arguments to WriteMakefile()
1162or as NAME=VALUE pairs on the command line:
1163
8e07c86e 1164=cut
005c1a0e 1165
864a5fa8 1166# The following "=item C" is used by the attrib_help routine
8e07c86e
AD
1167# likewise the "=back" below. So be careful when changing it!
1168
1169=over 2
1170
864a5fa8 1171=item C
8e07c86e 1172
864a5fa8
AD
1173Ref to array of *.c file names. Initialised from a directory scan
1174and the values portion of the XS attribute hash. This is not
1175currently used by MakeMaker but may be handy in Makefile.PLs.
8e07c86e 1176
864a5fa8 1177=item CONFIG
8e07c86e 1178
864a5fa8
AD
1179Arrayref. E.g. [qw(archname manext)] defines ARCHNAME & MANEXT from
1180config.sh. MakeMaker will add to CONFIG the following values anyway:
1181ar
1182cc
1183cccdlflags
1184ccdlflags
1185dlext
1186dlsrc
1187ld
1188lddlflags
1189ldflags
1190libc
1191lib_ext
1192obj_ext
1193ranlib
e05e23b1
PP
1194sitelibexp
1195sitearchexp
864a5fa8 1196so
8e07c86e
AD
1197
1198=item CONFIGURE
1199
e05e23b1
PP
1200CODE reference. The subroutine should return a hash reference. The
1201hash may contain further attributes, e.g. {LIBS => ...}, that have to
8e07c86e
AD
1202be determined by some evaluation method.
1203
864a5fa8 1204=item DEFINE
8e07c86e 1205
864a5fa8 1206Something like C<"-DHAVE_UNISTD_H">
8e07c86e 1207
864a5fa8 1208=item DIR
8e07c86e 1209
864a5fa8
AD
1210Ref to array of subdirectories containing Makefile.PLs e.g. [ 'sdbm'
1211] in ext/SDBM_File
8e07c86e 1212
864a5fa8 1213=item DISTNAME
8e07c86e 1214
e05e23b1 1215Your name for distributing the package (by tar file). This defaults to
864a5fa8 1216NAME above.
8e07c86e 1217
864a5fa8 1218=item DL_FUNCS
8e07c86e 1219
864a5fa8
AD
1220Hashref of symbol names for routines to be made available as
1221universal symbols. Each key/value pair consists of the package name
1222and an array of routine names in that package. Used only under AIX
1223(export lists) and VMS (linker options) at present. The routine
1224names supplied will be expanded in the same way as XSUB names are
1225expanded by the XS() macro. Defaults to
8e07c86e 1226
864a5fa8 1227 {"$(NAME)" => ["boot_$(NAME)" ] }
8e07c86e 1228
864a5fa8 1229e.g.
8e07c86e 1230
864a5fa8
AD
1231 {"RPC" => [qw( boot_rpcb rpcb_gettime getnetconfigent )],
1232 "NetconfigPtr" => [ 'DESTROY'] }
8e07c86e 1233
864a5fa8 1234=item DL_VARS
8e07c86e 1235
864a5fa8
AD
1236Array of symbol names for variables to be made available as
1237universal symbols. Used only under AIX (export lists) and VMS
1238(linker options) at present. Defaults to []. (e.g. [ qw(
1239Foo_version Foo_numstreams Foo_tree ) ])
8e07c86e 1240
864a5fa8 1241=item EXE_FILES
8e07c86e 1242
864a5fa8
AD
1243Ref to array of executable files. The files will be copied to the
1244INST_EXE directory. Make realclean will delete them from there
1245again.
8e07c86e 1246
3b03c0f3
PP
1247=item NO_VC
1248
1249In general any generated Makefile checks for the current version of
1250MakeMaker and the version the Makefile was built under. If NO_VC is
1251set, the version check is neglected. Do not write this into your
1252Makefile.PL, use it interactively instead.
1253
864a5fa8
AD
1254=item FIRST_MAKEFILE
1255
1256The name of the Makefile to be produced. Defaults to the contents of
1257MAKEFILE, but can be overridden. This is used for the second Makefile
1258that will be produced for the MAP_TARGET.
1259
1260=item FULLPERL
8e07c86e 1261
864a5fa8
AD
1262Perl binary able to run this extension.
1263
1264=item H
1265
1266Ref to array of *.h file names. Similar to C.
1267
1268=item INC
1269
1270Include file dirs eg: C<"-I/usr/5include -I/path/to/inc">
1271
1272=item INSTALLARCHLIB
1273
e05e23b1
PP
1274Used by 'make install', which copies files from INST_ARCHLIB to this
1275directory if INSTALLDIRS is set to perl.
864a5fa8
AD
1276
1277=item INSTALLBIN
1278
e05e23b1
PP
1279Used by 'make install' which copies files from INST_EXE to this
1280directory.
1281
1282=item INSTALLDIRS
1283
1284Determines which of the two sets of installation directories to
1285choose: installprivlib and installarchlib versus installsitelib and
1286installsitearch. The first pair is chosen with INSTALLDIRS=perl, the
1287second with INSTALLDIRS=site. Default is site.
8e07c86e
AD
1288
1289=item INSTALLMAN1DIR
1290
864a5fa8
AD
1291This directory gets the man pages at 'make install' time. Defaults to
1292$Config{installman1dir}.
1293
8e07c86e
AD
1294=item INSTALLMAN3DIR
1295
864a5fa8
AD
1296This directory gets the man pages at 'make install' time. Defaults to
1297$Config{installman3dir}.
8e07c86e 1298
864a5fa8 1299=item INSTALLPRIVLIB
8e07c86e 1300
e05e23b1
PP
1301Used by 'make install', which copies files from INST_LIB to this
1302directory if INSTALLDIRS is set to perl.
1303
1304=item INSTALLSITELIB
1305
1306Used by 'make install', which copies files from INST_LIB to this
1307directory if INSTALLDIRS is set to site (default).
1308
1309=item INSTALLSITEARCH
1310
1311Used by 'make install', which copies files from INST_ARCHLIB to this
1312directory if INSTALLDIRS is set to site (default).
8e07c86e 1313
864a5fa8 1314=item INST_ARCHLIB
8e07c86e 1315
864a5fa8 1316Same as INST_LIB for architecture dependent files.
8e07c86e 1317
864a5fa8 1318=item INST_EXE
8e07c86e 1319
864a5fa8 1320Directory, where executable scripts should be installed during
e05e23b1
PP
1321'make'. Defaults to "./blib/bin", just to have a dummy location during
1322testing. make install will copy the files in INST_EXE to INSTALLBIN.
8e07c86e 1323
864a5fa8 1324=item INST_LIB
8e07c86e 1325
864a5fa8
AD
1326Directory where we put library files of this extension while building
1327it.
8e07c86e 1328
864a5fa8 1329=item INST_MAN1DIR
8e07c86e 1330
864a5fa8 1331Directory to hold the man pages at 'make' time
8e07c86e 1332
864a5fa8 1333=item INST_MAN3DIR
8e07c86e 1334
864a5fa8 1335Directory to hold the man pages at 'make' time
8e07c86e 1336
864a5fa8 1337=item LDFROM
8e07c86e 1338
864a5fa8
AD
1339defaults to "$(OBJECT)" and is used in the ld command to specify
1340what files to link/load from (also see dynamic_lib below for how to
1341specify ld flags)
8e07c86e 1342
864a5fa8 1343=item LIBPERL_A
8e07c86e 1344
864a5fa8
AD
1345The filename of the perllibrary that will be used together with this
1346extension. Defaults to libperl.a.
8e07c86e
AD
1347
1348=item LIBS
1349
1350An anonymous array of alternative library
1351specifications to be searched for (in order) until
864a5fa8 1352at least one library is found. E.g.
8e07c86e
AD
1353
1354 'LIBS' => ["-lgdbm", "-ldbm -lfoo", "-L/path -ldbm.nfs"]
1355
1356Mind, that any element of the array
1357contains a complete set of arguments for the ld
1358command. So do not specify
1359
1360 'LIBS' => ["-ltcl", "-ltk", "-lX11"]
1361
1362See ODBM_File/Makefile.PL for an example, where an array is needed. If
1363you specify a scalar as in
1364
1365 'LIBS' => "-ltcl -ltk -lX11"
1366
1367MakeMaker will turn it into an array with one element.
1368
864a5fa8 1369=item LINKTYPE
8e07c86e 1370
e05e23b1
PP
1371'static' or 'dynamic' (default unless usedl=undef in
1372config.sh). Should only be used to force static linking (also see
864a5fa8 1373linkext below).
8e07c86e 1374
864a5fa8 1375=item MAKEAPERL
8e07c86e 1376
864a5fa8
AD
1377Boolean which tells MakeMaker, that it should include the rules to
1378make a perl. This is handled automatically as a switch by
1379MakeMaker. The user normally does not need it.
8e07c86e 1380
864a5fa8 1381=item MAKEFILE
8e07c86e 1382
864a5fa8 1383The name of the Makefile to be produced.
8e07c86e 1384
864a5fa8 1385=item MAN1PODS
8e07c86e 1386
864a5fa8
AD
1387Hashref of pod-containing files. MakeMaker will default this to all
1388EXE_FILES files that include POD directives. The files listed
1389here will be converted to man pages and installed as was requested
1390at Configure time.
8e07c86e 1391
864a5fa8 1392=item MAN3PODS
8e07c86e 1393
864a5fa8
AD
1394Hashref of .pm and .pod files. MakeMaker will default this to all
1395 .pod and any .pm files that include POD directives. The files listed
1396here will be converted to man pages and installed as was requested
1397at Configure time.
8e07c86e 1398
864a5fa8 1399=item MAP_TARGET
8e07c86e 1400
864a5fa8
AD
1401If it is intended, that a new perl binary be produced, this variable
1402may hold a name for that binary. Defaults to perl
8e07c86e 1403
864a5fa8 1404=item MYEXTLIB
4633a7c4 1405
864a5fa8
AD
1406If the extension links to a library that it builds set this to the
1407name of the library (see SDBM_File)
4633a7c4 1408
864a5fa8 1409=item NAME
8e07c86e 1410
864a5fa8
AD
1411Perl module name for this extension (DBD::Oracle). This will default
1412to the directory name but should be explicitly defined in the
1413Makefile.PL.
8e07c86e 1414
864a5fa8 1415=item NEEDS_LINKING
8e07c86e 1416
864a5fa8
AD
1417MakeMaker will figure out, if an extension contains linkable code
1418anywhere down the directory tree, and will set this variable
1419accordingly, but you can speed it up a very little bit, if you define
1420this boolean variable yourself.
8e07c86e 1421
e05e23b1
PP
1422=item NOECHO
1423
1424Defaults the C<@>. By setting it to an empty string you can generate a
1425Makefile that echos all commands. Mainly used in debugging MakeMaker
1426itself.
1427
864a5fa8 1428=item NORECURS
8e07c86e 1429
e05e23b1 1430Boolean. Attribute to inhibit descending into subdirectories.
8e07c86e 1431
864a5fa8 1432=item OBJECT
8e07c86e 1433
864a5fa8
AD
1434List of object files, defaults to '$(BASEEXT)$(OBJ_EXT)', but can be a long
1435string containing all object files, e.g. "tkpBind.o
1436tkpButton.o tkpCanvas.o"
8e07c86e 1437
3b03c0f3
PP
1438=item OPTIMIZE
1439
1440Defaults to C<-O>. Set it to C<-g> to turn debugging on. The flag is
1441passed to subdirectory makes.
1442
864a5fa8 1443=item PERL
8e07c86e 1444
864a5fa8 1445Perl binary for tasks that can be done by miniperl
8e07c86e 1446
864a5fa8 1447=item PERLMAINCC
005c1a0e 1448
864a5fa8
AD
1449The call to the program that is able to compile perlmain.c. Defaults
1450to $(CC).
005c1a0e 1451
864a5fa8 1452=item PERL_ARCHLIB
005c1a0e 1453
864a5fa8 1454Same as above for architecture dependent files
8e07c86e 1455
864a5fa8 1456=item PERL_LIB
8e07c86e 1457
864a5fa8 1458Directory containing the Perl library to use.
8e07c86e 1459
864a5fa8 1460=item PERL_SRC
8e07c86e 1461
864a5fa8
AD
1462Directory containing the Perl source code (use of this should be
1463avoided, it may be undefined)
8e07c86e 1464
864a5fa8 1465=item PL_FILES
8e07c86e 1466
864a5fa8
AD
1467Ref to hash of files to be processed as perl programs. MakeMaker
1468will default to any found *.PL file (except Makefile.PL) being keys
1469and the basename of the file being the value. E.g.
8e07c86e 1470
864a5fa8 1471 {'foobar.PL' => 'foobar'}
8e07c86e 1472
864a5fa8
AD
1473The *.PL files are expected to produce output to the target files
1474themselves.
8e07c86e 1475
864a5fa8 1476=item PM
8e07c86e 1477
864a5fa8 1478Hashref of .pm files and *.pl files to be installed. e.g.
8e07c86e 1479
864a5fa8 1480 {'name_of_file.pm' => '$(INST_LIBDIR)/install_as.pm'}
8e07c86e 1481
864a5fa8
AD
1482By default this will include *.pm and *.pl. If a lib directory
1483exists and is not listed in DIR (above) then any *.pm and *.pl files
1484it contains will also be included by default. Defining PM in the
1485Makefile.PL will override PMLIBDIRS.
8e07c86e 1486
864a5fa8 1487=item PMLIBDIRS
8e07c86e 1488
864a5fa8
AD
1489Ref to array of subdirectories containing library files. Defaults to
1490[ 'lib', $(BASEEXT) ]. The directories will be scanned and any files
1491they contain will be installed in the corresponding location in the
1492library. A libscan() method can be used to alter the behaviour.
1493Defining PM in the Makefile.PL will override PMLIBDIRS.
8e07c86e 1494
864a5fa8 1495=item PREFIX
8e07c86e 1496
864a5fa8 1497Can be used to set the three INSTALL* attributes in one go (except for
e05e23b1
PP
1498probably INSTALLMAN1DIR, if it is not below PREFIX according to
1499%Config). They will have PREFIX as a common directory node and will
1500branch from that node into lib/, lib/ARCHNAME or whatever Configure
1501decided at the build time of your perl (unless you override one of
1502them, of course).
8e07c86e 1503
864a5fa8 1504=item PREREQ
8e07c86e 1505
864a5fa8
AD
1506Placeholder, not yet implemented. Will eventually be a hashref: Names
1507of modules that need to be available to run this extension (e.g. Fcntl
1508for SDBM_File) are the keys of the hash and the desired version is the
1509value. Needs further evaluation, should probably allow to define
1510prerequisites among header files, libraries, perl version, etc.
8e07c86e 1511
864a5fa8 1512=item SKIP
8e07c86e 1513
864a5fa8
AD
1514Arryref. E.g. [qw(name1 name2)] skip (do not write) sections of the
1515Makefile
8e07c86e 1516
864a5fa8 1517=item TYPEMAPS
8e07c86e 1518
864a5fa8
AD
1519Ref to array of typemap file names. Use this when the typemaps are
1520in some directory other than the current directory or when they are
1521not named B<typemap>. The last typemap in the list takes
1522precedence. A typemap in the current directory has highest
1523precedence, even if it isn't listed in TYPEMAPS. The default system
1524typemap has lowest precedence.
8e07c86e 1525
864a5fa8 1526=item VERSION
8e07c86e 1527
864a5fa8
AD
1528Your version number for distributing the package. This defaults to
15290.1.
8e07c86e 1530
0d8023a2
PP
1531=item VERSION_FROM
1532
1533Instead of specifying the VERSION in the Makefile.PL you can let
1534MakeMaker parse a file to determine the version number. The parsing
1535routine requires that the file named by VERSION_FROM contains one
1536single line to compute the version number. The first line in the file
1537that contains the regular expression
1538
1539 /(\$[\w:]*\bVERSION)\b.*=/
1540
1541will be evaluated with eval() and the value of the named variable
1542B<after> the eval() will be assigned to the VERSION attribute of the
1543MakeMaker object. The following lines will be parsed o.k.:
1544
1545 $VERSION = '1.00';
3b03c0f3 1546 ( $VERSION ) = '$Revision: 1.187 $ ' =~ /\$Revision:\s+([^\s]+)/;
0d8023a2
PP
1547 $FOO::VERSION = '1.10';
1548
1549but these will fail:
1550
1551 my $VERSION = '1.01';
1552 local $VERSION = '1.02';
1553 local $FOO::VERSION = '1.30';
1554
1555The file named in VERSION_FROM is added as a dependency to Makefile to
1556guarantee, that the Makefile contains the correct VERSION macro after
1557a change of the file.
1558
864a5fa8 1559=item XS
8e07c86e 1560
864a5fa8 1561Hashref of .xs files. MakeMaker will default this. e.g.
8e07c86e 1562
864a5fa8 1563 {'name_of_file.xs' => 'name_of_file.c'}
8e07c86e 1564
864a5fa8
AD
1565The .c files will automatically be included in the list of files
1566deleted by a make clean.
4633a7c4 1567
864a5fa8 1568=item XSOPT
8e07c86e 1569
864a5fa8
AD
1570String of options to pass to xsubpp. This might include C<-C++> or
1571C<-extern>. Do not include typemaps here; the TYPEMAP parameter exists for
1572that purpose.
8e07c86e 1573
864a5fa8 1574=item XSPROTOARG
4633a7c4 1575
4e68a208 1576May be set to an empty string, which is identical to C<-prototypes>, or
864a5fa8 1577C<-noprototypes>. See the xsubpp documentation for details. MakeMaker
4e68a208
AD
1578defaults to the empty string.
1579
0d8023a2
PP
1580=item XS_VERSION
1581
1582Your version number for the .xs file of this package. This defaults
1583to the value of the VERSION attribute.
1584
8e07c86e
AD
1585=back
1586
1587=head2 Additional lowercase attributes
1588
1589can be used to pass parameters to the methods which implement that
1590part of the Makefile. These are not normally required:
1591
1592=over 2
1593
864a5fa8 1594=item clean
8e07c86e 1595
864a5fa8
AD
1596 {FILES => "*.xyz foo"}
1597
c07a80fd
PP
1598=item depend
1599
1600 {ANY_TARGET => ANY_DEPENDECY, ...}
1601
864a5fa8
AD
1602=item dist
1603
1604 {TARFLAGS => 'cvfF', COMPRESS => 'gzip', SUFFIX => 'gz',
3b03c0f3
PP
1605 SHAR => 'shar -m', DIST_CP => 'ln', ZIP => '/bin/zip',
1606 ZIPFLAGS => '-rl'}
864a5fa8
AD
1607
1608If you specify COMPRESS, then SUFFIX should also be altered, as it is
1609needed to tell make the target file of the compression. Setting
1610DIST_CP to ln can be useful, if you need to preserve the timestamps on
1611your files. DIST_CP can take the values 'cp', which copies the file,
1612'ln', which links the file, and 'best' which copies symbolic links and
1613links the rest. Default is 'best'.
1614
1615=item dynamic_lib
1616
0d8023a2 1617 {ARMAYBE => 'ar', OTHERLDFLAGS => '...', INST_DYNAMIC_DEP => '...'}
8e07c86e
AD
1618
1619=item installpm
1620
3b03c0f3 1621Deprecated as of MakeMaker 5.23. See L<ExtUtils::MM_Unix/pm_to_blib>.
8e07c86e
AD
1622
1623=item linkext
1624
1625 {LINKTYPE => 'static', 'dynamic' or ''}
1626
864a5fa8 1627NB: Extensions that have nothing but *.pm files had to say
8e07c86e
AD
1628
1629 {LINKTYPE => ''}
1630
864a5fa8
AD
1631with Pre-5.0 MakeMakers. Since version 5.00 of MakeMaker such a line
1632can be deleted safely. MakeMaker recognizes, when there's nothing to
1633be linked.
8e07c86e 1634
864a5fa8 1635=item macro
8e07c86e 1636
864a5fa8 1637 {ANY_MACRO => ANY_VALUE, ...}
8e07c86e
AD
1638
1639=item realclean
1640
1641 {FILES => '$(INST_ARCHAUTODIR)/*.xyz'}
1642
8e07c86e
AD
1643=item tool_autosplit
1644
1645 {MAXLEN =E<gt> 8}
005c1a0e
AD
1646
1647=back
1648
8e07c86e
AD
1649=cut
1650
1651# bug in pod2html, so leave the =back
1652
1653# Don't delete this cut, MM depends on it!
1654
005c1a0e
AD
1655=head2 Overriding MakeMaker Methods
1656
1657If you cannot achieve the desired Makefile behaviour by specifying
1658attributes you may define private subroutines in the Makefile.PL.
1659Each subroutines returns the text it wishes to have written to
1660the Makefile. To override a section of the Makefile you can
1661either say:
1662
1663 sub MY::c_o { "new literal text" }
1664
1665or you can edit the default by saying something like:
1666
8e07c86e
AD
1667 sub MY::c_o {
1668 my $self = shift;
1669 local *c_o;
1670 $_=$self->MM::c_o;
1671 s/old text/new text/;
1672 $_;
1673 }
1674
1675Both methods above are available for backwards compatibility with
1676older Makefile.PLs.
005c1a0e
AD
1677
1678If you still need a different solution, try to develop another
1679subroutine, that fits your needs and submit the diffs to
8e07c86e 1680F<perl5-porters@nicoh.com> or F<comp.lang.perl.misc> as appropriate.
005c1a0e 1681
3b03c0f3
PP
1682For a complete description of all MakeMaker methods see L<ExtUtils::MM_Unix>.
1683
1684Here is a simple example of how to add a new target to the generated
1685Makefile:
1686
1687 sub MY::postamble {
1688 '
1689 $(MYEXTLIB): sdbm/Makefile
1690 cd sdbm && $(MAKE) all
1691 ';
1692 }
1693
1694
005c1a0e
AD
1695=head2 Distribution Support
1696
1697For authors of extensions MakeMaker provides several Makefile
1698targets. Most of the support comes from the ExtUtils::Manifest module,
1699where additional documentation can be found.
1700
1701=over 4
1702
1703=item make distcheck
8e07c86e 1704
005c1a0e
AD
1705reports which files are below the build directory but not in the
1706MANIFEST file and vice versa. (See ExtUtils::Manifest::fullcheck() for
1707details)
1708
4633a7c4
LW
1709=item make skipcheck
1710
1711reports which files are skipped due to the entries in the
1712C<MANIFEST.SKIP> file (See ExtUtils::Manifest::skipcheck() for
1713details)
1714
005c1a0e 1715=item make distclean
8e07c86e 1716
005c1a0e
AD
1717does a realclean first and then the distcheck. Note that this is not
1718needed to build a new distribution as long as you are sure, that the
1719MANIFEST file is ok.
1720
1721=item make manifest
8e07c86e 1722
005c1a0e
AD
1723rewrites the MANIFEST file, adding all remaining files found (See
1724ExtUtils::Manifest::mkmanifest() for details)
1725
1726=item make distdir
8e07c86e 1727
005c1a0e
AD
1728Copies all the files that are in the MANIFEST file to a newly created
1729directory with the name C<$(DISTNAME)-$(VERSION)>. If that directory
1730exists, it will be removed first.
1731
8e07c86e
AD
1732=item make disttest
1733
1734Makes a distdir first, and runs a C<perl Makefile.PL>, a make, and
4633a7c4 1735a make test in that directory.
8e07c86e 1736
005c1a0e 1737=item make tardist
8e07c86e 1738
3b03c0f3
PP
1739First does a distdir. Then a command $(PREOP) which defaults to a null
1740command. Next it runs C<tar> on that directory into a tarfile and
1741deletes the directory. Finishes with a command $(POSTOP) which
1742defaults to a null command.
005c1a0e
AD
1743
1744=item make dist
8e07c86e 1745
005c1a0e
AD
1746Defaults to $(DIST_DEFAULT) which in turn defaults to tardist.
1747
1748=item make uutardist
8e07c86e 1749
005c1a0e
AD
1750Runs a tardist first and uuencodes the tarfile.
1751
1752=item make shdist
8e07c86e 1753
3b03c0f3
PP
1754First does a distdir. Then a command $(PREOP) which defaults to a null
1755command. Next it runs C<shar> on that directory into a sharfile and
1756deletes the intermediate directory again. Finishes with a command
1757$(POSTOP) which defaults to a null command. Note: For shdist to work
1758properly a C<shar> program that can handle directories is mandatory.
1759
1760=item make zipdist
1761
1762First does a distdir. Then a command $(PREOP) which defaults to a null
1763command. Runs C<$(ZIP) $(ZIPFLAGS)> on that directory into a
1764zipfile. Then deletes that directory. Finishes with a command
1765$(POSTOP) which defaults to a null command.
005c1a0e
AD
1766
1767=item make ci
8e07c86e
AD
1768
1769Does a $(CI) and a $(RCS_LABEL) on all files in the MANIFEST file.
1770
1771=back
005c1a0e
AD
1772
1773Customization of the dist targets can be done by specifying a hash
1774reference to the dist attribute of the WriteMakefile call. The
1775following parameters are recognized:
1776
8e07c86e 1777 CI ('ci -u')
005c1a0e 1778 COMPRESS ('compress')
005c1a0e 1779 POSTOP ('@ :')
8e07c86e
AD
1780 PREOP ('@ :')
1781 RCS_LABEL ('rcs -q -Nv$(VERSION_SYM):')
1782 SHAR ('shar')
1783 SUFFIX ('Z')
1784 TAR ('tar')
1785 TARFLAGS ('cvf')
3b03c0f3
PP
1786 ZIP ('zip')
1787 ZIPFLAGS ('-r')
005c1a0e
AD
1788
1789An example:
1790
1791 WriteMakefile( 'dist' => { COMPRESS=>"gzip", SUFFIX=>"gz" })
1792
005c1a0e 1793
e05e23b1 1794=head1 AUTHORS
fed7345c
AD
1795
1796Andy Dougherty F<E<lt>doughera@lafcol.lafayette.eduE<gt>>, Andreas
8e07c86e 1797KE<ouml>nig F<E<lt>A.Koenig@franz.ww.TU-Berlin.DEE<gt>>, Tim Bunce
fed7345c 1798F<E<lt>Tim.Bunce@ig.co.ukE<gt>>. VMS support by Charles Bailey
a5f75d66 1799F<E<lt>bailey@genetics.upenn.eduE<gt>>. OS/2 support by Ilya
e05e23b1
PP
1800Zakharevich F<E<lt>ilya@math.ohio-state.eduE<gt>>. Contact the
1801makemaker mailing list C<mailto:makemaker@franz.ww.tu-berlin.de>, if
1802you have any questions.
fed7345c
AD
1803
1804=head1 MODIFICATION HISTORY
1805
8e07c86e
AD
1806For a more complete documentation see the file Changes in the
1807MakeMaker distribution package.
e50aee73 1808
005c1a0e 1809=head1 TODO
f06db76b 1810
8e07c86e 1811See the file Todo in the MakeMaker distribution package.
005c1a0e
AD
1812
1813=cut