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