1ExtUtils::MM_Unix(3) User Contributed Perl Documentation ExtUtils::MM_Unix(3)
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 xs_obj_opt
54 Takes the object file as an argument, and returns the portion of
55 compile command-line that will output to the specified object file.
56
57 cflags (o)
58 Does very much the same as the cflags script in the perl
59 distribution. It doesn't return the whole compiler command line,
60 but initializes all of its parts. The const_cccmd method then
61 actually returns the definition of the CCCMD macro which uses these
62 parts.
63
64 const_cccmd (o)
65 Returns the full compiler call for C programs and stores the
66 definition in CONST_CCCMD.
67
68 const_config (o)
69 Sets SHELL if needed, then defines a couple of constants in the
70 Makefile that are imported from %Config.
71
72 const_loadlibs (o)
73 Defines EXTRALIBS, LDLOADLIBS, BSLOADLIBS, LD_RUN_PATH. See
74 ExtUtils::Liblist for details.
75
76 constants (o)
77 my $make_frag = $mm->constants;
78
79 Prints out macros for lots of constants.
80
81 depend (o)
82 Same as macro for the depend attribute.
83
84 init_DEST
85 $mm->init_DEST
86
87 Defines the DESTDIR and DEST* variables paralleling the INSTALL*.
88
89 init_dist
90 $mm->init_dist;
91
92 Defines a lot of macros for distribution support.
93
94 macro description default
95
96 TAR tar command to use tar
97 TARFLAGS flags to pass to TAR cvf
98
99 ZIP zip command to use zip
100 ZIPFLAGS flags to pass to ZIP -r
101
102 COMPRESS compression command to gzip --best
103 use for tarfiles
104 SUFFIX suffix to put on .gz
105 compressed files
106
107 SHAR shar command to use shar
108
109 PREOP extra commands to run before
110 making the archive
111 POSTOP extra commands to run after
112 making the archive
113
114 TO_UNIX a command to convert linefeeds
115 to Unix style in your archive
116
117 CI command to checkin your ci -u
118 sources to version control
119 RCS_LABEL command to label your sources rcs -Nv$(VERSION_SYM): -q
120 just after CI is run
121
122 DIST_CP $how argument to manicopy() best
123 when the distdir is created
124
125 DIST_DEFAULT default target to use to tardist
126 create a distribution
127
128 DISTVNAME name of the resulting archive $(DISTNAME)-$(VERSION)
129 (minus suffixes)
130
131 dist (o)
132 my $dist_macros = $mm->dist(%overrides);
133
134 Generates a make fragment defining all the macros initialized in
135 init_dist.
136
137 %overrides can be used to override any of the above.
138
139 dist_basics (o)
140 Defines the targets distclean, distcheck, skipcheck, manifest,
141 veryclean.
142
143 dist_ci (o)
144 Defines a check in target for RCS.
145
146 dist_core (o)
147 my $dist_make_fragment = $MM->dist_core;
148
149 Puts the targets necessary for 'make dist' together into one make
150 fragment.
151
152 dist_target
153 my $make_frag = $MM->dist_target;
154
155 Returns the 'dist' target to make an archive for distribution.
156 This target simply checks to make sure the Makefile is up-to-date
157 and depends on $(DIST_DEFAULT).
158
159 tardist_target
160 my $make_frag = $MM->tardist_target;
161
162 Returns the 'tardist' target which is simply so 'make tardist'
163 works. The real work is done by the dynamically named
164 tardistfile_target() method, tardist should have that as a
165 dependency.
166
167 zipdist_target
168 my $make_frag = $MM->zipdist_target;
169
170 Returns the 'zipdist' target which is simply so 'make zipdist'
171 works. The real work is done by the dynamically named
172 zipdistfile_target() method, zipdist should have that as a
173 dependency.
174
175 tarfile_target
176 my $make_frag = $MM->tarfile_target;
177
178 The name of this target is the name of the tarball generated by
179 tardist. This target does the actual work of turning the distdir
180 into a tarball.
181
182 zipfile_target
183 my $make_frag = $MM->zipfile_target;
184
185 The name of this target is the name of the zip file generated by
186 zipdist. This target does the actual work of turning the distdir
187 into a zip file.
188
189 uutardist_target
190 my $make_frag = $MM->uutardist_target;
191
192 Converts the tarfile into a uuencoded file
193
194 shdist_target
195 my $make_frag = $MM->shdist_target;
196
197 Converts the distdir into a shell archive.
198
199 dlsyms (o)
200 Used by some OS' to define DL_FUNCS and DL_VARS and write the *.exp
201 files.
202
203 Normally just returns an empty string.
204
205 dynamic_bs (o)
206 Defines targets for bootstrap files.
207
208 dynamic_lib (o)
209 Defines how to produce the *.so (or equivalent) files.
210
211 xs_dynamic_lib_macros
212 Defines the macros for the "dynamic_lib" section.
213
214 xs_make_dynamic_lib
215 Defines the recipes for the "dynamic_lib" section.
216
217 exescan
218 Deprecated method. Use libscan instead.
219
220 extliblist
221 Called by init_others, and calls ext ExtUtils::Liblist. See
222 ExtUtils::Liblist for details.
223
224 find_perl
225 Finds the executables PERL and FULLPERL
226
227 fixin
228 $mm->fixin(@files);
229
230 Inserts the sharpbang or equivalent magic number to a set of
231 @files.
232
233 force (o)
234 Writes an empty FORCE: target.
235
236 guess_name
237 Guess the name of this package by examining the working directory's
238 name. MakeMaker calls this only if the developer has not supplied a
239 NAME attribute.
240
241 has_link_code
242 Returns true if C, XS, MYEXTLIB or similar objects exist within
243 this object that need a compiler. Does not descend into
244 subdirectories as needs_linking() does.
245
246 init_dirscan
247 Scans the directory structure and initializes DIR, XS, XS_FILES, C,
248 C_FILES, O_FILES, H, H_FILES, PL_FILES, EXE_FILES.
249
250 Called by init_main.
251
252 init_MANPODS
253 Determines if man pages should be generated and initializes
254 MAN1PODS and MAN3PODS as appropriate.
255
256 init_MAN1PODS
257 Initializes MAN1PODS from the list of EXE_FILES.
258
259 init_MAN3PODS
260 Initializes MAN3PODS from the list of PM files.
261
262 init_PM
263 Initializes PMLIBDIRS and PM from PMLIBDIRS.
264
265 init_DIRFILESEP
266 Using / for Unix. Called by init_main.
267
268 init_main
269 Initializes AR, AR_STATIC_ARGS, BASEEXT, CONFIG, DISTNAME, DLBASE,
270 EXE_EXT, FULLEXT, FULLPERL, FULLPERLRUN, FULLPERLRUNINST, INST_*,
271 INSTALL*, INSTALLDIRS, LIB_EXT, LIBPERL_A, MAP_TARGET, NAME,
272 OBJ_EXT, PARENT_NAME, PERL, PERL_ARCHLIB, PERL_INC, PERL_LIB,
273 PERL_SRC, PERLRUN, PERLRUNINST, PREFIX, VERSION, VERSION_SYM,
274 XS_VERSION.
275
276 init_tools
277 Initializes tools to use their common (and faster) Unix commands.
278
279 init_linker
280 Unix has no need of special linker flags.
281
282 init_PERL
283 $mm->init_PERL;
284
285 Called by init_main. Sets up ABSPERL, PERL, FULLPERL and all the
286 *PERLRUN* permutations.
287
288 PERL is allowed to be miniperl
289 FULLPERL must be a complete perl
290
291 ABSPERL is PERL converted to an absolute path
292
293 *PERLRUN contains everything necessary to run perl, find it's
294 libraries, etc...
295
296 *PERLRUNINST is *PERLRUN + everything necessary to find the
297 modules being built.
298
299 init_platform
300 platform_constants
301 Add MM_Unix_VERSION.
302
303 init_PERM
304 $mm->init_PERM
305
306 Called by init_main. Initializes PERL_*
307
308 init_xs
309 $mm->init_xs
310
311 Sets up macros having to do with XS code. Currently just
312 INST_STATIC, INST_DYNAMIC and INST_BOOT.
313
314 install (o)
315 Defines the install target.
316
317 installbin (o)
318 Defines targets to make and to install EXE_FILES.
319
320 linkext (o)
321 Defines the linkext target which in turn defines the LINKTYPE.
322
323 lsdir
324 Takes as arguments a directory name and a regular expression.
325 Returns all entries in the directory that match the regular
326 expression.
327
328 macro (o)
329 Simple subroutine to insert the macros defined by the macro
330 attribute into the Makefile.
331
332 makeaperl (o)
333 Called by staticmake. Defines how to write the Makefile to produce
334 a static new perl.
335
336 By default the Makefile produced includes all the static extensions
337 in the perl library. (Purified versions of library files, e.g.,
338 DynaLoader_pure_p1_c0_032.a are automatically ignored to avoid link
339 errors.)
340
341 xs_static_lib_is_xs (o)
342 Called by a utility method of makeaperl. Checks whether a given
343 file is an XS library by seeing whether it defines any symbols
344 starting with "boot_".
345
346 makefile (o)
347 Defines how to rewrite the Makefile.
348
349 maybe_command
350 Returns true, if the argument is likely to be a command.
351
352 needs_linking (o)
353 Does this module need linking? Looks into subdirectory objects (see
354 also has_link_code())
355
356 parse_abstract
357 parse a file and return what you think is the ABSTRACT
358
359 parse_version
360 my $version = MM->parse_version($file);
361
362 Parse a $file and return what $VERSION is set to by the first
363 assignment. It will return the string "undef" if it can't figure
364 out what $VERSION is. $VERSION should be for all to see, so "our
365 $VERSION" or plain $VERSION are okay, but "my $VERSION" is not.
366
367 "<package Foo VERSION"> is also checked for. The first version
368 declaration found is used, but this may change as it differs from
369 how Perl does it.
370
371 parse_version() will try to "use version" before checking for
372 $VERSION so the following will work.
373
374 $VERSION = qv(1.2.3);
375
376 pasthru (o)
377 Defines the string that is passed to recursive make calls in
378 subdirectories. The variables like "PASTHRU_DEFINE" are used in
379 each level, and passed downwards on the command-line with e.g. the
380 value of that level's DEFINE. Example:
381
382 # Level 0 has DEFINE = -Dfunky
383 # This code will define level 0's PASTHRU=PASTHRU_DEFINE="$(DEFINE)
384 # $(PASTHRU_DEFINE)"
385 # Level 0's $(CCCMD) will include macros $(DEFINE) and $(PASTHRU_DEFINE)
386 # So will level 1's, so when level 1 compiles, it will get right values
387 # And so ad infinitum
388
389 perl_script
390 Takes one argument, a file name, and returns the file name, if the
391 argument is likely to be a perl script. On MM_Unix this is true for
392 any ordinary, readable file.
393
394 perldepend (o)
395 Defines the dependency from all *.h files that come with the perl
396 distribution.
397
398 pm_to_blib
399 Defines target that copies all files in the hash PM to their
400 destination and autosplits them. See "DESCRIPTION" in
401 ExtUtils::Install
402
403 ppd Defines target that creates a PPD (Perl Package Description) file
404 for a binary distribution.
405
406 prefixify
407 $MM->prefixify($var, $prefix, $new_prefix, $default);
408
409 Using either $MM->{uc $var} || $Config{lc $var}, it will attempt to
410 replace it's $prefix with a $new_prefix.
411
412 Should the $prefix fail to match AND a PREFIX was given as an
413 argument to WriteMakefile() it will set it to the $new_prefix +
414 $default. This is for systems whose file layouts don't neatly fit
415 into our ideas of prefixes.
416
417 This is for heuristics which attempt to create directory structures
418 that mirror those of the installed perl.
419
420 For example:
421
422 $MM->prefixify('installman1dir', '/usr', '/home/foo', 'man/man1');
423
424 this will attempt to remove '/usr' from the front of the
425 $MM->{INSTALLMAN1DIR} path (initializing it to
426 $Config{installman1dir} if necessary) and replace it with
427 '/home/foo'. If this fails it will simply use
428 '/home/foo/man/man1'.
429
430 processPL (o)
431 Defines targets to run *.PL files.
432
433 specify_shell
434 Specify SHELL if needed - not done on Unix.
435
436 quote_paren
437 Backslashes parentheses "()" in command line arguments. Doesn't
438 handle recursive Makefile "$(...)" constructs, but handles simple
439 ones.
440
441 replace_manpage_separator
442 my $man_name = $MM->replace_manpage_separator($file_path);
443
444 Takes the name of a package, which may be a nested package, in the
445 form 'Foo/Bar.pm' and replaces the slash with "::" or something
446 else safe for a man page file name. Returns the replacement.
447
448 cd
449 oneliner
450 quote_literal
451 Quotes macro literal value suitable for being used on a command
452 line so that when expanded by make, will be received by command as
453 given to this method:
454
455 my $quoted = $mm->quote_literal(q{it isn't});
456 # returns:
457 # 'it isn'\''t'
458 print MAKEFILE "target:\n\techo $quoted\n";
459 # when run "make target", will output:
460 # it isn't
461
462 escape_newlines
463 max_exec_len
464 Using POSIX::ARG_MAX. Otherwise falling back to 4096.
465
466 static (o)
467 Defines the static target.
468
469 xs_make_static_lib
470 Defines the recipes for the "static_lib" section.
471
472 static_lib_closures
473 Records "$(EXTRALIBS)" in extralibs.ld and $(PERL_SRC)/ext.libs.
474
475 static_lib_fixtures
476 Handles copying "$(MYEXTLIB)" as starter for final static library
477 that then gets added to.
478
479 static_lib_pure_cmd
480 Defines how to run the archive utility.
481
482 staticmake (o)
483 Calls makeaperl.
484
485 subdir_x (o)
486 Helper subroutine for subdirs
487
488 subdirs (o)
489 Defines targets to process subdirectories.
490
491 test (o)
492 Defines the test targets.
493
494 test_via_harness (override)
495 For some reason which I forget, Unix machines like to have
496 PERL_DL_NONLAZY set for tests.
497
498 test_via_script (override)
499 Again, the PERL_DL_NONLAZY thing.
500
501 tool_xsubpp (o)
502 Determines typemaps, xsubpp version, prototype behaviour.
503
504 all_target
505 Build man pages, too
506
507 top_targets (o)
508 Defines the targets all, subdirs, config, and O_FILES
509
510 writedoc
511 Obsolete, deprecated method. Not used since Version 5.21.
512
513 xs_c (o)
514 Defines the suffix rules to compile XS files to C.
515
516 xs_cpp (o)
517 Defines the suffix rules to compile XS files to C++.
518
519 xs_o (o)
520 Defines suffix rules to go from XS to object files directly. This
521 was originally only intended for broken make implementations, but
522 is now necessary for per-XS file under "XSMULTI", since each XS
523 file might have an individual "$(VERSION)".
524
526 ExtUtils::MakeMaker
527
528
529
530perl v5.28.0 2018-07-14 ExtUtils::MM_Unix(3)