Commit | Line | Data |
a0d0e21e |
1 | package ExtUtils::MakeMaker; |
2 | |
fec02dd3 |
3 | $Version = 4.086; # Last edited 9 Mar 1995 by Andy Dougherty |
a0d0e21e |
4 | |
5 | use Config; |
1aef975c |
6 | check_hints(); |
42793c05 |
7 | use Carp; |
8 | use Cwd; |
9 | |
a0d0e21e |
10 | require Exporter; |
11 | @ISA = qw(Exporter); |
1aef975c |
12 | @EXPORT = qw(&WriteMakefile &mkbootstrap &mksymlists $Verbose); |
3edbfbe5 |
13 | @EXPORT_OK = qw($Version %att %skip %Recognized_Att_Keys |
14 | @MM_Sections %MM_Sections |
1aef975c |
15 | &help &lsdir &neatvalue); |
a0d0e21e |
16 | |
42793c05 |
17 | $Is_VMS = $Config{'osname'} eq 'VMS'; |
18 | require ExtUtils::MM_VMS if $Is_VMS; |
a0d0e21e |
19 | |
42793c05 |
20 | use strict qw(refs); |
a0d0e21e |
21 | |
42793c05 |
22 | $Version = $Version;# avoid typo warning |
a0d0e21e |
23 | $Verbose = 0; |
a0d0e21e |
24 | $^W=1; |
25 | |
26 | |
42793c05 |
27 | =head1 NAME |
a0d0e21e |
28 | |
42793c05 |
29 | ExtUtils::MakeMaker - create an extension Makefile |
a0d0e21e |
30 | |
42793c05 |
31 | =head1 SYNOPSIS |
a0d0e21e |
32 | |
1aef975c |
33 | C<use ExtUtils::MakeMaker;> |
3edbfbe5 |
34 | |
fed7345c |
35 | C<WriteMakefile( ATTRIBUTE =E<gt> VALUE [, ...] );> |
a0d0e21e |
36 | |
42793c05 |
37 | =head1 DESCRIPTION |
38 | |
39 | This utility is designed to write a Makefile for an extension module |
40 | from a Makefile.PL. It is based on the Makefile.SH model provided by |
41 | Andy Dougherty and the perl5-porters. |
42 | |
43 | It splits the task of generating the Makefile into several subroutines |
44 | that can be individually overridden. Each subroutine returns the text |
45 | it wishes to have written to the Makefile. |
46 | |
1aef975c |
47 | MakeMaker.pm uses the architecture specific information from |
48 | Config.pm. In addition the extension may contribute to the C<%Config> |
49 | hash table of Config.pm by supplying hints files in a C<hints/> |
50 | directory. The hints files are expected to be named like their |
fed7345c |
51 | counterparts in C<PERL_SRC/hints>, but with an C<.pl> file name |
52 | extension (eg. C<next_3_2.sh>). They are simply C<eval>ed by MakeMaker |
53 | and can be used to execute commands as well as to include special |
54 | variables. If there is no hintsfile for the actual system, but for |
1aef975c |
55 | some previous releases of the same operating system, the latest one of |
56 | those is used. |
57 | |
42793c05 |
58 | =head2 Default Makefile Behaviour |
59 | |
3edbfbe5 |
60 | The automatically generated Makefile enables the user of the extension |
61 | to invoke |
62 | |
75f92628 |
63 | perl Makefile.PL |
64 | make |
40000a8c |
65 | make test # optionally set TEST_VERBOSE=1 |
66 | make install # See below |
75f92628 |
67 | |
68 | The Makefile to be produced may be altered by adding arguments of the |
69 | form C<KEY=VALUE>. If the user wants to have the extension installed |
70 | into a directory different from C<$Config{"installprivlib"}> it can be |
71 | done by specifying |
72 | |
40000a8c |
73 | perl Makefile.PL INST_LIB=~/myperllib INST_EXE=~/bin |
75f92628 |
74 | |
75 | Note, that in this example MakeMaker does the tilde expansion for you |
76 | and INST_ARCHLIB is set to either C<INST_LIB/$Config{"osname"}> if |
77 | that directory exists and otherwise to INST_LIB. |
78 | |
79 | Other interesting targets in the generated Makefile are |
80 | |
81 | make config # to check if the Makefile is up-to-date |
82 | make clean # delete local temporary files (Makefile gets renamed) |
83 | make realclean # delete all derived files (including installed files) |
84 | make distclean # produce a gzipped file ready for shipping |
85 | |
1aef975c |
86 | The macros in the produced Makefile may be overridden on the command |
87 | line to the make call as in the following example: |
75f92628 |
88 | |
40000a8c |
89 | make INST_LIB=/some/where INST_ARCHLIB=/some/where INST_EXE=/u/k/bin |
75f92628 |
90 | |
91 | Note, that this is a solution provided by C<make> in general, so tilde |
92 | expansion will probably not be available and INST_ARCHLIB will not be |
93 | set automatically when INST_LIB is given as argument. |
3edbfbe5 |
94 | |
1aef975c |
95 | The generated Makefile does not set any permissions. The installer has |
96 | to decide, which umask should be in effect. |
42793c05 |
97 | |
40000a8c |
98 | =head2 Special case C<make install> |
99 | |
100 | The I<install> target of the generated Makefile is for system |
101 | administrators only that have writing permissions on the |
102 | system-specific directories $Config{installprivlib}, |
103 | $Config{installarchlib}, and $Config{installbin}. This works, because |
104 | C<make> alone in fact puts all relevant files into directories that |
105 | are named by the macros INST_LIB, INST_ARCHLIB, and INST_EXE. All |
106 | three default to ./blib if you are not building below the perl source |
107 | directory. C<make install> is just a recursive call to C<make> with |
108 | the three relevant parameters set accordingly to the system-wide |
109 | defaults. |
110 | |
111 | C<make install> per default writes some documentation of what has been |
112 | done into the file C<$Config{'installarchlib'}/perllocal.pod>. This is |
113 | an experimental feature. It can be bypassed by calling C<make |
114 | pure_install>. |
115 | |
116 | Users that do not have privileges on the system but want to install |
117 | the relevant files of the module into their private library or binary |
118 | directories do not call C<make install>. In priciple they have the |
119 | choice to either say |
120 | |
121 | # case: trust the module |
122 | perl Makefile.PL INST_LIB=~/perllib INST_EXE=~/bin |
123 | make |
124 | make test |
125 | |
126 | or |
127 | |
128 | # case: want to run tests before installation |
129 | perl Makefile.PL |
130 | make |
131 | make test |
132 | make INST_LIB=/some/where INST_ARCHLIB=/foo/bar INST_EXE=/somebin |
133 | |
134 | (C<make test> is not necessarily supported for all modules.) |
135 | |
136 | =head2 Support to Link a new Perl Binary |
fed7345c |
137 | |
138 | An extension that is built with the above steps is ready to use on |
139 | systems supporting dynamic loading. On systems that do not support |
140 | dynamic loading, any newly created extension has to be linked together |
141 | with the available ressources. MakeMaker supports the linking process |
142 | by creating appropriate targets in the Makefile whenever an extension |
143 | is built. You can invoke the corresponding section of the makefile with |
144 | |
145 | make perl |
146 | |
147 | That produces a new perl binary in the current directory with all |
40000a8c |
148 | extensions linked in that can be found in INST_ARCHLIB and |
149 | PERL_ARCHLIB. |
fed7345c |
150 | |
151 | The binary can be installed into the directory where perl normally |
152 | resides on your machine with |
153 | |
154 | make inst_perl |
155 | |
40000a8c |
156 | To produce a perl binary with a different name than C<perl>, either say |
157 | |
158 | perl Makefile.PL MAP_TARGET=myperl |
159 | make myperl |
160 | make inst_perl |
161 | |
162 | or say |
fed7345c |
163 | |
40000a8c |
164 | perl Makefile.PL |
165 | make myperl MAP_TARGET=myperl |
166 | make inst_perl MAP_TARGET=myperl |
167 | |
168 | In any case you will be prompted with the correct invocation of the |
169 | C<inst_perl> target that installs the new binary into |
170 | $Config{'installbin'}. |
171 | |
172 | Note, that there is a C<makeaperl> scipt in the perl distribution, |
173 | that supports the linking of a new perl binary in a similar fashion, |
174 | but with more options. |
175 | |
176 | C<make inst_perl> per default writes some documentation of what has been |
177 | done into the file C<$Config{'installarchlib'}/perllocal.pod>. This |
178 | can be bypassed by calling C<make pure_inst_perl>. |
179 | |
180 | Warning: the inst_perl: target is rather mighty and will probably |
181 | overwrite your existing perl binary. Use with care! |
fed7345c |
182 | |
42793c05 |
183 | =head2 Determination of Perl Library and Installation Locations |
184 | |
1aef975c |
185 | MakeMaker needs to know, or to guess, where certain things are |
186 | located. Especially INST_LIB and INST_ARCHLIB (where to install files |
187 | into), PERL_LIB and PERL_ARCHLIB (where to read existing modules |
188 | from), and PERL_INC (header files and C<libperl*.*>). |
42793c05 |
189 | |
75f92628 |
190 | Extensions may be built either using the contents of the perl source |
191 | directory tree or from an installed copy of the perl library. |
192 | |
193 | If an extension is being built below the C<ext/> directory of the perl |
194 | source then MakeMaker will set PERL_SRC automatically (e.g., C<../..>). |
195 | If PERL_SRC is defined then other variables default to the following: |
196 | |
197 | PERL_INC = PERL_SRC |
198 | PERL_LIB = PERL_SRC/lib |
199 | PERL_ARCHLIB = PERL_SRC/lib |
200 | INST_LIB = PERL_LIB |
201 | INST_ARCHLIB = PERL_ARCHLIB |
3edbfbe5 |
202 | |
75f92628 |
203 | If an extension is being built away from the perl source then MakeMaker |
204 | will leave PERL_SRC undefined and default to using the installed copy |
205 | of the perl library. The other variables default to the following: |
42793c05 |
206 | |
75f92628 |
207 | PERL_INC = $archlib/CORE |
208 | PERL_LIB = $privlib |
209 | PERL_ARCHLIB = $archlib |
210 | INST_LIB = ./blib |
211 | INST_ARCHLIB = ./blib |
212 | |
213 | If perl has not yet been installed then PERL_SRC can be defined on the |
214 | command line as shown in the previous section. |
42793c05 |
215 | |
216 | =head2 Useful Default Makefile Macros |
217 | |
218 | FULLEXT = Pathname for extension directory (eg DBD/Oracle). |
219 | |
220 | BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. |
221 | |
222 | ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD) |
223 | |
3edbfbe5 |
224 | PERL_LIB = Directory where we read the perl library files |
42793c05 |
225 | |
3edbfbe5 |
226 | PERL_ARCHLIB = Same as above for architecture dependent files |
42793c05 |
227 | |
3edbfbe5 |
228 | INST_LIB = Directory where we put library files of this extension |
1aef975c |
229 | while building it. If we are building below PERL_SRC/ext |
230 | we default to PERL_SRC/lib, else we default to ./blib. |
42793c05 |
231 | |
3edbfbe5 |
232 | INST_ARCHLIB = Same as above for architecture dependent files |
42793c05 |
233 | |
fed7345c |
234 | INST_LIBDIR = C<$(INST_LIB)$(ROOTEXT)> |
42793c05 |
235 | |
fed7345c |
236 | INST_AUTODIR = C<$(INST_LIB)/auto/$(FULLEXT)> |
3edbfbe5 |
237 | |
fed7345c |
238 | INST_ARCHAUTODIR = C<$(INST_ARCHLIB)/auto/$(FULLEXT)> |
42793c05 |
239 | |
240 | =head2 Customizing The Generated Makefile |
241 | |
242 | If the Makefile generated does not fit your purpose you can change it |
243 | using the mechanisms described below. |
244 | |
245 | =head2 Using Attributes (and Parameters) |
246 | |
247 | The following attributes can be specified as arguments to WriteMakefile() |
248 | or as NAME=VALUE pairs on the command line: |
249 | |
3edbfbe5 |
250 | This description is not yet documented; you can get at the description |
251 | with the command |
fed7345c |
252 | |
253 | C<perl Makefile.PL help> (if you already have a basic Makefile.PL) |
254 | |
1aef975c |
255 | or |
fed7345c |
256 | |
257 | C<perl -e 'use ExtUtils::MakeMaker qw(&help); &help;'> |
42793c05 |
258 | |
259 | =head2 Overriding MakeMaker Methods |
260 | |
261 | If you cannot achieve the desired Makefile behaviour by specifying |
262 | attributes you may define private subroutines in the Makefile.PL. |
263 | Each subroutines returns the text it wishes to have written to |
264 | the Makefile. To override a section of the Makefile you can |
265 | either say: |
266 | |
267 | sub MY::c_o { "new literal text" } |
268 | |
269 | or you can edit the default by saying something like: |
270 | |
271 | sub MY::c_o { $_=MM->c_o; s/old text/new text/; $_ } |
a0d0e21e |
272 | |
fed7345c |
273 | If you still need a different solution, try to develop another |
274 | subroutine, that fits your needs and submit the diffs to |
275 | F<perl5-porters@nicoh.com> or F<comp.lang.perl> as appropriate. |
75f92628 |
276 | |
42793c05 |
277 | =cut |
278 | |
1aef975c |
279 | sub check_hints { |
280 | # We allow extension-specific hints files. If we find one we act as if Config.pm |
281 | # had read the contents |
282 | |
283 | # First we look for the best hintsfile we have |
284 | my(@goodhints); |
285 | my($hint)="$Config{'osname'}_$Config{'osvers'}"; |
286 | $hint =~ s/\./_/g; |
287 | $hint =~ s/_$//; |
288 | opendir DIR, "hints"; |
289 | while (defined ($_ = readdir DIR)) { |
290 | next if /^\./; |
fed7345c |
291 | next unless s/\.pl$//; |
1aef975c |
292 | next unless /^$Config{'osname'}/; |
293 | # Don't trust a hintfile for a later OS version: |
294 | next if $_ gt $hint; |
295 | push @goodhints, $_; |
296 | if ($_ eq $hint){ |
297 | @goodhints=$_; |
298 | last; |
299 | } |
300 | } |
301 | closedir DIR; |
302 | return unless @goodhints; # There was no hintsfile |
303 | # the last one in lexical ordering is our choice: |
fed7345c |
304 | $hint=(reverse sort @goodhints)[0]; |
1aef975c |
305 | |
306 | # execute the hintsfile: |
fed7345c |
307 | eval `cat hints/$hint.pl`; |
1aef975c |
308 | } |
42793c05 |
309 | |
310 | # Setup dummy package: |
311 | # MY exists for overriding methods to be defined within |
312 | unshift(@MY::ISA, qw(MM)); |
313 | |
314 | # Dummy package MM inherits actual methods from OS-specific |
315 | # default packages. We use this intermediate package so |
316 | # MY->func() can call MM->func() and get the proper |
317 | # default routine without having to know under what OS |
318 | # it's running. |
319 | unshift(@MM::ISA, $Is_VMS ? qw(ExtUtils::MM_VMS MM_Unix) : qw(MM_Unix)); |
320 | |
321 | $Attrib_Help = <<'END'; |
322 | NAME: Perl module name for this extension (DBD::Oracle) |
75f92628 |
323 | This will default to the directory name but should |
324 | be explicitly defined in the Makefile.PL. |
42793c05 |
325 | |
326 | DISTNAME: Your name for distributing the package (by tar file) |
327 | This defaults to NAME above. |
328 | |
329 | VERSION: Your version number for distributing the package. |
330 | This defaults to 0.1. |
331 | |
332 | INST_LIB: Perl library directory to install the module into. |
333 | INST_ARCHLIB: Perl architecture-dependent library to install into |
334 | (defaults to INST_LIB) |
335 | |
336 | PERL_LIB: Directory containing the Perl library to use. |
337 | PERL_SRC: Directory containing the Perl source code |
e1666bf5 |
338 | (use of this should be avoided, it may be undefined) |
42793c05 |
339 | |
340 | INC: Include file dirs eg: '-I/usr/5include -I/path/to/inc' |
341 | DEFINE: something like "-DHAVE_UNISTD_H" |
342 | OBJECT: List of object files, defaults to '$(BASEEXT).o', |
343 | but can be a long string containing all object files, |
344 | e.g. "tkpBind.o tkpButton.o tkpCanvas.o" |
345 | MYEXTLIB: If the extension links to a library that it builds |
346 | set this to the name of the library (see SDBM_File) |
347 | |
348 | LIBS: An anonymous array of alternative library specifications |
349 | to be searched for (in order) until at least one library |
350 | is found. |
351 | 'LIBS' => [ "-lgdbm", "-ldbm -lfoo", "-L/path -ldbm.nfs" ] |
352 | Mind, that any element of the array contains a complete |
353 | set of arguments for the ld command. So do not specify |
354 | 'LIBS' => ["-ltcl", "-ltk", "-lX11" ], #wrong |
355 | See ODBM_File/Makefile.PL for an example, where an |
356 | array is needed. If you specify a scalar as in |
357 | 'LIBS' => "-ltcl -ltk -lX11" |
358 | MakeMaker will turn it into an array with one element. |
359 | |
3edbfbe5 |
360 | LDFROM: defaults to "$(OBJECT)" and is used in the ld command |
361 | to specify what files to link/load from |
362 | (also see dynamic_lib below for how to specify ld flags) |
42793c05 |
363 | |
364 | DIR: Ref to array of subdirectories containing Makefile.PLs |
365 | e.g. [ 'sdbm' ] in ext/SDBM_File |
366 | |
75f92628 |
367 | PMLIBDIRS: Ref to array of subdirectories containing library files. |
368 | Defaults to [ 'lib', $(BASEEXT) ]. The directories will |
40000a8c |
369 | be scanned and any files they contain will |
75f92628 |
370 | be installed in the corresponding location in the library. |
371 | A MY::libscan() function can be used to alter the behaviour. |
372 | Defining PM in the Makefile.PL will override PMLIBDIRS. |
373 | |
42793c05 |
374 | PM: Hashref of .pm files and *.pl files to be installed. |
375 | e.g. { 'name_of_file.pm' => '$(INST_LIBDIR)/install_as.pm' } |
376 | By default this will include *.pm and *.pl. If a lib directory |
377 | exists and is not listed in DIR (above) then any *.pm and |
378 | *.pl files it contains will also be included by default. |
75f92628 |
379 | Defining PM in the Makefile.PL will override PMLIBDIRS. |
42793c05 |
380 | |
381 | XS: Hashref of .xs files. MakeMaker will default this. |
382 | e.g. { 'name_of_file.xs' => 'name_of_file.c' } |
383 | The .c files will automatically be included in the list |
384 | of files deleted by a make clean. |
385 | |
386 | C: Ref to array of *.c file names. Initialised from a directory scan |
387 | and the values portion of the XS attribute hash. This is not |
388 | currently used by MakeMaker but may be handy in Makefile.PLs. |
389 | |
390 | H: Ref to array of *.h file names. Similar to C: above. |
391 | |
40000a8c |
392 | EXE_FILES: Ref to array of executable files. The files will be copied to |
393 | the INST_EXE directory. The installed files will be deleted |
394 | by a make realclean. |
395 | |
396 | INST_EXE: Directory, where executable scripts should be installed. Defaults |
397 | to "./blib", just to have a dummy location during testing. |
398 | C<make install> will set INST_EXE to $Config{'installbin'}. |
399 | |
42793c05 |
400 | LINKTYPE: =>'static' or 'dynamic' (default unless usedl=undef in config.sh) |
401 | Should only be used to force static linking (also see linkext below). |
402 | |
1aef975c |
403 | DL_FUNCS: Hashref of symbol names for routines to be made available as |
404 | universal symbols. Each key/value pair consists of the package |
405 | name and an array of routine names in that package. Used only |
406 | under AIX (export lists) and VMS (linker options) at present. |
407 | The routine names supplied will be expanded in the same way |
408 | as XSUB names are expanded by the XS() macro. |
409 | Defaults to { "$(NAME)" => [ "boot_$(NAME)" ] }. |
410 | (e.g. { "RPC" => [qw( boot_rpcb rpcb_gettime getnetconfigent )], |
411 | "NetconfigPtr" => [ 'DESTROY'] } ) |
412 | |
413 | DL_VARS: Array of symbol names for variables to be made available as |
414 | universal symbols. Used only under AIX (export lists) and VMS |
415 | (linker options) at present. Defaults to []. |
416 | (e.g. [ qw( Foo_version Foo_numstreams Foo_tree ) ]) |
fed7345c |
417 | |
42793c05 |
418 | CONFIG: =>[qw(archname manext)] defines ARCHNAME & MANEXT from config.sh |
419 | SKIP: =>[qw(name1 name2)] skip (do not write) sections of the Makefile |
420 | |
40000a8c |
421 | MAP_TARGET: If it is intended, that a new perl binary be produced, this variable |
422 | may hold a name for that binary. Defaults to C<perl> |
423 | |
424 | LIBPERL_A: The filename of the perllibrary that will be used together |
425 | with this extension. Defaults to C<libperl.a>. |
426 | |
42793c05 |
427 | PERL: |
428 | FULLPERL: |
429 | |
430 | Additional lowercase attributes can be used to pass parameters to the |
431 | methods which implement that part of the Makefile. These are not |
432 | normally required: |
433 | |
434 | installpm: {SPLITLIB => '$(INST_LIB)' (default) or '$(INST_ARCHLIB)'} |
435 | linkext: {LINKTYPE => 'static', 'dynamic' or ''} |
75f92628 |
436 | dynamic_lib: {ARMAYBE => 'ar', OTHERLDFLAGS => '...'} |
42793c05 |
437 | clean: {FILES => "*.xyz foo"} |
3edbfbe5 |
438 | realclean: {FILES => '$(INST_ARCHAUTODIR)/*.xyz'} |
42793c05 |
439 | distclean: {TARNAME=>'MyTarFile', TARFLAGS=>'cvfF', COMPRESS=>'gzip'} |
440 | tool_autosplit: {MAXLEN => 8} |
441 | END |
442 | |
3edbfbe5 |
443 | sub help {print $Attrib_Help;} |
444 | |
42793c05 |
445 | @MM_Sections_spec = ( |
446 | 'post_initialize' => {}, |
42793c05 |
447 | 'const_config' => {}, |
1aef975c |
448 | 'constants' => {}, |
42793c05 |
449 | 'const_loadlibs' => {}, |
450 | 'const_cccmd' => {}, |
451 | 'tool_autosplit' => {}, |
452 | 'tool_xsubpp' => {}, |
453 | 'tools_other' => {}, |
454 | 'post_constants' => {}, |
455 | 'c_o' => {}, |
456 | 'xs_c' => {}, |
457 | 'xs_o' => {}, |
458 | 'top_targets' => {}, |
459 | 'linkext' => {}, |
1aef975c |
460 | 'dlsyms' => {}, |
42793c05 |
461 | 'dynamic' => {}, |
462 | 'dynamic_bs' => {}, |
463 | 'dynamic_lib' => {}, |
464 | 'static' => {}, |
465 | 'static_lib' => {}, |
466 | 'installpm' => {}, |
40000a8c |
467 | 'installbin' => {}, |
42793c05 |
468 | 'subdirs' => {}, |
469 | 'clean' => {}, |
470 | 'realclean' => {}, |
471 | 'distclean' => {}, |
472 | 'test' => {}, |
473 | 'install' => {}, |
474 | 'force' => {}, |
475 | 'perldepend' => {}, |
476 | 'makefile' => {}, |
477 | 'postamble' => {}, |
fed7345c |
478 | 'staticmake' => {}, |
42793c05 |
479 | ); |
480 | %MM_Sections = @MM_Sections_spec; # looses section ordering |
481 | @MM_Sections = grep(!ref, @MM_Sections_spec); # keeps order |
482 | |
483 | %Recognized_Att_Keys = %MM_Sections; # All sections are valid keys. |
484 | foreach(split(/\n/,$Attrib_Help)){ |
485 | chomp; |
486 | next unless m/^\s*(\w+):\s*(.*)/; |
487 | $Recognized_Att_Keys{$1} = $2; |
488 | print "Attribute '$1' => '$2'\n" if ($Verbose >= 2); |
489 | } |
490 | |
491 | %att = (); |
492 | %skip = (); |
493 | |
494 | sub skipcheck{ |
495 | my($section) = @_; |
1aef975c |
496 | if ($section eq 'dynamic') { |
fed7345c |
497 | print STDOUT "Warning (non-fatal): Target 'dynamic' depends on targets " |
1aef975c |
498 | . "in skipped section 'dynamic_bs'\n" |
499 | if $skip{'dynamic_bs'} && $Verbose; |
fed7345c |
500 | print STDOUT "Warning (non-fatal): Target 'dynamic' depends on targets " |
1aef975c |
501 | . "in skipped section 'dynamic_lib'\n" |
502 | if $skip{'dynamic_lib'} && $Verbose; |
503 | } |
504 | if ($section eq 'dynamic_lib') { |
fed7345c |
505 | print STDOUT "Warning (non-fatal): Target '\$(INST_DYNAMIC)' depends on " |
1aef975c |
506 | . "targets in skipped section 'dynamic_bs'\n" |
507 | if $skip{'dynamic_bs'} && $Verbose; |
508 | } |
509 | if ($section eq 'static') { |
fed7345c |
510 | print STDOUT "Warning (non-fatal): Target 'static' depends on targets " |
1aef975c |
511 | . "in skipped section 'static_lib'\n" |
512 | if $skip{'static_lib'} && $Verbose; |
513 | } |
42793c05 |
514 | return 'skipped' if $skip{$section}; |
515 | return ''; |
516 | } |
517 | |
518 | |
519 | sub WriteMakefile { |
a0d0e21e |
520 | %att = @_; |
521 | local($\)="\n"; |
522 | |
a0d0e21e |
523 | print STDOUT "MakeMaker" if $Verbose; |
a0d0e21e |
524 | |
42793c05 |
525 | parse_args(\%att, @ARGV); |
526 | my(%initial_att) = %att; # record initial attributes |
a0d0e21e |
527 | |
75f92628 |
528 | MY->init_main(); |
a0d0e21e |
529 | |
42793c05 |
530 | print STDOUT "Writing Makefile for $att{NAME}"; |
a0d0e21e |
531 | |
75f92628 |
532 | MY->init_dirscan(); |
533 | MY->init_others(); |
534 | |
42793c05 |
535 | unlink("Makefile", "MakeMaker.tmp", $Is_VMS ? 'Descrip.MMS' : ''); |
536 | open MAKE, ">MakeMaker.tmp" or die "Unable to open MakeMaker.tmp: $!"; |
537 | select MAKE; $|=1; select STDOUT; |
a0d0e21e |
538 | |
42793c05 |
539 | print MAKE "# This Makefile is for the $att{NAME} extension to perl.\n#"; |
75f92628 |
540 | print MAKE "# It was generated automatically by MakeMaker version $Version from the contents"; |
42793c05 |
541 | print MAKE "# of Makefile.PL. Don't edit this file, edit Makefile.PL instead."; |
542 | print MAKE "#\n# ANY CHANGES MADE HERE WILL BE LOST! \n#"; |
543 | print MAKE "# MakeMaker Parameters: "; |
544 | foreach $key (sort keys %initial_att){ |
545 | my($v) = neatvalue($initial_att{$key}); |
546 | $v =~ tr/\n/ /s; |
547 | print MAKE "# $key => $v"; |
548 | } |
a0d0e21e |
549 | |
42793c05 |
550 | # build hash for SKIP to make testing easy |
551 | %skip = map( ($_,1), @{$att{'SKIP'} || []}); |
552 | |
553 | foreach $section ( @MM_Sections ){ |
554 | print "Processing Makefile '$section' section" if ($Verbose >= 2); |
555 | my($skipit) = skipcheck($section); |
556 | if ($skipit){ |
557 | print MAKE "\n# --- MakeMaker $section section $skipit."; |
558 | } else { |
559 | my(%a) = %{$att{$section} || {}}; |
560 | print MAKE "\n# --- MakeMaker $section section:"; |
75f92628 |
561 | print MAKE "# ",%a if $Verbose; |
42793c05 |
562 | print(MAKE MY->nicetext(MY->$section( %a ))); |
563 | } |
564 | } |
a0d0e21e |
565 | |
42793c05 |
566 | if ($Verbose){ |
567 | print MAKE "\n# Full list of MakeMaker attribute values:"; |
568 | foreach $key (sort keys %att){ |
569 | my($v) = neatvalue($att{$key}); |
570 | $v =~ tr/\n/ /s; |
571 | print MAKE "# $key => $v"; |
572 | } |
573 | } |
a0d0e21e |
574 | |
42793c05 |
575 | print MAKE "\n# End."; |
a0d0e21e |
576 | close MAKE; |
42793c05 |
577 | my($finalname) = $Is_VMS ? "Descrip.MMS" : "Makefile"; |
578 | rename("MakeMaker.tmp", $finalname); |
579 | |
580 | chmod 0644, $finalname; |
581 | system("$Config{'eunicefix'} $finalname") unless $Config{'eunicefix'} eq ":"; |
a0d0e21e |
582 | |
583 | 1; |
584 | } |
585 | |
586 | |
587 | sub mkbootstrap{ |
42793c05 |
588 | parse_args(\%att, @ARGV); |
589 | MY->mkbootstrap(@_); |
a0d0e21e |
590 | } |
591 | |
1aef975c |
592 | sub mksymlists{ |
593 | %att = @_; |
594 | parse_args(\%att, @ARGV); |
595 | MY->mksymlists(@_); |
596 | } |
a0d0e21e |
597 | |
42793c05 |
598 | sub parse_args{ |
599 | my($attr, @args) = @_; |
600 | foreach (@args){ |
75f92628 |
601 | unless (m/(.*?)=(.*)/){ |
602 | help(),exit 1 if m/^help$/; |
603 | ++$Verbose if m/^verb/; |
604 | next; |
605 | } |
606 | my($name, $value) = ($1, $2); |
607 | if ($value =~ m/^~(\w+)?/){ # tilde with optional username |
608 | my($home) = ($1) ? (getpwnam($1))[7] : (getpwuid($>))[7]; |
609 | $value =~ s/^~(\w+)?/$home/; |
610 | } |
611 | $$attr{$name} = $value; |
42793c05 |
612 | } |
613 | # catch old-style 'potential_libs' and inform user how to 'upgrade' |
614 | if (defined $$attr{'potential_libs'}){ |
615 | my($msg)="'potential_libs' => '$$attr{potential_libs}' should be"; |
616 | if ($$attr{'potential_libs'}){ |
fed7345c |
617 | print STDOUT "$msg changed to:\n\t'LIBS' => ['$$attr{potential_libs}']\n"; |
42793c05 |
618 | } else { |
fed7345c |
619 | print STDOUT "$msg deleted.\n"; |
42793c05 |
620 | } |
621 | $$attr{LIBS} = [$$attr{'potential_libs'}]; |
622 | delete $$attr{'potential_libs'}; |
623 | } |
624 | # catch old-style 'ARMAYBE' and inform user how to 'upgrade' |
625 | if (defined $$attr{'ARMAYBE'}){ |
626 | my($armaybe) = $$attr{'ARMAYBE'}; |
fed7345c |
627 | print STDOUT "ARMAYBE => '$armaybe' should be changed to:\n", |
42793c05 |
628 | "\t'dynamic_lib' => {ARMAYBE => '$armaybe'}\n"; |
629 | my(%dl) = %{$$attr{'dynamic_lib'} || {}}; |
630 | $$attr{'dynamic_lib'} = { %dl, ARMAYBE => $armaybe}; |
631 | delete $$attr{'ARMAYBE'}; |
632 | } |
75f92628 |
633 | if (defined $$attr{'LDTARGET'}){ |
fed7345c |
634 | print STDOUT "LDTARGET should be changed to LDFROM\n"; |
75f92628 |
635 | $$attr{'LDFROM'} = $$attr{'LDTARGET'}; |
636 | delete $$attr{'LDTARGET'}; |
637 | } |
42793c05 |
638 | foreach(sort keys %{$attr}){ |
639 | print STDOUT " $_ => ".neatvalue($$attr{$_}) if ($Verbose); |
fed7345c |
640 | print STDOUT "'$_' is not a known MakeMaker parameter name.\n" |
42793c05 |
641 | unless exists $Recognized_Att_Keys{$_}; |
642 | } |
a0d0e21e |
643 | } |
644 | |
645 | |
42793c05 |
646 | sub neatvalue{ |
647 | my($v) = @_; |
fed7345c |
648 | return "undef" unless defined $v; |
42793c05 |
649 | my($t) = ref $v; |
650 | return "'$v'" unless $t; |
651 | return "[ ".join(', ',map("'$_'",@$v))." ]" if ($t eq 'ARRAY'); |
652 | return "$v" unless $t eq 'HASH'; |
653 | my(@m, $key, $val); |
654 | push(@m,"$key=>".neatvalue($val)) while (($key,$val) = each %$v); |
655 | return "{ ".join(', ',@m)." }"; |
656 | } |
657 | |
658 | |
659 | # ------ Define the MakeMaker default methods in package MM_Unix ------ |
a0d0e21e |
660 | |
42793c05 |
661 | package MM_Unix; |
a0d0e21e |
662 | |
663 | use Config; |
42793c05 |
664 | use Cwd; |
665 | use File::Basename; |
a0d0e21e |
666 | require Exporter; |
667 | |
42793c05 |
668 | Exporter::import('ExtUtils::MakeMaker', |
669 | qw(%att %skip %Recognized_Att_Keys $Verbose)); |
a0d0e21e |
670 | |
42793c05 |
671 | # These attributes cannot be overridden externally |
672 | @Other_Att_Keys{qw(EXTRALIBS BSLOADLIBS LDLOADLIBS)} = (1) x 3; |
a0d0e21e |
673 | |
42793c05 |
674 | if ($Is_VMS = $Config{'osname'} eq 'VMS') { |
675 | require File::VMSspec; |
676 | import File::VMSspec 'vmsify'; |
a0d0e21e |
677 | } |
678 | |
679 | |
75f92628 |
680 | sub init_main { |
42793c05 |
681 | # Find out directory name. This may contain the extension name. |
682 | my($pwd) = fastcwd(); # from Cwd.pm |
683 | |
684 | # --- Initialize PERL_LIB, INST_LIB, PERL_SRC |
685 | |
686 | # *Real* information: where did we get these two from? ... |
687 | $inc_config_dir = dirname($INC{'Config.pm'}); |
688 | $inc_carp_dir = dirname($INC{'Carp.pm'}); |
689 | |
690 | # Typically PERL_* and INST_* will be identical but that need |
691 | # not be the case (e.g., installing into project libraries etc). |
692 | |
693 | # Perl Macro: With source No source |
694 | # PERL_LIB ../../lib /usr/local/lib/perl5 |
695 | # PERL_ARCHLIB ../../lib /usr/local/lib/perl5/sun4-sunos |
e1666bf5 |
696 | # PERL_SRC ../.. (undefined) |
42793c05 |
697 | |
698 | # INST Macro: Locally Publically |
3edbfbe5 |
699 | # INST_LIB ../../lib ./blib |
700 | # INST_ARCHLIB ../../lib ./blib |
42793c05 |
701 | |
702 | unless ($att{PERL_SRC}){ |
a0d0e21e |
703 | foreach(qw(../.. ../../.. ../../../..)){ |
42793c05 |
704 | ($att{PERL_SRC}=$_, last) if -f "$_/config.sh"; |
a0d0e21e |
705 | } |
a0d0e21e |
706 | } |
42793c05 |
707 | unless ($att{PERL_SRC}){ |
42793c05 |
708 | # we should also consider $ENV{PERL5LIB} here |
709 | $att{PERL_LIB} = $Config{'privlib'} unless $att{PERL_LIB}; |
710 | $att{PERL_ARCHLIB} = $Config{'archlib'} unless $att{PERL_ARCHLIB}; |
e1666bf5 |
711 | $att{PERL_INC} = "$att{PERL_ARCHLIB}/CORE"; # wild guess for now |
fed7345c |
712 | die "Unable to locate Perl source. Try setting PERL_SRC in Makefile.PL or on command line.\n" |
e1666bf5 |
713 | unless (-f "$att{PERL_INC}/perl.h"); |
fed7345c |
714 | print STDOUT "Using header files found in $att{PERL_INC}" if $Verbose; |
42793c05 |
715 | } else { |
716 | $att{PERL_LIB} = "$att{PERL_SRC}/lib" unless $att{PERL_LIB}; |
717 | $att{PERL_ARCHLIB} = $att{PERL_LIB}; |
e1666bf5 |
718 | $att{PERL_INC} = $att{PERL_SRC}; |
42793c05 |
719 | } |
720 | |
721 | # INST_LIB typically pre-set if building an extension after |
722 | # perl has been built and installed. Setting INST_LIB allows |
3edbfbe5 |
723 | # you to build directly into privlib and avoid installperl. |
724 | unless ($att{INST_LIB}){ |
725 | if (defined $att{PERL_SRC}) { |
726 | $att{INST_LIB} = $att{PERL_LIB}; |
727 | } else { |
728 | $att{INST_LIB} = "$pwd/blib"; |
729 | } |
730 | } |
42793c05 |
731 | # Try to work out what INST_ARCHLIB should be if not set: |
732 | unless ($att{INST_ARCHLIB}){ |
733 | my(%archmap) = ( |
3edbfbe5 |
734 | "$pwd/blib" => "$pwd/blib", # our private build lib |
42793c05 |
735 | $att{PERL_LIB} => $att{PERL_ARCHLIB}, |
736 | $Config{'privlib'} => $Config{'archlib'}, |
737 | $Config{'installprivlib'} => $Config{'installarchlib'}, |
738 | $inc_carp_dir => $inc_config_dir, |
739 | ); |
740 | $att{INST_ARCHLIB} = $archmap{$att{INST_LIB}}; |
75f92628 |
741 | unless($att{INST_ARCHLIB}){ |
742 | # Oh dear, we'll have to default it and warn the user |
743 | my($archname) = $Config{'archname'}; |
744 | if (-d "$att{INST_LIB}/$archname"){ |
745 | $att{INST_ARCHLIB} = "$att{INST_LIB}/$archname"; |
fed7345c |
746 | print STDOUT "Defaulting INST_ARCHLIB to INST_LIB/$archname\n"; |
75f92628 |
747 | } else { |
748 | $att{INST_ARCHLIB} = $att{INST_LIB}; |
fed7345c |
749 | print STDOUT "Warning: Defaulting INST_ARCHLIB to INST_LIB ", |
75f92628 |
750 | "(not architecture independent).\n"; |
751 | } |
752 | } |
40000a8c |
753 | $att{INST_EXE} = "./blib" unless $att{INST_EXE}; |
754 | $att{MAP_TARGET} = "perl" unless $att{MAP_TARGET}; |
755 | $att{LIBPERL_A} = 'libperl.a' unless $att{LIBPERL_A}; |
42793c05 |
756 | } |
757 | |
758 | # make a few simple checks |
759 | die "PERL_LIB ($att{PERL_LIB}) is not a perl library directory" |
760 | unless (-f "$att{PERL_LIB}/Exporter.pm"); |
761 | |
762 | # --- Initialize Module Name and Paths |
a0d0e21e |
763 | |
42793c05 |
764 | # NAME = The perl module name for this extension (eg DBD::Oracle). |
765 | # FULLEXT = Pathname for extension directory (eg DBD/Oracle). |
a0d0e21e |
766 | # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. |
42793c05 |
767 | # ROOTEXT = Directory part of FULLEXT with leading /. |
768 | unless($att{NAME}){ # we have to guess our name |
769 | my($name) = $pwd; |
770 | if ($Is_VMS) { |
1aef975c |
771 | $name =~ s:.*?([^.\]]+)\]:$1: unless ($name =~ s:.*[.\[]ext\.(.*)\]:$1:i); |
42793c05 |
772 | ($att{NAME}=$name) =~ s#[.\]]#::#g; |
773 | } else { |
774 | $name =~ s:.*/:: unless ($name =~ s:^.*/ext/::); |
775 | ($att{NAME} =$name) =~ s#/#::#g; |
776 | } |
777 | } |
778 | ($att{FULLEXT} =$att{NAME}) =~ s#::#/#g ; #eg. BSD/Foo/Socket |
779 | ($att{BASEEXT} =$att{NAME}) =~ s#.*::##; #eg. Socket |
780 | ($att{ROOTEXT} =$att{FULLEXT}) =~ s#/?\Q$att{BASEEXT}\E$## ; # eg. /BSD/Foo |
1aef975c |
781 | $att{ROOTEXT} = ($Is_VMS ? '' : '/') . $att{ROOTEXT} if $att{ROOTEXT}; |
42793c05 |
782 | |
fed7345c |
783 | ($att{DISTNAME}=$att{NAME}) =~ s#(::)#-#g unless $att{DISTNAME}; |
42793c05 |
784 | $att{VERSION} = "0.1" unless $att{VERSION}; |
785 | |
786 | |
787 | # --- Initialize Perl Binary Locations |
788 | |
789 | # Find Perl 5. The only contract here is that both 'PERL' and 'FULLPERL' |
75f92628 |
790 | # will be working versions of perl 5. miniperl has priority over perl |
791 | # for PERL to ensure that $(PERL) is usable while building ./ext/* |
792 | $att{'PERL'} = MY->find_perl(5.0, [ qw(miniperl perl) ], |
fed7345c |
793 | [ grep defined $_, $att{PERL_SRC}, split(":", $ENV{PATH}), $Config{'bin'} ], $Verbose ) |
42793c05 |
794 | unless ($att{'PERL'} && -x $att{'PERL'}); |
a0d0e21e |
795 | |
42793c05 |
796 | # Define 'FULLPERL' to be a non-miniperl (used in test: target) |
797 | ($att{'FULLPERL'} = $att{'PERL'}) =~ s/miniperl/perl/ |
798 | unless ($att{'FULLPERL'} && -x $att{'FULLPERL'}); |
a0d0e21e |
799 | |
42793c05 |
800 | if ($Is_VMS) { |
1aef975c |
801 | $att{'PERL'} = 'MCR ' . vmsify($att{'PERL'}); |
802 | $att{'FULLPERL'} = 'MCR ' . vmsify($att{'FULLPERL'}); |
42793c05 |
803 | } |
75f92628 |
804 | } |
42793c05 |
805 | |
42793c05 |
806 | |
75f92628 |
807 | sub init_dirscan { # --- File and Directory Lists (.xs .pm etc) |
808 | |
809 | my($name, %dir, %xs, %c, %h, %ignore); |
810 | local(%pm); #the sub in find() has to see this hash |
811 | $ignore{'test.pl'} = 1; |
812 | $ignore{'makefile.pl'} = 1 if $Is_VMS; |
813 | foreach $name (lsdir(".")){ |
814 | next if ($name =~ /^\./ or $ignore{$name}); |
815 | if (-d $name){ |
816 | $dir{$name} = $name if (-f "$name/Makefile.PL"); |
817 | } elsif ($name =~ /\.xs$/){ |
818 | my($c); ($c = $name) =~ s/\.xs$/.c/; |
819 | $xs{$name} = $c; |
820 | $c{$c} = 1; |
821 | } elsif ($name =~ /\.c$/){ |
822 | $c{$name} = 1; |
823 | } elsif ($name =~ /\.h$/){ |
824 | $h{$name} = 1; |
825 | } elsif ($name =~ /\.p[ml]$/){ |
826 | $pm{$name} = "\$(INST_LIBDIR)/$name"; |
3edbfbe5 |
827 | } |
75f92628 |
828 | } |
3edbfbe5 |
829 | |
75f92628 |
830 | # Some larger extensions often wish to install a number of *.pm/pl |
831 | # files into the library in various locations. |
832 | |
833 | # The attribute PMLIBDIRS holds an array reference which lists |
834 | # subdirectories which we should search for library files to |
835 | # install. PMLIBDIRS defaults to [ 'lib', $att{BASEEXT} ]. |
836 | # We recursively search through the named directories (skipping |
837 | # any which don't exist or contain Makefile.PL files). |
838 | |
839 | # For each *.pm or *.pl file found MY->libscan() is called with |
840 | # the default installation path in $_. The return value of libscan |
841 | # defines the actual installation location. |
842 | # The default libscan function simply returns $_. |
843 | # The file is skipped if libscan returns false. |
844 | |
845 | # The default installation location passed to libscan in $_ is: |
846 | # |
847 | # ./*.pm => $(INST_LIBDIR)/*.pm |
848 | # ./xyz/... => $(INST_LIBDIR)/xyz/... |
849 | # ./lib/... => $(INST_LIB)/... |
850 | # |
851 | # In this way the 'lib' directory is seen as the root of the actual |
852 | # perl library whereas the others are relative to INST_LIBDIR |
853 | # (which includes ROOTEXT). This is a subtle distinction but one |
854 | # that's important for nested modules. |
855 | |
856 | $att{PMLIBDIRS} = [ 'lib', $att{BASEEXT} ] unless $att{PMLIBDIRS}; |
857 | |
858 | #only existing directories that aren't in $dir are allowed |
859 | @{$att{PMLIBDIRS}} = grep -d && !$dir{$_}, @{$att{PMLIBDIRS}}; |
860 | |
861 | if (@{$att{PMLIBDIRS}}){ |
862 | print "Searching PMLIBDIRS: @{$att{PMLIBDIRS}}" |
863 | if ($Verbose >= 2); |
864 | use File::Find; # try changing to require ! |
865 | File::Find::find(sub { |
fed7345c |
866 | # We now allow any file in PMLIBDIRS to be installed. nTk needs that, and |
867 | # we should allow it. |
868 | # return unless m/\.p[ml]$/; |
869 | return if -d $_; # anything else that Can't be copied? |
75f92628 |
870 | my($path, $prefix) = ($File::Find::name, '$(INST_LIBDIR)'); |
40000a8c |
871 | my $striplibpath; |
872 | $prefix = '$(INST_LIB)' if (($striplibpath = $path) =~ s:^lib/::); |
873 | local($_) = "$prefix/$striplibpath"; |
75f92628 |
874 | my($inst) = MY->libscan(); |
875 | print "libscan($path) => '$inst'" if ($Verbose >= 2); |
876 | return unless $inst; |
1aef975c |
877 | $pm{$path} = $inst; |
75f92628 |
878 | }, @{$att{PMLIBDIRS}}); |
42793c05 |
879 | } |
880 | |
75f92628 |
881 | $att{DIR} = [sort keys %dir] unless $att{DIRS}; |
882 | $att{XS} = \%xs unless $att{XS}; |
883 | $att{PM} = \%pm unless $att{PM}; |
884 | $att{C} = [sort keys %c] unless $att{C}; |
1aef975c |
885 | my(@o_files) = @{$att{C}}; |
886 | my($sufx) = $Is_VMS ? '.obj' : '.o'; |
887 | $att{O_FILES} = [grep s/\.c$/$sufx/, @o_files] ; |
75f92628 |
888 | $att{H} = [sort keys %h] unless $att{H}; |
889 | } |
890 | |
891 | |
892 | sub libscan { |
40000a8c |
893 | return undef if m:/RCS/: ; |
75f92628 |
894 | $_; |
895 | } |
896 | |
75f92628 |
897 | sub init_others { # --- Initialize Other Attributes |
42793c05 |
898 | |
899 | for $key (keys(%Recognized_Att_Keys), keys(%Other_Att_Keys)){ |
a0d0e21e |
900 | # avoid warnings for uninitialized vars |
42793c05 |
901 | next if exists $att{$key}; |
902 | $att{$key} = ""; |
a0d0e21e |
903 | } |
904 | |
42793c05 |
905 | # Compute EXTRALIBS, BSLOADLIBS and LDLOADLIBS from $att{'LIBS'} |
906 | # Lets look at $att{LIBS} carefully: It may be an anon array, a string or |
907 | # undefined. In any case we turn it into an anon array: |
908 | $att{LIBS}=[] unless $att{LIBS}; |
909 | $att{LIBS}=[$att{LIBS}] if ref \$att{LIBS} eq SCALAR; |
910 | foreach ( @{$att{'LIBS'}} ){ |
911 | s/^\s*(.*\S)\s*$/$1/; # remove leading and trailing whitespace |
912 | my(@libs) = MY->extliblist($_); |
913 | if ($libs[0] or $libs[1] or $libs[2]){ |
914 | @att{EXTRALIBS, BSLOADLIBS, LDLOADLIBS} = @libs; |
915 | last; |
916 | } |
917 | } |
a0d0e21e |
918 | |
fed7345c |
919 | print STDOUT "CONFIG must be an array ref\n" |
42793c05 |
920 | if ($att{CONFIG} and ref $att{CONFIG} ne 'ARRAY'); |
921 | $att{CONFIG} = [] unless (ref $att{CONFIG}); |
922 | push(@{$att{CONFIG}}, |
923 | qw( cc libc ldflags lddlflags ccdlflags cccdlflags |
924 | ranlib so dlext dlsrc installprivlib installarchlib |
925 | )); |
926 | push(@{$att{CONFIG}}, 'shellflags') if $Config{'shellflags'}; |
927 | |
928 | if ($Is_VMS) { |
42793c05 |
929 | $att{OBJECT} = '$(BASEEXT).obj' unless $att{OBJECT}; |
930 | $att{OBJECT} =~ s/[^,\s]\s+/, /g; |
931 | $att{OBJECT} =~ s/\n+/, /g; |
1aef975c |
932 | $att{OBJECT} =~ s#\.o,#\.obj,#; |
42793c05 |
933 | } else { |
934 | $att{OBJECT} = '$(BASEEXT).o' unless $att{OBJECT}; |
935 | $att{OBJECT} =~ s/\n+/ \\\n\t/g; |
a0d0e21e |
936 | } |
42793c05 |
937 | $att{BOOTDEP} = (-f "$att{BASEEXT}_BS") ? "$att{BASEEXT}_BS" : ""; |
e1666bf5 |
938 | $att{LD} = ($Config{'ld'} || 'ld') unless $att{LD}; |
3edbfbe5 |
939 | $att{LDFROM} = '$(OBJECT)' unless $att{LDFROM}; |
1aef975c |
940 | # Sanity check: don't define LINKTYPE = dynamic if we're skipping |
941 | # the 'dynamic' section of MM. We don't have this problem with |
942 | # 'static', since we either must use it (%Config says we can't |
943 | # use dynamic loading) or the caller asked for it explicitly. |
944 | if (!$att{LINKTYPE}) { |
945 | $att{LINKTYPE} = grep(/dynamic/,@{$att{SKIP} || []}) |
946 | ? 'static' |
947 | : ($Config{'usedl'} ? 'dynamic' : 'static'); |
948 | }; |
42793c05 |
949 | |
3edbfbe5 |
950 | # These get overridden for VMS and maybe some other systems |
951 | $att{NOOP} = ""; |
1aef975c |
952 | $att{MAKEFILE} = "Makefile"; |
3edbfbe5 |
953 | $att{RM_F} = "rm -f"; |
954 | $att{RM_RF} = "rm -rf"; |
955 | $att{TOUCH} = "touch"; |
956 | $att{CP} = "cp"; |
75f92628 |
957 | $att{MV} = "mv"; |
a0d0e21e |
958 | } |
959 | |
960 | |
42793c05 |
961 | sub lsdir{ |
3edbfbe5 |
962 | my($dir, $regex) = @_; |
42793c05 |
963 | local(*DIR, @ls); |
964 | opendir(DIR, $_[0] || ".") or die "opendir: $!"; |
965 | @ls = readdir(DIR); |
966 | closedir(DIR); |
3edbfbe5 |
967 | @ls = grep(/$regex/, @ls) if $regex; |
42793c05 |
968 | @ls; |
969 | } |
970 | |
971 | |
972 | sub find_perl{ |
973 | my($self, $ver, $names, $dirs, $trace) = @_; |
974 | my($name, $dir); |
fed7345c |
975 | if ($trace){ |
976 | print "Looking for perl $ver by these names: "; |
977 | print "@$names, "; |
978 | print "in these dirs:"; |
979 | print "@$dirs"; |
980 | } |
42793c05 |
981 | foreach $dir (@$dirs){ |
3edbfbe5 |
982 | next unless defined $dir; # $att{PERL_SRC} may be undefined |
42793c05 |
983 | foreach $name (@$names){ |
fed7345c |
984 | print "checking $dir/$name" if ($trace >= 2); |
42793c05 |
985 | if ($Is_VMS) { |
986 | $name .= ".exe" unless -x "$dir/$name"; |
987 | } |
988 | next unless -x "$dir/$name"; |
fed7345c |
989 | print "Executing $dir/$name" if ($trace); |
42793c05 |
990 | my($out); |
991 | if ($Is_VMS) { |
992 | my($vmscmd) = 'MCR ' . vmsify("$dir/$name"); |
993 | $out = `$vmscmd -e "require $ver; print ""VER_OK\n"""`; |
994 | } else { |
995 | $out = `$dir/$name -e 'require $ver; print "VER_OK\n" ' 2>&1`; |
996 | } |
997 | return "$dir/$name" if $out =~ /VER_OK/; |
a0d0e21e |
998 | } |
999 | } |
fed7345c |
1000 | print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n"; |
42793c05 |
1001 | 0; # false and not empty |
a0d0e21e |
1002 | } |
1003 | |
1004 | |
1005 | sub post_initialize{ |
1006 | ""; |
1007 | } |
fed7345c |
1008 | |
a0d0e21e |
1009 | |
1010 | sub constants { |
1011 | my(@m); |
1012 | |
a0d0e21e |
1013 | push @m, " |
42793c05 |
1014 | NAME = $att{NAME} |
a0d0e21e |
1015 | DISTNAME = $att{DISTNAME} |
1016 | VERSION = $att{VERSION} |
1017 | |
42793c05 |
1018 | # In which library should we install this extension? |
1019 | # This is typically the same as PERL_LIB. |
1020 | # (also see INST_LIBDIR and relationship to ROOTEXT) |
1021 | INST_LIB = $att{INST_LIB} |
1022 | INST_ARCHLIB = $att{INST_ARCHLIB} |
40000a8c |
1023 | INST_EXE = $att{INST_EXE} |
42793c05 |
1024 | |
1025 | # Perl library to use when building the extension |
1026 | PERL_LIB = $att{PERL_LIB} |
1027 | PERL_ARCHLIB = $att{PERL_ARCHLIB} |
40000a8c |
1028 | LIBPERL_A = $att{LIBPERL_A} |
75f92628 |
1029 | "; |
42793c05 |
1030 | |
75f92628 |
1031 | # Define I_PERL_LIBS to include the required -Ipaths |
1032 | # To be cute we only include PERL_ARCHLIB if different |
1033 | # To be portable we add quotes for VMS |
1034 | my(@i_perl_libs) = qw{-I$(PERL_ARCHLIB) -I$(PERL_LIB)}; |
1035 | shift(@i_perl_libs) if ($att{PERL_ARCHLIB} eq $att{PERL_LIB}); |
1036 | if ($Is_VMS){ |
1037 | push @m, "I_PERL_LIBS = \"".join('" "',@i_perl_libs)."\"\n"; |
1038 | } else { |
1039 | push @m, "I_PERL_LIBS = ".join(' ',@i_perl_libs)."\n"; |
1040 | } |
1041 | |
1042 | push @m, " |
fed7345c |
1043 | # Where is the perl source code located? |
1044 | PERL_SRC = $att{PERL_SRC}\n" if $att{PERL_SRC}; |
1045 | |
1046 | push @m, " |
42793c05 |
1047 | # Perl header files (will eventually be under PERL_LIB) |
e1666bf5 |
1048 | PERL_INC = $att{PERL_INC} |
42793c05 |
1049 | # Perl binaries |
1050 | PERL = $att{'PERL'} |
1051 | FULLPERL = $att{'FULLPERL'} |
75f92628 |
1052 | "; |
1053 | push @m, " |
42793c05 |
1054 | # FULLEXT = Pathname for extension directory (eg DBD/Oracle). |
1055 | # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. |
1056 | # ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD) |
1057 | FULLEXT = $att{FULLEXT} |
1058 | BASEEXT = $att{BASEEXT} |
1059 | ROOTEXT = $att{ROOTEXT} |
75f92628 |
1060 | "; |
1061 | push @m, " |
a0d0e21e |
1062 | INC = $att{INC} |
1063 | DEFINE = $att{DEFINE} |
1064 | OBJECT = $att{OBJECT} |
3edbfbe5 |
1065 | LDFROM = $att{LDFROM} |
a0d0e21e |
1066 | LINKTYPE = $att{LINKTYPE} |
a0d0e21e |
1067 | |
75f92628 |
1068 | # Handy lists of source code files: |
1069 | XS_FILES= ".join(" \\\n\t", sort keys %{$att{XS}})." |
1070 | C_FILES = ".join(" \\\n\t", @{$att{C}})." |
1aef975c |
1071 | O_FILES = ".join(" \\\n\t", @{$att{O_FILES}})." |
75f92628 |
1072 | H_FILES = ".join(" \\\n\t", @{$att{H}})." |
a0d0e21e |
1073 | |
42793c05 |
1074 | .SUFFIXES: .xs |
a0d0e21e |
1075 | |
42793c05 |
1076 | .PRECIOUS: Makefile |
1077 | |
75f92628 |
1078 | .PHONY: all config static dynamic test linkext |
42793c05 |
1079 | |
1080 | # This extension may link to it's own library (see SDBM_File) |
1081 | MYEXTLIB = $att{MYEXTLIB} |
1082 | |
75f92628 |
1083 | # Where is the Config information that we are using/depend on |
1084 | CONFIGDEP = \$(PERL_ARCHLIB)/Config.pm \$(PERL_INC)/config.h |
a0d0e21e |
1085 | "; |
1086 | |
1087 | push @m, ' |
1088 | # Where to put things: |
42793c05 |
1089 | INST_LIBDIR = $(INST_LIB)$(ROOTEXT) |
1090 | INST_ARCHLIBDIR = $(INST_ARCHLIB)$(ROOTEXT) |
1091 | |
3edbfbe5 |
1092 | INST_AUTODIR = $(INST_LIB)/auto/$(FULLEXT) |
1093 | INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT) |
1094 | '; |
42793c05 |
1095 | |
3edbfbe5 |
1096 | push @m, ' |
75f92628 |
1097 | INST_STATIC = $(INST_ARCHAUTODIR)/$(BASEEXT).a |
42793c05 |
1098 | INST_DYNAMIC = $(INST_ARCHAUTODIR)/$(BASEEXT).$(DLEXT) |
75f92628 |
1099 | INST_BOOT = $(INST_ARCHAUTODIR)/$(BASEEXT).bs |
42793c05 |
1100 | INST_PM = '.join(" \\\n\t", sort values %{$att{PM}}).' |
1101 | '; |
1102 | |
1103 | join('',@m); |
1104 | } |
1105 | |
1106 | |
1107 | sub const_cccmd{ |
40000a8c |
1108 | my($self,$libperl)=@_; |
1109 | $libperl or $libperl = $att{LIBPERL_A} || "libperl.a" ; |
75f92628 |
1110 | # This is implemented in the same manner as extliblist, |
1111 | # e.g., do both and compare results during the transition period. |
1112 | my($cc,$ccflags,$optimize,$large,$split, $shflags) |
1113 | = @Config{qw(cc ccflags optimize large split shellflags)}; |
1114 | $shflags = '' unless $shflags; |
40000a8c |
1115 | my($prog, $old, $uc, $perltype); |
75f92628 |
1116 | |
40000a8c |
1117 | chop($old = `cd $att{PERL_SRC}; sh $shflags ./cflags $libperl $att{BASEEXT}.c 2>/dev/null`) |
e1666bf5 |
1118 | if $att{PERL_SRC}; |
1119 | |
40000a8c |
1120 | my(%map) = ( |
1121 | D => '-DDEBUGGING', |
1122 | E => '-DEMBED', |
1123 | DE => '-DDEBUGGING -DEMBED', |
1124 | M => '-DEMBED -DMULTIPLICITY', |
1125 | DM => '-DDEBUGGING -DEMBED -DMULTIPLICITY', |
1126 | ); |
1127 | |
1128 | if ($libperl =~ /libperl(\w*)\.a/){ |
1129 | $uc = uc($1); |
1130 | } else { |
1131 | $uc = ""; # avoid warning |
1132 | } |
1133 | $perltype = $map{$uc} ? $map{$uc} : ""; |
1134 | |
1135 | if ($uc =~ /^D/) { |
1136 | $optdebug = "-g"; |
1137 | } |
1138 | |
1139 | |
1aef975c |
1140 | my($name); |
1141 | ( $name = $att{NAME} . "_cflags" ) =~ s/:/_/g ; |
1142 | if ($prog = $Config{$name}) { |
75f92628 |
1143 | # Expand hints for this extension via the shell |
fed7345c |
1144 | print STDOUT "Processing $name hint:\n" if $Verbose; |
75f92628 |
1145 | my(@o)=`cc=\"$cc\" |
1146 | ccflags=\"$ccflags\" |
1147 | optimize=\"$optimize\" |
40000a8c |
1148 | perltype=\"$perltype\" |
1149 | optdebug=\"$optdebug\" |
75f92628 |
1150 | large=\"$large\" |
1151 | split=\"$split\" |
1152 | eval '$prog' |
1153 | echo cc=\$cc |
1154 | echo ccflags=\$ccflags |
1155 | echo optimize=\$optimize |
40000a8c |
1156 | echo perltype=\$perltype |
1157 | echo optdebug=\$optdebug |
75f92628 |
1158 | echo large=\$large |
1159 | echo split=\$split |
1160 | `; |
1161 | my(%cflags); |
1162 | foreach $line (@o){ |
1163 | chomp $line; |
1164 | if ($line =~ /(.*?)=\s*(.*)\s*$/){ |
1165 | $cflags{$1} = $2; |
fed7345c |
1166 | print STDOUT " $1 = $2" if $Verbose; |
75f92628 |
1167 | } else { |
fed7345c |
1168 | print STDOUT "Unrecognised result from hint: '$line'\n"; |
75f92628 |
1169 | } |
1170 | } |
40000a8c |
1171 | ( $cc,$ccflags,$perltype,$optdebug,$optimize,$large,$split )=@cflags{ |
1172 | qw( cc ccflags perltype optdebug optimize large split)}; |
1173 | } |
1174 | |
1175 | if ($optdebug) { |
1176 | $optimize = $optdebug; |
75f92628 |
1177 | } |
1178 | |
40000a8c |
1179 | my($new) = "$cc -c $ccflags $optimize $perltype $large $split"; |
75f92628 |
1180 | if (defined($old) and $new ne $old) { |
fed7345c |
1181 | print STDOUT "Warning (non-fatal): cflags evaluation in MakeMaker differs from shell output\n" |
75f92628 |
1182 | ." package: $att{NAME}\n" |
1183 | ." old: $old\n" |
1184 | ." new: $new\n" |
1185 | ." Using 'old' set.\n" |
1186 | ."Please notify perl5-porters\@nicoh.com\n"; |
42793c05 |
1187 | } |
75f92628 |
1188 | my($cccmd)=($old) ? $old : $new; |
1189 | "CCCMD = $cccmd\n"; |
42793c05 |
1190 | } |
1191 | |
1192 | |
1193 | # --- Constants Sections --- |
1194 | |
1195 | sub const_config{ |
1196 | my(@m,$m); |
1197 | push(@m,"\n# These definitions are from config.sh (via $INC{'Config.pm'})\n"); |
1198 | my(%once_only); |
1199 | foreach $m (@{$att{'CONFIG'}}){ |
1200 | next if $once_only{$m}; |
fed7345c |
1201 | print STDOUT "CONFIG key '$m' does not exist in Config.pm\n" |
42793c05 |
1202 | unless exists $Config{$m}; |
1203 | push @m, "\U$m\E = $Config{$m}\n"; |
1204 | $once_only{$m} = 1; |
1205 | } |
1206 | join('', @m); |
1207 | } |
1208 | |
1209 | |
1210 | sub const_loadlibs{ |
1211 | " |
1212 | # $att{NAME} might depend on some other libraries: |
1213 | # (These comments may need revising:) |
1214 | # |
1215 | # Dependent libraries can be linked in one of three ways: |
1216 | # |
1217 | # 1. (For static extensions) by the ld command when the perl binary |
1218 | # is linked with the extension library. See EXTRALIBS below. |
1219 | # |
1220 | # 2. (For dynamic extensions) by the ld command when the shared |
1221 | # object is built/linked. See LDLOADLIBS below. |
1222 | # |
1223 | # 3. (For dynamic extensions) by the DynaLoader when the shared |
1224 | # object is loaded. See BSLOADLIBS below. |
1225 | # |
1226 | # EXTRALIBS = List of libraries that need to be linked with when |
1227 | # linking a perl binary which includes this extension |
1228 | # Only those libraries that actually exist are included. |
1229 | # These are written to a file and used when linking perl. |
1230 | # |
1231 | # LDLOADLIBS = List of those libraries which can or must be linked into |
1232 | # the shared library when created using ld. These may be |
1233 | # static or dynamic libraries. |
1234 | # |
1235 | # BSLOADLIBS = List of those libraries that are needed but can be |
1236 | # linked in dynamically at run time on this platform. |
1237 | # SunOS/Solaris does not need this because ld records |
1238 | # the information (from LDLOADLIBS) into the object file. |
1239 | # This list is used to create a .bs (bootstrap) file. |
42793c05 |
1240 | # |
1241 | EXTRALIBS = $att{'EXTRALIBS'} |
1242 | LDLOADLIBS = $att{'LDLOADLIBS'} |
1243 | BSLOADLIBS = $att{'BSLOADLIBS'} |
a0d0e21e |
1244 | "; |
42793c05 |
1245 | } |
a0d0e21e |
1246 | |
a0d0e21e |
1247 | |
42793c05 |
1248 | # --- Tool Sections --- |
a0d0e21e |
1249 | |
42793c05 |
1250 | sub tool_autosplit{ |
1251 | my($self, %attribs) = @_; |
1252 | my($asl) = ""; |
1253 | $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN}; |
1254 | q{ |
42793c05 |
1255 | # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto |
fed7345c |
1256 | AUTOSPLITFILE = $(PERL) $(I_PERL_LIBS) -e 'use AutoSplit;}.$asl.q{autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1) ;' |
42793c05 |
1257 | }; |
1258 | } |
a0d0e21e |
1259 | |
a0d0e21e |
1260 | |
42793c05 |
1261 | sub tool_xsubpp{ |
e1666bf5 |
1262 | my($xsdir) = '$(PERL_LIB)/ExtUtils'; |
1263 | # drop back to old location if xsubpp is not in new location yet |
1264 | $xsdir = '$(PERL_SRC)/ext' unless (-f "$att{PERL_LIB}/ExtUtils/xsubpp"); |
1265 | my(@tmdeps) = ('$(XSUBPPDIR)/typemap'); |
42793c05 |
1266 | push(@tmdeps, "typemap") if -f "typemap"; |
1267 | my(@tmargs) = map("-typemap $_", @tmdeps); |
1268 | " |
e1666bf5 |
1269 | XSUBPPDIR = $xsdir |
1270 | XSUBPP = \$(XSUBPPDIR)/xsubpp |
42793c05 |
1271 | XSUBPPDEPS = @tmdeps |
1272 | XSUBPPARGS = @tmargs |
1273 | "; |
1274 | }; |
a0d0e21e |
1275 | |
a0d0e21e |
1276 | |
42793c05 |
1277 | sub tools_other{ |
e1666bf5 |
1278 | " |
42793c05 |
1279 | SHELL = /bin/sh |
e1666bf5 |
1280 | LD = $att{LD} |
3edbfbe5 |
1281 | TOUCH = $att{TOUCH} |
1282 | CP = $att{CP} |
75f92628 |
1283 | MV = $att{MV} |
3edbfbe5 |
1284 | RM_F = $att{RM_F} |
1285 | RM_RF = $att{RM_RF} |
e1666bf5 |
1286 | ".q{ |
42793c05 |
1287 | # The following is a portable way to say mkdir -p |
75f92628 |
1288 | MKPATH = $(PERL) -wle '$$"="/"; foreach $$p (@ARGV){ next if -d $$p; my(@p); foreach(split(/\//,$$p)){ push(@p,$$_); next if -d "@p/"; print "mkdir @p"; mkdir("@p",0777)||die $$! }} exit 0;' |
42793c05 |
1289 | }; |
a0d0e21e |
1290 | } |
1291 | |
1292 | |
1293 | sub post_constants{ |
1294 | ""; |
1295 | } |
1296 | |
1297 | |
42793c05 |
1298 | # --- Translation Sections --- |
a0d0e21e |
1299 | |
42793c05 |
1300 | sub c_o { |
40000a8c |
1301 | my(@m); |
fed7345c |
1302 | push @m, ' |
42793c05 |
1303 | .c.o: |
1304 | $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $(INC) $*.c |
1305 | '; |
fed7345c |
1306 | join "", @m; |
a0d0e21e |
1307 | } |
1308 | |
42793c05 |
1309 | sub xs_c { |
1310 | ' |
1311 | .xs.c: |
fed7345c |
1312 | $(PERL) $(XSUBPP) $(XSUBPPARGS) $*.xs >$*.tc && mv $*.tc $@ |
42793c05 |
1313 | '; |
1314 | } |
a0d0e21e |
1315 | |
42793c05 |
1316 | sub xs_o { # many makes are too dumb to use xs_c then c_o |
a0d0e21e |
1317 | ' |
42793c05 |
1318 | .xs.o: |
1319 | $(PERL) $(XSUBPP) $(XSUBPPARGS) $*.xs >xstmp.c && mv xstmp.c $*.c |
1320 | $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $(INC) $*.c |
a0d0e21e |
1321 | '; |
1322 | } |
1323 | |
1324 | |
42793c05 |
1325 | # --- Target Sections --- |
1326 | |
1327 | sub top_targets{ |
40000a8c |
1328 | my(@m); |
fed7345c |
1329 | push @m, ' |
42793c05 |
1330 | all :: config linkext $(INST_PM) |
3edbfbe5 |
1331 | '.$att{NOOP}.' |
42793c05 |
1332 | |
1aef975c |
1333 | config :: '.$att{MAKEFILE}.' |
fed7345c |
1334 | @ $(MKPATH) $(INST_LIBDIR) $(INST_ARCHAUTODIR) |
a0d0e21e |
1335 | '; |
fed7345c |
1336 | |
1337 | push @m, ' |
1338 | $(O_FILES): $(H_FILES) |
1339 | ' if @{$att{O_FILES} || []} && @{$att{H} || []}; |
1340 | join('',@m); |
a0d0e21e |
1341 | } |
1342 | |
42793c05 |
1343 | sub linkext { |
1344 | my($self, %attribs) = @_; |
1345 | # LINKTYPE => static or dynamic |
1346 | my($linktype) = $attribs{LINKTYPE} || '$(LINKTYPE)'; |
1347 | " |
1348 | linkext :: $linktype |
3edbfbe5 |
1349 | $att{NOOP} |
42793c05 |
1350 | "; |
1351 | } |
1352 | |
1aef975c |
1353 | sub dlsyms { |
1354 | my($self,%attribs) = @_; |
1355 | |
40000a8c |
1356 | return '' if ($Config{'osname'} ne 'aix'); |
1aef975c |
1357 | |
1358 | my($funcs) = $attribs{DL_FUNCS} || $att{DL_FUNCS} || {}; |
1359 | my($vars) = $attribs{DL_VARS} || $att{DL_VARS} || []; |
1360 | my(@m); |
1361 | |
1362 | push(@m," |
1363 | dynamic :: $att{BASEEXT}.exp |
1364 | |
1365 | ") unless $skip{'dynamic'}; |
1366 | |
1367 | push(@m," |
1368 | static :: $att{BASEEXT}.exp |
1369 | |
1370 | ") unless $skip{'static'}; |
1371 | |
1372 | push(@m," |
1373 | $att{BASEEXT}.exp: Makefile.PL |
1374 | ",' $(PERL) $(I_PERL_LIBS) -e \'use ExtUtils::MakeMaker; \\ |
fed7345c |
1375 | mksymlists(DL_FUNCS => ', |
40000a8c |
1376 | %$funcs ? neatvalue($funcs) : '""',', DL_VARS => ', |
fec02dd3 |
1377 | @$vars ? neatvalue($vars) : '""', ", NAME => \"$att{NAME}\")' |
fed7345c |
1378 | "); |
1aef975c |
1379 | |
1380 | join('',@m); |
1381 | } |
42793c05 |
1382 | |
1383 | # --- Dynamic Loading Sections --- |
a0d0e21e |
1384 | |
1385 | sub dynamic { |
1386 | ' |
42793c05 |
1387 | # $(INST_PM) has been moved to the all: target. |
1388 | # It remains here for awhile to allow for old usage: "make dynamic" |
1aef975c |
1389 | dynamic :: '.$att{MAKEFILE}.' $(INST_DYNAMIC) $(INST_BOOT) $(INST_PM) |
3edbfbe5 |
1390 | '.$att{NOOP}.' |
42793c05 |
1391 | '; |
1392 | } |
a0d0e21e |
1393 | |
42793c05 |
1394 | sub dynamic_bs { |
1395 | my($self, %attribs) = @_; |
1396 | ' |
1397 | BOOTSTRAP = '."$att{BASEEXT}.bs".' |
a0d0e21e |
1398 | |
42793c05 |
1399 | # As MakeMaker mkbootstrap might not write a file (if none is required) |
1400 | # we use touch to prevent make continually trying to remake it. |
1401 | # The DynaLoader only reads a non-empty file. |
1aef975c |
1402 | $(BOOTSTRAP): '."$att{MAKEFILE} $att{BOOTDEP}".' |
40000a8c |
1403 | @ echo "Running mkbootstrap for $(NAME) ($(BSLOADLIBS))" |
1404 | @ $(PERL) $(I_PERL_LIBS) \ |
3edbfbe5 |
1405 | -e \'use ExtUtils::MakeMaker; &mkbootstrap("$(BSLOADLIBS)");\' \ |
e1666bf5 |
1406 | INST_LIB=$(INST_LIB) INST_ARCHLIB=$(INST_ARCHLIB) PERL_SRC=$(PERL_SRC) NAME=$(NAME) |
fed7345c |
1407 | @ $(TOUCH) $(BOOTSTRAP) |
a0d0e21e |
1408 | |
1409 | $(INST_BOOT): $(BOOTSTRAP) |
fed7345c |
1410 | @ '.$att{RM_RF}.' $(INST_BOOT) |
40000a8c |
1411 | -'.$att{CP}.' $(BOOTSTRAP) $(INST_BOOT) |
a0d0e21e |
1412 | '; |
1413 | } |
1414 | |
75f92628 |
1415 | |
42793c05 |
1416 | sub dynamic_lib { |
1417 | my($self, %attribs) = @_; |
1418 | my($otherldflags) = $attribs{OTHERLDFLAGS} || ""; |
1419 | my($armaybe) = $attribs{ARMAYBE} || $att{ARMAYBE} || ":"; |
3edbfbe5 |
1420 | my($ldfrom) = '$(LDFROM)'; |
75f92628 |
1421 | my($osname) = $Config{'osname'}; |
1422 | $armaybe = 'ar' if ($osname eq 'dec_osf' and $armaybe eq ':'); |
3edbfbe5 |
1423 | my(@m); |
1424 | push(@m,' |
75f92628 |
1425 | # This section creates the dynamically loadable $(INST_DYNAMIC) |
1426 | # from $(OBJECT) and possibly $(MYEXTLIB). |
42793c05 |
1427 | ARMAYBE = '.$armaybe.' |
1428 | OTHERLDFLAGS = '.$otherldflags.' |
a0d0e21e |
1429 | |
42793c05 |
1430 | $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) |
fed7345c |
1431 | @ $(MKPATH) $(INST_ARCHAUTODIR) |
3edbfbe5 |
1432 | '); |
1433 | if ($armaybe ne ':'){ |
1434 | $ldfrom = "tmp.a"; |
1435 | push(@m,' $(ARMAYBE) cr '.$ldfrom.' $(OBJECT)'."\n"); |
1436 | push(@m,' $(RANLIB) '."$ldfrom\n"); |
1437 | } |
75f92628 |
1438 | $ldfrom = "-all $ldfrom -none" if ($osname eq 'dec_osf'); |
1439 | push(@m,' $(LD) -o $@ $(LDDLFLAGS) '.$ldfrom. |
3edbfbe5 |
1440 | ' $(OTHERLDFLAGS) $(MYEXTLIB) $(LDLOADLIBS)'."\n"); |
1441 | join('',@m); |
a0d0e21e |
1442 | } |
1443 | |
1444 | |
42793c05 |
1445 | # --- Static Loading Sections --- |
1446 | |
1447 | sub static { |
a0d0e21e |
1448 | ' |
42793c05 |
1449 | # $(INST_PM) has been moved to the all: target. |
1450 | # It remains here for awhile to allow for old usage: "make static" |
fed7345c |
1451 | static :: '.$att{MAKEFILE}.' $(INST_STATIC) $(INST_PM) |
3edbfbe5 |
1452 | '.$att{NOOP}.' |
a0d0e21e |
1453 | '; |
1454 | } |
1455 | |
42793c05 |
1456 | sub static_lib{ |
1457 | my(@m); |
1458 | push(@m, <<'END'); |
1459 | $(INST_STATIC): $(OBJECT) $(MYEXTLIB) |
fed7345c |
1460 | @ $(MKPATH) $(INST_ARCHAUTODIR) |
42793c05 |
1461 | END |
1462 | # If this extension has it's own library (eg SDBM_File) |
1463 | # then copy that to $(INST_STATIC) and add $(OBJECT) into it. |
3edbfbe5 |
1464 | push(@m, " $att{CP} \$(MYEXTLIB) \$\@\n") if $att{MYEXTLIB}; |
42793c05 |
1465 | |
1466 | push(@m, <<'END'); |
1467 | ar cr $@ $(OBJECT) && $(RANLIB) $@ |
75f92628 |
1468 | @echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld |
42793c05 |
1469 | END |
fed7345c |
1470 | |
1471 | # Old mechanism - still available: |
1472 | |
e1666bf5 |
1473 | push(@m, <<'END') if $att{PERL_SRC}; |
fed7345c |
1474 | @ echo "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs |
e1666bf5 |
1475 | END |
42793c05 |
1476 | join('', "\n",@m); |
1477 | } |
1478 | |
a0d0e21e |
1479 | |
1480 | sub installpm { |
42793c05 |
1481 | my($self, %attribs) = @_; |
1482 | # By default .pm files are split into the architecture independent |
1483 | # library. This is a good thing. If a specific module requires that |
1484 | # it's .pm files are split into the architecture specific library |
1485 | # then it should use: installpm => {SPLITLIB=>'$(INST_ARCHLIB)'} |
1486 | # Note that installperl currently interferes with this (Config.pm) |
1487 | # User can disable split by saying: installpm => {SPLITLIB=>''} |
1488 | my($splitlib) = '$(INST_LIB)'; # NOT arch specific by default |
1489 | $splitlib = $attribs{SPLITLIB} if exists $attribs{SPLITLIB}; |
1490 | my(@m, $dist); |
1491 | foreach $dist (sort keys %{$att{PM}}){ |
1492 | my($inst) = $att{PM}->{$dist}; |
1493 | push(@m, "\n# installpm: $dist => $inst, splitlib=$splitlib\n"); |
1494 | push(@m, MY->installpm_x($dist, $inst, $splitlib)); |
1495 | push(@m, "\n"); |
1496 | } |
1497 | join('', @m); |
a0d0e21e |
1498 | } |
1499 | |
42793c05 |
1500 | sub installpm_x { # called by installpm per file |
1501 | my($self, $dist, $inst, $splitlib) = @_; |
1502 | my($instdir) = $inst =~ m|(.*)/|; |
1503 | my(@m); |
1504 | push(@m," |
fed7345c |
1505 | $inst: $dist Makefile |
1506 | ".' @ '.$att{RM_F}.' $@ |
1507 | @ $(MKPATH) '.$instdir.' |
1508 | '."$att{CP} $dist".' $@ |
42793c05 |
1509 | '); |
40000a8c |
1510 | push(@m, "\t\@\$(AUTOSPLITFILE) \$@ $splitlib/auto\n") |
42793c05 |
1511 | if ($splitlib and $inst =~ m/\.pm$/); |
1512 | join('', @m); |
1513 | } |
a0d0e21e |
1514 | |
40000a8c |
1515 | sub installbin { |
1516 | return "" unless $att{EXE_FILES} && ref $att{EXE_FILES} eq "ARRAY"; |
1517 | my(@m, $from, $to, %fromto, @to); |
1518 | for $from (@{$att{EXE_FILES}}) { |
1519 | local($_)= '$(INST_EXE)/' . basename($from); |
1520 | $to = MY->exescan(); |
1521 | print "exescan($from) => '$to'" if ($Verbose >=2); |
1522 | $fromto{$from}=$to; |
1523 | } |
1524 | @to = values %fromto; |
1525 | push(@m, " |
1526 | EXE_FILES = @{$att{EXE_FILES}} |
1527 | |
1528 | all :: @to |
1529 | |
1530 | realclean :: |
1531 | $att{RM_F} @to |
1532 | "); |
1533 | |
1534 | while (($from,$to) = each %fromto) { |
1535 | push @m, " |
1536 | $to: $from $att{MAKEFILE} |
1537 | $att{CP} $from $to |
1538 | "; |
1539 | } |
1540 | join "", @m; |
1541 | } |
42793c05 |
1542 | |
40000a8c |
1543 | sub exescan { |
1544 | $_; |
1545 | } |
42793c05 |
1546 | # --- Sub-directory Sections --- |
1547 | |
1548 | sub subdirs { |
1549 | my(@m); |
1550 | # This method provides a mechanism to automatically deal with |
1551 | # subdirectories containing further Makefile.PL scripts. |
1552 | # It calls the subdir_x() method for each subdirectory. |
1553 | foreach(<*/Makefile.PL>){ |
1554 | s:/Makefile\.PL$:: ; |
1555 | print "Including $_ subdirectory" if ($Verbose); |
1556 | push(@m, MY->subdir_x($_)); |
1557 | } |
1558 | if (@m){ |
1559 | unshift(@m, " |
1560 | # The default clean, realclean and test targets in this Makefile |
1561 | # have automatically been given entries for each subdir. |
1562 | |
1563 | all :: subdirs |
1564 | "); |
1565 | } else { |
1566 | push(@m, "\n# none") |
1567 | } |
1568 | join('',@m); |
1569 | } |
1570 | |
1571 | sub runsubdirpl{ # Experimental! See subdir_x section |
1572 | my($self,$subdir) = @_; |
1573 | chdir($subdir) or die "chdir($subdir): $!"; |
1aef975c |
1574 | ExtUtils::MakeMaker::check_hints(); |
42793c05 |
1575 | require "Makefile.PL"; |
a0d0e21e |
1576 | } |
1577 | |
42793c05 |
1578 | sub subdir_x { |
1579 | my($self, $subdir) = @_; |
1580 | my(@m); |
1581 | # The intention is that the calling Makefile.PL should define the |
1582 | # $(SUBDIR_MAKEFILE_PL_ARGS) make macro to contain whatever |
1583 | # information needs to be passed down to the other Makefile.PL scripts. |
1584 | # If this does not suit your needs you'll need to write your own |
1585 | # MY::subdir_x() method to override this one. |
1586 | qq{ |
1aef975c |
1587 | config :: $subdir/$att{MAKEFILE} |
40000a8c |
1588 | cd $subdir ; \$(MAKE) config INST_LIB=\$(INST_LIB) INST_ARCHLIB=\$(INST_ARCHLIB) \\ |
1589 | INST_EXE=\$(INST_EXE) LINKTYPE=\$(LINKTYPE) LIBPERL_A=\$(LIBPERL_A) \$(SUBDIR_MAKEFILE_PL_ARGS) |
42793c05 |
1590 | |
1aef975c |
1591 | $subdir/$att{MAKEFILE}: $subdir/Makefile.PL \$(CONFIGDEP) |
42793c05 |
1592 | }.' @echo "Rebuilding $@ ..." |
75f92628 |
1593 | $(PERL) $(I_PERL_LIBS) \\ |
42793c05 |
1594 | -e "use ExtUtils::MakeMaker; MM->runsubdirpl(qw('.$subdir.'))" \\ |
40000a8c |
1595 | INST_LIB=$(INST_LIB) INST_ARCHLIB=$(INST_ARCHLIB) \\ |
1596 | INST_EXE=$(INST_EXE) LINKTYPE=\$(LINKTYPE) LIBPERL_A=$(LIBPERL_A) $(SUBDIR_MAKEFILE_PL_ARGS) |
42793c05 |
1597 | @echo "Rebuild of $@ complete." |
1598 | '.qq{ |
1599 | |
1600 | subdirs :: |
1601 | cd $subdir ; \$(MAKE) all LINKTYPE=\$(LINKTYPE) |
1602 | |
1603 | }; |
1604 | } |
1605 | |
1606 | |
1607 | # --- Cleanup and Distribution Sections --- |
1608 | |
1609 | sub clean { |
1610 | my($self, %attribs) = @_; |
1611 | my(@m); |
1612 | push(@m, ' |
1613 | # Delete temporary files but do not touch installed files. We don\'t delete |
1614 | # the Makefile here so a later make realclean still has a makefile to use. |
1615 | |
1616 | clean :: |
1617 | '); |
1618 | # clean subdirectories first |
1aef975c |
1619 | push(@m, map("\t-cd $_ && test -f $att{MAKEFILE} && \$(MAKE) clean\n",@{$att{DIR}})); |
75f92628 |
1620 | my(@otherfiles) = values %{$att{XS}}; # .c files from *.xs files |
42793c05 |
1621 | push(@otherfiles, $attribs{FILES}) if $attribs{FILES}; |
1aef975c |
1622 | push(@otherfiles, "./blib"); |
75f92628 |
1623 | push(@m, " -$att{RM_RF} *~ t/*~ *.o *.a mon.out core so_locations " |
40000a8c |
1624 | ."\$(BOOTSTRAP) \$(BASEEXT).bso \$(BASEEXT).exp @otherfiles\n"); |
75f92628 |
1625 | # See realclean and ext/utils/make_ext for usage of Makefile.old |
1aef975c |
1626 | push(@m, " -$att{MV} $att{MAKEFILE} $att{MAKEFILE}.old 2>/dev/null\n"); |
42793c05 |
1627 | push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP}; |
1628 | join("", @m); |
1629 | } |
a0d0e21e |
1630 | |
1631 | sub realclean { |
42793c05 |
1632 | my($self, %attribs) = @_; |
1633 | my(@m); |
1634 | push(@m,' |
1635 | # Delete temporary files (via clean) and also delete installed files |
1636 | realclean purge :: clean |
1637 | '); |
75f92628 |
1638 | # realclean subdirectories first (already cleaned) |
1639 | $sub = "\t-cd %s && test -f %s && \$(MAKE) %s realclean\n"; |
1640 | foreach(@{$att{DIR}}){ |
1aef975c |
1641 | push(@m, sprintf($sub,$_,"$att{MAKEFILE}.old","-f $att{MAKEFILE}.old")); |
1642 | push(@m, sprintf($sub,$_,"$att{MAKEFILE}",'')); |
75f92628 |
1643 | } |
3edbfbe5 |
1644 | push(@m, " $att{RM_RF} \$(INST_AUTODIR) \$(INST_ARCHAUTODIR)\n"); |
75f92628 |
1645 | push(@m, " $att{RM_F} \$(INST_DYNAMIC) \$(INST_BOOT)\n"); |
1646 | push(@m, " $att{RM_F} \$(INST_STATIC) \$(INST_PM)\n"); |
fed7345c |
1647 | my(@otherfiles) = ($att{MAKEFILE}, |
40000a8c |
1648 | "$att{MAKEFILE}.old"); # Makefiles last |
42793c05 |
1649 | push(@otherfiles, $attribs{FILES}) if $attribs{FILES}; |
3edbfbe5 |
1650 | push(@m, " $att{RM_RF} @otherfiles\n") if @otherfiles; |
42793c05 |
1651 | push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP}; |
1652 | join("", @m); |
1653 | } |
a0d0e21e |
1654 | |
42793c05 |
1655 | |
1656 | sub distclean { |
1657 | my($self, %attribs) = @_; |
1658 | # VERSION should be sanitised before use as a file name |
1659 | my($tarname) = $attribs{TARNAME} || '$(DISTNAME)-$(VERSION)'; |
1660 | my($tarflags) = $attribs{TARFLAGS} || 'cvf'; |
1661 | my($compress) = $attribs{COMPRESS} || 'compress'; # eg gzip |
1662 | my($preop) = $attribs{PREOP} || '@:'; # e.g., update MANIFEST |
1663 | my($postop) = $attribs{POSTOP} || '@:'; |
fed7345c |
1664 | my($mkfiles) = join(' ', map("$_/$att{MAKEFILE} $_/$att{MAKEFILE}.old", ".", @{$att{DIR}})); |
42793c05 |
1665 | " |
1666 | distclean: clean |
1667 | $preop |
3edbfbe5 |
1668 | $att{RM_F} $mkfiles |
42793c05 |
1669 | cd ..; tar $tarflags $tarname.tar \$(BASEEXT) |
1670 | cd ..; $compress $tarname.tar |
1671 | $postop |
1672 | "; |
a0d0e21e |
1673 | } |
1674 | |
1675 | |
42793c05 |
1676 | # --- Test and Installation Sections --- |
1677 | |
a0d0e21e |
1678 | sub test { |
42793c05 |
1679 | my($self, %attribs) = @_; |
1680 | my($tests) = $attribs{TESTS} || (-d "t" ? "t/*.t" : ""); |
1681 | my(@m); |
1682 | push(@m," |
40000a8c |
1683 | TEST_VERBOSE=0 |
1684 | |
42793c05 |
1685 | test :: all |
1686 | "); |
1687 | push(@m, <<"END") if $tests; |
40000a8c |
1688 | \$(FULLPERL) -I\$(INST_ARCHLIB) -I\$(INST_LIB) -I\$(PERL_ARCHLIB) -I\$(PERL_LIB) -e 'use Test::Harness qw(&runtests \$\$verbose); \$\$verbose=\$(TEST_VERBOSE); runtests \@ARGV;' $tests |
42793c05 |
1689 | END |
1690 | push(@m, <<'END') if -f "test.pl"; |
fed7345c |
1691 | $(FULLPERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) test.pl |
42793c05 |
1692 | END |
40000a8c |
1693 | push(@m, map("\tcd $_ && test -f $att{MAKEFILE} && \$(MAKE) test LINKTYPE=\$(LINKTYPE)\n", |
1694 | @{$att{DIR}})); |
42793c05 |
1695 | push(@m, "\t\@echo 'No tests defined for \$(NAME) extension.'\n") unless @m > 1; |
1696 | join("", @m); |
a0d0e21e |
1697 | } |
1698 | |
1699 | |
1700 | sub install { |
3edbfbe5 |
1701 | my($self, %attribs) = @_; |
1702 | my(@m); |
40000a8c |
1703 | push @m, q{ |
1704 | doc_install :: |
1705 | @ $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \\ |
1706 | -e 'use ExtUtils::MakeMaker; MM->writedoc("Module", "$(NAME)", \\ |
1707 | "LINKTYPE=$(LINKTYPE)", "VERSION=$(VERSION)", "EXE_FILES=$(EXE_FILES)")' |
1708 | }; |
1709 | |
3edbfbe5 |
1710 | push(@m, " |
40000a8c |
1711 | install :: pure_install doc_install |
1712 | |
1713 | pure_install :: all |
3edbfbe5 |
1714 | "); |
1715 | # install subdirectories first |
1aef975c |
1716 | push(@m, map("\tcd $_ && test -f $att{MAKEFILE} && \$(MAKE) install\n",@{$att{DIR}})); |
3edbfbe5 |
1717 | |
75f92628 |
1718 | push(@m, "\t: perl5.000 and MM pre 3.8 autosplit into INST_ARCHLIB, we delete these old files here |
40000a8c |
1719 | $att{RM_F} $Config{'installarchlib'}/auto/\$(FULLEXT)/*.al |
1720 | $att{RM_F} $Config{'installarchlib'}/auto/\$(FULLEXT)/*.ix |
1721 | \$(MAKE) INST_LIB=$Config{'installprivlib'} INST_ARCHLIB=$Config{'installarchlib'} INST_EXE=$Config{'installbin'} |
3edbfbe5 |
1722 | "); |
a0d0e21e |
1723 | |
3edbfbe5 |
1724 | join("",@m); |
1725 | } |
a0d0e21e |
1726 | |
42793c05 |
1727 | sub force { |
1728 | '# Phony target to force checking subdirectories. |
1729 | FORCE: |
a0d0e21e |
1730 | '; |
1731 | } |
1732 | |
1733 | |
1734 | sub perldepend { |
42793c05 |
1735 | my(@m); |
1736 | push(@m,' |
1737 | PERL_HDRS = $(PERL_INC)/EXTERN.h $(PERL_INC)/INTERN.h \ |
1738 | $(PERL_INC)/XSUB.h $(PERL_INC)/av.h $(PERL_INC)/cop.h \ |
1739 | $(PERL_INC)/cv.h $(PERL_INC)/dosish.h $(PERL_INC)/embed.h \ |
1740 | $(PERL_INC)/form.h $(PERL_INC)/gv.h $(PERL_INC)/handy.h \ |
1741 | $(PERL_INC)/hv.h $(PERL_INC)/keywords.h $(PERL_INC)/mg.h \ |
1742 | $(PERL_INC)/op.h $(PERL_INC)/opcode.h $(PERL_INC)/patchlevel.h \ |
1743 | $(PERL_INC)/perl.h $(PERL_INC)/perly.h $(PERL_INC)/pp.h \ |
1744 | $(PERL_INC)/proto.h $(PERL_INC)/regcomp.h $(PERL_INC)/regexp.h \ |
1745 | $(PERL_INC)/scope.h $(PERL_INC)/sv.h $(PERL_INC)/unixish.h \ |
75f92628 |
1746 | $(PERL_INC)/util.h $(PERL_INC)/config.h |
42793c05 |
1747 | |
1748 | $(OBJECT) : $(PERL_HDRS) |
1749 | '); |
e1666bf5 |
1750 | |
42793c05 |
1751 | push(@m,' |
75f92628 |
1752 | # Check for unpropogated config.sh changes. Should never happen. |
1753 | # We do NOT just update config.h because that is not sufficient. |
1754 | # An out of date config.h is not fatal but complains loudly! |
1755 | $(PERL_INC)/config.h: $(PERL_SRC)/config.sh |
1756 | -@echo "Warning: $(PERL_INC)/config.h out of date with $(PERL_SRC)/config.sh"; false |
1757 | |
75f92628 |
1758 | $(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh |
1aef975c |
1759 | @echo "Warning: $(PERL_ARCHLIB)/Config.pm may be out of date with $(PERL_SRC)/config.sh" |
1760 | cd $(PERL_SRC); $(MAKE) lib/Config.pm |
e1666bf5 |
1761 | ') if $att{PERL_SRC}; |
1762 | |
42793c05 |
1763 | push(@m, join(" ", values %{$att{XS}})." : \$(XSUBPPDEPS)\n") |
1764 | if %{$att{XS}}; |
1765 | join("\n",@m); |
1766 | } |
1767 | |
1768 | |
1769 | sub makefile { |
1770 | # We do not know what target was originally specified so we |
75f92628 |
1771 | # must force a manual rerun to be sure. But as it should only |
42793c05 |
1772 | # happen very rarely it is not a significant problem. |
75f92628 |
1773 | ' |
1aef975c |
1774 | $(OBJECT) : '.$att{MAKEFILE}.' |
75f92628 |
1775 | |
1776 | # We take a very conservative approach here, but it\'s worth it. |
1777 | # We move Makefile to Makefile.old here to avoid gnu make looping. |
fed7345c |
1778 | '.$att{MAKEFILE}.': Makefile.PL $(CONFIGDEP) |
75f92628 |
1779 | @echo "Makefile out-of-date with respect to $?" |
1780 | @echo "Cleaning current config before rebuilding Makefile..." |
1aef975c |
1781 | -@mv '."$att{MAKEFILE} $att{MAKEFILE}.old".' |
1782 | -$(MAKE) -f '.$att{MAKEFILE}.'.old clean >/dev/null 2>&1 || true |
75f92628 |
1783 | $(PERL) $(I_PERL_LIBS) Makefile.PL |
42793c05 |
1784 | @echo "Now you must rerun make."; false |
a0d0e21e |
1785 | '; |
1786 | } |
1787 | |
1788 | |
1789 | sub postamble{ |
1790 | ""; |
1791 | } |
1792 | |
fed7345c |
1793 | # --- Make-A-Perl section --- |
1794 | |
1795 | sub staticmake { |
1796 | my($self, %attribs) = @_; |
1797 | |
1798 | my(%searchdirs)=($att{PERL_ARCHLIB} => 1, $att{INST_ARCHLIB} => 1); |
1799 | my(@searchdirs)=keys %searchdirs; |
1800 | # And as it's not yet built, we add the current extension |
1801 | my(@static)="$att{INST_ARCHLIB}/auto/$att{FULLEXT}/$att{BASEEXT}.a"; |
fed7345c |
1802 | my(@perlinc) = ($att{INST_ARCHLIB}, $att{INST_LIB}, $att{PERL_ARCHLIB}, $att{PERL_LIB}); |
1803 | MY->makeaperl('MAKE' => $att{MAKEFILE}, |
1804 | 'DIRS' => \@searchdirs, |
1805 | 'STAT' => \@static, |
fed7345c |
1806 | 'INCL' => \@perlinc, |
40000a8c |
1807 | 'TARGET' => $att{MAP_TARGET}, |
fed7345c |
1808 | 'TMP' => "", |
40000a8c |
1809 | 'LIBPERL' => $att{LIBPERL_A} |
fed7345c |
1810 | ); |
1811 | } |
1812 | |
1813 | sub makeaperl { |
1814 | my($self, %attribs) = @_; |
1815 | my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) = |
1816 | @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)}; |
1817 | my(@m); |
40000a8c |
1818 | my($cccmd, $linkcmd); |
fed7345c |
1819 | |
1820 | # This emulates cflags to get the compiler invocation... |
40000a8c |
1821 | $cccmd = MY->const_cccmd($libperl); |
fed7345c |
1822 | $cccmd =~ s/^CCCMD\s*=\s*//; |
1823 | chomp $cccmd; |
1824 | $cccmd =~ s/\s/ -I$att{PERL_INC} /; |
1825 | $cccmd .= " $Config{'cccdlflags'}" if ($Config{'d_shrplib'}); |
1826 | |
1827 | # The front matter of the linkcommand... |
1828 | $linkcmd = join ' ', $Config{'cc'}, |
1829 | grep($_, @Config{qw(large split ldflags ccdlflags)}); |
1830 | $linkcmd =~ s/\s+/ /g; |
1831 | |
1832 | # Which *.a files could we make use of... |
40000a8c |
1833 | local(%static); |
fed7345c |
1834 | File::Find::find(sub { |
1835 | return unless m/\.a$/; |
40000a8c |
1836 | return if m/^libperl/; |
1837 | $static{fastcwd() . "/" . $_}++; |
fed7345c |
1838 | }, grep( -d $_, @{$searchdirs || []}) ); |
1839 | |
40000a8c |
1840 | # We trust that what has been handed in as argument, will be buildable |
1841 | $static = [] unless $static; |
1842 | @static{@{$static}} = (1) x @{$static}; |
1843 | |
fed7345c |
1844 | $extra = [] unless $extra && ref $extra eq 'ARRAY'; |
1845 | for (sort keys %static) { |
1846 | next unless /\.a$/; |
40000a8c |
1847 | $_ = dirname($_) . "/extralibs.ld"; |
1848 | push @$extra, "`cat $_`"; |
fed7345c |
1849 | } |
1850 | |
fed7345c |
1851 | grep(s/^/-I/, @$perlinc); |
1852 | |
1853 | $target = "perl" unless $target; |
1854 | $tmp = "." unless $tmp; |
1855 | |
1856 | push @m, " |
40000a8c |
1857 | # --- MakeMaker makeaperl section --- |
fed7345c |
1858 | MAP_TARGET = $target |
1859 | FULLPERL = $att{'FULLPERL'} |
1860 | MAP_LINKCMD = $linkcmd |
1861 | MAP_PERLINC = @{$perlinc} |
1862 | MAP_STATIC = ", |
1863 | join(" ", sort keys %static), " |
1864 | MAP_EXTRA = @{$extra} |
1865 | MAP_PRELIBS = $Config{'libs'} $Config{'cryptlib'} |
1866 | "; |
fed7345c |
1867 | if ($libperl) { |
40000a8c |
1868 | unless (-f $libperl || -f ($libperl = "$Config{'installarchlib'}/CORE/$libperl")){ |
1869 | print STDOUT "Warning: $libperl not found"; |
1870 | undef $libperl; |
fed7345c |
1871 | } |
1872 | } |
40000a8c |
1873 | unless ($libperl) { |
1874 | if (defined $att{PERL_SRC}) { |
1875 | $libperl = "$att{PERL_SRC}/libperl.a"; |
1876 | } elsif ( -f ( $libperl = "$Config{'installarchlib'}/CORE/libperl.a" )) { |
1877 | } else { |
1878 | print STDOUT "Warning: $libperl not found"; |
fed7345c |
1879 | } |
40000a8c |
1880 | } |
fed7345c |
1881 | |
40000a8c |
1882 | push @m, " |
1883 | MAP_LIBPERL = $libperl |
fed7345c |
1884 | "; |
fed7345c |
1885 | |
40000a8c |
1886 | push @m, " |
1887 | \$(MAP_TARGET): $tmp/perlmain.o \$(MAP_LIBPERL) \$(MAP_STATIC) |
1888 | \$(MAP_LINKCMD) -o \$\@ $tmp/perlmain.o \$(MAP_LIBPERL) \$(MAP_STATIC) \$(MAP_EXTRA) \$(MAP_PRELIBS) |
1889 | @ echo 'To install the new \"\$(MAP_TARGET)\" binary, call' |
1890 | @ echo ' make -f $makefilename inst_perl MAP_TARGET=\$(MAP_TARGET)' |
1891 | @ echo 'To remove the intermediate files say' |
1892 | @ echo ' make -f $makefilename map_clean' |
1893 | |
1894 | $tmp/perlmain.o: $tmp/perlmain.c |
1895 | "; |
1896 | push @m, "\tcd $tmp && $cccmd perlmain.c\n"; |
fed7345c |
1897 | |
1898 | push @m, qq{ |
1899 | $tmp/perlmain.c: $makefilename}, q{ |
40000a8c |
1900 | @ echo Writing $@ |
1901 | @ $(FULLPERL) $(MAP_PERLINC) -e 'use ExtUtils::Miniperl; \\ |
1902 | writemain(grep s#.*/auto/##, qw|$(MAP_STATIC)|)' > $@.tmp && mv $@.tmp $@ |
1903 | |
1904 | }; |
fed7345c |
1905 | |
40000a8c |
1906 | # We write MAP_EXTRA outside the perl program to have it eval'd by the shell |
1907 | push @m, q{ |
1908 | doc_inst_perl: |
1909 | @ $(FULLPERL) -e 'use ExtUtils::MakeMaker; MM->writedoc("Perl binary", \\ |
1910 | "$(MAP_TARGET)", "MAP_STATIC=$(MAP_STATIC)", \\ |
1911 | "MAP_EXTRA=@ARGV", "MAP_LIBPERL=$(MAP_LIBPERL)")' -- $(MAP_EXTRA) |
fed7345c |
1912 | }; |
1913 | |
1914 | push @m, qq{ |
40000a8c |
1915 | inst_perl: pure_inst_perl doc_inst_perl |
1916 | |
1917 | pure_inst_perl: \$(MAP_TARGET) |
fed7345c |
1918 | $att{CP} \$(MAP_TARGET) $Config{'installbin'}/\$(MAP_TARGET) |
1919 | |
40000a8c |
1920 | realclean :: map_clean |
1921 | |
1922 | map_clean : |
1923 | $att{RM_F} $tmp/perlmain.o $tmp/perlmain.c $makefilename |
fed7345c |
1924 | }; |
1925 | |
1926 | join '', @m; |
1927 | } |
a0d0e21e |
1928 | |
42793c05 |
1929 | # --- Determine libraries to use and how to use them --- |
1930 | |
1931 | sub extliblist{ |
42793c05 |
1932 | my($self, $potential_libs)=@_; |
1933 | return ("", "", "") unless $potential_libs; |
40000a8c |
1934 | print STDOUT "Potential libraries are '$potential_libs':" if $Verbose; |
42793c05 |
1935 | |
1936 | my($so) = $Config{'so'}; |
1937 | my($libs) = $Config{'libs'}; |
1938 | |
1939 | # compute $extralibs, $bsloadlibs and $ldloadlibs from |
1940 | # $potential_libs |
1941 | # this is a rewrite of Andy Dougherty's extliblist in perl |
1942 | # its home is in <distribution>/ext/util |
1943 | |
1944 | my(@searchpath); # from "-L/path" entries in $potential_libs |
1945 | my(@libpath) = split " ", $Config{'libpth'}; |
40000a8c |
1946 | my(@ldloadlibs, @bsloadlibs, @extralibs); |
1947 | my($fullname, $thislib, $thispth, @fullname); |
42793c05 |
1948 | my($pwd) = fastcwd(); # from Cwd.pm |
40000a8c |
1949 | my($found) = 0; |
42793c05 |
1950 | |
1951 | foreach $thislib (split ' ', $potential_libs){ |
1952 | |
1953 | # Handle possible linker path arguments. |
1954 | if ($thislib =~ s/^(-[LR])//){ # save path flag type |
1955 | my($ptype) = $1; |
1956 | unless (-d $thislib){ |
fed7345c |
1957 | print STDOUT "$ptype$thislib ignored, directory does not exist\n" |
42793c05 |
1958 | if $Verbose; |
1959 | next; |
1960 | } |
1961 | if ($thislib !~ m|^/|) { |
fed7345c |
1962 | print STDOUT "Warning: $ptype$thislib changed to $ptype$pwd/$thislib\n"; |
42793c05 |
1963 | $thislib = "$pwd/$thislib"; |
1964 | } |
1965 | push(@searchpath, $thislib); |
1966 | push(@extralibs, "$ptype$thislib"); |
1967 | push(@ldloadlibs, "$ptype$thislib"); |
1968 | next; |
1969 | } |
1970 | |
1971 | # Handle possible library arguments. |
1972 | unless ($thislib =~ s/^-l//){ |
fed7345c |
1973 | print STDOUT "Unrecognized argument in LIBS ignored: '$thislib'\n"; |
42793c05 |
1974 | next; |
1975 | } |
1976 | |
1977 | my($found_lib)=0; |
1978 | foreach $thispth (@searchpath, @libpath){ |
1979 | |
fec02dd3 |
1980 | # Try to find the full name of the library. We need this to |
1981 | # determine whether it's a dynamically-loadable library or not. |
1982 | # This tends to be subject to various os-specific quirks. |
1983 | # For gcc-2.6.2 on linux (March 1995), DLD can not load |
1984 | # .sa libraries, with the exception of libm.sa, so we |
1985 | # deliberately skip them. |
42793c05 |
1986 | if (@fullname=<${thispth}/lib${thislib}.${so}.[0-9]*>){ |
1987 | $fullname=$fullname[-1]; #ATTN: 10 looses against 9! |
fec02dd3 |
1988 | } elsif (-f ($fullname="$thispth/lib$thislib.$so") |
1989 | && (($Config{'dlsrc'} ne "dl_dld") || ($thislib eq "m"))){ |
1aef975c |
1990 | } elsif (-f ($fullname="$thispth/lib${thislib}_s.a") |
1991 | && ($thislib .= "_s") ){ # we must explicitly ask for _s version |
42793c05 |
1992 | } elsif (-f ($fullname="$thispth/lib$thislib.a")){ |
1993 | } elsif (-f ($fullname="$thispth/Slib$thislib.a")){ |
fed7345c |
1994 | } else { |
40000a8c |
1995 | print STDOUT "$thislib not found in $thispth" if $Verbose; |
42793c05 |
1996 | next; |
1997 | } |
fed7345c |
1998 | print STDOUT "'-l$thislib' found at $fullname" if $Verbose; |
40000a8c |
1999 | $found++; |
42793c05 |
2000 | $found_lib++; |
2001 | |
2002 | # Now update library lists |
2003 | |
2004 | # what do we know about this library... |
2005 | my $is_dyna = ($fullname !~ /\.a$/); |
e1666bf5 |
2006 | my $in_perl = ($libs =~ /\B-l${thislib}\b/s); |
42793c05 |
2007 | |
2008 | # Do not add it into the list if it is already linked in |
2009 | # with the main perl executable. |
2010 | # We have to special-case the NeXT, because all the math is also in libsys_s |
2011 | unless ( $in_perl || ($Config{'osname'} eq 'next' && $thislib eq 'm') ){ |
2012 | push(@extralibs, "-l$thislib"); |
2013 | } |
fed7345c |
2014 | |
42793c05 |
2015 | |
2016 | # We might be able to load this archive file dynamically |
2017 | if ( $Config{'dlsrc'} =~ /dl_next|dl_dld/){ |
2018 | # We push -l$thislib instead of $fullname because |
2019 | # it avoids hardwiring a fixed path into the .bs file. |
2020 | # mkbootstrap will automatically add dl_findfile() to |
2021 | # the .bs file if it sees a name in the -l format. |
40000a8c |
2022 | # USE THIS, when dl_findfile() is fixed: |
2023 | # push(@bsloadlibs, "-l$thislib"); |
2024 | # OLD USE WAS while checking results against old_extliblist |
42793c05 |
2025 | push(@bsloadlibs, "$fullname"); |
2026 | } else { |
2027 | if ($is_dyna){ |
2028 | # For SunOS4, do not add in this shared library if |
2029 | # it is already linked in the main perl executable |
2030 | push(@ldloadlibs, "-l$thislib") |
2031 | unless ($in_perl and $Config{'osname'} eq 'sunos'); |
2032 | } else { |
2033 | push(@ldloadlibs, "-l$thislib"); |
2034 | } |
2035 | } |
2036 | last; # found one here so don't bother looking further |
2037 | } |
40000a8c |
2038 | print STDOUT "Warning (non-fatal): No library found for -l$thislib" unless $found_lib>0; |
42793c05 |
2039 | } |
40000a8c |
2040 | return ('','','') unless $found; |
42793c05 |
2041 | ("@extralibs", "@bsloadlibs", "@ldloadlibs"); |
2042 | } |
2043 | |
2044 | |
2045 | # --- Write a DynaLoader bootstrap file if required |
a0d0e21e |
2046 | |
2047 | sub mkbootstrap { |
a0d0e21e |
2048 | |
fed7345c |
2049 | =head1 USEFUL SUBROUTINES |
42793c05 |
2050 | |
fed7345c |
2051 | =head2 mkbootstrap() |
42793c05 |
2052 | |
fed7345c |
2053 | Make a bootstrap file for use by this system's DynaLoader. It |
2054 | typically gets called from an extension Makefile. |
42793c05 |
2055 | |
fed7345c |
2056 | There is no C<*.bs> file supplied with the extension. Instead a |
2057 | C<*_BS> file which has code for the special cases, like posix for |
2058 | berkeley db on the NeXT. |
42793c05 |
2059 | |
2060 | This file will get parsed, and produce a maybe empty |
fed7345c |
2061 | C<@DynaLoader::dl_resolve_using> array for the current architecture. |
42793c05 |
2062 | That will be extended by $BSLOADLIBS, which was computed by Andy's |
2063 | extliblist script. If this array still is empty, we do nothing, else |
fed7345c |
2064 | we write a .bs file with an C<@DynaLoader::dl_resolve_using> array, but |
42793c05 |
2065 | without any C<if>s, because there is no longer a need to deal with |
2066 | special cases. |
2067 | |
fed7345c |
2068 | The C<*_BS> file can put some code into the generated C<*.bs> file by placing |
2069 | it in C<$bscode>. This is a handy 'escape' mechanism that may prove |
42793c05 |
2070 | useful in complex situations. |
2071 | |
2072 | If @DynaLoader::dl_resolve_using contains C<-L*> or C<-l*> entries then |
2073 | mkbootstrap will automatically add a dl_findfile() call to the |
fed7345c |
2074 | generated C<*.bs> file. |
42793c05 |
2075 | |
2076 | =cut |
2077 | |
2078 | my($self, @bsloadlibs)=@_; |
2079 | |
2080 | @bsloadlibs = grep($_, @bsloadlibs); # strip empty libs |
2081 | |
fed7345c |
2082 | print STDOUT " bsloadlibs=@bsloadlibs\n" if $Verbose; |
42793c05 |
2083 | |
2084 | # We need DynaLoader here because we and/or the *_BS file may |
2085 | # call dl_findfile(). We don't say `use' here because when |
2086 | # first building perl extensions the DynaLoader will not have |
2087 | # been built when MakeMaker gets first used. |
2088 | require DynaLoader; |
2089 | import DynaLoader; |
2090 | |
75f92628 |
2091 | init_main() unless defined $att{'BASEEXT'}; |
a0d0e21e |
2092 | |
2093 | rename "$att{BASEEXT}.bs", "$att{BASEEXT}.bso"; |
2094 | |
2095 | if (-f "$att{BASEEXT}_BS"){ |
2096 | $_ = "$att{BASEEXT}_BS"; |
2097 | package DynaLoader; # execute code as if in DynaLoader |
2098 | local($osname, $dlsrc) = (); # avoid warnings |
42793c05 |
2099 | ($osname, $dlsrc) = @Config::Config{qw(osname dlsrc)}; |
a0d0e21e |
2100 | $bscode = ""; |
2101 | unshift @INC, "."; |
2102 | require $_; |
42793c05 |
2103 | shift @INC; |
a0d0e21e |
2104 | } |
2105 | |
2106 | if ($Config{'dlsrc'} =~ /^dl_dld/){ |
2107 | package DynaLoader; |
2108 | push(@dl_resolve_using, dl_findfile('-lc')); |
2109 | } |
2110 | |
42793c05 |
2111 | my(@all) = (@bsloadlibs, @DynaLoader::dl_resolve_using); |
a0d0e21e |
2112 | my($method) = ''; |
2113 | if (@all){ |
2114 | open BS, ">$att{BASEEXT}.bs" |
2115 | or die "Unable to open $att{BASEEXT}.bs: $!"; |
2116 | print STDOUT "Writing $att{BASEEXT}.bs\n"; |
2117 | print STDOUT " containing: @all" if $Verbose; |
2118 | print BS "# $att{BASEEXT} DynaLoader bootstrap file for $Config{'osname'} architecture.\n"; |
2119 | print BS "# Do not edit this file, changes will be lost.\n"; |
2120 | print BS "# This file was automatically generated by the\n"; |
2121 | print BS "# mkbootstrap routine in ExtUtils/MakeMaker.pm.\n"; |
2122 | print BS "\@DynaLoader::dl_resolve_using = "; |
42793c05 |
2123 | # If @all contains names in the form -lxxx or -Lxxx then it's asking for |
2124 | # runtime library location so we automatically add a call to dl_findfile() |
2125 | if (" @all" =~ m/ -[lLR]/){ |
a0d0e21e |
2126 | print BS " dl_findfile(qw(\n @all\n ));\n"; |
2127 | }else{ |
2128 | print BS " qw(@all);\n"; |
2129 | } |
2130 | # write extra code if *_BS says so |
2131 | print BS $DynaLoader::bscode if $DynaLoader::bscode; |
42793c05 |
2132 | print BS "\n1;\n"; |
a0d0e21e |
2133 | close BS; |
2134 | } |
a0d0e21e |
2135 | } |
2136 | |
1aef975c |
2137 | sub mksymlists { |
2138 | my($self) = shift; |
2139 | |
2140 | # only AIX requires a symbol list at this point |
2141 | # (so does VMS, but that's handled by the MM_VMS package) |
40000a8c |
2142 | return '' unless $Config{'osname'} eq 'aix'; |
1aef975c |
2143 | |
2144 | init_main(@ARGV) unless defined $att{'BASEEXT'}; |
94b6baf5 |
2145 | if (! $att{DL_FUNCS}) { |
40000a8c |
2146 | my($bootfunc); |
2147 | ($bootfunc = $att{NAME}) =~ s/\W/_/g; |
2148 | $att{DL_FUNCS} = {$att{BASEEXT} => ["boot_$bootfunc"]}; |
1aef975c |
2149 | } |
2150 | rename "$att{BASEEXT}.exp", "$att{BASEEXT}.exp_old"; |
2151 | |
2152 | open(EXP,">$att{BASEEXT}.exp") or die $!; |
40000a8c |
2153 | print EXP join("\n",@{$att{DL_VARS}}) if $att{DL_VARS}; |
2154 | foreach $pkg (keys %{$att{DL_FUNCS}}) { |
1aef975c |
2155 | (my($prefix) = $pkg) =~ s/\W/_/g; |
40000a8c |
2156 | foreach $func (@{$att{DL_FUNCS}->{$pkg}}) { |
1aef975c |
2157 | $func = "XS_${prefix}_$func" unless $func =~ /^boot_/; |
2158 | print EXP "$func\n"; |
2159 | } |
2160 | } |
2161 | close EXP; |
2162 | } |
42793c05 |
2163 | |
2164 | # --- Output postprocessing section --- |
2165 | #nicetext is included to make VMS support easier |
2166 | sub nicetext { # Just return the input - no action needed |
2167 | my($self,$text) = @_; |
2168 | $text; |
2169 | } |
fed7345c |
2170 | |
40000a8c |
2171 | # --- perllocal.pod section --- |
2172 | sub writedoc { |
2173 | my($self,$what,$name,@attribs)=@_; |
2174 | -w $Config{'installarchlib'} or die "No write permission to $Config{'installarchlib'}"; |
2175 | my($localpod) = "$Config{'installarchlib'}/perllocal.pod"; |
2176 | my($time); |
2177 | if (-f $localpod) { |
2178 | print "Appending installation info to $localpod\n"; |
2179 | open POD, ">>$localpod" or die "Couldn't open $localpod"; |
2180 | } else { |
2181 | print "Writing new file $localpod\n"; |
2182 | open POD, ">$localpod" or die "Couldn't open $localpod"; |
2183 | print POD "=head1 NAME |
2184 | |
2185 | perllocal - locally installed modules and perl binaries |
2186 | \n=head1 HISTORY OF LOCAL INSTALLATIONS |
2187 | |
2188 | "; |
2189 | } |
2190 | require "ctime.pl"; |
2191 | chop($time = ctime(time)); |
2192 | print POD "=head2 $time: $what C<$name>\n\n=over 4\n\n=item *\n\n"; |
2193 | print POD join "\n\n=item *\n\n", map("C<$_>",@attribs); |
2194 | print POD "\n\n=back\n\n"; |
2195 | close POD; |
2196 | } |
2197 | |
fed7345c |
2198 | =head1 AUTHORS |
2199 | |
2200 | Andy Dougherty F<E<lt>doughera@lafcol.lafayette.eduE<gt>>, Andreas |
2201 | Koenig F<E<lt>k@franz.ww.TU-Berlin.DEE<gt>>, Tim Bunce |
2202 | F<E<lt>Tim.Bunce@ig.co.ukE<gt>>. VMS support by Charles Bailey |
2203 | F<E<lt>bailey@HMIVAX.HUMGEN.UPENN.EDUE<gt>>. |
2204 | |
2205 | =head1 MODIFICATION HISTORY |
2206 | |
2207 | v1, August 1994; by Andreas Koenig. Based on Andy Dougherty's Makefile.SH. |
2208 | v2, September 1994 by Tim Bunce. |
2209 | v3.0 October 1994 by Tim Bunce. |
2210 | v3.1 November 11th 1994 by Tim Bunce. |
2211 | v3.2 November 18th 1994 by Tim Bunce. |
2212 | v3.3 November 27th 1994 by Andreas Koenig. |
2213 | v3.4 December 7th 1994 by Andreas Koenig and Tim Bunce. |
2214 | v3.5 December 15th 1994 by Tim Bunce. |
2215 | v3.6 December 15th 1994 by Tim Bunce. |
2216 | v3.7 December 30th 1994 By Tim Bunce |
2217 | v3.8 January 17th 1995 By Andreas Koenig and Tim Bunce |
2218 | v3.9 January 19th 1995 By Tim Bunce |
fed7345c |
2219 | v3.10 January 23rd 1995 By Tim Bunce |
fed7345c |
2220 | v3.11 January 24th 1995 By Andreas Koenig |
fed7345c |
2221 | v4.00 January 24th 1995 By Tim Bunce |
fed7345c |
2222 | v4.01 January 25th 1995 By Tim Bunce |
fed7345c |
2223 | v4.02 January 29th 1995 By Andreas Koenig |
40000a8c |
2224 | v4.03 January 30th 1995 By Andreas Koenig |
2225 | v4.04 Februeary 5th 1995 By Andreas Koenig |
2226 | v4.05 February 8th 1995 By Andreas Koenig |
2227 | v4.06 February 10th 1995 By Andreas Koenig |
fed7345c |
2228 | |
40000a8c |
2229 | Cleaning up the new interface. Suggestion to freeze now until 5.001. |
fed7345c |
2230 | |
40000a8c |
2231 | v4.061 February 12th 1995 By Andreas Koenig |
fed7345c |
2232 | |
40000a8c |
2233 | Fixes of some my() declarations and of @extra computing in makeaperl(). |
fed7345c |
2234 | |
40000a8c |
2235 | v4.08 - 4.085 February 14th-21st 1995 by Andreas Koenig |
fed7345c |
2236 | |
40000a8c |
2237 | Introduces EXE_FILES and INST_EXE for installing executable scripts |
2238 | and fixes documentation to reflect the new variable. |
fed7345c |
2239 | |
40000a8c |
2240 | Introduces the automated documentation of the installation history. Every |
2241 | make install |
2242 | and |
2243 | make inst_perl |
2244 | add some documentation to the file C<$installarchlib/perllocal.pod>. |
2245 | This is done by the writedoc() routine in the MM_Unix class. The |
2246 | documentation is rudimentary until we find an agreement, what |
2247 | information is supposed to go into the pod. |
fed7345c |
2248 | |
40000a8c |
2249 | Added ability to specify the another name than C<perl> for a new binary. |
fed7345c |
2250 | |
40000a8c |
2251 | Both C<make perl> and C<makeaperl> now prompt the user, how to install |
2252 | the new binary after the build. |
fed7345c |
2253 | |
40000a8c |
2254 | Reduced noise during the make. |
fed7345c |
2255 | |
40000a8c |
2256 | Variable LIBPERL_A enables indirect setting of the switches -DEMBED, |
2257 | -DDEBUGGING and -DMULTIPLICITY in the same way as done by cflags. |
fed7345c |
2258 | |
40000a8c |
2259 | old_extliblist() code deleted, new_extliblist() renamed to extliblist(). |
fed7345c |
2260 | |
40000a8c |
2261 | Improved algorithm in extliblist, that returns ('','','') if no |
2262 | library has been found, even if a -L directory has been found. |
fed7345c |
2263 | |
40000a8c |
2264 | Fixed a bug that didn't allow lib/ directory work as documented. |
fed7345c |
2265 | |
40000a8c |
2266 | Allowed C<make test TEST_VERBOSE=1> |
fed7345c |
2267 | |
fec02dd3 |
2268 | v4.086 March 9 1995 by Andy Dougherty |
2269 | |
2270 | Fixed some AIX buglets. Fixed DLD support for Linux with gcc 2.6.2. |
2271 | |
fed7345c |
2272 | =head1 NOTES |
2273 | |
2274 | MakeMaker development work still to be done: |
2275 | |
2276 | Needs more complete documentation. |
2277 | |
2278 | Add a html: target when there has been found a general solution to |
2279 | installing html files. |
2280 | |
fed7345c |
2281 | =cut |
2282 | |
42793c05 |
2283 | # the following keeps AutoSplit happy |
a0d0e21e |
2284 | package ExtUtils::MakeMaker; |
2285 | 1; |
2286 | |
2287 | __END__ |