1 |
< |
.\" $NetBSD: make.1,v 1.229 2014/01/19 10:23:29 apb Exp $ |
1 |
> |
.\" $NetBSD: make.1,v 1.271 2017/07/03 21:34:20 wiz Exp $ |
2 |
|
.\" |
3 |
|
.\" Copyright (c) 1990, 1993 |
4 |
|
.\" The Regents of the University of California. All rights reserved. |
29 |
|
.\" |
30 |
|
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 |
31 |
|
.\" |
32 |
< |
.Dd February 14, 2014 |
33 |
< |
.Dt MAKE 1 |
32 |
> |
.Dd June 22, 2017 |
33 |
> |
.Dt BMAKE 1 |
34 |
|
.Os |
35 |
|
.Sh NAME |
36 |
|
.Nm bmake |
48 |
|
.Op Fl m Ar directory |
49 |
|
.Op Fl T Ar file |
50 |
|
.Op Fl V Ar variable |
51 |
+ |
.Op Fl v Ar variable |
52 |
|
.Op Ar variable=value |
53 |
|
.Op Ar target ... |
54 |
|
.Sh DESCRIPTION |
207 |
|
.It Ar V |
208 |
|
Force the |
209 |
|
.Fl V |
210 |
< |
option to print raw values of variables. |
210 |
> |
option to print raw values of variables, overriding the default behavior |
211 |
> |
set via |
212 |
> |
.Va .MAKE.EXPAND_VARIABLES . |
213 |
|
.It Ar v |
214 |
|
Print debugging information about variable assignment. |
212 |
– |
.It Ar w |
213 |
– |
Print entering and leaving directory messages, pre and post processing. |
215 |
|
.It Ar x |
216 |
|
Run shell commands with |
217 |
|
.Fl x |
296 |
|
will search for the specified file or directory named in the remaining part |
297 |
|
of the argument string. |
298 |
|
The search starts with the current directory of |
299 |
< |
the Makefile and then works upward towards the root of the filesystem. |
299 |
> |
the Makefile and then works upward towards the root of the file system. |
300 |
|
If the search is successful, then the resulting directory replaces the |
301 |
|
.Qq \&.../ |
302 |
|
specification in the |
337 |
|
Rather than re-building a target as specified in the makefile, create it |
338 |
|
or update its modification time to make it appear up-to-date. |
339 |
|
.It Fl V Ar variable |
340 |
< |
Print |
341 |
< |
.Nm Ns 's |
341 |
< |
idea of the value of |
342 |
< |
.Ar variable , |
343 |
< |
in the global context. |
340 |
> |
Print the value of |
341 |
> |
.Ar variable . |
342 |
|
Do not build any targets. |
343 |
|
Multiple instances of this option may be specified; |
344 |
|
the variables will be printed one per line, |
345 |
|
with a blank line for each null or undefined variable. |
346 |
+ |
The value printed is extracted from the global context after all |
347 |
+ |
makefiles have been read. |
348 |
+ |
By default, the raw variable contents (which may |
349 |
+ |
include additional unexpanded variable references) are shown. |
350 |
|
If |
351 |
|
.Ar variable |
352 |
|
contains a |
353 |
|
.Ql \&$ |
354 |
< |
then the value will be expanded before printing. |
354 |
> |
then the value will be recursively expanded to its complete resultant |
355 |
> |
text before printing. |
356 |
> |
The expanded value will also be printed if |
357 |
> |
.Va .MAKE.EXPAND_VARIABLES |
358 |
> |
is set to true and |
359 |
> |
the |
360 |
> |
.Fl dV |
361 |
> |
option has not been used to override it. |
362 |
> |
Note that loop-local and target-local variables, as well as values |
363 |
> |
taken temporarily by global variables during makefile processing, are |
364 |
> |
not accessible via this option. |
365 |
> |
The |
366 |
> |
.Fl dv |
367 |
> |
debug mode can be used to see these at the cost of generating |
368 |
> |
substantial extraneous output. |
369 |
> |
.It Fl v Ar variable |
370 |
> |
Like |
371 |
> |
.Fl V |
372 |
> |
but the variable is always expanded to its complete value. |
373 |
|
.It Fl W |
374 |
|
Treat any warnings during makefile parsing as errors. |
375 |
+ |
.It Fl w |
376 |
+ |
Print entering and leaving directory messages, pre and post processing. |
377 |
|
.It Fl X |
378 |
|
Don't export variables passed on the command line to the environment |
379 |
|
individually. |
463 |
|
need not necessarily be used to describe existing files. |
464 |
|
Expansion is in directory order, not alphabetically as done in the shell. |
465 |
|
.Sh SHELL COMMANDS |
466 |
< |
Each target may have associated with it a series of shell commands, normally |
466 |
> |
Each target may have associated with it one or more lines of shell |
467 |
> |
commands, normally |
468 |
|
used to create the target. |
469 |
< |
Each of the commands in this script |
469 |
> |
Each of the lines in this script |
470 |
|
.Em must |
471 |
|
be preceded by a tab. |
472 |
< |
While any target may appear on a dependency line, only one of these |
473 |
< |
dependencies may be followed by a creation script, unless the |
472 |
> |
(For historical reasons, spaces are not accepted.) |
473 |
> |
While targets can appear in many dependency lines if desired, by |
474 |
> |
default only one of these rules may be followed by a creation |
475 |
> |
script. |
476 |
> |
If the |
477 |
|
.Ql Ic \&:: |
478 |
< |
operator is used. |
478 |
> |
operator is used, however, all rules may include scripts and the |
479 |
> |
scripts are executed in the order found. |
480 |
|
.Pp |
481 |
< |
If the first characters of the command line are any combination of |
481 |
> |
Each line is treated as a separate shell command, unless the end of |
482 |
> |
line is escaped with a backslash |
483 |
> |
.Pq Ql \e |
484 |
> |
in which case that line and the next are combined. |
485 |
> |
.\" The escaped newline is retained and passed to the shell, which |
486 |
> |
.\" normally ignores it. |
487 |
> |
.\" However, the tab at the beginning of the following line is removed. |
488 |
> |
If the first characters of the command are any combination of |
489 |
|
.Ql Ic @ , |
490 |
|
.Ql Ic + , |
491 |
|
or |
503 |
|
except that the effect can be limited to a single line of a script. |
504 |
|
A |
505 |
|
.Ql Ic \- |
506 |
+ |
in compatibility mode |
507 |
|
causes any non-zero exit status of the command line to be ignored. |
508 |
|
.Pp |
509 |
|
When |
512 |
|
.Fl j Ar max_jobs , |
513 |
|
the entire script for the target is fed to a |
514 |
|
single instance of the shell. |
480 |
– |
.Pp |
515 |
|
In compatibility (non-jobs) mode, each command is run in a separate process. |
516 |
|
If the command contains any shell meta characters |
517 |
|
.Pq Ql #=|^(){};&<>*?[]:$`\e\en |
518 |
< |
it will be passed to the shell, otherwise |
518 |
> |
it will be passed to the shell; otherwise |
519 |
|
.Nm |
520 |
|
will attempt direct execution. |
521 |
+ |
If a line starts with |
522 |
+ |
.Ql Ic \- |
523 |
+ |
and the shell has ErrCtl enabled then failure of the command line |
524 |
+ |
will be ignored as in compatibility mode. |
525 |
+ |
Otherwise |
526 |
+ |
.Ql Ic \- |
527 |
+ |
affects the entire job; |
528 |
+ |
the script will stop at the first command line that fails, |
529 |
+ |
but the target will not be deemed to have failed. |
530 |
|
.Pp |
488 |
– |
Since |
489 |
– |
.Nm |
490 |
– |
will |
491 |
– |
.Xr chdir 2 |
492 |
– |
to |
493 |
– |
.Ql Va .OBJDIR |
494 |
– |
before executing any targets, each child process |
495 |
– |
starts with that as its current working directory. |
496 |
– |
.Pp |
531 |
|
Makefiles should be written so that the mode of |
532 |
|
.Nm |
533 |
|
operation does not change their behavior. |
534 |
|
For example, any command which needs to use |
535 |
|
.Dq cd |
536 |
|
or |
537 |
< |
.Dq chdir , |
538 |
< |
without side-effect should be put in parenthesis: |
537 |
> |
.Dq chdir |
538 |
> |
without potentially changing the directory for subsequent commands |
539 |
> |
should be put in parentheses so it executes in a subshell. |
540 |
> |
To force the use of one shell, escape the line breaks so as to make |
541 |
> |
the whole script one command. |
542 |
> |
For example: |
543 |
|
.Bd -literal -offset indent |
506 |
– |
|
544 |
|
avoid-chdir-side-effects: |
545 |
|
@echo Building $@ in `pwd` |
546 |
< |
@(cd ${.CURDIR} && ${.MAKE} $@) |
546 |
> |
@(cd ${.CURDIR} && ${MAKE} $@) |
547 |
|
@echo Back in `pwd` |
548 |
|
|
549 |
|
ensure-one-shell-regardless-of-mode: |
550 |
< |
@echo Building $@ in `pwd`; \\ |
551 |
< |
(cd ${.CURDIR} && ${.MAKE} $@); \\ |
550 |
> |
@echo Building $@ in `pwd`; \e |
551 |
> |
(cd ${.CURDIR} && ${MAKE} $@); \e |
552 |
|
echo Back in `pwd` |
553 |
|
.Ed |
554 |
+ |
.Pp |
555 |
+ |
Since |
556 |
+ |
.Nm |
557 |
+ |
will |
558 |
+ |
.Xr chdir 2 |
559 |
+ |
to |
560 |
+ |
.Ql Va .OBJDIR |
561 |
+ |
before executing any targets, each child process |
562 |
+ |
starts with that as its current working directory. |
563 |
|
.Sh VARIABLE ASSIGNMENTS |
564 |
|
Variables in make are much like variables in the shell, and, by tradition, |
565 |
|
consist of all upper-case letters. |
670 |
|
Variables defined as part of the command line. |
671 |
|
.It Local variables |
672 |
|
Variables that are defined specific to a certain target. |
673 |
+ |
.El |
674 |
+ |
.Pp |
675 |
+ |
Local variables are all built in and their values vary magically from |
676 |
+ |
target to target. |
677 |
+ |
It is not currently possible to define new local variables. |
678 |
|
The seven local variables are as follows: |
679 |
< |
.Bl -tag -width ".ARCHIVE" |
679 |
> |
.Bl -tag -width ".ARCHIVE" -offset indent |
680 |
|
.It Va .ALLSRC |
681 |
|
The list of all sources for this target; also known as |
682 |
< |
.Ql Va \&\*[Gt] . |
682 |
> |
.Ql Va \&> . |
683 |
|
.It Va .ARCHIVE |
684 |
< |
The name of the archive file. |
684 |
> |
The name of the archive file; also known as |
685 |
> |
.Ql Va \&! . |
686 |
|
.It Va .IMPSRC |
687 |
|
In suffix-transformation rules, the name/path of the source from which the |
688 |
|
target is to be transformed (the |
689 |
|
.Dq implied |
690 |
|
source); also known as |
691 |
< |
.Ql Va \&\*[Lt] . |
691 |
> |
.Ql Va \&< . |
692 |
|
It is not defined in explicit rules. |
693 |
|
.It Va .MEMBER |
694 |
< |
The name of the archive member. |
694 |
> |
The name of the archive member; also known as |
695 |
> |
.Ql Va % . |
696 |
|
.It Va .OODATE |
697 |
|
The list of sources for this target that were deemed out-of-date; also |
698 |
|
known as |
701 |
|
The file prefix of the target, containing only the file portion, no suffix |
702 |
|
or preceding directory components; also known as |
703 |
|
.Ql Va * . |
704 |
+ |
The suffix must be one of the known suffixes declared with |
705 |
+ |
.Ic .SUFFIXES |
706 |
+ |
or it will not be recognized. |
707 |
|
.It Va .TARGET |
708 |
|
The name of the target; also known as |
709 |
|
.Ql Va @ . |
710 |
+ |
For compatibility with other makes this is an alias for |
711 |
+ |
.Ic .ARCHIVE |
712 |
+ |
in archive member rules. |
713 |
|
.El |
714 |
|
.Pp |
715 |
|
The shorter forms |
716 |
< |
.Ql Va @ , |
716 |
> |
.Ql ( Va > , |
717 |
> |
.Ql Va \&! , |
718 |
> |
.Ql Va < , |
719 |
> |
.Ql Va % , |
720 |
|
.Ql Va \&? , |
721 |
< |
.Ql Va \&\*[Lt] , |
660 |
< |
.Ql Va \&\*[Gt] , |
721 |
> |
.Ql Va * , |
722 |
|
and |
723 |
< |
.Ql Va * |
723 |
> |
.Ql Va @ ) |
724 |
|
are permitted for backward |
725 |
< |
compatibility with historical makefiles and are not recommended. |
726 |
< |
The six variables |
727 |
< |
.Ql Va "@F" , |
728 |
< |
.Ql Va "@D" , |
729 |
< |
.Ql Va "\*[Lt]F" , |
730 |
< |
.Ql Va "\*[Lt]D" , |
731 |
< |
.Ql Va "*F" , |
725 |
> |
compatibility with historical makefiles and legacy POSIX make and are |
726 |
> |
not recommended. |
727 |
> |
.Pp |
728 |
> |
Variants of these variables with the punctuation followed immediately by |
729 |
> |
.Ql D |
730 |
> |
or |
731 |
> |
.Ql F , |
732 |
> |
e.g. |
733 |
> |
.Ql Va $(@D) , |
734 |
> |
are legacy forms equivalent to using the |
735 |
> |
.Ql :H |
736 |
|
and |
737 |
< |
.Ql Va "*D" |
738 |
< |
are permitted for compatibility with |
737 |
> |
.Ql :T |
738 |
> |
modifiers. |
739 |
> |
These forms are accepted for compatibility with |
740 |
|
.At V |
741 |
< |
makefiles and are not recommended. |
741 |
> |
makefiles and POSIX but are not recommended. |
742 |
|
.Pp |
743 |
|
Four of the local variables may be used in sources on dependency lines |
744 |
|
because they expand to the proper value for each target on the line. |
748 |
|
.Ql Va .ARCHIVE , |
749 |
|
and |
750 |
|
.Ql Va .MEMBER . |
685 |
– |
.El |
751 |
|
.Ss Additional built-in variables |
752 |
|
In addition, |
753 |
|
.Nm |
798 |
|
A boolean that controls the default behavior of the |
799 |
|
.Fl V |
800 |
|
option. |
801 |
+ |
If true, variable values printed with |
802 |
+ |
.Fl V |
803 |
+ |
are fully expanded; if false, the raw variable contents (which may |
804 |
+ |
include additional unexpanded variable references) are shown. |
805 |
|
.It Va .MAKE.EXPORTED |
806 |
|
The list of variables exported by |
807 |
|
.Nm . |
872 |
|
.Nm |
873 |
|
runs in. |
874 |
|
It can contain a number of keywords: |
875 |
< |
.Bl -hang -width ignore-cmd |
875 |
> |
.Bl -hang -width missing-filemon=bf. |
876 |
|
.It Pa compat |
877 |
|
Like |
878 |
|
.Fl B , |
896 |
|
This can be overridden by setting |
897 |
|
.Va bf |
898 |
|
to a value which represents True. |
899 |
+ |
.It Pa missing-meta= Ar bf |
900 |
+ |
If |
901 |
+ |
.Va bf |
902 |
+ |
is True, then a missing .meta file makes the target out-of-date. |
903 |
+ |
.It Pa missing-filemon= Ar bf |
904 |
+ |
If |
905 |
+ |
.Va bf |
906 |
+ |
is True, then missing filemon data makes the target out-of-date. |
907 |
+ |
.It Pa nofilemon |
908 |
+ |
Do not use |
909 |
+ |
.Xr filemon 4 . |
910 |
|
.It Pa env |
911 |
< |
For debugging, it can be useful to inlcude the environment |
911 |
> |
For debugging, it can be useful to include the environment |
912 |
|
in the .meta file. |
913 |
|
.It Pa verbose |
914 |
|
If in "meta" mode, print a clue about the target being built. |
950 |
|
because the contents are expected to change over time. |
951 |
|
The default list includes: |
952 |
|
.Ql Pa /dev /etc /proc /tmp /var/run /var/tmp |
953 |
+ |
.It Va .MAKE.META.IGNORE_PATTERNS |
954 |
+ |
Provides a list of patterns to match against pathnames. |
955 |
+ |
Ignore any that match. |
956 |
+ |
.It Va .MAKE.META.IGNORE_FILTER |
957 |
+ |
Provides a list of variable modifiers to apply to each pathname. |
958 |
+ |
Ignore if the expansion is an empty string. |
959 |
|
.It Va .MAKE.META.PREFIX |
960 |
|
Defines the message printed for each meta file updated in "meta verbose" mode. |
961 |
|
The default value is: |
964 |
|
This variable is used to record the names of variables assigned to |
965 |
|
on the command line, so that they may be exported as part of |
966 |
|
.Ql Ev MAKEFLAGS . |
967 |
< |
This behaviour can be disabled by assigning an empty value to |
967 |
> |
This behavior can be disabled by assigning an empty value to |
968 |
|
.Ql Va .MAKEOVERRIDES |
969 |
|
within a makefile. |
970 |
|
Extra variables can be exported from a makefile |
987 |
|
.It Va .MAKE.PPID |
988 |
|
The parent process-id of |
989 |
|
.Nm . |
990 |
+ |
.It Va .MAKE.SAVE_DOLLARS |
991 |
+ |
value should be a boolean that controls whether |
992 |
+ |
.Ql $$ |
993 |
+ |
are preserved when doing |
994 |
+ |
.Ql := |
995 |
+ |
assignments. |
996 |
+ |
The default is false, for backwards compatibility. |
997 |
+ |
Set to true for compatability with other makes. |
998 |
+ |
If set to false, |
999 |
+ |
.Ql $$ |
1000 |
+ |
becomes |
1001 |
+ |
.Ql $ |
1002 |
+ |
per normal evaluation rules. |
1003 |
|
.It Va MAKE_PRINT_VAR_ON_ERROR |
1004 |
|
When |
1005 |
|
.Nm |
1006 |
< |
stops due to an error, it prints its name and the value of |
1006 |
> |
stops due to an error, it sets |
1007 |
> |
.Ql Va .ERROR_TARGET |
1008 |
> |
to the name of the target that failed, |
1009 |
> |
.Ql Va .ERROR_CMD |
1010 |
> |
to the commands of the failed target, |
1011 |
> |
and in "meta" mode, it also sets |
1012 |
> |
.Ql Va .ERROR_CWD |
1013 |
> |
to the |
1014 |
> |
.Xr getcwd 3 , |
1015 |
> |
and |
1016 |
> |
.Ql Va .ERROR_META_FILE |
1017 |
> |
to the path of the meta file (if any) describing the failed target. |
1018 |
> |
It then prints its name and the value of |
1019 |
|
.Ql Va .CURDIR |
1020 |
|
as well as the value of any variables named in |
1021 |
|
.Ql Va MAKE_PRINT_VAR_ON_ERROR . |
1064 |
|
.Ql Ev MAKEOBJDIR . |
1065 |
|
.Pp |
1066 |
|
.Ql Va .OBJDIR |
1067 |
< |
may be modified in the makefile as a global variable. |
1067 |
> |
may be modified in the makefile via the special target |
1068 |
> |
.Ql Ic .OBJDIR . |
1069 |
|
In all cases, |
1070 |
|
.Nm |
1071 |
|
will |
1072 |
|
.Xr chdir 2 |
1073 |
< |
to |
1073 |
> |
to the specified directory if it exists, and set |
1074 |
|
.Ql Va .OBJDIR |
1075 |
< |
and set |
1075 |
> |
and |
1076 |
|
.Ql Ev PWD |
1077 |
|
to that directory before executing any targets. |
1078 |
|
. |
1115 |
|
to the value of |
1116 |
|
.Ql Ev PWD |
1117 |
|
instead. |
1118 |
< |
This behaviour is disabled if |
1118 |
> |
This behavior is disabled if |
1119 |
|
.Ql Ev MAKEOBJDIRPREFIX |
1120 |
|
is set or |
1121 |
|
.Ql Ev MAKEOBJDIR |
1185 |
|
As a consequence of the way values are split into words, matched, |
1186 |
|
and then joined, a construct like |
1187 |
|
.Dl ${VAR:M*} |
1188 |
< |
will normalise the inter-word spacing, removing all leading and |
1188 |
> |
will normalize the inter-word spacing, removing all leading and |
1189 |
|
trailing space, and converting multiple consecutive spaces |
1190 |
|
to single spaces. |
1191 |
|
. |
1205 |
|
The results will be different each time you are referring to the |
1206 |
|
modified variable; use the assignment with expansion |
1207 |
|
.Pq Ql Cm \&:= |
1208 |
< |
to prevent such behaviour. |
1208 |
> |
to prevent such behavior. |
1209 |
|
For example, |
1210 |
|
.Bd -literal -offset indent |
1211 |
|
LIST= uno due tre quattro |
1231 |
|
.Nm . |
1232 |
|
.It Cm \&:R |
1233 |
|
Replaces each word in the variable with everything but its suffix. |
1234 |
< |
.It Cm \&:gmtime |
1234 |
> |
.It Cm \&:range[=count] |
1235 |
> |
The value is an integer sequence representing the words of the original |
1236 |
> |
value, or the supplied |
1237 |
> |
.Va count . |
1238 |
> |
.It Cm \&:gmtime[=utc] |
1239 |
|
The value is a format string for |
1240 |
|
.Xr strftime 3 , |
1241 |
< |
using the current |
1241 |
> |
using |
1242 |
|
.Xr gmtime 3 . |
1243 |
+ |
If a |
1244 |
+ |
.Va utc |
1245 |
+ |
value is not provided or is 0, the current time is used. |
1246 |
|
.It Cm \&:hash |
1247 |
< |
Compute a 32bit hash of the value and encode it as hex digits. |
1248 |
< |
.It Cm \&:localtime |
1247 |
> |
Compute a 32-bit hash of the value and encode it as hex digits. |
1248 |
> |
.It Cm \&:localtime[=utc] |
1249 |
|
The value is a format string for |
1250 |
|
.Xr strftime 3 , |
1251 |
< |
using the current |
1251 |
> |
using |
1252 |
|
.Xr localtime 3 . |
1253 |
+ |
If a |
1254 |
+ |
.Va utc |
1255 |
+ |
value is not provided or is 0, the current time is used. |
1256 |
|
.It Cm \&:tA |
1257 |
|
Attempt to convert variable to an absolute path using |
1258 |
|
.Xr realpath 3 , |
1313 |
|
Inside |
1314 |
|
.Ar new_string , |
1315 |
|
an ampersand |
1316 |
< |
.Pq Ql \*[Am] |
1316 |
> |
.Pq Ql & |
1317 |
|
is replaced by |
1318 |
|
.Ar old_string |
1319 |
|
(without any |
1452 |
|
.Pp |
1453 |
|
However a single character variable is often more readable: |
1454 |
|
.Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} |
1455 |
+ |
.It Cm \&:_[=var] |
1456 |
+ |
Save the current variable value in |
1457 |
+ |
.Ql $_ |
1458 |
+ |
or the named |
1459 |
+ |
.Va var |
1460 |
+ |
for later reference. |
1461 |
+ |
Example usage: |
1462 |
+ |
.Bd -literal -offset indent |
1463 |
+ |
M_cmpv.units = 1 1000 1000000 |
1464 |
+ |
M_cmpv = S,., ,g:_:range:@i@+ $${_:[-$$i]} \&\\ |
1465 |
+ |
\\* $${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh |
1466 |
+ |
|
1467 |
+ |
.Dv .if ${VERSION:${M_cmpv}} < ${3.1.12:L:${M_cmpv}} |
1468 |
+ |
|
1469 |
+ |
.Ed |
1470 |
+ |
Here |
1471 |
+ |
.Ql $_ |
1472 |
+ |
is used to save the result of the |
1473 |
+ |
.Ql :S |
1474 |
+ |
modifier which is later referenced using the index values from |
1475 |
+ |
.Ql :range . |
1476 |
|
.It Cm \&:U Ns Ar newval |
1477 |
|
If the variable is undefined |
1478 |
|
.Ar newval |
1546 |
|
.Pp |
1547 |
|
Ordinarily, a value is treated as a sequence of words |
1548 |
|
delimited by white space. |
1549 |
< |
Some modifiers suppress this behaviour, |
1549 |
> |
Some modifiers suppress this behavior, |
1550 |
|
causing a value to be treated as a single word |
1551 |
|
(possibly containing embedded white space). |
1552 |
|
An empty value, or a value that consists entirely of white-space, |
1632 |
|
.Nm |
1633 |
|
.Ql include file ... |
1634 |
|
is also accepted. |
1635 |
+ |
.Pp |
1636 |
|
If the include statement is written as |
1637 |
|
.Cm .-include |
1638 |
|
or as |
1639 |
|
.Cm .sinclude |
1640 |
|
then errors locating and/or opening include files are ignored. |
1641 |
|
.Pp |
1642 |
+ |
If the include statement is written as |
1643 |
+ |
.Cm .dinclude |
1644 |
+ |
not only are errors locating and/or opening include files ignored, |
1645 |
+ |
but stale dependencies within the included file will be ignored |
1646 |
+ |
just like |
1647 |
+ |
.Va .MAKE.DEPENDFILE . |
1648 |
+ |
.Pp |
1649 |
|
Conditional expressions are also preceded by a single dot as the first |
1650 |
|
character of a line. |
1651 |
|
The possible conditionals are as follows: |
1681 |
|
used by |
1682 |
|
.Nm |
1683 |
|
internally. |
1684 |
+ |
.It Ic .export-literal Ar variable ... |
1685 |
+ |
The same as |
1686 |
+ |
.Ql .export-env , |
1687 |
+ |
except that variables in the value are not expanded. |
1688 |
|
.It Ic .info Ar message |
1689 |
|
The message is printed along with the name of the makefile and line number. |
1690 |
|
.It Ic .undef Ar variable |
1777 |
|
.Bl -tag -width "Cm XX" |
1778 |
|
.It Cm \&|\&| |
1779 |
|
Logical OR. |
1780 |
< |
.It Cm \&\*[Am]\*[Am] |
1780 |
> |
.It Cm \&&& |
1781 |
|
Logical |
1782 |
|
.Tn AND ; |
1783 |
|
of higher precedence than |
1794 |
|
may be used to logically negate an entire |
1795 |
|
conditional. |
1796 |
|
It is of higher precedence than |
1797 |
< |
.Ql Ic \&\*[Am]\*[Am] . |
1797 |
> |
.Ql Ic \&&& . |
1798 |
|
.Pp |
1799 |
|
The value of |
1800 |
|
.Ar expression |
2068 |
|
.Ic .DEFAULT Ns 's |
2069 |
|
commands is set |
2070 |
|
to the target's own name. |
2071 |
+ |
.It Ic .DELETE_ON_ERROR |
2072 |
+ |
If this target is present in the makefile, it globally causes make to |
2073 |
+ |
delete targets whose commands fail. |
2074 |
+ |
(By default, only targets whose commands are interrupted during |
2075 |
+ |
execution are deleted. |
2076 |
+ |
This is the historical behavior.) |
2077 |
+ |
This setting can be used to help prevent half-finished or malformed |
2078 |
+ |
targets from being left around and corrupting future rebuilds. |
2079 |
|
.It Ic .END |
2080 |
|
Any command lines attached to this target are executed after everything |
2081 |
|
else is done. |
2124 |
|
Synonym for |
2125 |
|
.Ic .NOTPARALLEL , |
2126 |
|
for compatibility with other pmake variants. |
2127 |
+ |
.It Ic .OBJDIR |
2128 |
+ |
The source is a new value for |
2129 |
+ |
.Ql Va .OBJDIR . |
2130 |
+ |
If it exists, |
2131 |
+ |
.Nm |
2132 |
+ |
will |
2133 |
+ |
.Xr chdir 2 |
2134 |
+ |
to it and update the value of |
2135 |
+ |
.Ql Va .OBJDIR . |
2136 |
|
.It Ic .ORDER |
2137 |
|
The named targets are made in sequence. |
2138 |
|
This ordering does not add targets to the list of targets to be made. |
2190 |
|
pairs. |
2191 |
|
.Bl -tag -width hasErrCtls |
2192 |
|
.It Ar name |
2193 |
< |
This is the minimal specification, used to select one of the builtin |
2193 |
> |
This is the minimal specification, used to select one of the built-in |
2194 |
|
shell specs; |
2195 |
|
.Ar sh , |
2196 |
|
.Ar ksh , |
2291 |
|
system makefile directory |
2292 |
|
.El |
2293 |
|
.Sh COMPATIBILITY |
2294 |
< |
The basic make syntax is compatible between different versions of make, |
2294 |
> |
The basic make syntax is compatible between different versions of make; |
2295 |
|
however the special variables, variable modifiers and conditionals are not. |
2296 |
+ |
.Ss Older versions |
2297 |
+ |
An incomplete list of changes in older versions of |
2298 |
+ |
.Nm : |
2299 |
|
.Pp |
2125 |
– |
The way that parallel makes are scheduled changed in |
2126 |
– |
NetBSD 4.0 |
2127 |
– |
so that .ORDER and .WAIT apply recursively to the dependent nodes. |
2128 |
– |
The algorithms used may change again in the future. |
2129 |
– |
.Pp |
2300 |
|
The way that .for loop variables are substituted changed after |
2301 |
|
NetBSD 5.0 |
2302 |
|
so that they still appear to be variable expansions. |
2303 |
|
In particular this stops them being treated as syntax, and removes some |
2304 |
|
obscure problems using them in .if statements. |
2305 |
+ |
.Pp |
2306 |
+ |
The way that parallel makes are scheduled changed in |
2307 |
+ |
NetBSD 4.0 |
2308 |
+ |
so that .ORDER and .WAIT apply recursively to the dependent nodes. |
2309 |
+ |
The algorithms used may change again in the future. |
2310 |
+ |
.Ss Other make dialects |
2311 |
+ |
Other make dialects (GNU make, SVR4 make, POSIX make, etc.) do not |
2312 |
+ |
support most of the features of |
2313 |
+ |
.Nm |
2314 |
+ |
as described in this manual. |
2315 |
+ |
Most notably: |
2316 |
+ |
.Bl -bullet -offset indent |
2317 |
+ |
.It |
2318 |
+ |
The |
2319 |
+ |
.Ic .WAIT |
2320 |
+ |
and |
2321 |
+ |
.Ic .ORDER |
2322 |
+ |
declarations and most functionality pertaining to parallelization. |
2323 |
+ |
(GNU make supports parallelization but lacks these features needed to |
2324 |
+ |
control it effectively.) |
2325 |
+ |
.It |
2326 |
+ |
Directives, including for loops and conditionals and most of the |
2327 |
+ |
forms of include files. |
2328 |
+ |
(GNU make has its own incompatible and less powerful syntax for |
2329 |
+ |
conditionals.) |
2330 |
+ |
.It |
2331 |
+ |
All built-in variables that begin with a dot. |
2332 |
+ |
.It |
2333 |
+ |
Most of the special sources and targets that begin with a dot, |
2334 |
+ |
with the notable exception of |
2335 |
+ |
.Ic .PHONY , |
2336 |
+ |
.Ic .PRECIOUS , |
2337 |
+ |
and |
2338 |
+ |
.Ic .SUFFIXES . |
2339 |
+ |
.It |
2340 |
+ |
Variable modifiers, except for the |
2341 |
+ |
.Dl :old=new |
2342 |
+ |
string substitution, which does not portably support globbing with |
2343 |
+ |
.Ql % |
2344 |
+ |
and historically only works on declared suffixes. |
2345 |
+ |
.It |
2346 |
+ |
The |
2347 |
+ |
.Ic $> |
2348 |
+ |
variable even in its short form; most makes support this functionality |
2349 |
+ |
but its name varies. |
2350 |
+ |
.El |
2351 |
+ |
.Pp |
2352 |
+ |
Some features are somewhat more portable, such as assignment with |
2353 |
+ |
.Ic += , |
2354 |
+ |
.Ic ?= , |
2355 |
+ |
and |
2356 |
+ |
.Ic != . |
2357 |
+ |
The |
2358 |
+ |
.Ic .PATH |
2359 |
+ |
functionality is based on an older feature |
2360 |
+ |
.Ic VPATH |
2361 |
+ |
found in GNU make and many versions of SVR4 make; however, |
2362 |
+ |
historically its behavior is too ill-defined (and too buggy) to rely |
2363 |
+ |
upon. |
2364 |
+ |
.Pp |
2365 |
+ |
The |
2366 |
+ |
.Ic $@ |
2367 |
+ |
and |
2368 |
+ |
.Ic $< |
2369 |
+ |
variables are more or less universally portable, as is the |
2370 |
+ |
.Ic $(MAKE) |
2371 |
+ |
variable. |
2372 |
+ |
Basic use of suffix rules (for files only in the current directory, |
2373 |
+ |
not trying to chain transformations together, etc.) is also reasonably |
2374 |
+ |
portable. |
2375 |
|
.Sh SEE ALSO |
2376 |
|
.Xr mkdep 1 |
2377 |
|
.Sh HISTORY |