| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit f9d10b2b6 (make: fix detection of target rules (take 2))
added code to handle the case where a target rule had an inline
command with a ';' separator in a macro. This required all macros
on the line to be expanded, including those in the inline command.
The ';' should first be searched for in the original line (without
any macro expansion) and only if that fails should macros be
expanded.
This matches the behaviour of GNU and Unix V7 make. BSD and Schily
make don't handle the case where the ';' is in a macro.
(pdpmake GitHub issue 73)
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 85bbce87d (make: support GNU/BSD suffixes and inference
rules) added code to handle inference rules with arbitrary
suffixes. Unfortunately it failed to check for a single-suffix
rule in the case where no known suffix was found. Add the
necessary code and a test which would have caught the problem.
Adds 48 bytes.
(pdpmake GitHub issue 72)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 770bad1fe (make: disallow inference rules for phony targets)
added the GNU/BSD make feature that inference rules aren't used
for phony targets.
Normally a double-colon rule without associated commands causes
an inference rule search. If the target of the double-colon rule
was phony no search was carried out and the rule failed. As a
result of this perl failed to build (on Linux, I didn't try on
Windows).
When a double-colon rule has no commands and a phony target the
prerequisites should be built and the rule should succeed.
Adds 32 bytes.
(pdpmake GitHub issue #70)
|
|
|
|
|
|
|
|
|
|
|
| |
Move the code to remove the suffix from a target into a separate
function.
There's no need to test for non-NULL 'makefile' in newcmd().
Cosmetic changes.
Saves 0-16 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The specification of inference rules in POSIX implies that only
suffixes starting with a period and containing no other periods
are to be considered.
In contrast, both GNU and BSD make allow suffixes to contain an
arbitrary number of periods, or none at all. Allow this as an
extension.
Adds 640-816 bytes.
(pdpmake GitHub issue 70)
|
|
|
|
|
|
| |
Commit f0dea6674 (make: enforce restrictions on prerequisites/
commands) set the flags for .WAIT incorrectly: in POSIX mode it
shouldn't have prerequisites.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
POSIX mentions some restrictions on whether rules may or may not
have prerequisites or commands:
- most special targets shouldn't have commnds;
- inference/.DEFAULT rules shouldn't have prerequisites.
Enforce these restrictions in POSIX mode.
Generally, implementations are happy to accept prerequisites or
commands even if they're subsequently ignored. Allow this as an
extension.
Adds 216-256 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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) changed how empty
commands are handled. This broke the POSIX mode test for
inference rules of the form:
rule: ;
Adjust the setting of 'semicolon_cmd' to the new reality.
Adds 16-32 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
According to POSIX:
Blank lines, empty lines, and lines with <number-sign> ('#')
as the first character on the line are also known as comment
lines.
Most implementations also include lines where the first non-blank
character is '#'. Allow this as an extension.
Adds 0-16 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Running 'make thing.z' with the following makefile:
.SUFFIXES: .x .y .z
.x.y:
cp $< $@
.y.x:
cp $< $@
.y.z:
cp $< $@
resulted in infinite recursion and a segfault. Follow GNU make and
don't allow any implicit rule to appear more than once in a chain.
Adds 16-32 bytes.
|
|
|
|
|
|
|
|
| |
As an extension have pdpmake look for the file 'PDPmakefile' before
'makefile' and 'Makefile'. This is similar to how GNU make first
checks for 'GNUmakefile'.
Adds 32-40 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The global variables 'makefile' and 'lineno' weren't properly
reset after a recursive call to input(). As a result error
messages for included files could refer to the wrong file or
line number.
Restore 'makefile' and 'lineno' immediately after a rescursive
call to input(). This also requires a different fix for commit
b21546ddb (make: fix test for include with no pathnames).
Adds 16 bytes in the 32-bit build.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In POSIX 2024 the behaviour of an include line with no pathnames
is unspecified. The test for this condition was incorrect in
certain circumstances.
Files containing dependencies may be generated by the compiler and
included in the makefile. On an initial build no dependency files
will be present and the include line is made to ignore errors. In
this case the test for no pathnames returned true, even though many
pathnames may have been present.
Fix the problem by always setting 'makefile' even if the named
file can't be opened.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Try to match how different makes handle leading whitespace in
makefiles. (Tested with GNU, BSD, Schily and UNIX Version 7
make.)
- Commands in rules must start with a tab. It's the law.
- BSD make doesn't allow any whitespace at the start of an include
line. Enforce this restriction in POSIX mode: 'the word include
... appears at the beginning of a line'. As an extension allow
arbitrary tabs or spaces.
- All implementations allow a space as the first character of a
macro definition or rule. Permit this in all cases.
- Only GNU make allows a tab as the first character of a macro
definition, but POSIX 2024 seems to permit it too: 'string1 is
defined as all characters from the first non-<blank> character to
the last non-<blank> character, inclusive'. Allow this in POSIX
2024 mode and as an extension.
- No implementation allows a tab as the first character of a rule.
Disallow this in all cases.
Adds 32-64 bytes.
(pdpmake GitHub issue 63)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit f3f72ac1d (make: show location of errors during build)
stored a pointer to the name of the makefile with each command,
for use in diagnostic messages.
While this is fine for makefiles defined on the command line, the
names of included files will have been freed before they can be
used.
Always take a copy of the makefile name stored with commands.
Adds 32-48 bytes.
(GitHub issue #449)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Pragmas set when pdpmake is run are exported to the environment
variable PDPMAKE_PRAGMAS as a space-separated list of pragma names.
This environment variable is read when pdpmake starts and any
pragmas it contains are applied.
Thus pragmas are passed to recursive invocations of pdpmake.
PDPMAKE_PRAGMAS can also be set by the user.
Adds 240-288 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The default rules were changed in the 2024 standard:
- Fortran is no longer supported
- The CC macro is set to 'c17' instead of 'c99'
In addition to these changes, CC is set to 'cc' as a non-POSIX
extension: on my system, at least, there isn't a 'c17' compiler.
Adds 208-224 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 special target .PRAGMA could be used to set or reset pragmas.
Doing anything other than setting pragmas very early in execution
is likely to be problematic.
Limit the abilities of .PRAGMA:
- Specifying .PRAGMA with no prerequisites now does nothing:
pragmas are not reset.
- The posix_2017 and posix_202x pragmas can only be used to change
the enforced POSIX level from the default. Any further attempt
to change POSIX level results in a warning.
Adds 16-32 bytes.
|
|
|
|
|
|
|
|
|
| |
Only the forms of macro assignment required by POSIX were allowed
on the command line.
Add support for the non-POSIX := form too.
Adds 16-24 bytes.
|
|
|
|
|
|
|
|
|
|
| |
The previous commit failed to change an instance of find_char()
to find_colon().
It isn't necessary to use find_char() to replace find_colon()
in the non-Windows case: strchr(3) is sufficient.
Adds 16-48 bytes.
|
|
|
|
|
|
|
|
|
|
| |
Commit f9d10b2b6 (make: fix detection of target rules (take 2))
failed to include the function find_colon() which is used to skip
targets of the form c:/path when checking for a target rule.
Restore the function so Windows paths can be used as targets.
Adds 48 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
POSIX requires macro assignments to precede targets on the command
line. This requirement has been relaxed as a non-POSIX extension.
Verify the constraint has been applied in POSIX mode. This ensures
that the command:
make --posix target A=1
fails before it tries to update the target.
It also catches the case where POSIX mode had not been set with the
--posix option or PDPMAKE_POSIXLY_CORRECT environment but was then
set by the .POSIX special target in the makefile. In this case the
command line was scanned for macro assignments without enforcing
POSIX mode while targets were processed with POSIX mode enabled.
Adds 96 bytes.
|
|
|
|
| |
Only invoke GETOPT_RESET() if getopt(3) has actually been called.
|
|
|
|
|
|
|
|
|
|
|
| |
When using fgets(3) to read a line into a buffer it's necessary
to ensure at least two characters are available in the buffer.
Otherwise the read fails. (At least, it did when pdpmake was
built using MSYS2 on Windows.)
Adds 16 bytes to the 32-bit build.
(GitHub pdpmake issue 44)
|
|
|
|
|
|
|
|
|
|
|
| |
Synchronising with upstream pdpmake showed that a test was missing
from the BusyBox port. POSIX 202X doesn't specify what should
happen if an include statement has no arguments.
When the POSIX 202X standard is being enforced this is reported as
an error.
Adds 32 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 90c5352a9 (make: change how macros are read from the
environment) was intended to ignore environment variables with
invalid names. It had the unintended consequence of also ignoring
macros with invalid names defined in makefiles. This was because
such macros can have the same level (3) as those imported from the
environment.
Rather than use the level to detect importing from the environment
add a flag to indicate this circumstance.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 -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.
|
|
|
|
|
|
|
|
|
| |
The default POSIX level to be enforced in strict mode is now a
configuration option.
Print details of supported POSIX levels in the usage message.
Adds 56-64 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The pragma 'posix_202x' causes the 202X POSIX standard to be
enforced in POSIX mode. Add an equivalent 'posix_2017' for the
2017 standard.
There's now a DEFAULT_POSIX_LEVEL preprocessor symbol to configure
the default standard. This is hardcoded to the 2017 standard but
it can also be set to 202X.
Adds 48 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
The 'quick fix' in the previous commit unnecessarily checks the
fractional timestamp value to determine if a target exists. This
isn't how it's done elsewhere in the code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
POSIX says:
A target shall be considered up-to-date... if it has already
been made up-to-date by the current invocation of make
(regardless of the target's existence or age).
If the target does not exist after the target has been
successfully made up-to-date, the target shall be treated as
being newer than any target for which it is a prerequisite.
Previously 'make' assumed that if a rule had succeeded the
modification time of the target would be the current time. This
isn't necessarily the case. Instead:
- If the file exists use the modification time of the file as the
the time of the target.
- If it doesn't exist use the current time, which should be more
recent than the time of any file for which it's a prerequisite.
Adds 16 bytes.
(GitHub issue #410)
|
|
|
|
|
|
|
|
|
|
|
|
| |
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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Originally there was no validation of macro names imported from
the environment. However, process_macros() failed to account for
the additional flag bit at this level. Thus, for example, SHELL
was imported when it shouldn't have been.
The problem the lack of validation was supposed to address was
that of environment variables with invalid names, which the user
may not have control over, causing a fatal error.
As an alternative, silently ignore variables with invalid names
on import from the environment.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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)
|
|
|
|
|
|
|
| |
If stdout is fully buffered (e.g. because the output is redirected
to a file or pipe) the command string may appear after its output.
(pdpmake GitHub PR 34)
|
|
|
|
|
|
|
|
|
|
| |
When checking target names or looking for a target rule be more
strict about the form of Windows paths allowed.
Alter the error message when neither a target rule or macro
assignment has been detected.
Adds 88-96 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|