1ExtUtils::MM_Unix(3pm) Perl Programmers Reference Guide ExtUtils::MM_Unix(3pm)
2
3
4
6 ExtUtils::MM_Unix - methods used by ExtUtils::MakeMaker
7
9 "require ExtUtils::MM_Unix;"
10
12 The methods provided by this package are designed to be used in
13 conjunction with ExtUtils::MakeMaker. When MakeMaker writes a Makefile,
14 it creates one or more objects that inherit their methods from a
15 package "MM". MM itself doesn't provide any methods, but it ISA
16 ExtUtils::MM_Unix class. The inheritance tree of MM lets operating
17 specific packages take the responsibility for all the methods provided
18 by MM_Unix. We are trying to reduce the number of the necessary
19 overrides by defining rather primitive operations within
20 ExtUtils::MM_Unix.
21
22 If you are going to write a platform specific MM package, please try to
23 limit the necessary overrides to primitive methods, and if it is not
24 possible to do so, let's work out how to achieve that gain.
25
26 If you are overriding any of these methods in your Makefile.PL (in the
27 MY class), please report that to the makemaker mailing list. We are
28 trying to minimize the necessary method overrides and switch to data
29 driven Makefile.PLs wherever possible. In the long run less methods
30 will be overridable via the MY class.
31
33 The following description of methods is still under development. Please
34 refer to the code for not suitably documented sections and complain
35 loudly to the makemaker@perl.org mailing list. Better yet, provide a
36 patch.
37
38 Not all of the methods below are overridable in a Makefile.PL.
39 Overridable methods are marked as (o). All methods are overridable by a
40 platform specific MM_*.pm file.
41
42 Cross-platform methods are being moved into MM_Any. If you can't find
43 something that used to be in here, look in MM_Any.
44
45 Methods
46 os_flavor
47 Simply says that we're Unix.
48
49 c_o (o)
50 Defines the suffix rules to compile different flavors of C files to
51 object files.
52
53 cflags (o)
54 Does very much the same as the cflags script in the perl
55 distribution. It doesn't return the whole compiler command line,
56 but initializes all of its parts. The const_cccmd method then
57 actually returns the definition of the CCCMD macro which uses these
58 parts.
59
60 const_cccmd (o)
61 Returns the full compiler call for C programs and stores the
62 definition in CONST_CCCMD.
63
64 const_config (o)
65 Defines a couple of constants in the Makefile that are imported
66 from %Config.
67
68 const_loadlibs (o)
69 Defines EXTRALIBS, LDLOADLIBS, BSLOADLIBS, LD_RUN_PATH. See
70 ExtUtils::Liblist for details.
71
72 constants (o)
73 my $make_frag = $mm->constants;
74
75 Prints out macros for lots of constants.
76
77 depend (o)
78 Same as macro for the depend attribute.
79
80 init_DEST
81 $mm->init_DEST
82
83 Defines the DESTDIR and DEST* variables paralleling the INSTALL*.
84
85 init_dist
86 $mm->init_dist;
87
88 Defines a lot of macros for distribution support.
89
90 macro description default
91
92 TAR tar command to use tar
93 TARFLAGS flags to pass to TAR cvf
94
95 ZIP zip command to use zip
96 ZIPFLAGS flags to pass to ZIP -r
97
98 COMPRESS compression command to gzip --best
99 use for tarfiles
100 SUFFIX suffix to put on .gz
101 compressed files
102
103 SHAR shar command to use shar
104
105 PREOP extra commands to run before
106 making the archive
107 POSTOP extra commands to run after
108 making the archive
109
110 TO_UNIX a command to convert linefeeds
111 to Unix style in your archive
112
113 CI command to checkin your ci -u
114 sources to version control
115 RCS_LABEL command to label your sources rcs -Nv$(VERSION_SYM): -q
116 just after CI is run
117
118 DIST_CP $how argument to manicopy() best
119 when the distdir is created
120
121 DIST_DEFAULT default target to use to tardist
122 create a distribution
123
124 DISTVNAME name of the resulting archive $(DISTNAME)-$(VERSION)
125 (minus suffixes)
126
127 dist (o)
128 my $dist_macros = $mm->dist(%overrides);
129
130 Generates a make fragment defining all the macros initialized in
131 init_dist.
132
133 %overrides can be used to override any of the above.
134
135 dist_basics (o)
136 Defines the targets distclean, distcheck, skipcheck, manifest,
137 veryclean.
138
139 dist_ci (o)
140 Defines a check in target for RCS.
141
142 dist_core (o)
143 my $dist_make_fragment = $MM->dist_core;
144
145 Puts the targets necessary for 'make dist' together into one make
146 fragment.
147
148 dist_target
149 my $make_frag = $MM->dist_target;
150
151 Returns the 'dist' target to make an archive for distribution.
152 This target simply checks to make sure the Makefile is up-to-date
153 and depends on $(DIST_DEFAULT).
154
155 tardist_target
156 my $make_frag = $MM->tardist_target;
157
158 Returns the 'tardist' target which is simply so 'make tardist'
159 works. The real work is done by the dynamically named
160 tardistfile_target() method, tardist should have that as a
161 dependency.
162
163 zipdist_target
164 my $make_frag = $MM->zipdist_target;
165
166 Returns the 'zipdist' target which is simply so 'make zipdist'
167 works. The real work is done by the dynamically named
168 zipdistfile_target() method, zipdist should have that as a
169 dependency.
170
171 tarfile_target
172 my $make_frag = $MM->tarfile_target;
173
174 The name of this target is the name of the tarball generated by
175 tardist. This target does the actual work of turning the distdir
176 into a tarball.
177
178 zipfile_target
179 my $make_frag = $MM->zipfile_target;
180
181 The name of this target is the name of the zip file generated by
182 zipdist. This target does the actual work of turning the distdir
183 into a zip file.
184
185 uutardist_target
186 my $make_frag = $MM->uutardist_target;
187
188 Converts the tarfile into a uuencoded file
189
190 shdist_target
191 my $make_frag = $MM->shdist_target;
192
193 Converts the distdir into a shell archive.
194
195 dlsyms (o)
196 Used by some OS' to define DL_FUNCS and DL_VARS and write the *.exp
197 files.
198
199 Normally just returns an empty string.
200
201 dynamic_bs (o)
202 Defines targets for bootstrap files.
203
204 dynamic_lib (o)
205 Defines how to produce the *.so (or equivalent) files.
206
207 exescan
208 Deprecated method. Use libscan instead.
209
210 extliblist
211 Called by init_others, and calls ext ExtUtils::Liblist. See
212 ExtUtils::Liblist for details.
213
214 find_perl
215 Finds the executables PERL and FULLPERL
216
217 fixin
218 $mm->fixin(@files);
219
220 Inserts the sharpbang or equivalent magic number to a set of
221 @files.
222
223 force (o)
224 Writes an empty FORCE: target.
225
226 guess_name
227 Guess the name of this package by examining the working directory's
228 name. MakeMaker calls this only if the developer has not supplied a
229 NAME attribute.
230
231 has_link_code
232 Returns true if C, XS, MYEXTLIB or similar objects exist within
233 this object that need a compiler. Does not descend into
234 subdirectories as needs_linking() does.
235
236 init_dirscan
237 Scans the directory structure and initializes DIR, XS, XS_FILES, C,
238 C_FILES, O_FILES, H, H_FILES, PL_FILES, EXE_FILES.
239
240 Called by init_main.
241
242 init_MANPODS
243 Determines if man pages should be generated and initializes
244 MAN1PODS and MAN3PODS as appropriate.
245
246 init_MAN1PODS
247 Initializes MAN1PODS from the list of EXE_FILES.
248
249 init_MAN3PODS
250 Initializes MAN3PODS from the list of PM files.
251
252 init_PM
253 Initializes PMLIBDIRS and PM from PMLIBDIRS.
254
255 init_DIRFILESEP
256 Using / for Unix. Called by init_main.
257
258 init_main
259 Initializes AR, AR_STATIC_ARGS, BASEEXT, CONFIG, DISTNAME, DLBASE,
260 EXE_EXT, FULLEXT, FULLPERL, FULLPERLRUN, FULLPERLRUNINST, INST_*,
261 INSTALL*, INSTALLDIRS, LIB_EXT, LIBPERL_A, MAP_TARGET, NAME,
262 OBJ_EXT, PARENT_NAME, PERL, PERL_ARCHLIB, PERL_INC, PERL_LIB,
263 PERL_SRC, PERLRUN, PERLRUNINST, PREFIX, VERSION, VERSION_SYM,
264 XS_VERSION.
265
266 init_others
267 Initializes EXTRALIBS, BSLOADLIBS, LDLOADLIBS, LIBS, LD_RUN_PATH,
268 LD, OBJECT, BOOTDEP, PERLMAINCC, LDFROM, LINKTYPE, SHELL, NOOP,
269 FIRST_MAKEFILE, MAKEFILE_OLD, NOECHO, RM_F, RM_RF, TEST_F, TOUCH,
270 CP, MV, CHMOD, UMASK_NULL, ECHO, ECHO_N
271
272 init_linker
273 Unix has no need of special linker flags.
274
275 init_PERL
276 $mm->init_PERL;
277
278 Called by init_main. Sets up ABSPERL, PERL, FULLPERL and all the
279 *PERLRUN* permutations.
280
281 PERL is allowed to be miniperl
282 FULLPERL must be a complete perl
283
284 ABSPERL is PERL converted to an absolute path
285
286 *PERLRUN contains everything necessary to run perl, find it's
287 libraries, etc...
288
289 *PERLRUNINST is *PERLRUN + everything necessary to find the
290 modules being built.
291
292 init_platform
293 platform_constants
294 Add MM_Unix_VERSION.
295
296 init_PERM
297 $mm->init_PERM
298
299 Called by init_main. Initializes PERL_*
300
301 init_xs
302 $mm->init_xs
303
304 Sets up macros having to do with XS code. Currently just
305 INST_STATIC, INST_DYNAMIC and INST_BOOT.
306
307 install (o)
308 Defines the install target.
309
310 installbin (o)
311 Defines targets to make and to install EXE_FILES.
312
313 linkext (o)
314 Defines the linkext target which in turn defines the LINKTYPE.
315
316 lsdir
317 Takes as arguments a directory name and a regular expression.
318 Returns all entries in the directory that match the regular
319 expression.
320
321 macro (o)
322 Simple subroutine to insert the macros defined by the macro
323 attribute into the Makefile.
324
325 makeaperl (o)
326 Called by staticmake. Defines how to write the Makefile to produce
327 a static new perl.
328
329 By default the Makefile produced includes all the static extensions
330 in the perl library. (Purified versions of library files, e.g.,
331 DynaLoader_pure_p1_c0_032.a are automatically ignored to avoid link
332 errors.)
333
334 makefile (o)
335 Defines how to rewrite the Makefile.
336
337 maybe_command
338 Returns true, if the argument is likely to be a command.
339
340 needs_linking (o)
341 Does this module need linking? Looks into subdirectory objects (see
342 also has_link_code())
343
344 parse_abstract
345 parse a file and return what you think is the ABSTRACT
346
347 parse_version
348 my $version = MM->parse_version($file);
349
350 Parse a $file and return what $VERSION is set to by the first
351 assignment. It will return the string "undef" if it can't figure
352 out what $VERSION is. $VERSION should be for all to see, so "our
353 $VERSION" or plain $VERSION are okay, but "my $VERSION" is not.
354
355 "<package Foo VERSION"> is also checked for. The first version
356 declaration found is used, but this may change as it differs from
357 how Perl does it.
358
359 parse_version() will try to "use version" before checking for
360 $VERSION so the following will work.
361
362 $VERSION = qv(1.2.3);
363
364 pasthru (o)
365 Defines the string that is passed to recursive make calls in
366 subdirectories.
367
368 perl_script
369 Takes one argument, a file name, and returns the file name, if the
370 argument is likely to be a perl script. On MM_Unix this is true for
371 any ordinary, readable file.
372
373 perldepend (o)
374 Defines the dependency from all *.h files that come with the perl
375 distribution.
376
377 pm_to_blib
378 Defines target that copies all files in the hash PM to their
379 destination and autosplits them. See "DESCRIPTION" in
380 ExtUtils::Install
381
382 post_constants (o)
383 Returns an empty string per default. Dedicated to overrides from
384 within Makefile.PL after all constants have been defined.
385
386 post_initialize (o)
387 Returns an empty string per default. Used in Makefile.PLs to add
388 some chunk of text to the Makefile after the object is initialized.
389
390 postamble (o)
391 Returns an empty string. Can be used in Makefile.PLs to write some
392 text to the Makefile at the end.
393
394 ppd Defines target that creates a PPD (Perl Package Description) file
395 for a binary distribution.
396
397 prefixify
398 $MM->prefixify($var, $prefix, $new_prefix, $default);
399
400 Using either $MM->{uc $var} || $Config{lc $var}, it will attempt to
401 replace it's $prefix with a $new_prefix.
402
403 Should the $prefix fail to match AND a PREFIX was given as an
404 argument to WriteMakefile() it will set it to the $new_prefix +
405 $default. This is for systems whose file layouts don't neatly fit
406 into our ideas of prefixes.
407
408 This is for heuristics which attempt to create directory structures
409 that mirror those of the installed perl.
410
411 For example:
412
413 $MM->prefixify('installman1dir', '/usr', '/home/foo', 'man/man1');
414
415 this will attempt to remove '/usr' from the front of the
416 $MM->{INSTALLMAN1DIR} path (initializing it to
417 $Config{installman1dir} if necessary) and replace it with
418 '/home/foo'. If this fails it will simply use
419 '/home/foo/man/man1'.
420
421 processPL (o)
422 Defines targets to run *.PL files.
423
424 quote_paren
425 Backslashes parentheses "()" in command line arguments. Doesn't
426 handle recursive Makefile "$(...)" constructs, but handles simple
427 ones.
428
429 replace_manpage_separator
430 my $man_name = $MM->replace_manpage_separator($file_path);
431
432 Takes the name of a package, which may be a nested package, in the
433 form 'Foo/Bar.pm' and replaces the slash with "::" or something
434 else safe for a man page file name. Returns the replacement.
435
436 cd
437 oneliner
438 quote_literal
439 escape_newlines
440 max_exec_len
441 Using POSIX::ARG_MAX. Otherwise falling back to 4096.
442
443 static (o)
444 Defines the static target.
445
446 static_lib (o)
447 Defines how to produce the *.a (or equivalent) files.
448
449 staticmake (o)
450 Calls makeaperl.
451
452 subdir_x (o)
453 Helper subroutine for subdirs
454
455 subdirs (o)
456 Defines targets to process subdirectories.
457
458 test (o)
459 Defines the test targets.
460
461 test_via_harness (override)
462 For some reason which I forget, Unix machines like to have
463 PERL_DL_NONLAZY set for tests.
464
465 test_via_script (override)
466 Again, the PERL_DL_NONLAZY thing.
467
468 tool_xsubpp (o)
469 Determines typemaps, xsubpp version, prototype behaviour.
470
471 all_target
472 Build man pages, too
473
474 top_targets (o)
475 Defines the targets all, subdirs, config, and O_FILES
476
477 writedoc
478 Obsolete, deprecated method. Not used since Version 5.21.
479
480 xs_c (o)
481 Defines the suffix rules to compile XS files to C.
482
483 xs_cpp (o)
484 Defines the suffix rules to compile XS files to C++.
485
486 xs_o (o)
487 Defines suffix rules to go from XS to object files directly. This
488 is only intended for broken make implementations.
489
491 ExtUtils::MakeMaker
492
493
494
495perl v5.12.4 2011-11-04 ExtUtils::MM_Unix(3pm)