| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The POSIX standard allows inference rules to be redefined but not
the .DEFAULT rule. There is no explicit exception for .DEFAULT to:
Only one target rule for any given target can contain commands.
Treat redefinition of a .DEFAULT rule as an error in POSIX mode
but allow it as an extension.
Also, the code didn't allow an inference rule with dependencies to
redefine an existing inference rule. This is no longer the case.
Adds 64-96 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit e90345c10 (make: allow empty commands) rearranged readline()
in a way that broke the use of conditionals within the definition
of a rule.
Add a test case to detect this. Adjust readline() so that
conditionals are processed before returning command lines or
checking for empty lines and comments.
Remove the test for a leading tab in skip_lines(). This allows
conditionals in the definition of a rule to be indented with a
leading tab.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GNU make doesn't allow inference rules or the .DEFAULT target to
be used for phony targets.
POSIX is unclear on the matter but there doesn't seem to be an
explicit prohibition of inference rules or .DEFAULT.
Follow the GNU make behaviour as a non-POSIX extension.
Adds 48-80 bytes.
(pdpmake GitHub issue 56)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
pdpmake didn't allow rules to have empty commands. There are
circumstances where this may be useful.
Make the following changes:
- Add a flag to readline() to indicate the next line is expected
to be a command. If this flag is true and the input line starts
with a tab return it immediately, thus skipping the check for
an empty line or comment line.
- In docmds() skip tabs and spaces after a command prefix. If the
resulting command is empty don't print it or try to execute it.
- In newcmd() allow empty commands.
Adds 48-96 bytes.
(pdpmake GitHub issue 56)
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now that POSIX.1-2024 has been released we can replace all
references to the 202X draft standard with 2024.
Make this change throughout the code and testsuite.
The pragma 'posix_2024' has been added. 'posix_202x' remains as
an alias for the same.
The 2024 standard is enforced by default in POSIX mode.
|
|
|
|
|
|
| |
The test 'Complex chain of macro assignments' relies on recursive
macro expansion. This is a POSIX 202X feature, so the test should
be moved to the appropriate section of the test script.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit d6b764116 (make: fix detection of target rules) checked
for target rules before macro assignments. This failed for some
Makefiles generated by autotools because partially defined macros
were expanded while testing for a target rule.
Revert to checking for macro assignments first, but try to detect
if the proposed left hand side of the assignment might form part
of a target rule with an inline command.
Also handle the case where the ';' separator of the inline command
has been obfuscated by putting it in a macro.
Saves 128-160 bytes.
(GitHub pdpmake issues 31, 44)
|
|
|
|
|
|
|
|
|
|
|
|
| |
GNU make and bmake have different implementations for := macro
assignment. In POSIX 202X these are supported by the forms ::=
and :::= respectively. Only the former was supported on the
pdpmake command line.
Add the required support in process_macros() and update the usage
message.
Adds 48-64 bytes.
|
|
|
|
|
| |
The test 'Return error if command fails' needed an exit code of 2.
POSIX only requires an exit code greater than 0.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The -q option returns an exit status to indicate if targets are
up-to-date (0) or in need of updating (1) but without updating
them. As an exception (imported from GNU make) build commands
with a '+' prefix are executed.
pdpmake didn't implement the exception. Doing so required moving
handling of the -q option down into docmds().
Saves 48 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The -t option (in general) causes targets to be touched instead of
having build commands run to create them. There were two problems.
The flag variable 'ssilent' in docmds was too small (uint8_t) to
contain the value of 'dotouch' (uint32_t). Truncation of the
value resulted in build commands being echoed when they shouldn't
have been.
The POSIX specification is unclear as to how build commands with
a '+' prefix interact with touch. The rationale indicates that
this feature was imported from GNU make, so the behaviour has been
made to match what it does: if a '+' build command is run the
target is not touched.
The code has been rearranged to move the call to touch() up into
docmds().
Adds 48 bytes.
|
|
|
|
|
|
| |
A couple of tests require backslashes to be escaped.
The test for CURDIR should use 'pwd -P' to resolve symlinks.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add support for the conditional directives ifeq and ifneq.
These follow GNU make in allowing things like:
ifeq (arg1,arg2)
ifeq 'arg1' 'arg2'
In the second case single or double quotes may be used.
Macros are expanded in the two arguments and the resulting strings
are compared.
Adds 240-248 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
POSIX only requires $< and $* to be set for inference rules, not
target rules.
As an extension allow them to be set for target rules, as in
GNU make. This may or may not be useful.
In POSIX mode, when $< and $* are only set for inference rules,
they're set to an empty string for target rules. This avoids
the possibility of stale values being used.
Adds 64-80 bytes.
(GitHub issue #407)
|
|
|
|
|
|
|
|
|
|
|
| |
Austin Group defect report 1626 introduced support for the CURDIR
macro:
https://www.austingroupbugs.net/view.php?id=1626
Implement this as a POSIX 202X feature.
Adds 160-176 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
| |
POSIX requires macro definitions to appear before targets on the
command line. Allow mixed macros and targets as an extension.
All macros on the command line are read first, then the targets
are processed.
Costs 64-80 bytes.
(GitHub issue #406)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
POSIX says, regarding execution of commands:
The execution line shall then be executed by a shell as if it
were passed as the argument to the system() interface, except
that if errors are not being ignored then the shell -e option
shall also be in effect.
As a non-POSIX extension, skip the use of the -e option. This is
how GNU make and BSD make behave.
(GitHub issue #409)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
POSIX doesn't allow the '#' comment marker to be escaped, though
some implementations do.
As a non-POSIX extension allow '#' to be escaped with a preceding
backslash.
It isn't necessary to escape '#' in macro expansions or command
lines: these cases are covered by an existing extension. Commit
0aceca867 (make: comments in macro expansions and command lines)
Adds 16-32 bytes.
(pdpmake GitHub issue 38)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a build command fails and the '-k' option (continue on error)
is in effect, no further commands should be executed for the
current target.
Also, the resulting diagnostic should be reported to stderr. As
should the final 'not built due to errors' diagnostic.
Adds 80 bytes.
(pdpmake GitHub issue 35)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The presence of an equal sign in an inline command on a target
rule caused the line to be detected as a macro assignment.
For example:
target:; @echo a = $(a)
Rearrange input parsing so target rules are detected before macro
assignments. This is made more complex by having to allow for the
':=', '::=' and ':::=' assignment operators. (And for targets
containing colons on Windows.)
Costs 240-248 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a build command returned a non-zero exit status 'make'
reported a warning and returned an exit code of zero.
This was due to the misuse of the status returned by system(3).
As the man page says:
the return value is a "wait status" that can be examined using
the macros described in waitpid(2). (i.e., WIFEXITED(),
WEXITSTATUS(), and so on).
Use the error() function to correctly report the problem on stderr
and return an exit status of 2.
Some additional changes in the same area:
- When a target is removed report the diagnostic on stderr, as
required by POSIX.
- When a build command receives a signal GNU make removes the target.
bmake doesn't and it isn't required by POSIX. Implement this as an
extension.
- Expand the error message when a build command fails so it includes
the exit status or signal number, as obtained from the value
returned by system(3).
- Alter the WIN32 implementation of system(3) to handle exit codes
which represent termination as if by a signal.
Adds 200-240 bytes.
(GitHub issue #354)
|
|
|
|
| |
Add a test for the problem reported in -w32 GitHub issue #354.
|
|
|
|
|
|
|
|
| |
Unset MAKEFLAGS in the test script so it works if it's run using
a version of make that has options which pdpmake doesn't understand.
Return $FAILCOUNT as the exit status so the number of failures can
be reported.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The POSIX standard defines suffix substitution in macro expansion
as taking the form:
$(string1 [: subst1 =[ subst2 ]])
Since 'subst1' isn't bracketed a value must be supplied. Enforce
this in POSIX mode.
As a non-POSIX extension an empty 'subst1' is permitted with 'subst2'
being added to all words unconditionally. If both 'subst1' and
'subst2' are empty the words are returned unchanged.
|
|
|
|
|
| |
The test for valid macro names in POSIX mode was incorrect: it
shouldn't have allowed '-'.
|
|
|
|
|
|
|
| |
A typo in the previous commit caused dyndep() to process inference
rules incorrectly. This didn't affect the results of the test suite
when extensions were allowed but it caused the test 'Inference rule
with explicit rule for prerequisite' to fail in POSIX mode.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Austin Group defect report 875 clarifies some aspects of inference
rules. The crux of the issue is related to chained inference rules
so it doesn't affect POSIX mode. The test makefile looks like this:
.SUFFIXES: .a .b .c
.a.c:
@echo .a.c
.b.c:
@echo .b.c
test.c: test.b
test.a:
test.b:
The correct output is deemed to be '.a.c'. Additional complications
are:
- whether or not the prerequisite files are present;
- the use of the suffixes '.a' and '.c' may result in the builtin
inference rule '.c.a' being considered.
In favourable circumstances pdpmake managed to give the correct
result, in unfavourable it reported circular dependencies or
segfaulted.
Changes to fix these issues are:
- When prerequisites are being recursively built the standard says:
'Upon recursion, each prerequisite shall become a target itself.'
Follow this requirement.
- At the end of make() the target being built should have its time
(as represented by n_tim in struct name) updated when any action
has been taken.
- When dyndep() is looking for prerequisites it should:
* skip candidates that are in the process of being built;
* consider whether an explicit candidate is a target, not whether
it has any commands associated with it.
pdpmake now behaves similarly to GNU make when presented with
makefiles like the above. bmake gives the incorrect output '.b.c'.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The POSIX specification says:
There are three kinds of comments: blank lines, empty lines, and
a <number-sign> ('#') and all following characters up to the first
unescaped <newline> character.
Most implementations don't treat '#' in a macro expansion or a command
line as the start of a comment. POSIX doesn't mention either of these
exceptions.
Permit the exceptions as a non-POSIX extension.
|
|
|
|
|
| |
Use $? instead of $^ in the test for .WAIT. bmake supports .WAIT
but not $^.
|
|
|
|
|
|
|
| |
Austin Group defect report 1549 has been accepted. It requires
that an escaped newline inside a macro expansion in a command is
replaced by a space. Other escaped newlines in commands are
left in place, as before.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Austin Group defect report 1437 has been accepted. It describes
the special targets .NOTPARALLEL and .WAIT which are used to
influence the behaviour of parallel builds.
Since parallel builds aren't implemented in here they actually don't
't have much effect.
- For completeness they're flagged as special targets.
- .WAIT should be allowed as a prerequisite.
|
|
|
|
|
|
|
|
| |
Austin Group defect report 337 has been accepted, thus making
macro assignment from the output of a shell command (!=) a
POSIX 202X feature.
This was previously implemented as a non-POSIX extension.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Austin Group defect reports 514 and 1520 have both been accepted.
Together these introduce the internal macros $+ and $^:
- $+ lists all prerequisites, with duplicates retained;
- $^ lists all prerequisites, with duplicates removed.
$^ had already been implemented as a non-POSIX extension, it now
becomes a POSIX 202X extension. $+ has been added as a POSIX
202X extension.
Neither of the above defect reports mentions how $? should handle
duplicate prerequisites. In POSIX mode duplicates are retained.
Removal of duplicates is implemented as a non-POSIX extension to
match existing practice in other versions of make.
|
| |
|
|
This is an experimental implementation of make for busybox-w32,
based on my public domain POSIX make:
https://frippery.org/make/
(GitHub issue #44)
|