History log of /src/usr.bin/make/compat.c |
Revision | | Date | Author | Comments |
1.268 |
| 06-Jul-2025 |
rillig | make: clean up
|
1.267 |
| 13-Jun-2025 |
rillig | make: add on-demand inter-process stack traces
When debugging a build that heavily uses nested calls to sub-makes, the chain of calls is useful to quickly assess the situation. If explicitly requested, include the actions from any parent processes in the stack traces.
Reviewed by: sjg
|
1.266 |
| 18-May-2025 |
rillig | make: rename variables, remove now-redundant comments
|
1.265 |
| 03-May-2025 |
rillig | make: miscellaneous cleanups
|
1.264 |
| 22-Apr-2025 |
rillig | make: clean up
Replace 'unsigned int' with simply 'unsigned'.
In compat.c, skipping whitespace is not needed, as the loop above already skips it.
In job.c, remove the unused header <sys/file.h>.
Inline the TMPPAT macro, as it is only needed in a single place.
|
1.263 |
| 22-Apr-2025 |
rillig | make: move struct Job from job.h to job.c
The content of this struct is an implementation detail, and other parts of make only need to access very few parts of it.
|
1.262 |
| 19-Jan-2025 |
rillig | make: fix code coverage counts
See tests/usr.bin/gcov/t_gcov.sh.
|
1.261 |
| 20-Jul-2024 |
rillig | make: don't run erroneous commands in compat mode
When there is a parse or evaluation error in an expression that becomes part of the command, don't run that command, as the result of the failed evaluation typically contains garbage characters. Skip the remaining commands from that target as well, as they may depend on the erroneous command.
|
1.260 |
| 11-Jul-2024 |
sjg | Compat_RunCommand use tempfile if cmd too big
Extract the logic recently added to Cmd_Exec to handle long commands via temp file to Cmd_Argv, so it can also be leveraged by Compat_RunCommand
Reviewed by: christos
|
1.259 |
| 15-Jun-2024 |
rillig | branches: 1.259.2; make: clean up collection of context information for error messages
|
1.258 |
| 02-Jun-2024 |
rillig | make: sync VarEvalMode constant names with their debug log names
|
1.257 |
| 25-May-2024 |
rillig | make: fix memory leak for command strings
|
1.256 |
| 25-May-2024 |
rillig | make: minimize local variables around a vfork call
Passing all relevant values as arguments allows to remove the 'volatile' qualifiers.
|
1.255 |
| 20-Apr-2024 |
rillig | make: provide more context information for parse/evaluate errors
|
1.254 |
| 10-Mar-2024 |
sjg | 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:
|
1.253 |
| 01-Mar-2024 |
sjg | make: export target scope values
Pass target scope to Var_ReexportVars so that a target process will see the correct values in its env. We must then mark any Global scope variable as unexported so targets without local value get the Global one.
|
1.252 |
| 05-Jan-2024 |
rillig | make: miscellaneous cleanups
|
1.251 |
| 26-Dec-2023 |
sjg | Move fflush to a point to catch all cases.
|
1.250 |
| 26-Dec-2023 |
sjg | make: fix order of output in compat mode
Ensure that make's output is correctly ordered with the output of the target's commands, even when the output does not go to a terminal.
Reviewed by: rillig
|
1.249 |
| 24-Dec-2023 |
sjg | 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
|
1.248 |
| 19-Dec-2023 |
rillig | make: clean up comments
No binary change, except for line numbers in assertions.
|
1.247 |
| 04-May-2023 |
sjg | Compat_RunCommand mark bp volatile
gcc 4.8.5 (NetBSD 7.2) gets upset about bp.
|
1.246 |
| 18-Mar-2023 |
sjg | make: handle .PHONY consitently on interrupt
JobDeleteTarget skips .PHONY targets CompatDeleteTarget should do the same
This addresses https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269663
|
1.245 |
| 14-Feb-2023 |
rillig | make: clean up calls to Var_Subst
None of the calls to Var_Subst used the return value, and the return value was always VPR_OK.
No functional change.
|
1.244 |
| 17-Jan-2023 |
christos | Accept whitespace between command specifiers @+- like gmake does. New binutils does this.
|
1.243 |
| 07-Dec-2022 |
rillig | make: clean up comments
|
1.242 |
| 10-Oct-2022 |
rillig | make: change return type of unlink_file back to int
As unlink_file is a wrapper around unlink, use the same encoding for the possible return values as in the wrapped function. This consistency is more important than expressing all possible return values in the return type 'bool'.
https://mail-index.netbsd.org/tech-toolchain/2022/10/06/msg004155.html
No functional change.
|
1.241 |
| 17-Aug-2022 |
rillig | make: fix exit status for '-q' (since 1994)
|
1.240 |
| 07-May-2022 |
rillig | make: allow to randomize build order of targets
In complex dependency structures, when a build fails, a probable cause is a missing dependency declaration between some files. In compat mode, the build order is deterministic, in jobs mode, it is somewhat deterministic. To explore more edge cases, add the line ".MAKE.MODE += randomize-targets" somewhere in the makefile.
Fixes PR bin/45226 by riastradh. Reviewed by christos.
|
1.239 |
| 07-May-2022 |
rillig | make: rename Compat_Run to Compat_MakeAll
No functional change.
|
1.238 |
| 22-Jan-2022 |
rillig | make: add missing newline after "cannot continue" message
It was wrong of Parse_File to output an unfinished line and hope for some other code to finish it. As demonstrated in the test, PrintOnError did not do that in the case of additional debug output.
To keep the overall behavior as close as possible to before, the other callers of PrintOnError now have to pass the newline themselves. Passing strings that start with newlines but don't end with them looked suspicious anyway.
|
1.237 |
| 08-Jan-2022 |
rillig | make: remove redundant braces
No binary change, except for assertion line numbers.
|
1.236 |
| 07-Jan-2022 |
rillig | make: rename and inline Targ_Precious
No functional change.
|
1.235 |
| 27-Dec-2021 |
rillig | make: remove unnecessary words from command line options
Several years ago, the command line options were individual global variables. The global variable could therefore not be named 'silent' since that would have conflicted with local variables of the same name. After moving the global variable to the namespace 'struct CmdOpts', there is no conflict anymore.
There doesn't seem to be any risk of naming collisions for the names 'touch' and 'query'.
No functional change.
|
1.234 |
| 27-Dec-2021 |
rillig | make: rename eunlink to unlink_file
The name eunlink suggested a relation with the similarly named functions emalloc or esnprintf, but that was misleading. Instead, unlink_file works like unlink, except that it refuses to remove an empty directory.
No functional change.
|
1.233 |
| 15-Dec-2021 |
rillig | make: amend leftover cleanups from the previous commits
No functional change.
|
1.232 |
| 15-Dec-2021 |
rillig | make: format comments according to /usr/share/misc/style
Assisted by indent(1), with manual corrections due to its many remaining bugs.
No functional change.
|
1.231 |
| 15-Dec-2021 |
rillig | make: use consistent indentation for statements and continuations
No binary change, except for line numbers in assertions in suff.c.
|
1.230 |
| 15-Dec-2021 |
rillig | make: change return type of Compat_RunCommand from int to bool
The documentation was wrong before since status was not restricted to only 0 or 1.
No functional change.
|
1.229 |
| 28-Nov-2021 |
rillig | make: fix a few lint warnings about type mismatch in enum comparisons
These warnings were triggered with the lint flag '-e', which enables additional checks on enums. This check would have detected the type mismatch from the previous commit.
The check has a few strange warnings though, complaining about initialization of 'unsigned long' with 'unsigned long', so don't enable it for the official builds.
No functional change.
|
1.228 |
| 28-Nov-2021 |
rillig | make: convert GNodeFlags from enum into bit-fields
Now that Enum_ToString is implemented for each type separately, it's easy to convert them to bit-fields. This gets rid of the magic numbers 12 for CYCLE and 13 for DONECYCLE that left a suspicious gap in the numbers. This gap was not needed since the code didn't make use of the relative ordering of the enum constants.
The effects of this conversion are fewer capital letters in the code, smaller scope for the GNode flags, and clearer code especially when setting a flag back to false.
One strange thing is that GCC 10.3.0 doesn't optimize GNodeFlags_IsNone to an single bitmasking instruction, at least on x86_64. Instead it generates a testb instruction for each of the flags, even loading bit 8 separately from the others. Clang 12.0.1 knows this optimization though and generates the obvious sequence of movzwl, testl, jz.
No functional change.
|
1.227 |
| 27-Apr-2021 |
christos | add const
|
1.226 |
| 04-Apr-2021 |
rillig | make: rename a few functions to be more descriptive
No functional change.
|
1.225 |
| 03-Apr-2021 |
rillig | make: use C99 bool type instead of defining its own
No functional change.
|
1.224 |
| 05-Feb-2021 |
rillig | make: in the Var_ functions, move the scope to the front
This change provides for a more natural reading order in the code. Placing the scope first makes it immediately clear in which context the remaining parameters are interpreted.
No functional change.
|
1.223 |
| 04-Feb-2021 |
rillig | make: rename context and ctxt to scope
This continues the previous commit, in which VAR_GLOBAL, VAR_INTERNAL and VAR_CMDLINE were renamed.
Renaming the variable 'ctxt' was trivial since that word is used nowhere else. In the comments though, each occurrence of the word 'context' had to be checked individually since the word 'context' was not only used for referring to a variable scope. It is also used to distinguish different situations where characters are escaped in a certain way ('parsing context') and in a few other expressions.
|
1.222 |
| 02-Feb-2021 |
rillig | make: when exiting due to an error, print graph information
The code now does what the manual page has been promising since at least 1993.
|
1.221 |
| 01-Feb-2021 |
rillig | make: always use vfork, never fork
Before compat.c 1.217, job.c 1.390 and main.c 1.504 from 2020-12-27, the exported make variables were exported from each freshly forked child process. There was no practical difference though between exporting the variables from the parent process or the child process since these two processes share the same address space, except that the forked process is very limited in what it may actually do. This limitation was violated on a regular basis.
When an exported variable referred to a variable that used the :sh variable modifier, this led to a fork from within vfork, which is not allowed. Since 2020-12-27, exporting the variables is done from the main process, which prevents this situation from ever occurring.
Since that day, there is no need anymore to distinguish between vfork and fork, which removes any need for the macro.
|
1.220 |
| 19-Jan-2021 |
rillig | make(1): remove do-not-format markers from comments
These markers had been used inconsistently. Furthermore the source code had not been formatted automatically before 2020 at all, otherwise there wouldn't have been any trailing whitespace left.
|
1.219 |
| 10-Jan-2021 |
rillig | make(1): consistently use boolean expressions in conditions
Most of the make code already followed the style of explicitly writing (ptr != NULL) instead of the shorter (ptr) in conditions.
The remaining 50 instances have been found by an experimental, unpublished check in lint(1) that treats bool expressions as incompatible to any other scalar type, just as in Java, C#, Pascal and several other languages.
The only unsafe operation on Boolean that is left over is (flags & FLAG), for an enum implementing a bit set. If Boolean is an ordinary integer type (the default), some high bits may get lost. But if Boolean is the same as _Bool (by compiling with -DUSE_C99_BOOLEAN), C99 6.3.1.2 defines that a conversion from any scalar to the type _Bool acts as a comparison to 0, which cannot lose any bits.
|
1.218 |
| 30-Dec-2020 |
rillig | make(1): format multi-line comments
|
1.217 |
| 27-Dec-2020 |
rillig | make(1): re-export variables from the actual make process
Since make uses vfork if available, re-exporting the variables happens in the address space of the main process anyway, so there is no point in mentioning anything about "our client process" anywhere.
|
1.216 |
| 20-Dec-2020 |
rillig | make(1): omit linear search for command in Compat_RunCommand
|
1.215 |
| 13-Dec-2020 |
rillig | make(1): fix .ERROR_TARGET in compat -k mode (since 2010-04-07)
|
1.214 |
| 13-Dec-2020 |
rillig | make(1): document variable expansion in the .END node
|
1.213 |
| 13-Dec-2020 |
christos | fix comment
|
1.212 |
| 13-Dec-2020 |
rillig | make(1): add comments for strange error handling in Compat_Run
|
1.211 |
| 13-Dec-2020 |
rillig | make(1): extract InitSignals from Compat_Run
|
1.210 |
| 13-Dec-2020 |
rillig | make(1): extract MakeBeginNode from Compat_Run
The comment "execute the commands" had once been correct but not anymore. Since a few years, not only the commands of the .BEGIN and .END nodes are executed, instead the nodes are made as usual, including their dependencies.
|
1.209 |
| 13-Dec-2020 |
rillig | make(1): extract UseShell from Compat_RunCommand
|
1.208 |
| 12-Dec-2020 |
rillig | make(1): rename Var_ExportVars to Var_ReexportVars
|
1.207 |
| 12-Dec-2020 |
rillig | make(1): remove const from function parameters
These have been left-overs from refactoring, when these pieces were extracted to separate functions.
|
1.206 |
| 12-Dec-2020 |
rillig | make(1): inline Targ_Ignore and Targ_Silent
Each of these functions was only used 2 times, and each of these calls used a different part of the whole expression.
|
1.205 |
| 10-Dec-2020 |
rillig | make(1): split JobFlags into separate fields
Having all these flags in a single bitmask makes it harder to see where exactly they can possibly be used since their state could also be modified using the unsuspicious job->flags = 0. Using individual names just leaves the single memset, and that is only used during initialization.
|
1.204 |
| 07-Dec-2020 |
rillig | make(1): fix wrong exit status for multiple failed main targets
|
1.203 |
| 07-Dec-2020 |
rillig | make(1): add test for wrong exit status 0 after failed targets with -k
|
1.202 |
| 07-Dec-2020 |
rillig | make(1): merge local variables in Compat_Run
|
1.201 |
| 07-Dec-2020 |
rillig | make(1): clean up Compat_Run
Now that errors in the main targets and in their dependencies have the same effect on the .END node and its dependencies, the two variables can be merged.
|
1.200 |
| 07-Dec-2020 |
rillig | make(1): don't make .END if the main targets already failed
This only applies to -k mode. By default, make exits earlier and skips the .END node as well if an error occurs.
|
1.199 |
| 07-Dec-2020 |
rillig | make(1): fix exit status in -k mode if a dependency fails
Whether in -k mode or not, the exit status tells whether all requested targets were made or not. If a dependency could not be made, the main target was not made as well, therefore the exit status must be nonzero in such a case.
This part of the code lacked proper unit tests until today. The unit test deptgt-end-fail.mk is compatible with make>=2003 at least, allowing to compare the output over time.
In 2003, in the ok-ok-ok-ok case, "Making all from all-dep." was printed twice in a row, for whatever reason ... (40 minutes later) ... If I had just made the two commands for 'all' and '.END' more distinguishable. Back in 2003, the local variables for .END had not been initialized, instead the .END node was run with the local variables of the last preceding node. In this case, that node was 'all', therefore ${.TARGET} had obviously expanded to 'all'.
Somewhere in 2004, the shell commands were no longer run with the -e flag, which resulted in the "exit status $?" line to be printed in cases that had stopped early before.
Somewhere in 2005, the local variables for the .END node had been fixed. The variable ${.TARGET} now had the value '.END', just as expected. In addition, the dependencies for the .END node were made, although without getting their proper local variables. This resulted in the output "Making out of nothing" instead of the expected "Making end-dep out of nothing".
Still in 2005, in the test case "all=ok all-dep=ok end=ok end-dep=ERR", the error code of the failed 'end-dep' was first reported as "*** Error code 1 (continuing)". To compensate for this improvement, a new bug had been introduced. The test case "all=ok all-dep=ok end=ERR end-dep=ERR" had properly exited with status 1 on 2005-01-01, but on 2006-01-01 it exited with status 0, thereby ignoring errors in the .END node.
Somewhere in 2008, some of the error messages (but not all) were directed to stderr instead of stdout. The actual output stayed the same though.
Somewhere in 2011, the dependency of the .END node got its own local variables, and ${.TARGET} now expanded to 'end-dep', as expected.
Somewhere in 2016, the two empty lines between the "*** Error code 1 (continuing)" and the "Stop." got compressed into a single empty line.
On 2020-12-07 (that is, today), the exit status 1 has been restored in the error cases, after it had been wrong for at least 14 years.
|
1.198 |
| 06-Dec-2020 |
rillig | make(1): refactor Compat_Run to show the error condition more clearly
This refactoring allows to gradually change the conditions for the "Stop." error message, to demonstrate which cases are affected by each tiny change.
|
1.197 |
| 06-Dec-2020 |
rillig | make(1): refactor error handling in Compat_Run
This is in preparation for the upcoming bug fixes.
|
1.196 |
| 28-Nov-2020 |
rillig | make(1): reduce pointer indirection for GNode.implicitParents
|
1.195 |
| 28-Nov-2020 |
rillig | make(1): reduce pointer indirection for GNode.cohorts
|
1.194 |
| 28-Nov-2020 |
rillig | make(1): reduce memory allocation for GNode.parents and GNode.children
|
1.193 |
| 28-Nov-2020 |
rillig | make(1): remove pointer indirection from GNode.commands
Just to save a few memory allocations. No noticeable effect on the performance though.
|
1.192 |
| 24-Nov-2020 |
rillig | make(1): fix error handling for .BEGIN dependency in -k mode
|
1.191 |
| 24-Nov-2020 |
rillig | make(1): fix error handling for dependency of .END in -k mode
Fix one bug, find 4 new ones. All these bugs have been around since 2005-05-08, when dependencies on the .BEGIN, .END and .INTERRUPT nodes were implemented. Before that, checking gn->made == ERROR was appropriate, but adding the dependencies made ABORTED a new possible error value from Compat_Make.
|
1.190 |
| 24-Nov-2020 |
rillig | make(1): document the enum GNodeMade
Given only the state names and their individual documentation, it is hard to see the full picture. To make this easier, provide typical examples of the ways that a GNode takes through these states.
|
1.189 |
| 24-Nov-2020 |
rillig | make(1): move documentation about the result of Compat_Make
|
1.188 |
| 24-Nov-2020 |
rillig | make(1): fix missing "Stop." after failed .END node in -k mode
|
1.187 |
| 23-Nov-2020 |
rillig | make(1): use comparisons in boolean expressions
The generated code stays exactly the same.
|
1.186 |
| 23-Nov-2020 |
rillig | make(1): indent compat.c with tabs instead of spaces
|
1.185 |
| 23-Nov-2020 |
rillig | make(1): split Compat_Make into smaller functions
|
1.184 |
| 23-Nov-2020 |
rillig | make(1): extract DebugFailedTarget from Compat_RunCommand
|
1.183 |
| 15-Nov-2020 |
rillig | make(1): clean up coding style in compat, parse, suff
|
1.182 |
| 14-Nov-2020 |
rillig | make(1): clean up Job_Touch
Several more outdated comments were removed. To compensate for that, several new comments mark places where errors are not properly propagated.
|
1.181 |
| 08-Nov-2020 |
rillig | make(1): rename Make_OODate to GNode_IsOODate
It doesn't matter which of the make modules is in charge of determining whether a node is out-of-date. Therefore, remove the module name from the function name.
|
1.180 |
| 08-Nov-2020 |
rillig | make(1): rename Make_TimeStamp to GNode_UpdateYoungestChild
|
1.179 |
| 07-Nov-2020 |
rillig | make(1): clean up Compat_Make
|
1.178 |
| 07-Nov-2020 |
rillig | make(1): clean up Compat_RunCommand
|
1.177 |
| 07-Nov-2020 |
rillig | make(1): replace switch with if-else chain in Compat_RunCommand
|
1.176 |
| 07-Nov-2020 |
rillig | make(1): omit redundant bitwise or in Compat_Make
|
1.175 |
| 07-Nov-2020 |
rillig | make(1): clean up code stylistically
* Replace character literal 0 with '\0'. * Replace pointer literal 0 with NULL. * Remove redundant parentheses. * Parentheses in multi-line conditions are not redundant at the beginning of a line. * Replace a few !ptr with ptr == NULL. * Replace a few ptr with ptr != NULL. * Replace (expr & mask) == 0 with !(expr & mask). * Remove redundant braces for blocks in cases where the generated code stays the same. (Assertions further down in the code would get different line numbers.) * Rename parameters in CondParser_String to reflect the data flow. * Replace #ifdef notdef with #if 0.
The generated code stays exactly the same, at least with GCC 5.5.0 on NetBSD 8.0 amd64 using the default configuration.
|
1.174 |
| 02-Nov-2020 |
rillig | make(1): clean up CompatDeleteTarget and CompatInterrupt
|
1.173 |
| 01-Nov-2020 |
rillig | make(1): negate NoExecute to GNode_ShouldExecute
|
1.172 |
| 31-Oct-2020 |
rillig | make(1): remove unused code from needshell
Since usr.bin/xinstall no longer uses this code, there is no need to keep the second parameter.
|
1.171 |
| 31-Oct-2020 |
rillig | make(1): do not look up local variables like .TARGET anywhere else
Nobody defines a global variable named .TARGET since that would have many unpredictable effects, applying to all targets at once.
Nobody defines an environment variable named .TARGET since that's against the naming conventions for environment variables and would have the same effect.
Because of this, there is no point looking up the variables that are local to a GNode anywhere else. This means they cannot come from the environment and thus their value doesn't need to be freed after use, which makes the code simpler.
The newly added accessor functions in make.h refer to external functions, but since that header is not used anywhere outside of usr.bin/make, it doesn't matter. Between 2020-08-25 and 2020-10-30, that header had been referenced by usr.bin/xinstall.
|
1.170 |
| 30-Oct-2020 |
rillig | make(1): change char * to void * in Var_Value
The only purpose of the parameter freeIt is to free the memory associated with the return value. To do this, no pointer arithmetic is needed. Therefore, change to a void pointer, to catch accidental use of that pointer.
|
1.169 |
| 26-Oct-2020 |
rillig | make(1): group the command line options and arguments
By having a single struct that holds all command line options and arguments, it is easy to see in the code when such a command line argument is modified. It also cleans up the namespace since the command line options don't follow a common naming style. Having them in a struct also means that there is a single place for putting the documentation, not two as before.
The struct also suggests to extract the initialization code out of main, which is still too large, having more than 400 lines of code and covering far too many topics.
|
1.168 |
| 24-Oct-2020 |
rillig | make(1): clean up code style in compat.c
|
1.167 |
| 23-Oct-2020 |
rillig | make(1): rename GNode.cmgn to youngestChild
The name is longer than before but also clearer.
|
1.166 |
| 18-Oct-2020 |
rillig | make(1): replace execError with execDie
All calls to this function were followed by _exit(1).
|
1.165 |
| 05-Oct-2020 |
rillig | make(1): revert previous commit
It had accidentally reverted all the work from the past few days.
|
1.164 |
| 05-Oct-2020 |
rillig | make(1): fix double-free bug in -DCLEANUP mode (since 2020-10-02)
The bug had been introduced with dir.c 1.155 on 2020-10-02 22:20:25. In that commit, openDirectories was replaced with a combination of a list with a hash table, for more efficient lookup by name.
Upon cleanup, OpenDirs_Done is called, which in turn called Dir_ClearPath. Dir_ClearPath takes full ownership of the given list and empties it. This was no problem before since afterwards the list was empty and calling Lst_Free just frees the remaining list pointer.
With OpenDirs, this list was combined with a hash table, and the hash table contains the list nodes, assuming that the OpenDirs functions have full ownership of both the list and the hash table. This assumption was generally correct, except for the one moment during cleanup where full ownership of the list was passed to Dir_ClearPath, while the hash table still contained pointers to the (now freed) list nodes. This by itself was not a problem since the hash table would be freed afterwards. But as part of Dir_ClearPath, OpenDirs_Remove was called, which looked up the freed directory by name and now found the freed list node, trying to free it again. Boom.
Fixed by replacing the call to Dir_ClearPath with code that only frees the directories, without giving up control over the list.
|
1.163 |
| 05-Oct-2020 |
rillig | make(1): clean up compat.c
Only cosmetic changes, no change of functionality.
|
1.162 |
| 03-Oct-2020 |
rillig | make(1): clean up #include sections
|
1.161 |
| 01-Oct-2020 |
rillig | make(1): remove redundant function prototypes
|
1.160 |
| 01-Oct-2020 |
rillig | make(1): add note about "..." with duplicate shell commands
|
1.159 |
| 28-Sep-2020 |
rillig | make(1): replace += 1 with ++ and -= 1 with --
Just for visual consistency. The generated code stays exactly the same.
|
1.158 |
| 28-Sep-2020 |
rillig | make(1): make debug logging simpler
This avoids referring to the debug_file variable in many places where this implementation detail is not necessary.
|
1.157 |
| 28-Sep-2020 |
rillig | make(1): make debugging code shorter
|
1.156 |
| 27-Sep-2020 |
rillig | make(1): normalize whitespace in source code
There is no more space tab. Either only tabs or only spaces or tabs followed by spaces, but not spaces followed by tabs.
|
1.155 |
| 27-Sep-2020 |
rillig | make(1): inline Lst_ForEachUntil in Compat_Make
This avoids the extra local function and a few conversions to void pointers, to gain additional type safety.
The code in Compat_RunCommand does not modify gn->commands structurally, therefore it does not need the extra complexity of Lst_ForEachUntil. It does have access to a list node to exactly this list. This list node is only used to set the command to NULL after processing it, not for removing the node from the list.
|
1.154 |
| 27-Sep-2020 |
rillig | make(1): rename local variable in MakeNodes
By convention, list nodes are named ln to distinguish them from GNodes, which are called gn.
|
1.153 |
| 27-Sep-2020 |
rillig | make(1): make parameter of Compat_RunCommand const
|
1.152 |
| 26-Sep-2020 |
rillig | make(1): inline Lst_ForEachUntil in Compat_Make
|
1.151 |
| 26-Sep-2020 |
rillig | make(1): clean up API for finding and creating GNodes
The previous API had complicated rules for the cases in which the single function returned NULL or what it did. The flags for that function were confusing since passing TARG_NOHASH would create a new node even though TARG_CREATE was not included in that bit mask.
Splitting the function into 3 separate functions avoids this confusion. It also reveals several places where the complicated API led to unreachable code. Such code has been removed.
|
1.150 |
| 24-Sep-2020 |
rillig | make(1): rename Lst_ForEach to Lst_ForEachUntil
Since the callback function returns a terminating condition, this is not really a foreach loop.
Many of the calls to Lst_ForEachUntil don't make use of the terminating condition, and several don't modify the list structurally, which means they don't need this complicated implementation.
In a follow-up commit, Lst_ForEach will be added back with a much simpler implementation that iterates over the list naively, without a terminating condition and without taking the iteration state from Lst_Open/Lst_Next/Lst_Close into account. The migration to this simpler implementation will be done step by step since each callback function needs to be examined closely.
|
1.149 |
| 23-Sep-2020 |
rillig | make(1): fix assertion failure in -j mode with .END node
There had been two separate global variables for the .END node, and in parallel mode, only the one in jobs.c was initialized.
The code in JobRun heads over to Compat_Make without calling Compat_Run first, which left the variable ENDNode uninitialized.
|
1.148 |
| 22-Sep-2020 |
rillig | make(1): prepare Var_Subst for proper error handling
Returning a VarParseResult instead of a string makes it possible to let the error bubble up, until it reaches the main expression.
|
1.147 |
| 22-Sep-2020 |
rillig | make(1): use fine-grained type names for lists and their nodes
This is only intended to help the human reader. There is no additional type safety yet.
|
1.146 |
| 21-Sep-2020 |
rillig | make(1): add specific typedefs for lists
These typedefs are only intended to help human readers, they do not provide any type-safety. They also make the pointers explicit, which had been hidden before by the typedef for Lst and LstNode. Typing a few '*' is less work than finding out which of the many types are pointers and which aren't.
In meta.c, the variable "ln" served two completely different purposes, which have been split again. Register allocation is the job of the compiler, not of the human source code reader.
|
1.145 |
| 13-Sep-2020 |
rillig | make(1): clean up RCSID blocks
These blocks mostly consisted of redundant structure, following the same #ifndef pattern over and over, with only minimal variation.
It's easier to maintain if the common structure is only written once and encapsulated in a macro.
To avoid "defined but unused" warnings from GCC in the case where MAKE_NATIVE is not defined, I had to add volatile. Adding MAKE_ATTR_UNUSED alone would not preserve the rcsid variable in the resulting binary.
|
1.144 |
| 13-Sep-2020 |
rillig | make(1): reduce indentation in Compat_RunCommand
The while (1) had been there since the initial import on 1993-03-21, and in all that time there had never been a good reason for having it.
|
1.143 |
| 12-Sep-2020 |
rillig | make(1): fix prototype of Compat_Make
|
1.142 |
| 12-Sep-2020 |
rillig | make(1): fix name and prototype of Compat_RunCommand
By convention, exported identifiers are written with underscore.
The prototype of an exported function must not use void * just because it is used in Lst_ForEach. This is an implementation detail and must remain so.
|
1.141 |
| 12-Sep-2020 |
rillig | make(1): fix inconsistent code indentation
|
1.140 |
| 11-Sep-2020 |
rillig | make(1): add wrappers around ctype.h functions
This avoids casting the argument to unsigned char, and to cast the result of toupper/tolower back to char.
|
1.139 |
| 30-Aug-2020 |
rillig | make(1): remove unreachable code from CompatRunCommand
At the point where Str_Words is called, the string contains no meta-characters. This means that the parameter "expand" in Str_Words is never looked at. This in turn means that this parameter can be set to FALSE, thereby making it impossible that Str_Words returns NULL.
|
1.138 |
| 30-Aug-2020 |
rillig | make(1): replace brk_string with Str_Words
The API is much simpler, and there is less detail that is exposed by default and fewer punctuation to type on the caller's side. To see that there is some memory to be freed, one would have to look into the struct. Having part of the return value as the actual return value and the rest in output parameters was unnecessarily asymmetrical.
|
1.137 |
| 30-Aug-2020 |
rillig | make(1): rename GNode.iParents to implicitParents
The i alone was too ambiguous. It could have meant ignore, implicit, interactive, and probably many more.
|
1.136 |
| 30-Aug-2020 |
rillig | make(1): rename Lst_Memeber to Lst_FindDatum
The new name nicely aligns with Lst_Find and Lst_FindFrom.
|
1.135 |
| 29-Aug-2020 |
rillig | make(1): fix assertion failure for .SUFFIXES in archives
This occurred in the posix1.mk test, even though it is disabled in unit-tests. But in tests/usr.bin/make it still runs. There, it should have produced an "expected failure" but crashed instead.
The archive-suffix test is the stripped-down version of the posix1 test.
|
1.134 |
| 29-Aug-2020 |
rillig | make(1): clean up documentation for CompatInterrupt and Compat_Run
|
1.133 |
| 29-Aug-2020 |
rillig | make(1): add another Boolean variant to check during development
|
1.132 |
| 28-Aug-2020 |
rillig | make(1): remove trailing 'S' from names of Lst functions
The migration from null-passing Lst functions to argument-checking Lst functions is completed.
There were 2 surprises: The targets list may be NULL, and in Dir_AddDir, the path may be NULL. The latter case is especially surprising since that function turns into an almost-nop in that case. This is another case where probably 2 independent functions have been squeezed into a single function. This may be improved in a follow-up commit.
All other lists were fine. They were always defined and thus didn't need much work.
|
1.131 |
| 27-Aug-2020 |
rillig | make(1): migrate Lst_IsEmpty to Lst_IsEmptyS
|
1.130 |
| 27-Aug-2020 |
rillig | make(1): migrate Lst_ForEach to Lst_ForEachS
Most lists are always valid. Only the "targets" variable may be null in some cases, probably.
|
1.129 |
| 23-Aug-2020 |
rillig | make(1): make compat.c ready for WARNS=6
|
1.128 |
| 23-Aug-2020 |
rillig | make(1): make brk_string return size_t for the number of words
|
1.127 |
| 23-Aug-2020 |
rillig | make(1): handle special case of a list containing null pointers
GNode.commands is the only place in make where a list can contain null pointers. That's unexpected, and memory management in CompatRunCommand looks suspicous enough to warrant extensive documentation.
|
1.126 |
| 22-Aug-2020 |
rillig | make(1): clean up headers
Remove redundant headers that are already included by "make.h". Make <assert.h> available to all compilation units that use "make.h".
|
1.125 |
| 22-Aug-2020 |
rillig | make(1): replace segmentation fault with failed assertion
To reproduce: ./make -r -C unit-tests -f sh-dots.mk -j1
Without -j1, the test succeeds.
|
1.124 |
| 22-Aug-2020 |
rillig | make(1): require argument of Lst_Member to be non-null
Since the lists don't contain null pointers, it doesn't make sense to search for a null pointer. All calls but one already had obviously non-null arguments. The one remaining call using targ->suff has been guarded for now.
The code for Lst_Member became much simpler than before. Partly because the old code had an extra condition for circular lists, which are not used by make.
|
1.123 |
| 22-Aug-2020 |
rillig | make(1): convert Lst_Enqueue and Lst_Dequeue to nonnull variants
Except for once instance in parse.c, the usage pattern for Lst_Dequeue was to first test whether the list is empty. This pattern allowed the implementation of Lst_Dequeue to become simpler since the null check is not needed anymore.
The calls to Lst_Enqueue never pass an invalid list or a null pointer, therefore making them strict was trivial.
|
1.122 |
| 22-Aug-2020 |
rillig | make(1): replace "(void)Lst_AtEnd" with stricter "Lst_AppendS"
This change ensures that there is actually something added to the list. Lst_AtEnd had silently skipped the addition if the list was invalid (null pointer), which was not intended in these cases. The "(void)" is assumed to mean "I know that this cannot fail", while it could also mean "I don't care whether something actually happened".
Running "./build.sh -j6 tools" still succeeds after this change, therefore chances are very low that this change breaks anything. If there is any change, it's an obvious assertion failure. There is no silent change in behavior though.
|
1.121 |
| 22-Aug-2020 |
rillig | make(1): remove constant variable
The variable "local" had been TRUE for at least the last 28 years.
No change in binary size, as expected.
|
1.120 |
| 22-Aug-2020 |
rillig | make(1): remove form feeds in the code
|
1.119 |
| 21-Aug-2020 |
rillig | make(1): make list library code stricter
Up to now, the list library didn't distinguish between programming mistakes (violations of invariants, illegal parameter values) and actually interesting situations like "element not found in list".
The current code contains many branches for conditions that are neither exercised by the unit tests nor by real-world usage. There is no point in keeping this unnecessary code.
The list functions will be migrated from their lenient variants to the stricter variants in small parts, each function getting the S suffix when it is made strict, to avoid any confusion about how strict a particular function is. When all functions have been migrated, they will be renamed back to their original names.
While here, the comments of the functions are cleaned up since they mention irrelevant implementation details in the API comments, as well as "side effects" that are really main effects.
|
1.118 |
| 01-Aug-2020 |
rillig | make(1): use consistent indentation in source code
Tabs for multiples of 8, then spaces.
The usage string has been kept as-is since the spaces there are indentional and do influence the output.
|
1.117 |
| 01-Aug-2020 |
rillig | make(1): avoid calls to free(3) in the common case of a NULL pointer
|
1.116 |
| 01-Aug-2020 |
rillig | make(1): let Var_Value return a const char *
The return value must not be modified anyway, so let the compiler check this for free.
|
1.115 |
| 28-Jul-2020 |
rillig | make(1): remove dead code from Var_Subst
The first parameter from Var_Subst had been a literal NULL in all cases. These have been fixed using this command:
sed -i 's|Var_Subst(NULL, |Var_Subst(|' *.c
The one remaining case was not found because the "NULL," was followed by a line break instead of a space.
The removed code probably wouldn't have worked as expected anyway. Expanding a single variable to a literal string would have led to unexpected behavior for cases like ${VAR:M${pattern}}, in case pattern would contain an unescaped ':' itself.
|
1.114 |
| 19-Jul-2020 |
rillig | make(1): rename Varf_Flags to VarEvalFlags
In var.c there are lots of different flag types. To make any accidental mixture obvious, each flag group gets its own prefix.
The only flag group that is visible outside of var.c is concerned with evaluating variables, therefore the "e", which replaces the former "f" that probably just meant "flag".
|
1.113 |
| 03-Jul-2020 |
rillig | make(1): remove trailing whitespace
|
1.112 |
| 03-Jul-2020 |
rillig | make(1): remove redundant parentheses around return values
|
1.111 |
| 02-Jul-2020 |
rillig | make(1): remove useless parameter from Var_Set
The enum corresponding to this int parameter is only defined in var.c, which makes it impractical for the outside to set this parameter to anything but 0.
On x86_64, this reduces the size of the resulting executable by 5 kB.
|
1.110 |
| 19-Jan-2020 |
riastradh | Reimplement make(1) meta mode without filemon(4).
|
1.109 |
| 19-Dec-2019 |
maxv | Revert the filemon removal in bmake, as pointed out by maya we do care about not introducing divergence with FreeBSD, and the cost of unused is acceptable here.
|
1.108 |
| 18-Dec-2019 |
maxv | Retire filemon, discussed on tech-kern@.
|
1.107 |
| 20-Jul-2017 |
sjg | branches: 1.107.4; Make compat.c handle SIGINT etc more like job.c
If there is a running child, pass the signal on, and wait for it to exit before we self-terminate.
Reviewed by: christos
|
1.106 |
| 26-Aug-2016 |
dholland | Add a .DELETE_ON_ERROR: magic target that causes *failed* targets as well as *interrupted* targets to be deleted. The name and behavior of the variable matches gmake.
Also fix a glitch in newline output on error in compat mode that I discovered while doing it.
Closes PR 51376.
|
1.105 |
| 12-May-2016 |
sjg | Propagate errors from filemon.
If we encounter errors producing a .meta file, we should not consider the target completed successfully.
|
1.104 |
| 18-Feb-2016 |
christos | Collapse the 3 boolean parameter to 1 flags parameter. No functional change.
|
1.103 |
| 17-Jan-2016 |
christos | remove free NULL checks (Tilman Sauerbeck)
|
1.102 |
| 09-Jan-2016 |
christos | Preserve $$ in := assignments..
FOO=\$$CRAP BAR:=${FOO}
all: echo ${FOO} echo ${BAR}
|
1.101 |
| 11-Oct-2015 |
sjg | Add Boolean wantit to Var_Parse and Var_Subst
wantit will be FALSE when we are just consuming to discard in which case we skip "expensive" things like Cmd_Exec.
Reviewed by: christos
|
1.100 |
| 19-Jun-2015 |
christos | make needshell customizable, so that xinstall can use it.
|
1.99 |
| 19-Jun-2015 |
christos | create needshell so we don't scan the string multiple times.
|
1.98 |
| 19-Jun-2015 |
mlelstv | Adjust metachar handling to previous behaviour: - space and tab are no shell metachars, remove them from generic metachar function - add space and tab as to-be-quoted characters for :Q modifier - add = and : as characters that require command handling by the shell
|
1.97 |
| 17-Jun-2015 |
christos | Centralize the "is a meta char" test, instead of using two different arrays.
|
1.96 |
| 07-Sep-2014 |
joerg | Revert all make changes except the unit tests to the state of three weeks ago. Individual changes can be reapplied after review.
|
1.95 |
| 23-Aug-2014 |
christos | PR/46096: Jarmo Jaakkola: fix many problems with dependencies (PR 49086)
Quite extensive rewrite of the Suff module. Some ripple effects into Parse and Targ modules too.
Dependency searches in general were made to honor explicit rules so implicit and explicit sources are no longer applied on targets that do not invoke a transformation rule.
Archive member dependency search was rewritten. Explicit rules now work properly and $(.TARGET) is set correctly. POSIX semantics for lib(member.o) and .s1.a rules are supported.
.SUFFIXES list maintenance was rewritten so that scanning of existing rules works when suffixes are added and that clearing the suffix list removes single suffix rules too. Transformation rule nodes are now mixed with regular nodes so they are available as regular targets too if needed (especially after the known suffixes are cleared).
The .NULL target was documented in the manual page, especially to warn against using it when a single suffix rule would work. A deprecation warning was also added to the manual and make also warns the user if it encounters .NULL.
Search for suffix rules no longer allows the explicit dependencies to override the selected transformation rule. A check is made in the search that the transformation that would be tried does not already exist in the chain. This prevents getting stuck in an infinite loop under specific circumstances. Local variables are now set before node's children are expanded so dynamic sources work in multi-stage transformations. Make_HandleUse() no longer expands the added children for transformation nodes, preventing triple expansion and allowing the Suff module to properly postpone their expansion until proper values are set for the local variables.
Directory prefix is no longer removed from $(.PREFIX) if the target is found via directory search.
The last rule defined is now used instead of the first one (POSIX requirement) in case a rule is defined multiple times. Everything defined in the first instance is undone, but things added "globally" are honored. To implement this, each node tracks attribute bits which have been set by special targets (global) instead of special sources (local). They also track dependencies that were added by a rule with commands (local) instead of rule with no commands (global).
New attribute, OP_FROM_SYS_MK is introduced. It is set on all targets found in system makefiles so that they are not eligible to become the main target. We cannot just set OP_NOTMAIN because it is one of the attributes inherited from transformation and .USE rules and would make any eligible target that uses a built-in inference rule ineligible.
The $(.IMPSRC) local variable now works like in gmake: it is set to the first prerequisite for explicit rules. For implicit rules it is still the implied source.
The manual page is improved regarding the fixed features. Test cases for the fixed problems are added.
Other improvements in the Suff module include: - better debug messages for transformation rule search (length of the chain is now visualized by indentation) - Suff structures are created, destroyed and moved around by a set of maintenance functions so their reference counts are easier to track (this also gets rid of a lot of code duplication) - some unreasonably long functions were split into smaller ones - many local variables had their names changed to describe their purpose instead of their type
|
1.94 |
| 03-Jan-2014 |
sjg | Treat '~' as a meta char requiring a shell. Patch from Steve McIntyre 93sam at debian.org
Reviewed by: christos
|
1.93 |
| 02-Sep-2013 |
sjg | Do not apply shellErrFlag unless errCheck is true.
|
1.92 |
| 05-Jul-2013 |
sjg | If commandShell hasErrCtl is true, set shellErrFlag for use by CompatRunCommand() so that behavior in jobs and compat mode remains consistent.
|
1.91 |
| 25-Jan-2013 |
sjg | Remove Check_Cwd - it is no longer needed.
|
1.90 |
| 07-Oct-2012 |
sjg | Treat empty commands same as jobs mode
|
1.89 |
| 10-Jun-2012 |
wiz | branches: 1.89.2; Remove a __dead for an undead function (clang errors out otherwise).
|
1.88 |
| 05-Jun-2012 |
sjg | kill(2) is more appropriate and more portable than raise(3)
|
1.87 |
| 05-Jun-2012 |
sjg | Re-raising SIGINT etc, after running .INTERRUPT provides much more reliable shutdown on some systems. Based on CompatInterrupt in FreeBSD's make.
|
1.86 |
| 30-May-2012 |
sjg | An empty command is quietly ignored in jobs mode, but causes a failure in compat mode. Just skip it.
|
1.85 |
| 15-May-2012 |
seanb | - Use _exit() instead of exit() in signal handler since the latter isn't signal safe.
|
1.84 |
| 16-Sep-2011 |
joerg | branches: 1.84.2; Use __dead consistently. If it doesn't exist, define it away.
|
1.83 |
| 14-Aug-2011 |
christos | - remove gcc-4.5 warnings - simplify job printing code - document non-literal format strings
|
1.82 |
| 25-Nov-2010 |
christos | Instead of keeping around the mtime of the youngest child, keep a pointer to it, so that we can print it when we do the out of date determination.
|
1.81 |
| 13-Sep-2010 |
sjg | Add meta.c which implements "meta" mode for make. In this mode, a .meta file is created for each target, capturing the expanded commands used, any command output, and if filemon(9) is available, a record of system calls which are of interest. Not enabled unless USE_META=yes is set when building make. Also, if FILEMON_H exists, meta.c will be compiled to use filemon(9).
|
1.80 |
| 07-Aug-2010 |
sjg | wait[pid]() is called in several places. If we encounter an error and run the .ERROR target, we may reap a pid which jobs is waiting for. Ensure that we cleanup so that make isn't left waiting for an already deceased child.
|
1.79 |
| 03-Jun-2010 |
sjg | We have required sigaction() for quite a while. Use bmake_signal() - a wrapper around sigaction() rather than signal() to ensure that signals are handled consistently.
|
1.78 |
| 23-Apr-2010 |
sjg | On darwin at least, vfork() fails in child of vfork(). It probably shouldn't work anyway, so avoid this. We use the macro vFork() - a function seems to cause problems and is unnecessary overhead.
|
1.77 |
| 07-Apr-2010 |
sjg | Add:
.error "message" .warning "message" based on FreeBSD implementation. add .info while were at it.
.ERROR: a target to run on error. We pass the failing GNode to PrintOnError so it can set .ERROR_TARGET.
.MAKE.MAKEFILE_PREFERENCE As a means to control make's list of prefered makefile names. (Default: "makefile Makefile")
.MAKE.DEPENDFILE Names the file to read dependencies from (Default ".depend")
.MAKE.MODE Processed after all makefiles are read. Can put make into "compat" mode (more to come).
Fix:
compat.c: Error code should not be sent to debug_file. Make_DoAllVar: use DONE_ALLSRC to avoid processing a node multiple times. ReadMakefile: we can simply use doing_depend to control setting MAKEFILE.
|
1.76 |
| 22-Feb-2009 |
dholland | Use pid_t for the result of fork and wait. PR 38031 from Ryan Stutsman.
|
1.75 |
| 23-Jan-2009 |
dsl | branches: 1.75.2; Change 'ClientData' to 'void *' so that relevant parameters can be made 'const void *'.
|
1.74 |
| 16-Jan-2009 |
dsl | Debug print improvements.
|
1.73 |
| 19-Dec-2008 |
christos | if brk_string failed, use the shell.
|
1.72 |
| 13-Dec-2008 |
dsl | Use NULL instead of -1 cast to the relavant type (usually via NIL). This was a suggestion from christos - so blame him if there is a deep reason for using -1 :-)
|
1.71 |
| 15-Feb-2008 |
christos | back all changes out until I fix it properly.
|
1.70 |
| 14-Feb-2008 |
christos | - use pid_t/size_t as appropriate instead of int. - use %ld to print pids. - fix a bit of lint. - WARNS=4
|
1.69 |
| 19-Jan-2008 |
sjg | Implement -dl (aka LOUD) to override '@' at the start of script lines. Based on supplied patch.
PR: 37202
|
1.68 |
| 05-Oct-2007 |
sjg | Add the ability to .export variables to the environment.
|
1.67 |
| 05-Apr-2007 |
christos | branches: 1.67.4; kill clobbered warning from Tobias Nygren
|
1.66 |
| 17-Nov-2006 |
dsl | branches: 1.66.2; 1.66.4; A rather large rototil in the way the parallel make code schedules jobs. This gives a considerable speedup in the processing of .WAIT and .ORDER. Both .WAIT and .ORDER stop both the commands of the node, and its dependant nodes being built until the LH nodes are complete. .WAIT only applies to the dependency line on which it appears, whereas .ORDER applies globally between the two nodes. In both cases dependant nodes can be built because other targets need them. make now processes the target list left to right, scheduling child nodes as they are needed to make other nodes (instead of attempting to generate a bottom-up dependency graph at the start). This means that 'make -j1' will tend to build in the same order as a non-parallel make. Note that: all: x y x: a .WAIT b y: b .WAIT a does not generate a dependency loop. But x: y .ORDER y x does (unless something elswhere causes 'y' to be built).
|
1.65 |
| 27-Oct-2006 |
dsl | Since 'ClientData' is 'void *', nuke almost all the (ClientData) casts.
|
1.64 |
| 22-Oct-2006 |
christos | sprinkle volatile.
|
1.63 |
| 15-Oct-2006 |
dsl | Output all debug trace output through 'debug_file' defaulting to 'stdout'. (Almost all the debug output went there, but some went to stderr.) Split the parsing of -d (debug flags) out into its own routine. Allow the output filename to be changed by specifying -dF<file> to create a log file, or -dF+<file> to append to it. <file> may be stdout or stderr. Also change so that -d-<flags> acts on <flags> locally but doesn't copy them to MAKEFLAGS so they aren't inherited by child makes. I'm not 100% happy with the command line syntax for the above, so they are currently undocumented.
|
1.62 |
| 09-Oct-2006 |
apb | In a non-native build, always use a shell to execute commands. This may be necessary in a weird cross-build environment. Previously, if the command looked simple enough, we would try to exec it directly.
OK sjg, christos
|
1.61 |
| 22-Apr-2006 |
christos | Coverity CID 530: Don't leak the argument vector.
|
1.60 |
| 08-Aug-2005 |
christos | From Max Okumoto: - Remove casts to NULL. - Remove space between cast and object.
|
1.59 |
| 25-Jul-2005 |
christos | Whitespace KNF cleanup from Max Okumoto
|
1.58 |
| 08-May-2005 |
christos | Don't complain that we cannot make .END.
|
1.57 |
| 08-May-2005 |
christos | Now that dependencies in .BEGIN, .END, and .INTERRUPT work, allow them.
|
1.56 |
| 16-Feb-2005 |
christos | PR/29203, PR/29204: Max Okumoto: KNF changes to make [no functional changes]
|
1.55 |
| 01-Jul-2004 |
jmc | Add some checks for gcc around a few function declarations and note the unused variables. Also fix a few other warnings that PR#22118 shows when trying to compile bmake on non-NetBSD hosts
|
1.54 |
| 07-May-2004 |
sjg | Remove use of sh -e when running in compat mode. Its not posix compliant and serves very little purpose. With this change compat and jobs modes are consistent wrt how they treat each line of a script.
Add support for the '+' command line prefix as required by posix. Lines prefixed with '+' are executed even when -n is given. [Actually posix says they should also be done for -q and -t]
PR: Reviewed by: jmc
|
1.53 |
| 07-May-2004 |
ross | Simplify build, no functional changes.
Instead of adding MAKE_BOOTSTRAP for hosted environments, i.e., when you want things simple, instead add MAKE_NATIVE to get those hugely important features like __RCSID().
It's now possible to build make on some hosts with: cc *.c */*.c
|
1.52 |
| 10-Sep-2003 |
jmmv | branches: 1.52.2; Add the 'e' debug flag (i.e., '-d e'): when enabled, show the "target failed" and "command failed" messages added recently. These introduce too much noise when debugging some kind of problems, specially in pkgsrc.
|
1.51 |
| 09-Sep-2003 |
lukem | when displaying the 'Failed command:', collapse runs of whitespace in the command to a single space. suggested by David Laight in private mail.
|
1.50 |
| 08-Sep-2003 |
lukem | don't free cmdStart too early, as cmd points somewhere in there and we may want cmd for error messages. should fix [bin/22705] from itojun@
|
1.49 |
| 02-Sep-2003 |
lukem | Also display failed target. Given printf "all:\n\ttrue\n\t@false\n" | make -f - the error output now looks like: *** Failed target: all *** Failed command: false *** Error code 1 instead of just *** Error code 1
XXX: add this support for make -j builds.
|
1.48 |
| 02-Sep-2003 |
lukem | display the command that failed. this is useful if the command-line had been suppressed.
|
1.47 |
| 07-Aug-2003 |
agc | Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
|
1.46 |
| 01-Aug-2003 |
sjg | Allow .SHELL: to control the shell used by compat mode too. Add a shell spec for ksh - a nice portable posix shell. Document .SHELL:
|
1.45 |
| 14-Jul-2003 |
christos | Pass WARNS=3
|
1.44 |
| 15-Jun-2002 |
wiz | Remove !__STDC__ stuff, de-__P(), ANSIfy, and de-register.
|
1.43 |
| 27-Apr-2002 |
bjh21 | Rather than hardcoding "/bin/sh", use _PATH_BSHELL. To allow bootstrapping, provide a default for this in pathnames.h, and only include <paths.h> ifndef MAKE_BOOTSTRAP.
|
1.42 |
| 21-Mar-2002 |
christos | don't print extra newlines on errors.
|
1.41 |
| 14-Mar-2002 |
pk | JobExec(): don't use Punt() in the child; it can't possibly DTRT, and will also mess up the parents variables.
Instead, use execError() for all error paths in the child code.
|
1.40 |
| 07-Feb-2002 |
pk | When making a node which is the source of both a .MADE target and a normal target (the latter dependency being the reason why it's made), the .MADE parent should not be put on the `toBeMade' list again (in Make_Update()) since it was already put on it in Make_ExpandUse(). Doing so would cause the rules for the .MADE target to be executed (at least) twice, and also mess up the unmade children count of _its_ parent, resulting in spurious graph cylce detection.
To achieve this, make sure the unmade children count of the .MADE target is set to zero before enqueueing it on the `toBeMade' list in Make_ExpandUse(). Then, in Make_Update(), check if the parent has the .MADE attribute before diddling with the queue.
For the same reason the status of a node must not be set to UPTODATE unconditionally in compat mode, since that will prevent the node from being built even if it is the source of a normal target. Instead, check both its state and the type of the parent to decide whether to continue on behalf of the current parent.
|
1.39 |
| 04-Feb-2002 |
christos | Remove OP_NOSUFF, fix OP_MADE in compat mode [from pk], and make the OP_MADE comment reflect reality.
|
1.38 |
| 03-Feb-2002 |
pk | Don't bother to apply suffix rules to find sources for a target marked as .MADE.
|
1.37 |
| 27-Jan-2002 |
reinoud | Fix major bug in make(1) ... due to shadowing of the dotLast path used for the .DOTLAST primitive by a boolean variable with the same name, this whole mechanism was broken ... it doesn't save much stat calls but it was wrong.
Thanks to Jason Thorpe for the other shadow-variable fixing patches he made.
|
1.36 |
| 16-Oct-2001 |
sjg | Don't ignore errors during .END processing.
PR: 14267 Reviewed: christos
|
1.35 |
| 12-Jun-2001 |
sjg | Add 4th arg (flags) to Var_Set so that VarLoopExpand can tell it not to export interator variables when using context VAR_CMD.
Reviewed: christos
|
1.34 |
| 01-Jun-2001 |
sjg | A number of semi-related changes. 1. make -dx turns on DEBUG_SHELL which causes sh -x to be used where possible. 2. PrintOnError() is now called when make is stopping due to an error. This routine reports the curdir and the value of any variables listed in MAKE_PRINT_VAR_ON_ERROR. 3. Variables set via command line, are propagated to child-makes via MAKEFLAGS. This behaviour appears to be necessary for POSIX (according to the GNU folk anyway). 4. Do not reset MAKEFILE when reading ".depend" as this rather eliminates the usefulness of ${MAKEFILE}. 5. Added ${.newline} as a simple means of being able to include \n in the result of a :@ loop expansion. 6. Set ${MAKE_VERSION} if defined. Need to come up with a useful value.
Reviewed: christos
|
1.33 |
| 29-May-2001 |
christos | better error messages on exec* failures. From Simon Burge.
|
1.32 |
| 06-Apr-2001 |
wiz | Negative exit code cleanup: Replace exit(-x) with exit(x). As seen on tech-userlevel.
|
1.31 |
| 01-Jan-2001 |
sommerfeld | Delete forceSerial; just use compatMake for that. Add -N flag to *really* not execute any commands (useful when using the -d flags to debug usr/src/Makefile) Document -N Update documentation of -n to mention that it still executes commands for targets marked .MAKE so that the -N/-n distinction is clear.
|
1.30 |
| 20-Apr-2000 |
sjg | Changes to make MAKEOBJDIRPREFIX useful.
Firstly, we ignore getenv("PWD") if MAKEOBJDIRPREFIX is set so that we always get the same value for .CURDIR regardless of how make was invoked.
Second, when executing a command we check if it is ${.MAKE} or ${.MAKE:T} without a preceeding chdir, if so we insert a chdir(${.CURDIR}) so that the Makefile will be found by the child make. Note that this behaviour is dissabled if MAKEOBJDIRPREFIX is not set or if NOCHECKMAKECHDIR is set. See the comments in main.c for more detail.
With these two changes, one can successfully build usr/src using MAKEOBJDIRPREFIX allowing the src to be mounted from a CD-ROM.
|
1.29 |
| 21-Jan-2000 |
mycroft | Nuke `extern int errno;' in code we compile with -Wstrict-prototypes. We get the correct definition from errno.h.
|
1.28 |
| 16-Sep-1999 |
mycroft | Fix a bug in the previous. In the `compat' case, we don't actually use the list of target nodes returned by Make_ExpandUse(). We have to search the cohorts explicitly while iterating through the tree. So, tweak CompatMake() to do this.
|
1.27 |
| 24-Mar-1999 |
sommerfe | branches: 1.27.2; report a sensible error if wait() fails.
|
1.26 |
| 11-Nov-1998 |
christos | This patch fixes the problem introduced in the previous commit where parents would be get remade, even if children were not really updated by the commands executed for them. It also makes all the children have the real modification time set if possible, so it should fix some other timing weirdnesses...
- collapse childMade and make fields into flags and convert them to bits CHILDMADE and REMAKE - introduce FORCE flag that gets set in all the parents of a child that has no sources and does not exist. - set oodate if the FORCE flag is set, and not if CHILDMADE - centralize the RECHECK into Make_Recheck() and use this in make.c and compat.c - use Make_TimeStamp for all child -> parent timestamp propagations
|
1.25 |
| 01-Nov-1998 |
itohy | Reduced memory leaks. I found some more leaks, but are not in inside of iterations.
|
1.24 |
| 26-Mar-1998 |
christos | PR/5210: Hauke Fath: make core dumps with .SHELL Unfortunately this revealed a deeper problem with the brk_string code. To fix it: - remove sharing of the buffer between brk_string invocations - change the semantics of brk_string so that the argument array starts with 0, and return the buffer where the strings are stored
|
1.23 |
| 31-Dec-1997 |
thorpej | Change an exit() to _exit(), so that it's safe for vfork().
|
1.22 |
| 28-Sep-1997 |
lukem | branches: 1.22.2; wrap #include <sys/cdefs.h>, __RCSID(...) stuff in #ifndef MAKE_BOOTSTRAP
|
1.21 |
| 01-Jul-1997 |
christos | Add WARNS=1 RCSID police
|
1.20 |
| 07-May-1997 |
mycroft | Ignore `-t' when the .MAKE attribute is set.
|
1.19 |
| 06-May-1997 |
mycroft | Make sure `-n' is actually disabled for targets with the .MAKE attribute.
|
1.18 |
| 28-Mar-1997 |
christos | Make sure that the children of nodes that are marked .MADE, are marked UPTODATE and their timestamps are consistent.
|
1.17 |
| 23-Mar-1997 |
christos | Locate all the children of a node marked as MADE.
|
1.16 |
| 10-Mar-1997 |
christos | Add a .MADE directive to indicated that the children of a target are up-to-date, even when they are not. This is to simulate our current make install behavior with proper dependencies.
|
1.15 |
| 20-Feb-1997 |
christos | Reported by cgd: fix .USE directive problems: 1. ${.*} variables did not get expanded in dependencies. 2. expanded ${.*} variables in .USE dependencies can cause tree restructuring; handle it. 3. in compat mode, expand .USE before evaluating the list of targets, instead of doing .USE expansions on demand, because they can cause tree restructuring.
|
1.14 |
| 06-Nov-1996 |
christos | - Merge in FreeBSD and Lite2 changes. - Fix bug where a non-archive target with a .a suffix would always be considered to be out of date, since it does not have a TOC.
|
1.13 |
| 22-Nov-1995 |
christos | branches: 1.13.4; Updates for POSIX/SVR4 compiling:
arch.c: Don't require ranlib stuff. Not everybody has it. dir.c: SunOS-4 != Solaris; change #ifdef sun to #if sun && !__svr4__ job.c, compat.c: Don't use 'union wait', use int and the W*() macros. main.c: Check for uname() == -1; some unames return > 0... util.c, job.c: Add signal() with BSD semantics for svr4, don't use bsd sigmask and friends.
|
1.12 |
| 02-Nov-1995 |
christos | Minor: - ${.PREFIX} should never contain a full pathname - Fixed gcc -Wall warnings Major: - compatMake is now FALSE. This means that we are now running in full pmake mode: * rules on dependency lines can be executed in parallel and or out of sequence:
foo: bar baz
can fire the rule for baz before the rule for bar is fired. To enforce bar to be fired before baz, another rule needs to be added. [bar: baz] * adjacent shell commands in a target are now executed by a single invocation of the shell, not one invocation of the shell per line (compatMake can be turned off using the -B flag) - The -j flag now works... I.e. make -j 4 will fork up to four jobs in parallel when it can. The target name is printed before each burst of output caused by the target execution as '--- target ---', when j > 1 - I have changed all the Makefiles so that they work with make -j N, and I have tested the whole netbsd by: 'make -j 4 cleandir; make -j 4 depend; make -j 4; make -j 4 install' - I have not compiled or tested this version of make with -DREMOTE.
|
1.11 |
| 27-Sep-1995 |
jtc | Update lseek() constants: L_SET -> SEEK_SET And add off_t cast to offset argument.
|
1.10 |
| 14-Jun-1995 |
christos | - $NetBSD$ rcsids - Fixed so that .[A-Z]* targets that do not match keywords are ignored as Posix mandates - Added .PHONY target keyword
|
1.9 |
| 25-Nov-1994 |
christos | Don't remove targets when the -n flag is given and make is interrupted. (From Keith Bostic)
|
1.8 |
| 16-Jun-1994 |
jtc | Christos' fix for quoting variable extraction properly.
|
1.7 |
| 06-Jun-1994 |
jtc | Fixes from Christos Zoulas, who used purify, objectcenter and testcenter to find memory leaks and illegal memory accesses.
|
1.6 |
| 07-Mar-1994 |
cgd | kill some warnings, from Christos.
|
1.5 |
| 05-Mar-1994 |
cgd | fixes/improvements from Christos Zoulas <christos@deshaw.com>.
|
1.4 |
| 13-Jan-1994 |
jtc | Include appropriate header files to bring prototypes into scope.
|
1.3 |
| 01-Aug-1993 |
mycroft | Add RCS identifiers.
|
1.2 |
| 21-Mar-1993 |
cgd | after 0.2.2 "stable" patches applied
|
1.1 |
| 21-Mar-1993 |
cgd | branches: 1.1.1; Initial revision
|
1.1.1.2 |
| 28-Dec-1996 |
tls | Import 4.4BSD-Lite2 sources onto CSRG branch (already merged at head)
|
1.1.1.1 |
| 21-Mar-1993 |
cgd | initial import of 386bsd-0.1 sources
|
1.13.4.1 |
| 26-Jan-1997 |
rat | Update make(1) from trunk, by request from Christos Zoulas. Fixes many bugs.
|
1.22.2.1 |
| 08-May-1998 |
mycroft | Sync with trunk, per request of christos.
|
1.27.2.1 |
| 23-Jan-2000 |
he | Pull up revision 1.29 (requested by mycroft): Always do the errno indirection hack, so that non-threaded libraries get the right errno value when linked with -lpthread. This means "always include <errno.h> and never declare errno yourself".
|
1.52.2.2 |
| 10-May-2004 |
tron | Pull up revision 1.54 (requested by sjg in ticket #282): Remove use of sh -e when running in compat mode. Its not posix compliant and serves very little purpose. With this change compat and jobs modes are consistent wrt how they treat each line of a script. Add support for the '+' command line prefix as required by posix. Lines prefixed with '+' are executed even when -n is given. [Actually posix says they should also be done for -q and -t] PR: Reviewed by: jmc
|
1.52.2.1 |
| 10-May-2004 |
tron | Pull up revision 1.53 (requested by sjg in ticket #282): Simplify build, no functional changes. Instead of adding MAKE_BOOTSTRAP for hosted environments, i.e., when you want things simple, instead add MAKE_NATIVE to get those hugely important features like __RCSID(). It's now possible to build make on some hosts with: cc *.c */*.c
|
1.66.4.1 |
| 03-Sep-2007 |
wrstuden | Sync w/ NetBSD-4-RC_1
|
1.66.2.1 |
| 05-Jun-2007 |
bouyer | Apply patch (requested by tron in ticket #696): usr.bin/make/compat.c patch usr.bin/make/cond.c patch usr.bin/make/dir.c patch usr.bin/make/for.c patch usr.bin/make/main.c patch usr.bin/make/make.1 patch usr.bin/make/make.c patch usr.bin/make/make.h patch usr.bin/make/nonints.h patch usr.bin/make/parse.c patch usr.bin/make/str.c patch usr.bin/make/targ.c patch usr.bin/make/util.c patch usr.bin/make/var.c patch
Synchronize make(1) with HEAD branch to increase perfomance and improve stability.
|
1.67.4.2 |
| 23-Mar-2008 |
matt | sync with HEAD
|
1.67.4.1 |
| 06-Nov-2007 |
matt | sync with HEAD
|
1.75.2.1 |
| 13-May-2009 |
jym | Sync with HEAD.
Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
|
1.84.2.3 |
| 22-May-2014 |
yamt | sync with head.
for a reference, the tree before this commit was tagged as yamt-pagecache-tag8.
this commit was splitted into small chunks to avoid a limitation of cvs. ("Protocol error: too many arguments")
|
1.84.2.2 |
| 30-Oct-2012 |
yamt | sync with head
|
1.84.2.1 |
| 23-May-2012 |
yamt | sync with head.
|
1.89.2.3 |
| 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.89.2.2 |
| 25-Feb-2013 |
tls | resync with head
|
1.89.2.1 |
| 20-Nov-2012 |
tls | Resync to 2012-11-19 00:00:00 UTC
|
1.107.4.1 |
| 08-Apr-2020 |
martin | Merge changes from current as of 20200406
|
1.259.2.1 |
| 02-Aug-2025 |
perseant | Sync with HEAD
|