Commit Graph

377 Commits

Author SHA1 Message Date
sjg cdcc95b114 make: add .export-all
An explicit syntax for exporting all global variables is much safer
than allowing .export with no argument to do the same.

Add .export-all and have .export with no argument throw a warning saying
to use .export-all

Reviewed by: rillig
2024-06-01 06:26:36 +00:00
sjg e78cefbe42 make: allow debugging the warning about .OBJDIR
When make complains about an unwritable .OBJDIR
it is not always obvious how we derrived that value.

If MAKE_DEBUG_OBJDIR_CHECK_WRITABLE is enabled call PrintOnError
so we can examine variables that are likely relevant.

Fix description of MAKE_OBJDIR_CHECK_WRITABLE in make.1
2024-05-28 19:09:04 +00:00
sjg b52179abfc make: record exit status in GNode
SetErrorVars can now set .ERROR_EXIT which allows
a .ERROR target to ignore the case of .ERROR_EXIT == 6
which means failure happened elsewhere.

Reviewed by:
2024-03-10 02:53:37 +00:00
sjg 384f068bd8 Note that in both :U and :D newval may be empty 2024-01-25 21:00:59 +00:00
sjg b0fb99a891 Indicate that for :U newval is optional 2024-01-25 07:35:46 +00:00
sjg 94c9d8dd49 Compat_RunCommand call Shell_Init is shellPath is NULL
Since .SHELL is potentially used in compat mode as well,
the man page description should not imply it is only used in jobs mode.

Remove path="sh" from shell-sh unit-test - and it would have detected
this bug.

Reviewed by: rillig
2023-12-24 16:48:30 +00:00
rillig d220208611 make: fix typo 2023-09-10 21:52:36 +00:00
sjg 7e018a29ea Add .MAKE.JOBS.C to indicate wether -jC is supported 2023-09-09 16:41:04 +00:00
sjg 859d4f0b97 make: allow -j to compute a multiple of ncpu
If _SC_NPROCESSORS_ONLN is supported; and -j arg is a floating point
number or ends in 'C' compute .MAKE.JOBS as a multiple of _SC_NPROCESSORS_ONLN

Based on a suggestion from des at freebsd.org
Discussed with: rillig, christos
2023-09-09 01:30:59 +00:00
sjg 90280d3b93 make.1: note that %s should only be used with :localtime 2023-08-20 19:58:15 +00:00
rillig acb8ae43d7 make.1: clean up wording, clarify scope of '!' in conditions 2023-06-28 06:15:07 +00:00
sjg 699fcfcdaa Make :mtime operate on each word in variable value.
Reviewed by: rillig
2023-05-10 18:22:33 +00:00
sjg dbf16036c3 make: :mtime=error throw error on stat(2) failure
Sometimes we want fatal error if stat fails on the
presumed pathname.
2023-05-09 20:53:23 +00:00
sjg ff8067fc6f make: add :mtime to provide mtime of file
The value of the variable is passed to stat(2)
and st_mtime is new value.
An optional arg can be used if stat(2) fails, otherwise
the current time is used.

See varmod-mtime.mk for usage examples.
2023-05-09 20:14:27 +00:00
sjg 9c8e40c4fa make.1: lose the trailing blank lines 2023-05-07 16:43:50 +00:00
sjg 5a93219217 make: fix description of .PREFIX
For at least 20 years, the setting of .PREFIX in make
has not matched the documentation.
Since the documented behavior does not match reality or
POSIX make, fix the documentation.

In FindDepsRegularPath str_basename is applied to .PREFIX
this is wrong, but I was unable to verify fixing it
was benign in NetBSD build - my NetBSD box (7.2)
was unable to build known-good src with or without any patches.

For now just document the behavior more accurately.
2023-05-07 16:32:47 +00:00
sjg 29a673fa23 Document unexplained *** Error code 6 2023-03-23 03:29:28 +00:00
sjg e2f523b9a6 make: some variables should be read-only
Make variables like .newline and .MAKE.{GID,PID,PPID,UID} read-only.

Reviewed by: rillig
2023-01-26 20:48:17 +00:00
sjg 8e4b5cfef0 make: .SYSPATH: to add dirs to sysIncPath
.SYSPATH: with no sources will clear sysIncPath
otherwise sources are added

Reviewed by: rillig
2023-01-24 00:24:02 +00:00
sjg ca0cc05370 make: .[NO]READONLY for control of read-only variables
Reviewed by: rillig
2023-01-23 23:01:52 +00:00
rillig 45ace73b72 make.1: bump date 2023-01-01 21:02:09 +00:00
rillig 8e09af3040 make.1: fix markup 2023-01-01 19:55:25 +00:00
rillig 502439098e make.1: sync list of built-in variables with reality
Fixes PR 57029.
2023-01-01 19:10:58 +00:00
rillig cea4af7ad3 make.1: sort list of built-in variables 2023-01-01 17:27:40 +00:00
rillig b0a5fb511c make.1: use consistent markup for boolean flags 2023-01-01 17:17:09 +00:00
rillig 11dbf5aaaf make.1: move description of .MAKE.MODE below the .MAKE.META block 2023-01-01 17:15:07 +00:00
rillig 193f1f6ffd make.1: reduce indentation of the long list of variable names 2023-01-01 16:49:27 +00:00
rillig f5a044d5d6 make.1: clarify in which case an expression may omit braces 2022-11-29 23:56:05 +00:00
rillig 2b7b086f37 make.1: make horizontal and vertical spacing more consistent 2022-11-15 07:58:00 +00:00
rillig 9c582520c3 make.1: clean up style, typography, accuracy
In a code example, replace the deprecated `pwd` with the preferred form
$$(pwd).

Shorten the paragraph about escaping a dollar in modifiers, as the
various escaping mechanisms are described in the section 'Expansion of
variables'.

Summarize the previously many cases of the ':from=to' modifier to be
simpler to understand, actually mention what the pattern matching
character '%' can match.

Describe the syntax of function call expressions in conditionals.
Previously, only the function names had been documented.
2022-10-02 23:36:41 +00:00
uwe 7f73633888 make(1): fix and simplify optional negation on conditional 2022-09-15 14:49:36 +00:00
uwe eda6bbda16 make(1): use .Dl for one-line literal display 2022-09-15 14:39:33 +00:00
rillig f3842871fb make.1: make typography more consistent 2022-09-14 20:39:23 +00:00
rillig 641e59034d make.1: fix typography, especially spacing 2022-09-14 20:18:24 +00:00
rillig 231bb012d3 make.1: fix style of ellipsis
In most places, '...' is not intended to be entered verbatim, instead it
is a placeholder, so don't use a fixed-width font for it.
2022-09-12 07:21:10 +00:00
rillig 48b12f17b3 make.1: remove extraneous .El, update date 2022-09-12 07:13:02 +00:00
rillig 340ff79b9a make.1: split section on directives into several subsections
Directives such as .error or .undef are not conditionals.  Having these
directives mixed in a single list made it more difficult to see how the
directives relate.
2022-09-12 07:10:59 +00:00
uwe 10a3e782b5 make(1): add space before the punctuation argument 2022-09-09 10:57:39 +00:00
rillig 6836e7ba01 make.1: clean up and make the description more accurate
Most changes are editorial.  Notable exceptions are:

The ':Q' in MAKE_PRINT_VAR_ON_ERROR was wrongly added in the previous
commit.  As that variable does not produce a shell command, there is no
point in quoting the characters.

Since 2012.10.07.19.17.31, make doesn't complain anymore if a shell
command in compat mode expands to an empty string, which removes the
need to "keep make happy".
2022-09-09 06:23:36 +00:00
rillig c5a155a374 make.1: only use .Pa for actual pathnames 2022-09-09 05:27:32 +00:00
rillig fc8c6bcdfc make.1: rewrite many details in a more precise way 2022-09-08 20:22:55 +00:00
rillig ec40413dc3 make.1: clean up style, grammar, punctuation, improve clarity 2022-09-07 23:34:56 +00:00
rillig 0ba6f9d9a6 make.1: remove redundant 'then' from conditional sentences. 2022-09-07 22:57:43 +00:00
rillig f69e668dd2 make.1: use present tense in conditional sentences
These sentences are about general, timeless rules, rather than about
predictions about the future.
2022-09-07 22:36:48 +00:00
rillig 33a45076d3 make.1: clarify interpretation of conditionals
String literals in quotes are never interpreted as numbers.

The operators '<', '<=', '>', '>=' are only allowed in numeric
comparisons.

Avoid the term 'C relational operators' since in C, the relational
operators exclude '==' and '!=', which are called equality operators
instead.
2022-09-05 17:13:36 +00:00
rillig 863fcc7b0b make: clean up handling of .break in .for loops
Move For_Break further up, as the functions in that file are sorted from
small to big.  The cast from size_t to unsigned int is required by lint.

In parse.c, move the code into a separate function to keep
ParseDirective small.  Its only job is to parse the directive and then
delegate to another function doing the actual work.

In the manual page, remove empty lines.

In the test, ensure that .break stops processing of the .for loop
immediately; anything after the .break is not processed anymore.
Replace ':=' with '=', as there is no need to evaluate '$i' early.
Check the expected value in the .mk file instead of the .exp file, to
keep the reading scope as small as possible.
2022-09-03 00:50:07 +00:00
sjg 5cc8492191 make: add .break to terminate .for loop early
When .break is encountered within a .for loop
it causes immediate termination.

Outside of a .for loop .break causes a parse error.

Reviewed by: christos
2022-09-02 16:24:31 +00:00
uwe 5787f4b7f0 make(1): mark up the variable expansion example 2022-08-14 22:11:20 +00:00
uwe e92ea9877b make(1): use .Dl for .MAKE.JOB.PREFIX examples 2022-08-14 21:57:26 +00:00
uwe 633d46b244 make(1): prettify .for index variable example 2022-08-14 21:53:58 +00:00