1make(1S) SunOS Specific Commands make(1S)
2
3
4
6 make - maintain, update, and regenerate related programs and files
7
9 /usr/bin/make [-d] [-dd] [-D] [-DD] [-e] [-i] [-k] [-n]
10 [-p] [-P] [-q] [-r] [-s] [-S] [-t] [-V]
11 [-f makefile]... [-K statefile]... [target]...
12 [macro = value...]
13
14
15 /usr/xpg4/bin/make [-d] [-dd] [-D] [-DD] [-e] [-i] [-k]
16 [-n] [-p] [-P] [-q] [-r] [-s] [-S] [-t] [-V]
17 [-f makefile]... [target]... [macro = value...]
18
19
21 The make utility executes a list of shell commands associated with each
22 target, typically to create or update a file of the same name. makefile
23 contains entries that describe how to bring a target up to date with
24 respect to those on which it depends, which are called dependencies.
25 Since each dependency is a target, it can have dependencies of its own.
26 Targets, dependencies, and sub-dependencies comprise a tree structure
27 that make traces when deciding whether or not to rebuild a target.
28
29
30 The make utility recursively checks each target against its dependen‐
31 cies, beginning with the first target entry in makefile if no target
32 argument is supplied on the command line. If, after processing all of
33 its dependencies, a target file is found either to be missing, or to be
34 older than any of its dependencies, make rebuilds it. Optionally with
35 this version of make, a target can be treated as out-of-date when the
36 commands used to generate it have changed since the last time the tar‐
37 get was built.
38
39
40 To build a given target, make executes the list of commands, called a
41 rule. This rule can be listed explicitly in the target's makefile
42 entry, or it can be supplied implicitly by make.
43
44
45 If no target is specified on the command line, make uses the first tar‐
46 get defined in makefile.
47
48
49 If a target has no makefile entry, or if its entry has no rule, make
50 attempts to derive a rule by each of the following methods, in turn,
51 until a suitable rule is found. Each method is described under Usage
52 below.
53
54 o Pattern matching rules.
55
56 o Implicit rules, read in from a user-supplied makefile.
57
58 o Standard implicit rules (also known as suffix rules), typi‐
59 cally read in from the file /usr/share/lib/make/make.rules.
60
61 o SCCS retrieval. make retrieves the most recent version from
62 the SCCS history file (if any). See the description of the
63 .SCCS_GET: special-function target for details.
64
65 o The rule from the .DEFAULT: target entry, if there is such
66 an entry in the makefile.
67
68
69 If there is no makefile entry for a target, if no rule can be derived
70 for building it, and if no file by that name is present, make issues an
71 error message and halts.
72
74 The following options are supported:
75
76 -d Displays the reasons why make chooses to rebuild a tar‐
77 get. make displays any and all dependencies that are
78 newer. In addition, make displays options read in from
79 the MAKEFLAGS environment variable.
80
81
82 -dd Displays the dependency check and processing in vast
83 detail.
84
85
86 -D Displays the text of the makefiles read in.
87
88
89 -DD Displays the text of the makefiles, make.rules file,
90 the state file, and all hidden-dependency reports.
91
92
93 -e Environment variables override assignments within make‐
94 files.
95
96
97 -f makefile Uses the description file makefile. A − as the makefile
98 argument denotes the standard input. The contents of
99 makefile, when present, override the standard set of
100 implicit rules and predefined macros. When more than
101 one -f makefile argument pair appears, make uses the
102 concatenation of those files, in order of appearance.
103
104 When no makefile is specified, /usr/bin/make tries the
105 following in sequence, except when in POSIX mode (see
106 .POSIX in Usage):
107
108 o If there is a file named makefile in the
109 working directory, make uses that file. If,
110 however, there is an SCCS history file
111 (SCCS/s.makefile) which is newer, make
112 attempts to retrieve and use the most recent
113 version.
114
115 o In the absence of the above file(s), if a
116 file named Makefile is present in the work‐
117 ing directory, make attempts to use it. If
118 there is an SCCS history file (SCCS/s.Make‐
119 file) that is newer, make attempts to
120 retrieve and use the most recent version.
121 When no makefile is specified, /usr/bin/make in POSIX
122 mode and /usr/xpg4/bin/make try the following files in
123 sequence:
124
125 o ./makefile, ./Makefile
126
127 o s.makefile, SCCS/s.makefile
128
129 o s.Makefile, SCCS/s.Makefile
130
131
132 -i Ignores error codes returned by commands. Equivalent
133 to the special-function target .IGNORE:.
134
135
136 -k When a nonzero error status is returned by a rule, or
137 when make cannot find a rule, abandons work on the cur‐
138 rent target, but continues with other dependency
139 branches that do not depend on it.
140
141
142 -K statefile Uses the state file statefile. A − as the statefile
143 argument denotes the standard input. The contents of
144 statefile, when present, override the standard set of
145 implicit rules and predefined macros. When more than
146 one -K statefile argument pair appears, make uses the
147 concatenation of those files, in order of appearance.
148 (See also .KEEP_STATE and .KEEP_STATE_FILE in the Spe‐
149 cial-Function Targets section).
150
151
152 -n No execution mode. Prints commands, but does not exe‐
153 cute them. Even lines beginning with an @ are printed.
154 However, if a command line contains a reference to the
155 $(MAKE) macro, that line is always executed (see the
156 discussion of MAKEFLAGS in Reading Makefiles and the
157 Environment). When in POSIX mode, lines beginning with
158 a "+" are executed.
159
160
161 -p Prints out the complete set of macro definitions and
162 target descriptions.
163
164
165 -P Merely reports dependencies, rather than building them.
166
167
168 -q Question mode. make returns a zero or nonzero status
169 code depending on whether or not the target file is up
170 to date. When in POSIX mode, lines beginning with a "+"
171 are executed.
172
173
174 -r Does not read in the default makefile
175 /usr/share/lib/make/make.rules.
176
177
178 -s Silent mode. Does not print command lines before exe‐
179 cuting them. Equivalent to the special-function target
180 .SILENT:.
181
182
183 -S Undoes the effect of the -k option. Stops processing
184 when a non-zero exit status is returned by a command.
185
186
187 -t Touches the target files (bringing them up to date)
188 rather than performing their rules. Warning: This can
189 be dangerous when files are maintained by more than one
190 person. When the .KEEP_STATE: target appears in the
191 makefile, this option updates the state file just as if
192 the rules had been performed. When in POSIX mode, lines
193 beginning with a "+" are executed.
194
195
196 -V Puts make into SysV mode. Refer to sysV-make(1) for
197 respective details.
198
199
201 The following operands are supported:
202
203 target Target names, as defined in Usage.
204
205
206 macro=value Macro definition. This definition overrides any regular
207 definition for the specified macro within the makefile
208 itself, or in the environment. However, this definition
209 can still be overridden by conditional macro assign‐
210 ments.
211
212
214 The usage of make is described below:
215
216 Reading Makefiles and the Environment
217 When make first starts, it reads the MAKEFLAGS environment variable to
218 obtain any of the following options specified present in its value: -d,
219 -D, -e, -i, -k, -n, -p, -q, -r, -s, -S, or -t. Due to the implementa‐
220 tion of POSIX.2 (see POSIX.2(5), the MAKEFLAGS values contains a lead‐
221 ing − character. The make utility then reads the command line for addi‐
222 tional options, which also take effect.
223
224
225 Next, make reads in a default makefile that typically contains prede‐
226 fined macro definitions, target entries for implicit rules, and addi‐
227 tional rules, such as the rule for retrieving SCCS files. If present,
228 make uses the file make.rules in the current directory; otherwise it
229 reads the file /usr/share/lib/make/make.rules, which contains the stan‐
230 dard definitions and rules. Use the directive:
231
232 include /usr/share/lib/make/make.rules
233
234
235
236
237 in your local make.rules file to include them.
238
239
240 Next, make imports variables from the environment (unless the -e option
241 is in effect), and treats them as defined macros. Because make uses the
242 most recent definition it encounters, a macro definition in the make‐
243 file normally overrides an environment variable of the same name. When
244 -e is in effect, however, environment variables are read in after all
245 makefiles have been read. In that case, the environment variables take
246 precedence over definitions in the makefile.
247
248
249 Next, make reads any makefiles you specify with -f, or one of makefile
250 or Makefile as described above and then the state file, in the local
251 directory if it exists. If the makefile contains a .KEEP_STATE_FILE
252 target, then it reads the state file that follows the target. Refer to
253 special target .KEEP_STATE_FILE for details.
254
255
256 Next (after reading the environment if -e is in effect), make reads in
257 any macro definitions supplied as command line arguments. These over‐
258 ride macro definitions in the makefile and the environment both, but
259 only for the make command itself.
260
261
262 make exports environment variables, using the most recently defined
263 value. Macro definitions supplied on the command line are not normally
264 exported, unless the macro is also an environment variable.
265
266
267 make does not export macros defined in the makefile. If an environment
268 variable is set, and a macro with the same name is defined on the com‐
269 mand line, make exports its value as defined on the command line.
270 Unless -e is in effect, macro definitions within the makefile take
271 precedence over those imported from the environment.
272
273
274 The macros MAKEFLAGS, MAKE, SHELL, HOST_ARCH, HOST_MACH, and TAR‐
275 GET_MACH are special cases. See Special-Purpose Macros below for
276 details.
277
278 Makefile Target Entries
279 A target entry has the following format:
280
281 target [:|::] [dependency] ... [; command] ...
282 [command]
283 ...
284
285
286
287 The first line contains the name of a target, or a space-separated list
288 of target names, terminated with a colon or double colon. If a list of
289 targets is given, this is equivalent to having a separate entry of the
290 same form for each target. The colon(s) can be followed by a depen‐
291 dency, or a dependency list. make checks this list before building the
292 target. The dependency list can be terminated with a semicolon (;),
293 which in turn can be followed by a single Bourne shell command. Subse‐
294 quent lines in the target entry begin with a TAB and contain Bourne
295 shell commands. These commands comprise the rule for building the tar‐
296 get.
297
298
299 Shell commands can be continued across input lines by escaping the NEW‐
300 LINE with a backslash (\). The continuing line must also start with a
301 TAB.
302
303
304 To rebuild a target, make expands macros, strips off initial TAB char‐
305 acters and either executes the command directly (if it contains no
306 shell metacharacters), or passes each command line to a Bourne shell
307 for execution.
308
309
310 The first non-empty line that does not begin with a TAB or # begins
311 another target or macro definition.
312
313 Special Characters
314 Special characters are defined below.
315
316 Global
317 # Start a comment. The comment ends at the next NEW‐
318 LINE. If the # follows the TAB in a command line,
319 that line is passed to the shell (which also treats
320 # as the start of a comment).
321
322
323 include filename If the word include appears as the first seven let‐
324 ters of a line and is followed by a SPACE or TAB,
325 the string that follows is taken as a filename to
326 interpolate at that line. include files can be
327 nested to a depth of no more than 38 nested make‐
328 files . If filename is a macro reference, it is
329 expanded.
330
331
332 Targets and Dependencies
333 :
334
335 Target list terminator. Words following the colon are added to the
336 dependency list for the target or targets. If a target is named in
337 more than one colon-terminated target entry, the dependencies for
338 all its entries are added to form that target's complete dependency
339 list.
340
341
342 ::
343
344 Target terminator for alternate dependencies. When used in place of
345 a : the double-colon allows a target to be checked and updated with
346 respect to alternate dependency lists. When the target is out-of-
347 date with respect to dependencies listed in the first alternate, it
348 is built according to the rule for that entry. When out-of-date
349 with respect to dependencies in another alternate, it is built
350 according the rule in that other entry. Implicit rules do not apply
351 to double-colon targets; you must supply a rule for each entry. If
352 no dependencies are specified, the rule is always performed.
353
354
355 target [+ target...] :
356
357 Target group. The rule in the target entry builds all the indicated
358 targets as a group. It is normally performed only once per make
359 run, but is checked for command dependencies every time a target in
360 the group is encountered in the dependency scan.
361
362
363 %
364
365 Pattern matching wild card metacharacter. Like the * shell wild
366 card, % matches any string of zero or more characters in a target
367 name or dependency, in the target portion of a conditional macro
368 definition, or within a pattern replacement macro reference. Notice
369 that only one % can appear in a target, dependency-name, or pat‐
370 tern-replacement macro reference.
371
372
373 ./pathname
374
375 make ignores the leading ./ characters from targets with names
376 given as pathnames relative to "dot," the working directory.
377
378
379 Macros
380 = Macro definition. The word to the left of this character is
381 the macro name; words to the right comprise its value. Leading
382 and trailing white space characters are stripped from the
383 value. A word break following the = is implied.
384
385
386 $ Macro reference. The following character, or the parenthesized
387 or bracketed string, is interpreted as a macro reference: make
388 expands the reference (including the $) by replacing it with
389 the macro's value.
390
391
392 ( ) Macro-reference name delimiters. A parenthesized or bracketed
393 { } word appended to a $ is taken as the name of the macro being
394 referred to. Without the delimiters, make recognizes only the
395 first character as the macro name.
396
397
398 $$ A reference to the dollar-sign macro, the value of which is
399 the character $. Used to pass variable expressions beginning
400 with $ to the shell, to refer to environment variables which
401 are expanded by the shell, or to delay processing of dynamic
402 macros within the dependency list of a target, until that tar‐
403 get is actually processed.
404
405
406 \$ Escaped dollar-sign character. Interpreted as a literal dol‐
407 lar sign within a rule.
408
409
410 += When used in place of =, appends a string to a macro defini‐
411 tion (must be surrounded by white space, unlike =).
412
413
414 := Conditional macro assignment. When preceded by a list of tar‐
415 gets with explicit target entries, the macro definition that
416 follows takes effect when processing only those targets, and
417 their dependencies.
418
419
420 :sh = Define the value of a macro to be the output of a command (see
421 Command Substitutions below).
422
423
424 :sh In a macro reference, execute the command stored in the macro,
425 and replace the reference with the output of that command (see
426 Command Substitutions below).
427
428
429 Rules
430 + make always executes the commands preceded by a "+", even when
431 -n is specified.
432
433
434 − make ignores any nonzero error code returned by a command line
435 for which the first non-TAB character is a −. This character is
436 not passed to the shell as part of the command line. make nor‐
437 mally terminates when a command returns nonzero status, unless
438 the -i or -k options, or the .IGNORE: special-function target
439 is in effect.
440
441
442 @ If the first non-TAB character is a @, make does not print the
443 command line before executing it. This character is not passed
444 to the shell.
445
446
447 ? Escape command-dependency checking. Command lines starting with
448 this character are not subject to command dependency checking.
449
450
451 ! Force command-dependency checking. Command-dependency checking
452 is applied to command lines for which it would otherwise be
453 suppressed. This checking is normally suppressed for lines that
454 contain references to the ? dynamic macro (for example, $?).
455
456 When any combination of +, −, @, ?, or ! appear as the first
457 characters after the TAB, all that are present apply. None are
458 passed to the shell.
459
460
461 Special-Function Targets
462 When incorporated in a makefile, the following target names perform
463 special-functions:
464
465 .DEFAULT: If it has an entry in the makefile, the rule for
466 this target is used to process a target when
467 there is no other entry for it, no rule for
468 building it, and no SCCS history file from which
469 to retrieve a current version. make ignores any
470 dependencies for this target.
471
472
473 .DONE: If defined in the makefile, make processes this
474 target and its dependencies after all other tar‐
475 gets are built. This target is also performed
476 when make halts with an error, unless the
477 .FAILED target is defined.
478
479
480 .FAILED: This target, along with its dependencies, is
481 performed instead of .DONE when defined in the
482 makefile and make halts with an error.
483
484
485 .GET_POSIX: This target contains the rule for retrieving the
486 current version of an SCCS file from its history
487 file in the current working directory. make uses
488 this rule when it is running in POSIX mode.
489
490
491 .IGNORE: Ignore errors. When this target appears in the
492 makefile, make ignores non-zero error codes
493 returned from commands. When used in POSIX mode,
494 .IGNORE could be followed by target names only,
495 for which the errors is ignored.
496
497
498 .INIT: If defined in the makefile, this target and its
499 dependencies are built before any other targets
500 are processed.
501
502
503 .KEEP_STATE: If this target is in effect, make updates the
504 state file, .make.state, in the current direc‐
505 tory. This target also activates command depen‐
506 dencies, and hidden dependency checks. If either
507 the .KEEP_STATE: target appears in the makefile,
508 or the environment variable KEEP_STATE is set
509 (setenv KEEP_STATE), make rebuilds everything in
510 order to collect dependency information, even if
511 all the targets were up to date due to previous
512 make runs. See also the Environment Variables
513 section. This target has no effect if used in
514 POSIX mode.
515
516
517 .KEEP_STATE_FILE: This target has no effect if used in POSIX mode.
518 This target implies .KEEP_STATE. If the target
519 is followed by a filename, make uses it as the
520 state file. If the target is followed by a
521 directory name, make looks for a .make.state
522 file in that directory. If the target is not
523 followed by any name, make looks for .make.state
524 file in the current working directory.
525
526
527 .MAKE_VERSION: A target-entry of the form:
528
529 .MAKE_VERSION: VERSION−number
530
531 enables version checking. If the version of make
532 differs from the version indicated by a string
533 like VERSION-1.0, make issues a warning message.
534
535
536 .NO_PARALLEL: Currently, this target has no effect, it is,
537 however, reserved for future use.
538
539
540 .PARALLEL: Currently of no effect, but reserved for future
541 use.
542
543
544 .POSIX: This target enables POSIX mode.
545
546
547 .PRECIOUS: List of files not to delete. make does not
548 remove any of the files listed as dependencies
549 for this target when interrupted. make normally
550 removes the current target when it receives an
551 interrupt. When used in POSIX mode, if the tar‐
552 get is not followed by a list of files, all the
553 file are assumed precious.
554
555
556 .SCCS_GET: This target contains the rule for retrieving the
557 current version of an SCCS file from its history
558 file. To suppress automatic retrieval, add an
559 entry for this target with an empty rule to your
560 makefile.
561
562
563 .SCCS_GET_POSIX: This target contains the rule for retrieving the
564 current version of an SCCS file from its history
565 file. make uses this rule when it is running in
566 POSIX mode.
567
568
569 .SILENT: Run silently. When this target appears in the
570 makefile, make does not echo commands before
571 executing them. When used in POSIX mode, it
572 could be followed by target names, and only
573 those are executed silently.
574
575
576 .SUFFIXES: The suffixes list for selecting implicit rules
577 (see The Suffixes List).
578
579
580 .WAIT: Currently of no effect, but reserved for future
581 use.
582
583
584 Clearing Special Targets
585 In this version of make, you can clear the definition of the following
586 special targets by supplying entries for them with no dependencies and
587 no rule:
588
589
590 .DEFAULT, .SCCS_GET, and .SUFFIXES
591
592 Command Dependencies
593 When the .KEEP_STATE: target is effective, make checks the command for
594 building a target against the state file. If the command has changed
595 since the last make run, make rebuilds the target.
596
597 Hidden Dependencies
598 When the .KEEP_STATE: target is effective, make reads reports from
599 cpp(1) and other compilation processors for any "hidden" files, such as
600 #include files. If the target is out of date with respect to any of
601 these files, make rebuilds it.
602
603 Macros
604 Entries of the form
605
606 macro=value
607
608
609
610 define macros. macro is the name of the macro, and value, which con‐
611 sists of all characters up to a comment character or unescaped NEWLINE,
612 is the value. make strips both leading and trailing white space in
613 accepting the value.
614
615
616 Subsequent references to the macro, of the forms: $(name) or ${name}
617 are replaced by value. The parentheses or brackets can be omitted in a
618 reference to a macro with a single-character name.
619
620
621 Macro references can contain references to other macros, in which case
622 nested references are expanded first.
623
624 Suffix Replacement Macro References
625 Substitutions within macros can be made as follows:
626
627 $(name:string1=string2)
628
629
630
631 where string1 is either a suffix, or a word to be replaced in the macro
632 definition, and string2 is the replacement suffix or word. Words in a
633 macro value are separated by SPACE, TAB, and escaped NEWLINE charac‐
634 ters.
635
636 Pattern Replacement Macro References
637 Pattern matching replacements can also be applied to macros, with a
638 reference of the form:
639
640 $(name: op%os= np%ns)
641
642
643
644 where op is the existing (old) prefix and os is the existing (old) suf‐
645 fix, np and ns are the new prefix and new suffix, respectively, and the
646 pattern matched by % (a string of zero or more characters), is carried
647 forward from the value being replaced. For example:
648
649 PROGRAM=fabricate
650 DEBUG= $(PROGRAM:%=tmp/%−g)
651
652
653
654
655 sets the value of DEBUG to tmp/fabricate−g.
656
657
658 Notice that pattern replacement macro references cannot be used in the
659 dependency list of a pattern matching rule; the % characters are not
660 evaluated independently. Also, any number of % metacharacters can
661 appear after the equal-sign.
662
663 Appending to a Macro
664 Words can be appended to macro values as follows:
665
666 macro += word ...
667
668
669 Special-Purpose Macros
670 When the MAKEFLAGS variable is present in the environment, make takes
671 options from it, in combination with options entered on the command
672 line. make retains this combined value as the MAKEFLAGS macro, and
673 exports it automatically to each command or shell it invokes.
674
675
676 Notice that flags passed by way of MAKEFLAGS are only displayed when
677 the -d, or -dd options are in effect.
678
679
680 The MAKE macro is another special case. It has the value make by
681 default, and temporarily overrides the -n option for any line in which
682 it is referred to. This allows nested invocations of make written as:
683
684 $(MAKE) ...
685
686
687
688 to run recursively, with the -n flag in effect for all commands but
689 make. This lets you use make -n to test an entire hierarchy of make‐
690 files.
691
692
693 For compatibility with the 4.2 BSD make, the MFLAGS macro is set from
694 the MAKEFLAGS variable by prepending a -. MFLAGS is not exported auto‐
695 matically.
696
697
698 The SHELL macro, when set to a single-word value such as /usr/bin/csh,
699 indicates the name of an alternate shell to use. The default is
700 /bin/sh. Notice that make executes commands that contain no shell
701 metacharacters itself. Built-in commands, such as dirs in the C shell,
702 are not recognized unless the command line includes a metacharacter
703 (for instance, a semicolon). This macro is neither imported from, nor
704 exported to the environment, regardless of -e. To be sure it is set
705 properly, you must define this macro within every makefile that
706 requires it.
707
708
709 The syntax of the VPATH macro is:
710
711 VPATH = [ pathname [ : pathname ] ... ]
712
713
714
715 VPATH specifies a list of directories to search for the files, which
716 are targets or dependencies, when make is executed. VPATH is also used
717 in order to search for the include files mentioned in the particular
718 makefile.
719
720
721 When processing a target or a dependency or an include directive, make
722 checks the existence of the file with the same name in the current
723 directory. If the file is found to be missing, make searches for this
724 file in the list of directories presented in VPATH (like the PATH vari‐
725 able in the shell). Unlike the PATH variable, VPATH is used in order to
726 search for the files with relative pathnames. When make attempts to
727 apply implicit rules to the target, it also searches for the dependency
728 files using VPATH.
729
730
731 When the file is found using VPATH, internal macros $@, @<, $?, $*, and
732 their alternative forms (with D or F appended) are set in accordance
733 with the name derived from VPATH. For instance, if the target sub‐
734 dir/foo.o is found in the directory /aaa/bbb using VPATH, then the
735 value of the internal macro $@ for this target is /aaa/bbb/sub‐
736 dir/foo.o.
737
738
739 If a target or a dependency file is found using VPATH, then any occur‐
740 rences of the word that is the same as the target name in the subse‐
741 quent rules are replaced with the actual name of the target derived
742 from VPATH.
743
744
745 For example:
746
747 VPATH=./subdir
748 file.o : file.c
749 cc -c file.c -o file.o
750
751
752
753
754 If file.c is found in ./subdir, then the command
755
756 cc -c ./subdir/file.c -o file.o
757
758
759
760
761 are executed.
762
763
764 The following macros are provided for use with cross-compilation:
765
766 HOST_ARCH The processor type of the host system. By default, this
767 is the output of the mach(1) command, prepended with -.
768 Under normal circumstances, this value should never be
769 altered by the user.
770
771
772 HOST_MACH The machine architecture of the host system. By default,
773 this is the output of the arch(1) command, prepended
774 with −. Under normal circumstances, this value should
775 never be altered by the user.
776
777
778 TARGET_ARCH The processor type of the target system. By default, the
779 output of mach, prepended with −.
780
781
782 Dynamic Macros
783 There are several dynamically maintained macros that are useful as
784 abbreviations within rules. They are shown here as references; if you
785 were to define them, make would simply override the definition.
786
787 $* The basename of the current target, derived as if selected for
788 use with an implicit rule.
789
790
791 $< The name of a dependency file, derived as if selected for use
792 with an implicit rule.
793
794
795 $@ The name of the current target. This is the only dynamic macro
796 whose value is strictly determined when used in a dependency
797 list. (In which case it takes the form $$@.)
798
799
800 $? The list of dependencies that are newer than the target. Command-
801 dependency checking is automatically suppressed for lines that
802 contain this macro, just as if the command had been prefixed with
803 a ?. See the description of ?, under Special Character Rules
804 above. You can force this check with the ! command-line prefix.
805
806
807 $% The name of the library member being processed. (See Library
808 Maintenance below.)
809
810
811
812 To refer to the $@ dynamic macro within a dependency list, precede the
813 reference with an additional $ character (as in, $$@). Because make
814 assigns $< and $* as it would for implicit rules (according to the suf‐
815 fixes list and the directory contents), they can be unreliable when
816 used within explicit target entries.
817
818
819 These macros can be modified to apply either to the filename part, or
820 the directory part of the strings they stand for, by adding an upper
821 case F or D, respectively (and enclosing the resulting name in paren‐
822 theses or braces). Thus, $(@D) refers to the directory part of the
823 string $@; if there is no directory part, . is assigned. $(@F) refers
824 to the filename part.
825
826 Conditional Macro Definitions
827 A macro definition of the form:
828
829 target-list := macro = value
830
831
832
833 indicates that when processing any of the targets listed and their
834 dependencies, macro is to be set to the value supplied. Notice that if
835 a conditional macro is referred to in a dependency list, the $ must be
836 delayed (use $$ instead). Also, target-list can contain a % pattern, in
837 which case the macro is conditionally defined for all targets encoun‐
838 tered that match the pattern. A pattern replacement reference can be
839 used within the value.
840
841
842 You can temporarily append to a macros value with a conditional defini‐
843 tion of the form:
844
845 target-list := macro += value
846
847
848 Predefined Macros
849 make supplies the macros shown in the table that follows for compilers
850 and their options, host architectures, and other commands. Unless these
851 macros are read in as environment variables, their values are not
852 exported by make. If you run make with any of these set in the environ‐
853 ment, it is a good idea to add commentary to the makefile to indicate
854 what value each is expected to take. If -r is in effect, make does not
855 read the default makefile (./make.rules or
856 /usr/share/lib/make/make.rules) in which these macro definitions are
857 supplied.
858
859
860
861
862 ┌───────────────────────────┬──────────────┬──────────────────────────────────────────┐
863 │Table of Predefined Macros │ │ │
864 ├───────────────────────────┼──────────────┼──────────────────────────────────────────┤
865 │ Use │ Macro │ Default Value │
866 ├───────────────────────────┼──────────────┼──────────────────────────────────────────┤
867 │ Library │ AR │ ar │
868 │ Archives │ ARFLAGS │ rv │
869 ├───────────────────────────┼──────────────┼──────────────────────────────────────────┤
870 │ │ │ │
871 │ Assembler │ AS │ as │
872 │ Commands │ ASFLAGS │ │
873 │ │ COMPILE.s │ $(AS) $(ASFLAGS) │
874 │ │ COMPILE.S │ $(CC) $(ASFLAGS) $(CPPFLAGS) -c │
875 ├───────────────────────────┼──────────────┼──────────────────────────────────────────┤
876 │ │ │ │
877 │ C │ CC │ cc │
878 │ Compiler │ CFLAGS │ │
879 │ Commands │ CPPFLAGS │ │
880 │ │ COMPILE.c │ $(CC) $(CFLAGS) $(CPPFLAGS) -c │
881 │ │ LINK.c │ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) │
882 ├───────────────────────────┼──────────────┼──────────────────────────────────────────┤
883 │ │ │ │
884 │ C++ │ CCC │ CC │
885 │ Compiler │ CCFLAGS │ CFLAGS │
886 │ Commands │ CPPFLAGS │ │
887 │ │ COMPILE.cc │ $(CCC) $(CCFLAGS) $(CPPFLAGS) -c │
888 │ │ LINK.cc │ $(CCC) $(CCFLAGS) $(CPPFLAGS) $(LDFLAGS) │
889 │ │ COMPILE.C │ $(CCC) $(CCFLAGS) $(CPPFLAGS) -c │
890 │ │ LINK.C │ $(CCC) $(CCFLAGS) $(CPPFLAGS) $(LDFLAGS) │
891 ├───────────────────────────┼──────────────┼──────────────────────────────────────────┤
892 │ │ │ │
893 │ FORTRAN 77 │ FC │ f77 │
894 │ Compiler │ FFLAGS │ │
895 │ Commands │ COMPILE.f │ $(FC) $(FFLAGS) -c │
896 │ │ LINK.f │ $(FC) $(FFLAGS) $(LDFLAGS) │
897 │ │ COMPILE.F │ $(FC) $(FFLAGS) $(CPPFLAGS) -c │
898 │ │ LINK.F │ $(FC) $(FFLAGS) $(CPPFLAGS) $(LDFLAGS) │
899 ├───────────────────────────┼──────────────┼──────────────────────────────────────────┤
900 │ │ │ │
901 │ FORTRAN 90 │ FC │ f90 │
902 │ Compiler │ F90FLAGS │ │
903 │ Commands │ COMPILE.f90 │ $(F90C) $(F90FLAGS) -c │
904 │ │ LINK.f90 │ $(F90C) $(F90FLAGS) $(LDFLAGS) │
905 │ │ COMPILE.ftn │ $(F90C) $(F90FLAGS) $(CPPFLAGS) -c │
906 │ │ LINK.ftn │ $(F90C) $(F90FLAGS) $(CPPFLAGS) │
907 │ │ │ $(LDFLAGS) │
908 ├───────────────────────────┼──────────────┼──────────────────────────────────────────┤
909 │ │ │ │
910 │ Link Editor │ LD │ ld │
911 │ Command │ LDFLAGS │ │
912 ├───────────────────────────┼──────────────┼──────────────────────────────────────────┤
913 │ │ │ │
914 │ lex │ LEX │ lex │
915 │ Command │ LFLAGS │ │
916 │ │ LEX.l │ $(LEX) $(LFLAGS) -t │
917 ├───────────────────────────┼──────────────┼──────────────────────────────────────────┤
918 │ │ │ │
919 │ lint │ LINT │ lint │
920 │ Command │ LINTFLAGS │ │
921 │ │ LINT.c │ $(LINT) $(LINTFLAGS) $(CPPFLAGS) │
922 ├───────────────────────────┼──────────────┼──────────────────────────────────────────┤
923 │ │ │ │
924 │ Modula 2 │ M2C │ m2c │
925 │ Commands │ M2FLAGS │ │
926 │ │ MODFLAGS │ │
927 │ │ DEFFLAGS │ │
928 │ │ COMPILE.def │ $(M2C) $(M2FLAGS) $(DEFFLAGS) │
929 │ │ COMPILE.mod │ $(M2C) $(M2FLAGS) $(MODFLAGS) │
930 ├───────────────────────────┼──────────────┼──────────────────────────────────────────┤
931 │ │ │ │
932 │ Pascal │ PC │ pc │
933 │ Compiler │ PFLAGS │ │
934 │ Commands │ COMPILE.p │ $(PC) $(PFLAGS) $(CPPFLAGS) -c │
935 │ │ LINK.p │ $(PC) $(PFLAGS) $(CPPFLAGS) $(LDFLAGS) │
936 ├───────────────────────────┼──────────────┼──────────────────────────────────────────┤
937 │ │ │ │
938 │ Ratfor │ RFLAGS │ │
939 │ Compilation │ COMPILE.r │ $(FC) $(FFLAGS) $(RFLAGS) -c │
940 │ Commands │ LINK.r │ $(FC) $(FFLAGS) $(RFLAGS) $(LDFLAGS) │
941 ├───────────────────────────┼──────────────┼──────────────────────────────────────────┤
942 │ │ │ │
943 │ rm Command │ RM │ rm -f │
944 ├───────────────────────────┼──────────────┼──────────────────────────────────────────┤
945 │ │ │ │
946 │ sccs │ SCCSFLAGS │ │
947 │ Command │ SCCSGETFLAGS │ -s │
948 ├───────────────────────────┼──────────────┼──────────────────────────────────────────┤
949 │ │ │ │
950 │ yacc │ YACC │ yacc │
951 │ Command │ YFLAGS │ │
952 │ │ YACC.y │ $(YACC) $(YFLAGS) │
953 ├───────────────────────────┼──────────────┼──────────────────────────────────────────┤
954 │ │ │ │
955 │ Suffixes List │ SUFFIXES │ .o .c .c~ .cc .cc~ .y .y~ .l .l~ .s .s~ │
956 │ │ │ .sh .sh~ .S .S~ .ln .h .h~ .f .f~ .F .F~ │
957 │ │ │ .mod .mod~ .sym .def .def~ .p .p~ .r .r~ │
958 │ │ │ .cps .cps~ .C .C~ .Y .Y~ .L .L .f90 │
959 │ │ │ .f90~ .ftn .ftn~ │
960 └───────────────────────────┴──────────────┴──────────────────────────────────────────┘
961
962 Implicit Rules
963 When a target has no entry in the makefile, make attempts to determine
964 its class (if any) and apply the rule for that class. An implicit rule
965 describes how to build any target of a given class, from an associated
966 dependency file. The class of a target can be determined either by a
967 pattern, or by a suffix; the corresponding dependency file (with the
968 same basename) from which such a target might be built. In addition to
969 a predefined set of implicit rules, make allows you to define your own,
970 either by pattern, or by suffix.
971
972 Pattern Matching Rules
973 A target entry of the form:
974
975 tp%ts:dp%ds
976 rule
977
978
979
980
981 is a pattern matching rule, in which tp is a target prefix, ts is a
982 target suffix, dp is a dependency prefix, and ds is a dependency suffix
983 (any of which can be null). The % stands for a basename of zero or more
984 characters that is matched in the target, and is used to construct the
985 name of a dependency. When make encounters a match in its search for an
986 implicit rule, it uses the rule in that target entry to build the tar‐
987 get from the dependency file. Pattern-matching implicit rules typically
988 make use of the $@ and $< dynamic macros as placeholders for the target
989 and dependency names. Other, regular dependencies can occur in the
990 dependency list; however, none of the regular dependencies can contain
991 %. An entry of the form:
992
993 tp%ts:[dependency ...] dp%ds[dependency ...]
994 rule
995
996
997
998
999 is a valid pattern matching rule.
1000
1001 Suffix Rules
1002 When no pattern matching rule applies, make checks the target name to
1003 see if it ends with a suffix in the known suffixes list. If so, make
1004 checks for any suffix rules, as well as a dependency file with same
1005 root and another recognized suffix, from which to build it.
1006
1007
1008 The target entry for a suffix rule takes the form:
1009
1010 DsTs: rule
1011
1012
1013
1014
1015 where Ts is the suffix of the target, Ds is the suffix of the depen‐
1016 dency file, and rule is the rule for building a target in the class.
1017 Both Ds and Ts must appear in the suffixes list. (A suffix need not
1018 begin with a . to be recognized.)
1019
1020
1021 A suffix rule with only one suffix describes how to build a target hav‐
1022 ing a null (or no) suffix from a dependency file with the indicated
1023 suffix. For instance, the .c rule could be used to build an executable
1024 program named file from a C source file named file.c. If a target with
1025 a null suffix has an explicit dependency, make omits the search for a
1026 suffix rule.
1027
1028
1029
1030
1031 ┌───────────────────┬─────────────────────────────────────────┐
1032 │Table of Standard │ │
1033 │Implicit (Suffix) │ │
1034 │Rules for Assembly │ │
1035 │Files │ │
1036 ├───────────────────┼─────────────────────────────────────────┤
1037 │Implicit Rule Name │ Command Line │
1038 ├───────────────────┼─────────────────────────────────────────┤
1039 │ .s.o │ $(COMPILE.s) -o $@ $< │
1040 ├───────────────────┼─────────────────────────────────────────┤
1041 │ │ │
1042 │ .s.a │ $(COMPILE.s) -o $% $< │
1043 │ │ $(AR) $(ARFLAGS) $@ $% │
1044 │ │ $(RM) $% │
1045 ├───────────────────┼─────────────────────────────────────────┤
1046 │ │ │
1047 │ .s~.o │ $(GET) $(GFLAGS) -p $< > $*.s │
1048 │ │ $(COMPILE.s) -o $@ $*.s │
1049 ├───────────────────┼─────────────────────────────────────────┤
1050 │ │ │
1051 │ .S.o │ $(COMPILE.S) -o $@ $< │
1052 ├───────────────────┼─────────────────────────────────────────┤
1053 │ │ │
1054 │ .S.a │ $(COMPILE.S) -o $% $< │
1055 │ │ $(AR) $(ARFLAGS) $@ $% │
1056 │ │ $(RM) $% │
1057 ├───────────────────┼─────────────────────────────────────────┤
1058 │ │ │
1059 │ .S~.o │ $(GET) $(GFLAGS) -p $< > $*.S │
1060 │ │ $(COMPILE.S) -o $@ $*.S │
1061 ├───────────────────┼─────────────────────────────────────────┤
1062 │ │ │
1063 │ .S~.a │ $(GET) $(GFLAGS) -p $< > $*.S │
1064 │ │ $(COMPILE.S) -o $% $*.S │
1065 │ │ $(AR) $(ARFLAGS) $@ $% │
1066 │ │ $(RM) $% │
1067 └───────────────────┴─────────────────────────────────────────┘
1068
1069
1070
1071
1072 ┌───────────────────┬─────────────────────────────────────────┐
1073 │Table of Standard │ │
1074 │Implicit (Suffix) │ │
1075 │Rules for C Files │ │
1076 ├───────────────────┼─────────────────────────────────────────┤
1077 │Implicit Rule Name │ Command Line │
1078 ├───────────────────┼─────────────────────────────────────────┤
1079 │ .c │ $(LINK.c) -o $@ $< $(LDLIBS) │
1080 ├───────────────────┼─────────────────────────────────────────┤
1081 │ │ │
1082 │ .c.ln │ $(LINT.c) $(OUTPUT_OPTION) -i $< │
1083 ├───────────────────┼─────────────────────────────────────────┤
1084 │ │ │
1085 │ .c.o │ $(COMPILE.c) $(OUTPUT_OPTION) $< │
1086 ├───────────────────┼─────────────────────────────────────────┤
1087 │ │ │
1088 │ .c.a │ $(COMPILE.c) -o $% $< │
1089 │ │ $(AR) $(ARFLAGS) $@ $% │
1090 │ │ $(RM) $% │
1091 ├───────────────────┼─────────────────────────────────────────┤
1092 │ │ │
1093 │ .c~ │ $(GET) $(GFLAGS) -p $< > $*.c │
1094 │ │ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $*.c │
1095 ├───────────────────┼─────────────────────────────────────────┤
1096 │ │ │
1097 │ .c~.o │ $(GET) $(GFLAGS) -p $< > $*.c │
1098 │ │ $(CC) $(CFLAGS) -c $*.c │
1099 ├───────────────────┼─────────────────────────────────────────┤
1100 │ │ │
1101 │ .c~.ln │ $(GET) $(GFLAGS) -p $< > $*.c │
1102 │ │ $(LINT.c) $(OUTPUT_OPTION) -c $*.c │
1103 ├───────────────────┼─────────────────────────────────────────┤
1104 │ │ │
1105 │ .c~.a │ $(GET) $(GFLAGS) -p $< > $*.c │
1106 │ │ $(COMPILE.c) -o $% $*.c │
1107 │ │ $(AR) $(ARFLAGS) $@ $% │
1108 │ │ $(RM) $% │
1109 └───────────────────┴─────────────────────────────────────────┘
1110
1111
1112
1113
1114 ┌───────────────────┬─────────────────────────────────────────┐
1115 │Table of Standard │ │
1116 │Implicit (Suffix) │ │
1117 │Rules for C++ │ │
1118 │Files │ │
1119 ├───────────────────┼─────────────────────────────────────────┤
1120 │Implicit Rule Name │ Command Line │
1121 ├───────────────────┼─────────────────────────────────────────┤
1122 │ .cc │ $(LINK.cc) -o $@ $< $(LDLIBS) │
1123 ├───────────────────┼─────────────────────────────────────────┤
1124 │ │ │
1125 │ .cc.o │ $(COMPILE.cc) $(OUTPUT_OPTION) $< │
1126 ├───────────────────┼─────────────────────────────────────────┤
1127 │ │ │
1128 │ .cc.a │ $(COMPILE.cc) -o $% $< │
1129 │ │ $(AR) $(ARFLAGS) $@ $% │
1130 │ │ $(RM) $% │
1131 ├───────────────────┼─────────────────────────────────────────┤
1132 │ │ │
1133 │ .cc~ │ $(GET) $(GFLAGS) -p $< > $*.cc │
1134 │ │ $(LINK.cc) -o $@ $*.cc $(LDLIBS) │
1135 ├───────────────────┼─────────────────────────────────────────┤
1136 │ │ │
1137 │ .cc.o │ $(COMPILE.cc) $(OUTPUT_OPTION) $< │
1138 ├───────────────────┼─────────────────────────────────────────┤
1139 │ │ │
1140 │ .cc~.o │ $(GET) $(GFLAGS) -p $< > $*.cc │
1141 │ │ $(COMPILE.cc) $(OUTPUT_OPTION) $*.cc │
1142 ├───────────────────┼─────────────────────────────────────────┤
1143 │ │ │
1144 │ .cc.a │ $(COMPILE.cc) -o $% $< │
1145 │ │ $(AR) $(ARFLAGS) $@ $% │
1146 │ │ $(RM) $% │
1147 ├───────────────────┼─────────────────────────────────────────┤
1148 │ │ │
1149 │ .cc~.a │ $(GET) $(GFLAGS) -p $< > $*.cc │
1150 │ │ $(COMPILE.cc) -o $% $*.cc │
1151 │ │ $(AR) $(ARFLAGS) $@ $% │
1152 │ │ $(RM) $% │
1153 ├───────────────────┼─────────────────────────────────────────┤
1154 │ │ │
1155 │ .C │ $(LINK.C) -o $@ $< $(LDLIBS) │
1156 ├───────────────────┼─────────────────────────────────────────┤
1157 │ │ │
1158 │ .C~ │ $(GET) $(GFLAGS) -p $< > $*.C │
1159 │ │ $(LINK.C) -o $@ $*.C $(LDLIBS) │
1160 ├───────────────────┼─────────────────────────────────────────┤
1161 │ │ │
1162 │ .C.o │ $(COMPILE.C) $(OUTPUT_OPTION) $< │
1163 ├───────────────────┼─────────────────────────────────────────┤
1164 │ │ │
1165 │ .C~.o │ $(GET) $(GFLAGS) -p $< > $*.C │
1166 │ │ $(COMPILE.C) $(OUTPUT_OPTION) $*.C │
1167 ├───────────────────┼─────────────────────────────────────────┤
1168 │ │ │
1169 │ .C.a │ $(COMPILE.C) -o $% $< │
1170 │ │ $(AR) $(ARFLAGS) $@ $% │
1171 │ │ $(RM) $% │
1172 ├───────────────────┼─────────────────────────────────────────┤
1173 │ │ │
1174 │ .C~.a │ $(GET) $(GFLAGS) -p $< > $*.C │
1175 │ │ $(COMPILE.C) -o $% $*.C │
1176 │ │ $(AR) $(ARFLAGS) $@ $% │
1177 │ │ $(RM) $% │
1178 └───────────────────┴─────────────────────────────────────────┘
1179
1180
1181
1182
1183 ┌───────────────────┬─────────────────────────────────────────┐
1184 │Table of Standard │ │
1185 │Implicit (Suffix) │ │
1186 │Rules for FORTRAN │ │
1187 │77 Files │ │
1188 ├───────────────────┼─────────────────────────────────────────┤
1189 │Implicit Rule Name │ Command Line │
1190 ├───────────────────┼─────────────────────────────────────────┤
1191 │ .f │ $(LINK.f) -o $@ $< $(LDLIBS) │
1192 ├───────────────────┼─────────────────────────────────────────┤
1193 │ │ │
1194 │ .f.o │ $(COMPILE.f) $(OUTPUT_OPTION) $< │
1195 ├───────────────────┼─────────────────────────────────────────┤
1196 │ │ │
1197 │ .f.a │ $(COMPILE.f) -o $% $< │
1198 │ │ $(AR) $(ARFLAGS) $@ $% │
1199 │ │ $(RM) $% │
1200 ├───────────────────┼─────────────────────────────────────────┤
1201 │ │ │
1202 │ .f │ $(LINK.f) -o $@ $< $(LDLIBS) │
1203 ├───────────────────┼─────────────────────────────────────────┤
1204 │ │ │
1205 │ .f~ │ $(GET) $(GFLAGS) -p $< > $*.f │
1206 │ │ $(FC) $(FFLAGS) $(LDFLAGS) -o $@ $*.f │
1207 ├───────────────────┼─────────────────────────────────────────┤
1208 │ │ │
1209 │ .f~.o │ $(GET) $(GFLAGS) -p $< > $*.f │
1210 │ │ $(FC) $(FFLAGS) -c $*.f │
1211 ├───────────────────┼─────────────────────────────────────────┤
1212 │ │ │
1213 │ .f~.a │ $(GET) $(GFLAGS) -p $< > $*.f │
1214 │ │ $(COMPILE.f) -o $% $*.f │
1215 │ │ $(AR) $(ARFLAGS) $@ $% │
1216 │ │ $(RM) $% │
1217 ├───────────────────┼─────────────────────────────────────────┤
1218 │ │ │
1219 │ .F │ $(LINK.F) -o $@ $< $(LDLIBS) │
1220 ├───────────────────┼─────────────────────────────────────────┤
1221 │ │ │
1222 │ .F.o │ $(COMPILE.F) $(OUTPUT_OPTION) $< │
1223 ├───────────────────┼─────────────────────────────────────────┤
1224 │ │ │
1225 │ .F.a │ $(COMPILE.F) -o $% $< │
1226 │ │ $(AR) $(ARFLAGS) $@ $% │
1227 │ │ $(RM) $% │
1228 ├───────────────────┼─────────────────────────────────────────┤
1229 │ │ │
1230 │ .F~ │ $(GET) $(GFLAGS) -p $< > $*.F │
1231 │ │ $(FC) $(FFLAGS) $(LDFLAGS) -o $@ $*.F │
1232 ├───────────────────┼─────────────────────────────────────────┤
1233 │ │ │
1234 │ .F~.o │ $(GET) $(GFLAGS) -p $< > $*.F │
1235 │ │ $(FC) $(FFLAGS) -c $*.F │
1236 ├───────────────────┼─────────────────────────────────────────┤
1237 │ │ │
1238 │ .F~.a │ $(GET) $(GFLAGS) -p $< > $*.F │
1239 │ │ $(COMPILE.F) -o $% $*.F │
1240 │ │ $(AR) $(ARFLAGS) $@ $% │
1241 │ │ $(RM) $% │
1242 └───────────────────┴─────────────────────────────────────────┘
1243
1244
1245
1246
1247 ┌───────────────────┬─────────────────────────────────────────┐
1248 │Table of Standard │ │
1249 │Implicit (Suffix) │ │
1250 │Rules for FORTRAN │ │
1251 │90 Files │ │
1252 ├───────────────────┼─────────────────────────────────────────┤
1253 │Implicit Rule Name │ Command Line │
1254 ├───────────────────┼─────────────────────────────────────────┤
1255 │ .f90 │ $(LINK.f90) -o $@ $< $(LDLIBS) │
1256 ├───────────────────┼─────────────────────────────────────────┤
1257 │ │ │
1258 │ .f90~ │ $(GET) $(GFLAGS) -p $< > $*.f90 │
1259 │ │ $(LINK.f90) -o $@ $*.f90 $(LDLIBS) │
1260 ├───────────────────┼─────────────────────────────────────────┤
1261 │ │ │
1262 │ .f90.o │ $(COMPILE.f90) $(OUTPUT_OPTION) $< │
1263 ├───────────────────┼─────────────────────────────────────────┤
1264 │ │ │
1265 │ .f90~.o │ $(GET) $(GFLAGS) -p $< > $*.f90 │
1266 │ │ $(COMPILE.f90) $(OUTPUT_OPTION) $*.f90 │
1267 ├───────────────────┼─────────────────────────────────────────┤
1268 │ │ │
1269 │ .f90.a │ $(COMPILE.f90) -o $% $< │
1270 │ │ $(AR) $(ARFLAGS) $@ $% │
1271 │ │ $(RM) $% │
1272 ├───────────────────┼─────────────────────────────────────────┤
1273 │ │ │
1274 │ .f90~.a │ $(GET) $(GFLAGS) -p $< > $*.f90 │
1275 │ │ $(COMPILE.f90) -o $% $*.f90 │
1276 │ │ $(AR) $(ARFLAGS) $@ $% │
1277 │ │ $(RM) $% │
1278 ├───────────────────┼─────────────────────────────────────────┤
1279 │ │ │
1280 │ .ftn │ $(LINK.ftn) -o $@ $< $(LDLIBS) │
1281 ├───────────────────┼─────────────────────────────────────────┤
1282 │ │ │
1283 │ .ftn~ │ $(GET) $(GFLAGS) -p $< > $*.ftn │
1284 │ │ $(LINK.ftn) -o $@ $*.ftn $(LDLIBS) │
1285 ├───────────────────┼─────────────────────────────────────────┤
1286 │ │ │
1287 │ .ftn.o │ $(COMPILE.ftn) $(OUTPUT_OPTION) $< │
1288 ├───────────────────┼─────────────────────────────────────────┤
1289 │ │ │
1290 │ .ftn~.o │ $(GET) $(GFLAGS) -p $< > $*.ftn │
1291 │ │ $(COMPILE.ftn) $(OUTPUT_OPTION) $*.ftn │
1292 ├───────────────────┼─────────────────────────────────────────┤
1293 │ │ │
1294 │ .ftn.a │ $(COMPILE.ftn) -o $% $< │
1295 │ │ $(AR) $(ARFLAGS) $@ $% │
1296 │ │ $(RM) $% │
1297 ├───────────────────┼─────────────────────────────────────────┤
1298 │ │ │
1299 │ .ftn~.a │ $(GET) $(GFLAGS) -p $< > $*.ftn │
1300 │ │ $(COMPILE.ftn) -o $% $*.ftn │
1301 │ │ $(AR) $(ARFLAGS) $@ $% │
1302 │ │ $(RM) $% │
1303 └───────────────────┴─────────────────────────────────────────┘
1304
1305
1306
1307
1308 ┌───────────────────┬─────────────────────────────────────────┐
1309 │Table of Standard │ │
1310 │Implicit (Suffix) │ │
1311 │Rules for lex │ │
1312 │Files │ │
1313 ├───────────────────┼─────────────────────────────────────────┤
1314 │Implicit Rule Name │ Command Line │
1315 ├───────────────────┼─────────────────────────────────────────┤
1316 │ .l │ $(RM) $*.c │
1317 │ │ $(LEX.l) $< > $*.c │
1318 │ │ $(LINK.c) -o $@ $*.c $(LDLIBS) │
1319 │ │ $(RM) $*.c │
1320 ├───────────────────┼─────────────────────────────────────────┤
1321 │ │ │
1322 │ .l.c │ $(RM) $@ │
1323 │ │ $(LEX.l) $< > $@ │
1324 ├───────────────────┼─────────────────────────────────────────┤
1325 │ │ │
1326 │ .l.ln │ $(RM) $*.c │
1327 │ │ $(LEX.l) $< > $*.c │
1328 │ │ $(LINT.c) -o $@ -i $*.c │
1329 │ │ $(RM) $*.c │
1330 ├───────────────────┼─────────────────────────────────────────┤
1331 │ │ │
1332 │ .l.o │ $(RM) $*.c │
1333 │ │ $(LEX.l) $< > $*.c │
1334 │ │ $(COMPILE.c) -o $@ $*.c │
1335 │ │ $(RM) $*.c │
1336 ├───────────────────┼─────────────────────────────────────────┤
1337 │ │ │
1338 │ .l~ │ $(GET) $(GFLAGS) -p $< > $*.l │
1339 │ │ $(LEX) $(LFLAGS) $*.l │
1340 │ │ $(CC) $(CFLAGS) -c lex.yy.c │
1341 │ │ rm -f lex.yy.c │
1342 │ │ mv lex.yy.c $@ │
1343 ├───────────────────┼─────────────────────────────────────────┤
1344 │ │ │
1345 │ .l~.c │ $(GET) $(GFLAGS) -p $< > $*.l │
1346 │ │ $(LEX) $(LFLAGS) $*.l │
1347 │ │ mv lex.yy.c $@ │
1348 ├───────────────────┼─────────────────────────────────────────┤
1349 │ │ │
1350 │ .l~.ln │ $(GET) $(GFLAGS) -p $< > $*.l │
1351 │ │ $(RM) $*.c │
1352 │ │ $(LEX.l) $*.l > $*.c │
1353 │ │ $(LINT.c) -o $@ -i $*.c │
1354 │ │ $(RM) $*.c │
1355 ├───────────────────┼─────────────────────────────────────────┤
1356 │ │ │
1357 │ .l~.o │ $(GET) $(GFLAGS) -p $< > $*.l │
1358 │ │ $(LEX) $(LFLAGS) $*.l │
1359 │ │ $(CC) $(CFLAGS) -c lex.yy.c │
1360 │ │ rm -f lex.yy.c │
1361 │ │ mv lex.yy.c $@ │
1362 └───────────────────┴─────────────────────────────────────────┘
1363
1364
1365
1366
1367 ┌───────────────────┬─────────────────────────────────────────┐
1368 │Table of Standard │ │
1369 │Implicit (Suffix) │ │
1370 │Rules for Modula 2 │ │
1371 │Files │ │
1372 ├───────────────────┼─────────────────────────────────────────┤
1373 │Implicit Rule Name │ Command Line │
1374 ├───────────────────┼─────────────────────────────────────────┤
1375 │ .mod │ $(COMPILE.mod) -o $@ -e $@ $< │
1376 ├───────────────────┼─────────────────────────────────────────┤
1377 │ │ │
1378 │ .mod.o │ $(COMPILE.mod) -o $@ $< │
1379 ├───────────────────┼─────────────────────────────────────────┤
1380 │ │ │
1381 │ .def.sym │ $(COMPILE.def) -o $@ $< │
1382 ├───────────────────┼─────────────────────────────────────────┤
1383 │ │ │
1384 │ .def~.sym │ $(GET) $(GFLAGS) -p $< > $*.def │
1385 │ │ $(COMPILE.def) -o$@ $*.def │
1386 ├───────────────────┼─────────────────────────────────────────┤
1387 │ │ │
1388 │ .mod~ │ $(GET) $(GFLAGS) -p $< > $*.mod │
1389 │ │ $(COMPILE.mod) -o $@ -e $@ $*.mod │
1390 ├───────────────────┼─────────────────────────────────────────┤
1391 │ │ │
1392 │ .mod~.o │ $(GET) $(GFLAGS) -p $< > $*.mod │
1393 │ │ $(COMPILE.mod) -o $@ $*.mod │
1394 ├───────────────────┼─────────────────────────────────────────┤
1395 │ │ │
1396 │ .mod~.a │ $(GET) $(GFLAGS) -p $< > $*.mod │
1397 │ │ $(COMPILE.mod) -o $% $*.mod │
1398 │ │ $(AR) $(ARFLAGS) $@ $% │
1399 │ │ $(RM) $% │
1400 └───────────────────┴─────────────────────────────────────────┘
1401
1402
1403
1404
1405 ┌───────────────────┬─────────────────────────────────────────┐
1406 │Table of Standard │ │
1407 │Implicit (Suffix) │ │
1408 │Rules for NeWS │ │
1409 │Files │ │
1410 ├───────────────────┼─────────────────────────────────────────┤
1411 │Implicit Rule Name │ Command Line │
1412 ├───────────────────┼─────────────────────────────────────────┤
1413 │ .cps.h │ cps $*.cps │
1414 ├───────────────────┼─────────────────────────────────────────┤
1415 │ .cps~.h │ $(GET) $(GFLAGS) -p $< > $*.cps │
1416 │ │ $(CPS) $(CPSFLAGS) $*.cps │
1417 └───────────────────┴─────────────────────────────────────────┘
1418
1419
1420
1421
1422 ┌───────────────────┬─────────────────────────────────────────┐
1423 │Table of Standard │ │
1424 │Implicit (Suffix) │ │
1425 │Rules for Pascal │ │
1426 │Files │ │
1427 ├───────────────────┼─────────────────────────────────────────┤
1428 │Implicit Rule Name │ Command Line │
1429 ├───────────────────┼─────────────────────────────────────────┤
1430 │ .p │ $(LINK.p) -o $@ $< $(LDLIBS) │
1431 ├───────────────────┼─────────────────────────────────────────┤
1432 │ │ │
1433 │ .p.o │ $(COMPILE.p) $(OUTPUT_OPTION) $< │
1434 ├───────────────────┼─────────────────────────────────────────┤
1435 │ │ │
1436 │ .p~ │ $(GET) $(GFLAGS) -p $< > $*.p │
1437 │ │ $(LINK.p) -o $@ $*.p $(LDLIBS) │
1438 ├───────────────────┼─────────────────────────────────────────┤
1439 │ │ │
1440 │ .p~.o │ $(GET) $(GFLAGS) -p $< > $*.p │
1441 │ │ $(COMPILE.p) $(OUTPUT_OPTION) $*.p │
1442 ├───────────────────┼─────────────────────────────────────────┤
1443 │ │ │
1444 │ .p~.a │ $(GET) $(GFLAGS) -p $< > $*.p │
1445 │ │ $(COMPILE.p) -o $% $*.p │
1446 │ │ $(AR) $(ARFLAGS) $@ $% │
1447 │ │ $(RM) $% │
1448 └───────────────────┴─────────────────────────────────────────┘
1449
1450
1451
1452
1453 ┌───────────────────┬─────────────────────────────────────────┐
1454 │Table of Standard │ │
1455 │Implicit (Suffix) │ │
1456 │Rules for Ratfor │ │
1457 │Files │ │
1458 ├───────────────────┼─────────────────────────────────────────┤
1459 │Implicit Rule Name │ Command Line │
1460 ├───────────────────┼─────────────────────────────────────────┤
1461 │ .r │ $(LINK.r) -o $@ $< $(LDLIBS) │
1462 ├───────────────────┼─────────────────────────────────────────┤
1463 │ │ │
1464 │ .r.o │ $(COMPILE.r) $(OUTPUT_OPTION) $< │
1465 ├───────────────────┼─────────────────────────────────────────┤
1466 │ │ │
1467 │ .r.a │ $(COMPILE.r) -o $% $< │
1468 │ │ $(AR) $(ARFLAGS) $@ $% │
1469 │ │ $(RM) $% │
1470 ├───────────────────┼─────────────────────────────────────────┤
1471 │ │ │
1472 │ .r~ │ $(GET) $(GFLAGS) -p $< > $*.r │
1473 │ │ $(LINK.r) -o $@ $*.r $(LDLIBS) │
1474 ├───────────────────┼─────────────────────────────────────────┤
1475 │ │ │
1476 │ .r~.o │ $(GET) $(GFLAGS) -p $< > $*.r │
1477 │ │ $(COMPILE.r) $(OUTPUT_OPTION) $*.r │
1478 ├───────────────────┼─────────────────────────────────────────┤
1479 │ │ │
1480 │ .r~.a │ $(GET) $(GFLAGS) -p $< > $*.r │
1481 │ │ $(COMPILE.r) -o $% $*.r │
1482 │ │ $(AR) $(ARFLAGS) $@ $% │
1483 │ │ $(RM) $% │
1484 └───────────────────┴─────────────────────────────────────────┘
1485
1486
1487
1488
1489 ┌───────────────────┬──────────────────────────────────────────┐
1490 │Table of Standard │ │
1491 │Implicit (Suffix) │ │
1492 │Rules for SCCS │ │
1493 │Files │ │
1494 ├───────────────────┼──────────────────────────────────────────┤
1495 │Implicit Rule Name │ Command Line │
1496 ├───────────────────┼──────────────────────────────────────────┤
1497 │ .SCCS_GET │ sccs $(SCCSFLAGS) get $(SCCSGETFLAGS) $@ │
1498 │ │ -G$@ │
1499 │ │ │
1500 ├───────────────────┼──────────────────────────────────────────┤
1501 │ │ │
1502 │ .SCCS_GET_POSIX │ sccs $(SCCSFLAGS) get $(SCCSGETFLAGS) $@ │
1503 ├───────────────────┼──────────────────────────────────────────┤
1504 │ │ │
1505 │ .GET_POSIX │ $(GET) $(GFLAGS) s.$@ │
1506 └───────────────────┴──────────────────────────────────────────┘
1507
1508
1509
1510
1511 ┌───────────────────┬─────────────────────────────────────────┐
1512 │Table of Standard │ │
1513 │Implicit (Suffix) │ │
1514 │Rules for Shell │ │
1515 │Scripts │ │
1516 ├───────────────────┼─────────────────────────────────────────┤
1517 │Implicit Rule Name │ Command Line │
1518 ├───────────────────┼─────────────────────────────────────────┤
1519 │ .sh │ cat $< >$@ │
1520 │ │ chmod +x $@ │
1521 ├───────────────────┼─────────────────────────────────────────┤
1522 │ │ │
1523 │ .sh~ │ $(GET) $(GFLAGS) -p $< > $*.sh │
1524 │ │ cp $*.sh $@ │
1525 │ │ chmod a+x $@ │
1526 └───────────────────┴─────────────────────────────────────────┘
1527
1528
1529
1530
1531 ┌───────────────────┬─────────────────────────────────────────┐
1532 │Table of Standard │ │
1533 │Implicit (Suffix) │ │
1534 │Rules for yacc │ │
1535 │Files │ │
1536 ├───────────────────┼─────────────────────────────────────────┤
1537 │Implicit Rule Name │ Command Line │
1538 ├───────────────────┼─────────────────────────────────────────┤
1539 │ .y │ $(YACC.y) $< │
1540 │ │ $(LINK.c) -o $@ y.tab.c $(LDLIBS) │
1541 │ │ $(RM) y.tab.c │
1542 ├───────────────────┼─────────────────────────────────────────┤
1543 │ │ │
1544 │ .y.c │ $(YACC.y) $< │
1545 │ │ mv y.tab.c $@ │
1546 ├───────────────────┼─────────────────────────────────────────┤
1547 │ │ │
1548 │ .y.ln │ $(YACC.y) $< │
1549 │ │ $(LINT.c) -o $@ -i y.tab.c │
1550 │ │ $(RM) y.tab.c │
1551 ├───────────────────┼─────────────────────────────────────────┤
1552 │ │ │
1553 │ .y.o │ $(YACC.y) $< │
1554 │ │ $(COMPILE.c) -o $@ y.tab.c │
1555 │ │ $(RM) y.tab.c │
1556 ├───────────────────┼─────────────────────────────────────────┤
1557 │ │ │
1558 │ .y~ │ $(GET) $(GFLAGS) -p $< > $*.y │
1559 │ │ $(YACC) $(YFLAGS) $*.y │
1560 │ │ $(COMPILE.c) -o $@ y.tab.c │
1561 │ │ $(RM) y.tab.c │
1562 ├───────────────────┼─────────────────────────────────────────┤
1563 │ │ │
1564 │ .y~.c │ $(GET) $(GFLAGS) -p $< > $*.y │
1565 │ │ $(YACC) $(YFLAGS) $*.y │
1566 │ │ mv y.tab.c $@ │
1567 ├───────────────────┼─────────────────────────────────────────┤
1568 │ │ │
1569 │ .y~.ln │ $(GET) $(GFLAGS) -p $< > $*.y │
1570 │ │ $(YACC.y) $*.y │
1571 │ │ $(LINT.c) -o $@ -i y.tab.c │
1572 │ │ $(RM) y.tab.c │
1573 ├───────────────────┼─────────────────────────────────────────┤
1574 │ │ │
1575 │ .y~.o │ $(GET) $(GFLAGS) -p $< > $*.y │
1576 │ │ $(YACC) $(YFLAGS) $*.y │
1577 │ │ $(CC) $(CFLAGS) -c y.tab.c │
1578 │ │ rm -f y.tab.c │
1579 │ │ mv y.tab.o $@ │
1580 └───────────────────┴─────────────────────────────────────────┘
1581
1582
1583 make reads in the standard set of implicit rules from the file
1584 /usr/share/lib/make/make.rules, unless -r is in effect, or there is a
1585 make.rules file in the local directory that does not include that file.
1586
1587 The Suffixes List
1588 The suffixes list is given as the list of dependencies for the .SUF‐
1589 FIXES: special-function target. The default list is contained in the
1590 SUFFIXES macro (See Table of Predefined Macros for the standard list of
1591 suffixes). You can define additional .SUFFIXES: targets; a .SUFFIXES
1592 target with no dependencies clears the list of suffixes. Order is sig‐
1593 nificant within the list; make selects a rule that corresponds to the
1594 target's suffix and the first dependency-file suffix found in the list.
1595 To place suffixes at the head of the list, clear the list and replace
1596 it with the new suffixes, followed by the default list:
1597
1598 .SUFFIXES:
1599 .SUFFIXES: suffixes $(SUFFIXES)
1600
1601
1602
1603 A tilde (~) indicates that if a dependency file with the indicated suf‐
1604 fix (minus the ~) is under SCCS its most recent version should be
1605 retrieved, if necessary, before the target is processed.
1606
1607 Library Maintenance
1608 A target name of the form:
1609
1610 lib(member ...)
1611
1612
1613
1614 refers to a member, or a space-separated list of members, in an ar(1)
1615 library.
1616
1617
1618 The dependency of the library member on the corresponding file must be
1619 given as an explicit entry in the makefile. This can be handled by a
1620 pattern matching rule of the form:
1621
1622 lib(%.s): %.s
1623
1624
1625
1626 where .s is the suffix of the member; this suffix is typically .o for
1627 object libraries.
1628
1629
1630 A target name of the form:
1631
1632 lib((symbol))
1633
1634
1635
1636 refers to the member of a randomized object library that defines the
1637 entry point named symbol.
1638
1639 Command Execution
1640 Command lines are executed one at a time, each by its own process or
1641 shell. Shell commands, notably cd, are ineffectual across an unescaped
1642 NEWLINE in the makefile. A line is printed (after macro expansion) just
1643 before being executed. This is suppressed if it starts with a @, if
1644 there is a .SILENT: entry in the makefile, or if make is run with the
1645 -s option. Although the -n option specifies printing without execution,
1646 lines containing the macro $(MAKE) are executed regardless, and lines
1647 containing the @ special character are printed. The -t (touch) option
1648 updates the modification date of a file without executing any rules.
1649 This can be dangerous when sources are maintained by more than one per‐
1650 son.
1651
1652
1653 make invokes the shell with the -e (exit-on-errors) argument. Thus,
1654 with semicolon-separated command sequences, execution of the later com‐
1655 mands depends on the success of the former. This behavior can be over‐
1656 ridden by starting the command line with a -, or by writing a shell
1657 script that returns a non-zero status only as it finds appropriate.
1658
1659 Bourne Shell Constructs
1660 To use the Bourne shell if control structure for branching, use a com‐
1661 mand line of the form:
1662
1663 if expression ; \
1664 then command ; \
1665 ... ; \
1666 else command; \
1667 ... ; \
1668 fi
1669
1670
1671
1672 Although composed of several input lines, the escaped NEWLINE charac‐
1673 ters insure that make treats them all as one (shell) command line.
1674
1675
1676 To use the Bourne shell for control structure for loops, use a command
1677 line of the form:
1678
1679 for var in list ; \
1680 do command; \
1681 ... ; \done
1682
1683
1684
1685 To refer to a shell variable, use a double-dollar-sign ($$). This pre‐
1686 vents expansion of the dollar-sign by make.
1687
1688 Command Substitutions
1689 To incorporate the standard output of a shell command in a macro, use a
1690 definition of the form:
1691
1692 MACRO:sh =command
1693
1694
1695
1696 The command is executed only once, standard error output is discarded,
1697 and NEWLINE characters are replaced with SPACEs. If the command has a
1698 non-zero exit status, make halts with an error.
1699
1700
1701 To capture the output of a shell command in a macro reference, use a
1702 reference of the form:
1703
1704 $(MACRO:sh)
1705
1706
1707
1708 where MACRO is the name of a macro containing a valid Bourne shell com‐
1709 mand line. In this case, the command is executed whenever the reference
1710 is evaluated. As with shell command substitutions, the reference is
1711 replaced with the standard output of the command. If the command has a
1712 non-zero exit status, make halts with an error.
1713
1714
1715 In contrast to commands in rules, the command is not subject for macro
1716 substitution; therefore, a dollar sign ($) need not be replaced with a
1717 double dollar sign ($$).
1718
1719 Signals
1720 INT, SIGTERM, and QUIT signals received from the keyboard halt make and
1721 remove the target file being processed unless that target is in the
1722 dependency list for .PRECIOUS:.
1723
1725 Example 1 Defining dependencies
1726
1727
1728 This makefile says that pgm depends on two files a.o and b.o, and that
1729 they in turn depend on their corresponding source files (a.c and b.c)
1730 along with a common file incl.h:
1731
1732
1733 pgm: a.o b.o
1734 $(LINK.c) -o $@a.o b.o
1735 a.o: incl.h a.c
1736 cc -c a.c
1737 b.o: incl.h b.c
1738 cc -c b.c
1739
1740
1741 Example 2 Using implicit rules
1742
1743
1744 The following makefile uses implicit rules to express the same depen‐
1745 dencies:
1746
1747
1748 pgm: a.o b.o
1749 cc a.o b.o -o pgm
1750 a.o b.o: incl.h
1751
1752
1754 See environ(5) for descriptions of the following environment variables
1755 that affect the execution of make: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
1756 and NLSPATH.
1757
1758 KEEP_STATE This environment variable has the same effect as the
1759 .KEEP_STATE: special-function target. It enables com‐
1760 mand dependencies, hidden dependencies and writing of
1761 the state file.
1762
1763
1764 USE_SVR4_MAKE This environment variable causes make to invoke the
1765 generic System V version of make (/usr/lib/svr4.make).
1766 See sysV-make(1).
1767
1768
1769 MAKEFLAGS This variable is interpreted as a character string
1770 representing a series of option characters to be used
1771 as the default options. The implementation accepts
1772 both of the following formats (but need not accept
1773 them when intermixed):
1774
1775 1. The characters are option letters without
1776 the leading hyphens or blank character sep‐
1777 aration used on a command line.
1778
1779 2. The characters are formatted in a manner
1780 similar to a portion of the make command
1781 line: options are preceded by hyphens and
1782 blank-character-separated. The macro=name
1783 macro definition operands can also be
1784 included. The difference between the con‐
1785 tents of MAKEFLAGS and the command line is
1786 that the contents of the variable is not
1787 subjected to the word expansions associated
1788 with parsing the command line values. See
1789 wordexp(3C).
1790
1791 When the command-line options -f or -p are
1792 used, they take effect regardless of
1793 whether they also appear in MAKEFLAGS. If
1794 they otherwise appear in MAKEFLAGS, the
1795 result is undefined.
1796 The MAKEFLAGS variable is accessed from the environ‐
1797 ment before the makefile is read. At that time, all of
1798 the options (except -f and -p) and command-line macros
1799 not already included in MAKEFLAGS are added to the
1800 MAKEFLAGS macro. The MAKEFLAGS macro is passed into
1801 the environment as an environment variable for all
1802 child processes. If the MAKEFLAGS macro is subse‐
1803 quently set by the makefile, it replaces the MAKEFLAGS
1804 variable currently found in the environment.
1805
1806
1807 PROJECTDIR Provides a directory to be used to search for SCCS
1808 files not found in the current directory. In all of
1809 the following cases, the search for SCCS files is made
1810 in the directory SCCS in the identified directory. If
1811 the value of PROJECTDIR begins with a slash, it shall
1812 be considered an absolute pathname. Otherwise, the
1813 value of PROJECTDIR is treated as a user name and that
1814 user's initial working directory shall be examined for
1815 a subdirectory src or source. If such a directory is
1816 found, it shall be used. Otherwise, the value is used
1817 as a relative pathname.
1818
1819 If PROJECTDIR is not set or has a null value, the
1820 search for SCCS files shall be made in the directory
1821 SCCS in the current directory. The setting of PROJECT‐
1822 DIR affects all files listed in the remainder of this
1823 utility description for files with a component named
1824 SCCS.
1825
1826
1828 When the -q option is specified, the make utility exits with one of the
1829 following values:
1830
1831 0 Successful completion.
1832
1833
1834 1 The target was not up-to-date.
1835
1836
1837 >1 An error occurred.
1838
1839
1840
1841 When the -q option is not specified, the make utility exits with one of
1842 the following values:
1843
1844 0 Successful completion
1845
1846
1847 >0 An error occurred
1848
1849
1851 makefile
1852 Makefile
1853
1854 current version(s) of make description file
1855
1856
1857 s.makefile
1858 s.Makefile
1859
1860 SCCS history files for the above makefile(s) in the current direc‐
1861 tory
1862
1863
1864 SCCS/s.makefile
1865 SCCS/s.Makefile
1866
1867 SCCS history files for the above makefile(s)
1868
1869
1870 make.rules
1871
1872 default file for user-defined targets, macros, and implicit rules
1873
1874
1875 /usr/share/lib/make/make.rules
1876
1877 makefile for standard implicit rules and macros (not read if
1878 make.rules is)
1879
1880
1881 .make.state
1882
1883 state file in the local directory
1884
1885
1887 See attributes(5) for descriptions of the following attributes:
1888
1889 /usr/bin/make
1890 ┌─────────────────────────────┬─────────────────────────────┐
1891 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
1892 ├─────────────────────────────┼─────────────────────────────┤
1893 │Availability │SUNWsprot │
1894 └─────────────────────────────┴─────────────────────────────┘
1895
1896 /usr/xpg4/bin/make
1897 ┌─────────────────────────────┬─────────────────────────────┐
1898 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
1899 ├─────────────────────────────┼─────────────────────────────┤
1900 │Availability │SUNWxcu4t │
1901 ├─────────────────────────────┼─────────────────────────────┤
1902 │Interface Stability │Committed │
1903 ├─────────────────────────────┼─────────────────────────────┤
1904 │Standard │See standards(5). │
1905 └─────────────────────────────┴─────────────────────────────┘
1906
1908 ar(1), arch(1), cd(1), cpp(1), lex(1), mach(1), sccs-get(1), sh(1),
1909 sysV-make(1), yacc(1), wordexp(3C), passwd(4), attributes(5), envi‐
1910 ron(5), POSIX.2(5), standards(5)
1911
1912
1913 Solaris Advanced User's Guide
1914
1916 Don't know how to make target target
1917
1918 There is no makefile entry for target, and none of make's implicit
1919 rules apply (there is no dependency file with a suffix in the suf‐
1920 fixes list, or the target's suffix is not in the list).
1921
1922
1923 *** target removed.
1924
1925 make was interrupted while building target. Rather than leaving a
1926 partially-completed version that is newer than its dependencies,
1927 make removes the file named target.
1928
1929
1930 *** target not removed.
1931
1932 make was interrupted while building target and target was not
1933 present in the directory.
1934
1935
1936 *** target could not be removed, reason
1937
1938 make was interrupted while building target, which was not removed
1939 for the indicated reason.
1940
1941
1942 Read of include file file failed
1943
1944 The makefile indicated in an include directive was not found, or
1945 was inaccessible.
1946
1947
1948 Loop detected when expanding macro value macro'
1949
1950 A reference to the macro being defined was found in the definition.
1951
1952
1953 Could not write state file file
1954
1955 You used the .KEEP_STATE: target, but do not have write permission
1956 on the state file.
1957
1958
1959 ***Error code n
1960
1961 The previous shell command returned a nonzero error code.
1962
1963
1964 *** signal message
1965
1966 The previous shell command was aborted due to a signal. If - core
1967 dumped appears after the message, a core file was created.
1968
1969
1970 Conditional macro conflict encountered
1971
1972 Displayed only when -d is in effect, this message indicates that
1973 two or more parallel targets currently being processed depend on a
1974 target which is built differently for each by virtue of conditional
1975 macros. Since the target cannot simultaneously satisfy both depen‐
1976 dency relationships, it is conflicted.
1977
1978
1980 Some commands return nonzero status inappropriately; to overcome this
1981 difficulty, prefix the offending command line in the rule with a −.
1982
1983
1984 Filenames with the characters =, :, or @, do not work.
1985
1986
1987 You cannot build file.o from lib(file.o).
1988
1989
1990 Options supplied by MAKEFLAGS should be reported for nested make com‐
1991 mands. Use the -d option to find out what options the nested command
1992 picks up from MAKEFLAGS.
1993
1994
1995 This version of make is incompatible in certain respects with previous
1996 versions:
1997
1998 o The -d option output is much briefer in this version. -dd
1999 now produces the equivalent voluminous output.
2000
2001 o make attempts to derive values for the dynamic macros $*,
2002 $<, and $?, while processing explicit targets. It uses the
2003 same method as for implicit rules; in some cases this can
2004 lead either to unexpected values, or to an empty value being
2005 assigned. (Actually, this was true for earlier versions as
2006 well, even though the documentation stated otherwise.)
2007
2008 o make no longer searches for SCCS history (s.) files.
2009
2010 o Suffix replacement in macro references are now applied after
2011 the macro is expanded.
2012
2013
2014 There is no guarantee that makefiles created for this version of make
2015 works with earlier versions.
2016
2017
2018 If there is no make.rules file in the current directory, and the file
2019 /usr/share/lib/make/make.rules is missing, make stops before processing
2020 any targets. To force make to run anyway, create an empty make.rules
2021 file in the current directory.
2022
2023
2024 Once a dependency is made, make assumes the dependency file is present
2025 for the remainder of the run. If a rule subsequently removes that file
2026 and future targets depend on its existence, unexpected errors can
2027 result.
2028
2029
2030 When hidden dependency checking is in effect, the $? macro's value
2031 includes the names of hidden dependencies. This can lead to improper
2032 filename arguments to commands when $? is used in a rule.
2033
2034
2035 Pattern replacement macro references cannot be used in the dependency
2036 list of a pattern matching rule.
2037
2038
2039 Unlike previous versions, this version of make strips a leading ./ from
2040 the value of the $@ dynamic macro.
2041
2042
2043 With automatic SCCS retrieval, this version of make does not support
2044 tilde suffix rules.
2045
2046
2047 The only dynamic macro whose value is strictly determined when used in
2048 a dependency list is $@ (takes the form $$@).
2049
2050
2051 make invokes the shell with the -e argument. This cannot be inferred
2052 from the syntax of the rule alone.
2053
2054
2055
2056SunOS 5.11 23 Apr 2008 make(1S)