History log of /src/usr.bin/make/main.c |
Revision | | Date | Author | Comments |
1.662 |
| 09-Aug-2025 |
rillig | make: clean up
|
1.661 |
| 06-Jul-2025 |
rillig | make: clean up
|
1.660 |
| 02-Jul-2025 |
rillig | make: shorten diagnostic for invalid -J option
In the manual page, there's more space to properly explain the complexity behind the warning.
|
1.659 |
| 13-Jun-2025 |
rillig | make: new sentence, new line
|
1.658 |
| 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.657 |
| 12-Jun-2025 |
rillig | make: use a common style for unexpected error messages
In enomem, report the actual error instead of a fixed ENOMEM.
|
1.656 |
| 05-Jun-2025 |
rillig | make: remove empty line from diagnostic, add tests for output handling
The warning for the invalid internal option "-J" does not need a trailing newline, as that is provided by Parse_Error already.
Having this newline in the output demonstrated a previously unknown bug in handling the output of child commands in parallel mode. There, empty lines are randomly discarded, depending on the chunks in which the output from the child process is copied to make's stdout. See job-output.mk for a demonstration.
The test for the Korn shell did not run the Korn shell in error handling mode, as the error handling mode only affects the parallel mode but the test didn't switch to that mode.
After fixing the shell-ksh.mk test, the single '"' in the output looked suspicious, and indeed, the shell-csh.mk test had the same problem of filtering more characters from the output than intended.
|
1.655 |
| 28-May-2025 |
sjg | make: delay warning about bogus -J flag
In MainParseArgJobsInternal just set bogusJflag to indicate that the descriptors passed were invalid.
By the time we get to InitMaxJobs the command line and indeed the makefile have had a chance to put us in compat mode, in which case the warning is unnecessary. Add suggestion of -B if compat mode is desired in the sub-make.
Reviewed by: rillig
|
1.654 |
| 26-May-2025 |
rillig | make: show contents of MAKEFLAGS in the stack trace
When the internal -J option refers to a closed file descriptor, it's helpful to know what the MAKEFLAGS environment variable contains, in addition to the executed command line. Same for parse errors in variable assignments from the command line.
|
1.653 |
| 23-May-2025 |
rillig | make: add current directory to error messages from MAKEFLAGS
While parsing the additional command line arguments from the MAKEFLAGS environment variable, the current directory was not initialized yet, so swap the order.
As a side effect, this change would allow a "-m .../share/mk" option, with a literal magic "...", thus looking up the system directory in any ancestor directory of the current directory. This idea sounds unreliable enough that probably nobody will try this in practice.
|
1.652 |
| 23-May-2025 |
rillig | make: warn when falling from parallel mode back to compat mode
Falling back may run fewer jobs than intended, thus increasing the build's wall time.
Falling back may run more jobs than intended, when a sub-make creates its own and independent token pool, thus overloading the system.
Warn in both cases. Since the -J option is internal, it is not obvious how to fix the situation, so provide detailed instructions on the possible fixes and their effects.
|
1.651 |
| 20-May-2025 |
sjg | Revert export of MAKEFLAGS from Cmd_Exec
Until we work out what the issue is. Revert related unit-test changes as well
|
1.650 |
| 18-May-2025 |
sjg | make: Cmd_Exec call Main_ExportMAKEFLAGS
export MAKEFLAGS the fist time Cmd_Exec is called. This allows ${.MAKE} run via x!= to see them.
Remove test case from varname-dot-makeflags that checked this does not happen.
Reviewed by: christos
|
1.649 |
| 18-May-2025 |
rillig | make: rename variables, remove now-redundant comments
|
1.648 |
| 18-May-2025 |
rillig | make: remove redundant comments, summarize a few others
|
1.647 |
| 11-May-2025 |
rillig | make: clean up error message for malformed internal -J option
There's no point printing the usage, as the problem is typically somewhere else. Reword the message to be easier to parse.
|
1.646 |
| 10-May-2025 |
rillig | make: rename token pool variables to be more descriptive
|
1.645 |
| 03-May-2025 |
rillig | make: miscellaneous cleanups
|
1.644 |
| 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.643 |
| 22-Apr-2025 |
rillig | make: group the code for handling the job token pool
|
1.642 |
| 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.641 |
| 31-Mar-2025 |
riastradh | make(1): Nix trailing whitespace.
No functional change intended.
|
1.640 |
| 30-Mar-2025 |
sjg | make: POSIX mode, check for sysV style modifiers first
A POSIX compatible makefile should not be using any of our native modifiers, so give preference to the sysV style modifier and only check the others as a fallback.
Reviewed by: rillig
|
1.639 |
| 07-Mar-2025 |
rillig | make: clean up comments and code for parallel mode
Most of the comments didn't help understand the code.
The Finish function was named way too soft for what it does, which is to exit without cleaning up properly. Since it was used only once, inline it. The code from that function causes jobs to be terminated early when an unrelated target has failed, resulting in partially written files, due to SIGPIPE.
|
1.638 |
| 19-Jan-2025 |
rillig | make: avoid memory allocation in error path after exec
Just to be on the extra-safe side.
|
1.637 |
| 19-Jan-2025 |
rillig | make: fix code coverage counts
See tests/usr.bin/gcov/t_gcov.sh.
|
1.636 |
| 23-Nov-2024 |
rillig | make: fix confusing error message when overriding a read-only variable
|
1.635 |
| 10-Nov-2024 |
sjg | make: allow -f .../Makefile
If the arg to -f or an entry in .MAKE.MAKEFILE_PREFERENCE starts with ".../" look for the rest of the path in .CURDIR and above.
Reviewed by: rillig
|
1.634 |
| 27-Aug-2024 |
rillig | make: treat recursive variables non-fatally
A recursive variable is no worse than an unknown modifier, so treat them in the same way by continuing parsing until the end of the makefile.
|
1.633 |
| 25-Aug-2024 |
rillig | make: add more context to error message about recursive variables
|
1.632 |
| 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.631 |
| 09-Jul-2024 |
rillig | make: error out on parse/evaluation errors in shell commands
The expression ${VAR:X} has an unknown modifier ':X'. Previously, this expression errored out when the expression was evaluated at parse time, but not when the expression was evaluated when generating the commands to bring a target up to date. The errors were previously reported, they didn't affect the exit status, though.
Now, errors in expressions are handled in the same way, regardless of the time at which they are evaluated.
|
1.630 |
| 07-Jul-2024 |
rillig | make: move initialization of variable scopes to targ.c
The variable scopes are freed by Targ_End, so initialize them there as well. Separate printing statistics and freeing memory, which makes Var_End unnecessary.
|
1.629 |
| 07-Jul-2024 |
rillig | make: only generate code for cleanup functions in CLEANUP mode
|
1.628 |
| 06-Jul-2024 |
rillig | make: clean up condition when printing an error
|
1.627 |
| 05-Jul-2024 |
rillig | make: reduce lint-specific comments about ARGSUSED
|
1.626 |
| 04-Jul-2024 |
rillig | make: on error, print the targets to be made
This helps to understand situations with several nested sub-makes in varying directories.
|
1.625 |
| 30-Jun-2024 |
rillig | make: add detailed exit status to message for failed sub-commands
Several commands communicate via the exit status and not only distinguish between zero and non-zero, so make this information available to ease investigations.
The command "false" is not guaranteed to exit with a consistent status, so use "(exit 13)" instead in the tests, to keep these tests portable across different operating systems. The exit status 127 is required for a shell that cannot find a command, so keep that one.
|
1.624 |
| 02-Jun-2024 |
rillig | branches: 1.624.2; make: sync VarEvalMode constant names with their debug log names
|
1.623 |
| 01-Jun-2024 |
rillig | make: fix memory leak in realpath cache
|
1.622 |
| 01-Jun-2024 |
rillig | make: replace strncpy with snprintf
There's no point copying a MAXPATHLEN buffer in its entirety when only the initial string part is ever used.
|
1.621 |
| 01-Jun-2024 |
rillig | make: fix variable lifetime when initializing MAKE and .MAKE
The pathbuf buffer is aliased by abspath, which later escapes the block where the buffer is declared.
|
1.620 |
| 01-Jun-2024 |
sjg | make: ensure loop termination in purge_relative_cached_realpaths
You cannot ignore the return from HashIter_Next
|
1.619 |
| 31-May-2024 |
rillig | make: clean up API for iterating over hash tables
|
1.618 |
| 28-May-2024 |
sjg | make: allow debugging the warning about .OBJDIR
When make complains about an unwritable .OBJDIR it is not always obvious how we derrived that value.
If MAKE_DEBUG_OBJDIR_CHECK_WRITABLE is enabled call PrintOnError so we can examine variables that are likely relevant.
Fix description of MAKE_OBJDIR_CHECK_WRITABLE in make.1
|
1.617 |
| 24-May-2024 |
rillig | make: in -DCLEANUP mode, free variables and their values
The variables in the 3 scopes must be freed before the scopes themselves are freed by Targ_End.
The test opt-m-include-dir creates a directory of the form '*.tmp', thus it must be removed before attempting to only remove regular files of this name.
POSIX requires setenv to copy the passed name and value, so there is no need to keep that memory allocated any longer.
|
1.616 |
| 19-May-2024 |
sjg | Dir_FindFile treat sysIncPath and defSysIncPath as special
Rather than play games with adding .DOTLAST and then having to exclude that from .SYSPATH, just have Dir_FindFile check if path is sysIncPath or defSysIncPath and behave as if .DOTLAST seen and also skip the final search of .CURDIR.
Fix Dir_SetSYSPATH to use defSysIncPath if sysIncPath is empty.
|
1.615 |
| 07-May-2024 |
sjg | make: all command line overrides go in .MAKEOVERRIDES
Not all variables that start with '.' are internals, and unless they are explicitly flagged as internal should go into .MAKEOVERRIDES
Update varname-dot-makeoverrides to check this.
Also avoid using SCOPE_CMDLINE when ReadOnly will do.
|
1.614 |
| 30-Apr-2024 |
sjg | make: ensure '.include <makefile>' respects MAKESYSPATH
Since Dir_FindFile is used by '.include' and its variants, and will first search .CURDIR unless the give path starts with ".DOTLAST".
Update unit-tests/opt-m-include-dir to test this.
|
1.613 |
| 27-Apr-2024 |
rillig | make: simplify freeing of lists
|
1.612 |
| 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.611 |
| 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.610 |
| 07-Feb-2024 |
rillig | make: remove unneeded conditional-compilation toggles
The toggles INCLUDES, LIBRARIES, POSIX, SYSVINCLUDE, SYSVVARSUB, GMAKEEXPORT and SUNSHCMD are no longer needed, they were unconditionally set.
The toggle NO_REGEX was configurable from the command line, but disabling it would result in various error messages about the unknown ':C' modifier.
OK sjg@.
|
1.609 |
| 07-Jan-2024 |
sjg | make: more consistent error messages
Move %s: progname from Job_CheckCommands to Fatal to avoid is being repeated when Job_CheckCommands is passed Error.
This means some errors from var also report progname (and level) which is useful.
Reviewed by: rillig
|
1.608 |
| 05-Jan-2024 |
rillig | make: miscellaneous cleanups
|
1.607 |
| 05-Jan-2024 |
sjg | Cmd_Exec use tempfile if cmd is too big
To avoid blowing commandline/env limits, if "cmd" is more than 1000 bytes, write it to a file and pass that to shell.
Reviewed by: rillig
|
1.606 |
| 27-Dec-2023 |
sjg | make: ensure shellPath is set before using it.
|
1.605 |
| 17-Dec-2023 |
rillig | make: clean up unused return value of str2Lst_Append
No functional change.
|
1.604 |
| 17-Dec-2023 |
rillig | make: clean up names of local variables
No binary change.
|
1.603 |
| 02-Nov-2023 |
rillig | make: miscellaneous cleanups
No functional change.
|
1.602 |
| 02-Nov-2023 |
rillig | make: clean up comments
No functional change.
|
1.601 |
| 02-Nov-2023 |
rillig | make: inline a single-line cross-file function
No functional change.
|
1.600 |
| 19-Sep-2023 |
rillig | make: clean up code for parsing the '-j' command line option
No binary change.
|
1.599 |
| 10-Sep-2023 |
rillig | make: fix typo
|
1.598 |
| 10-Sep-2023 |
rillig | make: add more details to usage message of -j option
|
1.597 |
| 10-Sep-2023 |
rillig | make: fix lint warning about strchr
main.c(416): warning: call to 'strchr' effectively discards 'const' from argument [346]
Even though C23 turns strchr into a const-generic function, it doesn't do the same for strtol, so use separate pointers for the current parsing position and the end of a number, as their constness differs.
|
1.596 |
| 09-Sep-2023 |
sjg | Add .MAKE.JOBS.C to indicate wether -jC is supported
|
1.595 |
| 09-Sep-2023 |
mrg | add explicit cast for long -> int truncation warning-as-error.
as this is number of CPUs, i don't think we have to care about it for a long, long, *long* time...
|
1.594 |
| 09-Sep-2023 |
sjg | make: allow -j to compute a multiple of ncpu
If _SC_NPROCESSORS_ONLN is supported; and -j arg is a floating point number or ends in 'C' compute .MAKE.JOBS as a multiple of _SC_NPROCESSORS_ONLN
Based on a suggestion from des at freebsd.org Discussed with: rillig, christos
|
1.593 |
| 28-Mar-2023 |
rillig | make: declare all common symbols in headers, unexport others
No functional change.
|
1.592 |
| 25-Feb-2023 |
rillig | make: rename function for parsing command line options
No binary change.
|
1.591 |
| 15-Feb-2023 |
rillig | make: inline macros for variable names
The variable name '.MAKEOVERRIDES' was already used in the non-macro form.
No binary change.
|
1.590 |
| 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.589 |
| 26-Jan-2023 |
sjg | make: some variables should be read-only
Make variables like .newline and .MAKE.{GID,PID,PPID,UID} read-only.
Reviewed by: rillig
|
1.588 |
| 24-Jan-2023 |
sjg | make: .SYSPATH: to add dirs to sysIncPath
.SYSPATH: with no sources will clear sysIncPath otherwise sources are added
Reviewed by: rillig
|
1.587 |
| 19-Jan-2023 |
rillig | make: inline macro for variable name
This fixes the inconsistency of using the macro name in one place and its value in another place (since 2010).
No binary change.
|
1.586 |
| 01-Jan-2023 |
rillig | make: don't assemble identifiers from smaller tokens
No binary change.
|
1.585 |
| 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.584 |
| 10-Oct-2022 |
rillig | make: document the guard for directories in unlink_file
Document only the POSIX requirement for now, as I didn't find information about _which_ ancient UNIX systems would corrupt the filesystem on unlinking a directory.
http://man.cat-v.org/unix-1st/2/sys-unlink (1971) says: > It is also illegal to unlink a directory (except for the super-user).
https://mail-index.netbsd.org/tech-toolchain/2022/10/06/msg004147.html
|
1.583 |
| 28-Sep-2022 |
sjg | Don't ignore return from snprintf or getcwd
|
1.582 |
| 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.581 |
| 07-May-2022 |
rillig | make: rename Compat_Run to Compat_MakeAll
No functional change.
|
1.580 |
| 18-Apr-2022 |
rillig | make: only switch to POSIX mode if '.POSIX:' is the first line
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html says that in order to make a makefile POSIX-conforming, its first non-comment line must be the special dependency line '.POSIX:' without any source dependencies.
Previously, make switched to POSIX mode even if such a line occurred anywhere else, which was allowed by POSIX but was deep in the "unspecified behavior" area. For NetBSD make, there is no big difference since it doesn't ship any <posix.mk> file, this change mainly affects the bmake distribution.
Previously, makefiles that contain '.POSIX:' somewhere in the middle could fail due to <posix.mk> resetting .SUFFIXES, among other things.
Suggested by Simon J. Gerraty, who also reviewed an earlier version of this change.
|
1.579 |
| 22-Mar-2022 |
rillig | make: clean up comments and code for setting debug flags
No binary change.
|
1.578 |
| 09-Feb-2022 |
rillig | make: prefix the warning about read-only .OBJDIR with a colon
For consistency with the other warnings.
|
1.577 |
| 29-Jan-2022 |
rillig | make: print stack trace on fatal errors
The only fatal error that occurs while the makefiles are read in is the one about recursive variables, which didn't give any hint about the location before.
If a recursive variable is detected while evaluating the commands of a target to be made, there is no location information, as before.
|
1.576 |
| 27-Jan-2022 |
sjg | Allow local variable assignments in dependency lines
The variable is set in the context of the target. This syntax has been supported by gmake for ~ever. If necessary a makefile can set .MAKE.TARGET_LOCAL_VARIABLES=false to disable this.
Expose GetBooleanExpr so parse.c can use it.
|
1.575 |
| 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.574 |
| 22-Jan-2022 |
rillig | make: clean up comments
|
1.573 |
| 15-Jan-2022 |
rillig | make: remove extra semicolon after statement
Lint will complain about this very soon.
No binary change.
|
1.572 |
| 15-Jan-2022 |
rillig | make: replace Var_Value with Var_Exists where applicable
The latter function already existed in 1993, no idea why it was not used.
No functional change.
|
1.571 |
| 15-Jan-2022 |
rillig | make: remove unnecessary functions for expanding variable names
In meta mode, the affected variable patterns do not contain a '$'.
Outside of meta mode, Global_SetExpand was only called a single time, so inline that call.
No functional change.
|
1.570 |
| 15-Jan-2022 |
rillig | make: merge duplicate code for expanding variable expressions
No functional change.
|
1.569 |
| 10-Jan-2022 |
rillig | make: add debug logging for capturing the output of external commands
This applies to all 4 situations in which the output of an external command is used for modifying a variable or an expression:
* the assignment operator '!=' * the assignment modifier '::!=' * the SUN shell modifier ':sh' * the other shell modifier ':!cmd!'
Previously, only the shell modifier ':!cmd!' had debug logging.
Suggested by Christoph Badura.
|
1.568 |
| 09-Jan-2022 |
rillig | make: in Cmd_Exec, return error message instead of format string
This change leaves only literal format strings in parse.c. It allows for more detailed error messages than the current "non-zero status" or "exited on a signal".
No functional change.
|
1.567 |
| 07-Jan-2022 |
rillig | make: have as few statements as possible between va_start and va_end
No functional change.
|
1.566 |
| 07-Jan-2022 |
rillig | make: clean up comments, variable names, function names
The comment in ApplyDependencySourceOther repeated the code, its second half didn't match any current code.
The comment above ParseDependencySourcesEmpty repeated the code.
No binary change, except for assertion line numbers.
|
1.565 |
| 01-Jan-2022 |
rillig | make: fix error message when reading more than 1 GB from stdin
Previously, the error message was: make: (null): file too large Now it is: make: (stdin): file too large
|
1.564 |
| 01-Jan-2022 |
rillig | make: reduce indentation in Main_SetObjdir
No functional change.
|
1.563 |
| 31-Dec-2021 |
rillig | make: unexport types VarAssignOp and VarAssign
These types are only needed in the parsing module.
No functional change.
|
1.562 |
| 28-Dec-2021 |
rillig | make: fix double-free in CLEANUP mode (since 2021.12.27.23.11.55)
When make is run without the '-f' option, it searches for the files 'makefile' and 'Makefile' in the current directory. The function ReadFirstDefaultMakefile allocated memory for these filenames, added the filenames to opts.makefiles and then freed the memory. From that moment, opts.makefiles contained dangling pointers.
The function main_CleanUp cleans the list, but only if make is compiled with -DCLEANUP. Since main.c 1.557 from 2021.12.27.23.11.55, the strings in opts.makefiles are freed as well, before that, only the list nodes were freed. Freeing the strings led to the double-free.
Fix this bug by using a separate list for these short-lived strings. At the point where ReadFirstDefaultMakefile is called, opts.makefiles is not used anymore, therefore there are no side effects.
To reproduce, run 'make test-coverage', which compiles with -DCLEANUP. The test opt-chdir failed with a segmentation fault in main_Cleanup. This test may be the only one that doesn't use the option '-f'.
|
1.561 |
| 28-Dec-2021 |
rillig | make: clean up stylistically
No binary change.
|
1.560 |
| 28-Dec-2021 |
rillig | make: constify cached_realpath
No binary change.
|
1.559 |
| 27-Dec-2021 |
rillig | make: clean up Cmd_Exec
Renaming savederr to saved_errno makes the comment redundant.
Group the conditions for setting errfmt, retaining their relative order.
No functional change.
|
1.558 |
| 27-Dec-2021 |
rillig | make: reduce indentation of Cmd_Exec
No functional change.
|
1.557 |
| 27-Dec-2021 |
rillig | make: free the names of the makefiles in cleanup mode
Since parse.c 1.576 from 2021-12-13 the filenames from opts.makefiles no longer end up in the GNodes, they are copied by Str_Intern.
|
1.556 |
| 27-Dec-2021 |
rillig | make: merge local variables holding the path to the object directory
This is a similar pattern as in the other situations where a string is fed through Var_Subst. In this case though, the unexpanded string may need to be freed, therefore the FStr_Done that is not needed in the other places.
No functional change.
|
1.555 |
| 27-Dec-2021 |
rillig | make: prevent out-of-bounds read for debug log file name
Even though the name of the debug log file currently only occurs in strings of the form '-dFname' or '-dF+name', the code for replacing '%d' with the PID accesses the passed string out of bounds. That's not a problem in practice but looks suspicious anyway.
|
1.554 |
| 27-Dec-2021 |
rillig | make: remove usage message if the debug file cannot be opened
Since a non-writable file is not a syntax error, there is no point in showing the usage in this situation. Showing the usage may have been a copy-and-paste mistake from a few lines below, when this option was added back in main.c 1.133 from 2006-10-15.
|
1.553 |
| 27-Dec-2021 |
rillig | make: narrow down the return type of ReadMakefile
No functional change.
|
1.552 |
| 27-Dec-2021 |
rillig | make: rename local variables to be simpler
No binary change.
|
1.551 |
| 27-Dec-2021 |
rillig | make: clean up 'explode'
Breaking out of the first 'for' loop was unnecessarily complicated. The call to strlen was not necessary since f already pointed at the end of the string.
No functional change.
|
1.550 |
| 27-Dec-2021 |
rillig | make: clean up comments
|
1.549 |
| 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.548 |
| 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.547 |
| 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.546 |
| 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.545 |
| 15-Dec-2021 |
rillig | make: remove bmake_free
It was only used in 2 places, and in both these places, the pointer was never null.
|
1.544 |
| 15-Dec-2021 |
rillig | make: in CLEANUP mode, free interned strings at the very end
Noticed by sjg.
|
1.543 |
| 13-Dec-2021 |
rillig | make: convert debugging flags from enum to bit-field
This gets rid of the magic numbers, making it possible to add another debug flag without renumbering the others.
No functional change.
|
1.542 |
| 13-Dec-2021 |
rillig | make: fix memory leak for filenames in .for loops (since 2013-06-18)
Previously, each time a .for directive pushed its buffer on the input file stack, the current filename was duplicated. This was a waste of memory.
The name of a file is typically only used while it is read in. There is one situation when the filename is needed for longer, which is when a target is defined.
Since .for loops are implemented as a special form of included files, each .for loop duplicated the current filename as well.
$ cat << EOF > for.mk .for i in 1 2 3 4 5 6 7 8 9 0 .for i in 1 2 3 4 5 6 7 8 9 0 .for i in 1 2 3 4 5 6 7 8 9 0 .for i in 1 2 3 4 5 6 7 8 9 0 .for i in 1 2 3 4 5 6 7 8 9 0 .for i in 1 2 3 4 5 6 7 8 9 0 .for i in 1 2 3 4 5 6 7 8 9 0 .endfor .endfor .endfor .endfor .endfor .endfor .endfor
all: @ps -o rsz -p ${.MAKE.PID} EOF
$ make-2021.12.13.03.55.16 -r -f for.mk RSZ 10720
$ ./make -r -f for.mk RSZ 1716
The difference is 8 MB, which amounts to 1 million .for loops.
|
1.541 |
| 14-Aug-2021 |
rillig | make: rename variable and function for handling parse errors
The word 'fatals' was an unnecessary abbreviation.
No functional change.
|
1.540 |
| 18-Jun-2021 |
rillig | make: clean up access to character iterator
Having both p[0] and *p intermixed was inconsistent.
No functional change.
|
1.539 |
| 19-Apr-2021 |
rillig | make: avoid double slash in name of temporary directory
If the environment variable TMPDIR is not set, make uses a default path that includes a trailing '/'.
For extra correctness it always appended an extra '/', leading to paths of the form '/tmp//makeXXXXXX'. This looked suspicious, as if there had been a forgotten empty part between the two '/'. Avoid this ambiguity by replacing '//' with '/'.
|
1.538 |
| 14-Apr-2021 |
rillig | make: turn run-time string concatenation into compile-time
No functional change.
|
1.537 |
| 14-Apr-2021 |
rillig | make: remove unnecessary modifier ':U' for certain fixed expressions
No functional change, since the expression is evaluated using VARE_WANTRES, not using VARE_UNDEFERR.
|
1.536 |
| 04-Apr-2021 |
rillig | make: remove filler word 'Do' from function names for parsing
No functional change, except for debug logging.
|
1.535 |
| 04-Apr-2021 |
rillig | make: rename a few functions to be more descriptive
No functional change.
|
1.534 |
| 03-Apr-2021 |
rillig | make: use C99 bool type instead of defining its own
No functional change.
|
1.533 |
| 05-Feb-2021 |
sjg | Avoid strdup in mkTempFile
Require caller to pass a buffer and size if they want the tempfile not unlinked.
Add Job_TempFile to handle blocking signals around call to mkTempFile, so that meta_open_filemon can use it in jobs mode.
|
1.532 |
| 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.531 |
| 05-Feb-2021 |
rillig | make: add shortcut Global_Delete for deleting a global variable
|
1.530 |
| 04-Feb-2021 |
rillig | make: rename some VAR constants to SCOPE
The word "context" does not fit perfectly to the variables that are associate with a GNode, as the context is usually something from the outside and the variables are more like properties inherent to the GNode.
The term "global context" fits even less. Since the thing where variables are looked up is commonly named a scope, use that term instead.
This commit only renames the global variables VAR_GLOBAL, VAR_INTERNAL and VAR_CMDLINE, plus a few very closely related comments. These are:
GNode.vars (because of line breaks) GNode_Free (dito) varname-make_print_var_on_error.mk varname-make_print_var_on_error-jobs.mk
The debug message in Var_Stats is left as-is since there is no unit test for it yet.
The other renamings (variable names "context", "ctxt", as well as further comments) will be done in a follow-up commit.
|
1.529 |
| 03-Feb-2021 |
rillig | make: replace Global_AppendExpand with Global_Append
All callers with a variable name that is guaranteed to not contain a dollar sign have been converted to call Global_Append instead of the previous Global_AppendExpand. After that, Global_AppendExpand was unused, therefore it was effectively just renamed.
|
1.528 |
| 03-Feb-2021 |
rillig | make: replace Global_SetExpand with Global_Set for constant names
|
1.527 |
| 03-Feb-2021 |
rillig | make: use shortcut functions Global_SetExpand and Global_AppendExpand
There are many places where global variables are set or appended to. To reduce clutter and code size, encode the VAR_GLOBAL in the function name.
The word Expand in the function names says that the variable name is expanded. In most of the cases, this is not necessary, but there are no corresponding functions Global_Set or Global_Append yet.
Encoding the information whether the name is expanded or not in the function name will make inconsistencies obvious in future manual code reviews. Letting the compiler check this by using different types for unexpanded and expanded variable names is probably not worth the effort. There are still a few bugs to be fixed, such as in SetVar, which expands the variable name twice in a row.
|
1.526 |
| 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.525 |
| 01-Feb-2021 |
rillig | make: clean up main.c
|
1.524 |
| 01-Feb-2021 |
rillig | make: simplify MakeMode
|
1.523 |
| 01-Feb-2021 |
rillig | make: replace pre-increment with post-increment or simple addition
The rest of the code already prefers post-increment if there is no actual difference.
|
1.522 |
| 01-Feb-2021 |
rillig | make: rename functions for parsing command line arguments
The function names now match the names around them.
|
1.521 |
| 01-Feb-2021 |
rillig | make: clean up comments
|
1.520 |
| 30-Jan-2021 |
rillig | make(1): inline Buf_Len
|
1.519 |
| 30-Jan-2021 |
rillig | make(1): inline Buf_GetAll
|
1.518 |
| 30-Jan-2021 |
rillig | make(1): split Buf_Destroy into Buf_Done and Buf_DoneData
In all cases except one, the boolean argument to Buf_Destroy was constant. Removing that argument by splitting the function into two separate functions makes the intention clearer on the call site. It also removes the possibility for using the return value of Buf_Done, which would have made no sense.
The function Buf_Done now pairs with Buf_Init, just as in HashTable and Lst.
Even though Buf_Done is essentially a no-op, it is kept as a function, both for symmetry with Buf_Init and for clearing the Buffer members after use (this will be done only in CLEANUP mode, in a follow-up commit).
|
1.517 |
| 24-Jan-2021 |
rillig | make(1): convert SearchPath to struct
This prepares for making dotLast a simple struct member instead of a fake CachedDir, which is easier to understand.
|
1.516 |
| 23-Jan-2021 |
rillig | make(1): rename Dir_AddDir, reorder parameters of SearchPath_ToFlags
|
1.515 |
| 23-Jan-2021 |
rillig | make(1): rename Dir_Expand to SearchPath_Expand
The main subject of this function is the search path. In this search path the pattern is expanded.
|
1.514 |
| 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.513 |
| 16-Jan-2021 |
rillig | make(1): fix a few inconsistencies for lint's strict bool mode
|
1.512 |
| 10-Jan-2021 |
rillig | make(1): make a few more bool expressions more precise
The previous version of lint(1) from a few hours ago didn't catch all occurrences. And even the current one doesn't catch everything. Function arguments and return types still need some work. The "return quietly" from shouldDieQuietly still implicitly converts from int to _Bool.
No functional change.
|
1.511 |
| 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.510 |
| 09-Jan-2021 |
rillig | make(1): fix lint warnings
|
1.509 |
| 08-Jan-2021 |
sjg | Ensure PrintOnError always reports 'stopped in' on first call.
We may still suppress the rest of the noise if shouldDieQuietly says to, but the 'stopped in' output is too important to lose. Avoid repeating it though in the same process.
For the case of aborting due to failure detected elsewhere, exit 6 so we have a clue.
PR: 55578 Reviewed by:
|
1.508 |
| 31-Dec-2020 |
rillig | make(1): replace pointers in controlling conditions with booleans
|
1.507 |
| 30-Dec-2020 |
rillig | make(1): format multi-line comments
|
1.506 |
| 28-Dec-2020 |
rillig | make(1): replace global preserveUndefined with VARE_KEEP_UNDEF
Controlling the expansion of variable expressions using a global variable and a VARE flag was inconsistent.
Converting the global variable into a flag had to prerequisites:
1. The unintended duplicate variable assignment had to be fixed, as done in parse.c 1.520 from 2020-12-27. Without this fix, it would have been necessary to add more flags to Var_Exists and Var_SetWithFlags, and this would have become too complex.
2. There had to be a unit test demonstrating that VARE_KEEP_DOLLAR only applies to the top-level expression and is not passed to the subexpressions, while VARE_KEEP_UNDEF applies to all subexpressions as well. This test is in var-op-expand.mk 1.10 from 2020-12-28, at least for the ':@word@' modifier. In ParseModifierPartSubst, VARE_KEEP_UNDEF is not passed down either, in the same way.
|
1.505 |
| 27-Dec-2020 |
rillig | make(1): exit 2 on technical errors
This allows the -q option to distinguish errors from out-of-date targets. Granted, it's an edge case but it should be solved consistently anyway.
The majority of cases in which make exits with exit status 1, even in -q mode, is when there are parse errors. These have been kept as-is for now as they affect many of the unit tests.
The technical errors, on the other hand, occur so rarely that it's hard to write reliable tests for them that fail consistently on all platforms supported by make.
|
1.504 |
| 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.503 |
| 26-Dec-2020 |
sjg | Use .MAKE.DEPENDFILE as makefiles set it
|
1.502 |
| 23-Dec-2020 |
rillig | make(1): fix a few lint warnings
|
1.501 |
| 23-Dec-2020 |
rillig | make(1): rename CmdOpts.lint to strict
When running lint(1) on the code, it defines the preprocessor macro "lint" to 1, which generated a syntax error in the declaration "Boolean lint", as that became "Boolean 1".
|
1.500 |
| 20-Dec-2020 |
rillig | make(1): remove constant parameter from MakeMode
|
1.499 |
| 20-Dec-2020 |
rillig | make(1): change return type of Var_Value to FStr
|
1.498 |
| 13-Dec-2020 |
rillig | make(1): add str_basename to reduce duplicate code
The function basename from POSIX has a few unfortunate properties, it is allowed to return a pointer to static memory. This is too unreliable, therefore this trivial own implementation.
|
1.497 |
| 13-Dec-2020 |
rillig | make(1): constify progname
|
1.496 |
| 13-Dec-2020 |
rillig | make(1): replace *line with line[0]
Since a line is not an iterator and since the expression *line typically means "the current element", not "the first character", replacing *line with line[0] more directly expresses the idea of accessing the first character of a string.
|
1.495 |
| 12-Dec-2020 |
rillig | make(1): rename Var_ExportVars to Var_ReexportVars
|
1.494 |
| 11-Dec-2020 |
rillig | make(1): clean up comments for command line options
|
1.493 |
| 11-Dec-2020 |
rillig | make(1): remove DEFMAXLOCAL and DEFMAXJOBS
These have been hard-wired all the time. The word LOCAL doesn't make sense anymore since the code for running jobs remotely has gone.
|
1.492 |
| 05-Dec-2020 |
rillig | make(1): define constants for enum zero-values
|
1.491 |
| 01-Dec-2020 |
rillig | make(1): remove Dir_InitDir
The function name had been too ambiguous since it didn't mention the particular directory that was initialized. Instead of that function, Dir_InitCur is called directly from main_Init.
The pseudo CachedDir entry ".DOTLAST" is initialized at the very beginning. The observable behavior is unchanged since this a memory-only object with no connection to the file system.
|
1.490 |
| 29-Nov-2020 |
rillig | make(1): reduce memory allocation for dirSearchPath
|
1.489 |
| 29-Nov-2020 |
rillig | make(1): fix main_CleanUp in -DCLEANUP mode (broken since 1 hour)
Broken since main.c 1.486 from 2020-11-28, about 1 hour ago.
|
1.488 |
| 29-Nov-2020 |
rillig | make(1): reduce memory allocation for targets
This change moves the initialization and finalization of the list of targets to the same function. They had been split before.
|
1.487 |
| 28-Nov-2020 |
rillig | make(1): reduce memory allocation in ReadBuiltinRules
|
1.486 |
| 28-Nov-2020 |
rillig | make(1): reduce memory allocation for CmdOpts.create
|
1.485 |
| 28-Nov-2020 |
rillig | make(1): reduce memory allocation in CmdOpts.variables
|
1.484 |
| 28-Nov-2020 |
rillig | make(1): reduce memory allocation in CmdOpts.makefiles
|
1.483 |
| 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.482 |
| 28-Nov-2020 |
rillig | make(1): rename local variable in Cmd_Exec
It conflicts with the global fds in job.c.
|
1.481 |
| 28-Nov-2020 |
rillig | make(1): rename conflicting global variables called 'error'
When compiling make in all-in-one mode, these variable names conflict. They could have been merged into a single variable, but that would have required to make it a global variable for the other modules as well. The parse module has a similar variable called 'fatals'. All these can possibly be merged into a single variable, but not now.
|
1.480 |
| 25-Nov-2020 |
sjg | Add .MAKE.UID and .MAKE.GID
|
1.479 |
| 24-Nov-2020 |
rillig | make(1): fix indentation for short expressions in main.c
|
1.478 |
| 23-Nov-2020 |
rillig | make(1): use comparisons in boolean expressions
The generated code stays exactly the same.
|
1.477 |
| 23-Nov-2020 |
rillig | make(1): use properly typed comparisons in boolean contexts
|
1.476 |
| 16-Nov-2020 |
rillig | make(1): fix initialization order of modules (broken since today)
In CLEANUP mode, Var_Init depends on Targ_Init since the variable scopes are implemented as GNodes.
By the way, since 1999-09-15 variables are no longer stored in lists but in hash tables.
|
1.475 |
| 16-Nov-2020 |
rillig | make(1): use postfix increment where possible
|
1.474 |
| 15-Nov-2020 |
rillig | make(1): clean up ParseBoolean
|
1.473 |
| 15-Nov-2020 |
rillig | make(1): clean up getTmpdir
Reduce indentation, structure code into paragraphs.
|
1.472 |
| 15-Nov-2020 |
rillig | make(1): clean up PrintOnError
No functional change.
|
1.471 |
| 15-Nov-2020 |
rillig | make(1): fix previous commit for parse_debug_options
|
1.470 |
| 15-Nov-2020 |
rillig | make(1): reduce code size of parse_debug_options
Each access to a global variable requires a relocation. Skip these.
|
1.469 |
| 14-Nov-2020 |
rillig | make(1): switch cache for realpath from GNode to HashTable
An unintended side effect from the GNode implementation was that the variable modifier :tA and the other places where cached_realpath are used could be affected by setting a variable in the global scope, thereby "redirecting" absolute paths to completely unrelated but existing paths.
Another unintended side effect was that filenames containing a dollar sign would not be resolved correctly since the dollar sign would be expanded as a variable expression by Var_Set.
While here, the debugging output for the realpath cache has been adjusted to the standard behavior. Previously, when a new entry was added to the cache, this was logged for the module VAR, as a side effect of calling Var_Set, but only if the preprocessor macro DEBUG_REALPATH_CACHE was defined at compilation time. When relative paths were purged from the cache because the current directory changed and logging for the DIR module was active, the log output went directly to stderr instead of the usual opts.debug_file. This deviation from the standard behavior was probably not intended as well.
All logging concerning the realpath cache now goes into the standard debug log file and is controlled by the -dd option, not -dv.
|
1.468 |
| 14-Nov-2020 |
rillig | make(1): document the -S option
This option has been available at least since 1993-03-21, and for the same time it has been undocumented.
|
1.467 |
| 14-Nov-2020 |
rillig | make(1): fix trailing whitespace in usage (since 2009-08-27)
|
1.466 |
| 14-Nov-2020 |
rillig | make(1): don't modify progname in usage
|
1.465 |
| 14-Nov-2020 |
rillig | make(1): clean up Fatal
Use the shortest possible scope between va_start and the corresponding va_end.
|
1.464 |
| 14-Nov-2020 |
rillig | make(1): clean up InitDefSysIncPath
Flipping the arguments to strncmp puts the subject first in the sentence. Inverting the condition makes the code flow easier to follow.
|
1.463 |
| 14-Nov-2020 |
rillig | make(1): use progname instead of hard-coded 'make' in warning
This only affects the warning that chdir to objdir failed. In sub-makes the progname includes the [n], allowing to narrow down the actual cause of the problem.
|
1.462 |
| 14-Nov-2020 |
rillig | make(1): remove redundant parameter from str2Lst_Append
|
1.461 |
| 14-Nov-2020 |
rillig | make(1): rename Main_SetVarObjdir to SetVarObjdir
Only exported functions should be prefixed with the module name.
|
1.460 |
| 14-Nov-2020 |
rillig | make(1): use different style of accessing characters in MainParseArgs
The * is preferred for iterators. Since argv[i] is not an iterator but a fixed string, argv[i][0] expresses the idea "read the first character" more directly.
|
1.459 |
| 14-Nov-2020 |
rillig | make(1): rename DEFAULT to defaultNode
In C, uppercase names are typically used for constants, and this is not a constant.
|
1.458 |
| 13-Nov-2020 |
rillig | make(1): clean up preprocessor macros in InitVarMachine
|
1.457 |
| 13-Nov-2020 |
rillig | make(1): flatten #ifdef in InitVarMachineArch
Without proper indentation, that chain of nested #ifndef directives was really hard to read.
|
1.456 |
| 12-Nov-2020 |
sjg | Pass a writable flag to Main_SetObjdir to control writable check
For curdir and an explicit .OBJDIR target, we allow for the directory to be read-only. During InitObjdir we otherwise default to requiring objdir to be writable - this can be controlled by env variable MAKE_OBJDIR_CHECK_WRITABLE
Add unit-tests/objdir-writable
Reviewed by: christos rillig
|
1.455 |
| 08-Nov-2020 |
rillig | make(1): move lint option away from the debug flags
The lint option affects much more than a typical debug flag. Not only does it produce additional diagnostics, it also changes the control flow and fixes the traditional error handling in a few places.
No functional change.
|
1.454 |
| 08-Nov-2020 |
rillig | make(1): use strict typing in conditions of the form !var
|
1.453 |
| 08-Nov-2020 |
rillig | make(1): reformat main.c more closely to share/misc/style
|
1.452 |
| 08-Nov-2020 |
rillig | make(1): remove redundant comment from main_ReadFiles
The code has become so simple that it made the comment redundant.
|
1.451 |
| 08-Nov-2020 |
rillig | make(1): rename init_machine to InitVarMachine
For consistency with the other Init functions.
|
1.450 |
| 08-Nov-2020 |
rillig | make(1): move usage further to the top
This avoids a forward declaration.
|
1.449 |
| 08-Nov-2020 |
rillig | make(1): move documentation from main to the phase functions
|
1.448 |
| 08-Nov-2020 |
rillig | make(1): split main into manageable pieces
The purpose of a main function is to give a high-level overview about the whole program. 270 lines of code with lots of tricky details did not serve this purpose. Split the code into functions corresponding to the phases.
|
1.447 |
| 08-Nov-2020 |
rillig | make(1): indent main consistently
|
1.446 |
| 08-Nov-2020 |
rillig | make(1): inline ReadMakefileSucceeded into ReadFirstDefaultMakefile
This gets rid of a few void pointers and an unused function parameter.
|
1.445 |
| 08-Nov-2020 |
rillig | make(1): inline Lst_ForEachUntil in ReadBuiltinRules
The list of expanded filenames for sys.mk is freed in the end, but not the filenames themselves, as these are still needed.
|
1.444 |
| 08-Nov-2020 |
rillig | make(1): use common indentation style for else
|
1.443 |
| 08-Nov-2020 |
rillig | make(1): split ReadMakefiles into separate functions
This keeps the indentation of the code small.
It also reduces the possible confusion about the two similar branches in that function that differ in a small but important detail: ReadAllMakefiles reads all the makefiles while ReadFirstDefaultMakefile stops after the first existing makefile.
|
1.442 |
| 08-Nov-2020 |
rillig | make(1): fix unrealistic memory leak in Main_ParseArgLine
It's unlikely that anyone ever defines an environment variable named ".MAKE" and then runs make with the -e option, which would make the environment variable stronger than the built-in global variable.
|
1.441 |
| 08-Nov-2020 |
rillig | make(1): add remarks for missing command line options in MAKEFLAGS
|
1.440 |
| 08-Nov-2020 |
rillig | make(1): parse the internal option -J strictly
|
1.439 |
| 08-Nov-2020 |
rillig | make(1): merge duplicate code in is_relpath
|
1.438 |
| 08-Nov-2020 |
rillig | make(1): clean up overview comment in main.c
|
1.437 |
| 08-Nov-2020 |
rillig | make(1): fix type mismatch between int and PrintVarsMode
|
1.436 |
| 07-Nov-2020 |
rillig | make(1): remove trailing whitespace
|
1.435 |
| 07-Nov-2020 |
rillig | make(1): make API of Buf_Init simpler
In most cases, the caller doesn't want to specify the exact number of preallocated bytes.
|
1.434 |
| 07-Nov-2020 |
rillig | make(1): document InitDefSysIncPath
|
1.433 |
| 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.432 |
| 06-Nov-2020 |
rillig | make(1): rename getBoolean and s2Boolean
|
1.431 |
| 06-Nov-2020 |
rillig | make(1): fix comment of Error
|
1.430 |
| 06-Nov-2020 |
rillig | make(1): clean up Cmd_Exec stylistically
|
1.429 |
| 06-Nov-2020 |
rillig | make(1): rename dieQuietly to shouldDieQuietly
It was too confusing to have a function named die that doesn't actually die. Plus, the return type int didn't give any clue about what the function actually returns.
|
1.428 |
| 06-Nov-2020 |
rillig | make(1): fix typo from previous commit
|
1.427 |
| 06-Nov-2020 |
rillig | make(1): fix wrong condition in mkTempFile (since 2020-10-31)
The wrong negation had been added in main.c 1.414 from 2020-10-31. Found by GCC 10, which complained about a potential null pointer dereference in line 2188.
|
1.426 |
| 05-Nov-2020 |
rillig | make(1): remove redundant parentheses from sizeof operator
The parentheses are only needed if the argument is a type, not an expression.
|
1.425 |
| 04-Nov-2020 |
rillig | make(1): move declaration of parseIncPath from main.c to make.h
|
1.424 |
| 04-Nov-2020 |
rillig | make(1): rename MAKEFILE_PREFERENCE for consistency
The names of the other special variables are all prefixed with MAKE_.
|
1.423 |
| 04-Nov-2020 |
rillig | make(1): negate discardUndefined to preserveUndefined
|
1.422 |
| 04-Nov-2020 |
rillig | make(1): rename oldVars to discardUndefined
While here, moved all the documentation about this variable into a single place.
|
1.421 |
| 01-Nov-2020 |
rillig | make(1): in lint mode, exit with error status on errors
Calling Parse_Error during parsing has always led to a nonzero exit status. Calling Parse_Error later, when expanding the shell commands, has had no effect on the exit status. Neither had calling Error.
To make make a reliable tool, it has to report errors as they occur. Enable this strict behavior in lint mode for now. Lint mode has to be enabled explicitly, preserving the default behavior.
|
1.420 |
| 31-Oct-2020 |
sjg | Main_SetObjdir is first called for curdir which may be readonly
Skip access check if path is curdir. This ensures that all proper initialization is done at least once.
If path is not curdir it should be writable to be useful.
Reviewed by: rillig
|
1.419 |
| 31-Oct-2020 |
rillig | make(1): revert requiring a writable objdir
The change in main.c 1.413 broke the NetBSD build.sh if it uses a read-only source tree, as in the daily builds.
Original commit: https://mail-index.netbsd.org/source-changes/2020/10/31/msg123560.html
Build log: make warning: /home/source/ab/HEAD/src: Permission denied. [1] Segmentation fault "${make}" -m ${T...
|
1.418 |
| 31-Oct-2020 |
rillig | make(1): reduce the scope where recursive expressions are detected
Only the call to Var_Subst needs to be protected since the other functions have nothing to do with expanding variables.
|
1.417 |
| 31-Oct-2020 |
rillig | make(1): remove redundant :tl from getBoolean
Uppercase and lowercase letters are already handled the same by s2Boolean, which makes the :tl modifier redundant.
|
1.416 |
| 31-Oct-2020 |
rillig | make(1): remove redundant null check from s2Boolean
|
1.415 |
| 31-Oct-2020 |
rillig | make(1): write s2Boolean in a more compact form
|
1.414 |
| 31-Oct-2020 |
rillig | make(1): clean up mkTempFile
|
1.413 |
| 31-Oct-2020 |
sjg | Do not use an objdir that is not writable.
|
1.412 |
| 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.411 |
| 30-Oct-2020 |
rillig | make(1): fix indentation in source code
|
1.410 |
| 30-Oct-2020 |
rillig | make(1): rename VAR_CMD to VAR_CMDLINE
Since make has to do with both the command line and child commands, the former name was confusing.
|
1.409 |
| 28-Oct-2020 |
rillig | make(1): rename defIncPath to defSysIncPath
There are two variables, parseIncPath and sysIncPath, which made the name defIncPath ambiguous.
|
1.408 |
| 27-Oct-2020 |
rillig | make(1): extract InitMaxJobs from main
|
1.407 |
| 27-Oct-2020 |
rillig | make(1): extract InitObjdir from main
|
1.406 |
| 27-Oct-2020 |
rillig | make(1): make InitVarMake simpler and document its intention
|
1.405 |
| 27-Oct-2020 |
rillig | make(1): extract InitVarMake from main
|
1.404 |
| 27-Oct-2020 |
rillig | make(1): extract InitRandom from main
|
1.403 |
| 27-Oct-2020 |
rillig | make(1): extract ReadMakefiles from main
|
1.402 |
| 27-Oct-2020 |
rillig | make(1): extract CleanUp from main
This makes it a bit easier to spot the main task of the main function, which is the runTargets call.
|
1.401 |
| 27-Oct-2020 |
rillig | make(1): free the variable names given on the command line
These are not aliased anywhere. The opts.makefiles on the other hand may be referenced in GNode.fname or pretty much anywhere else, so don't free them. There's still a Targ_PrintGraph call below it that might use them.
|
1.400 |
| 27-Oct-2020 |
rillig | make(1): extract InitVpath from main
|
1.399 |
| 27-Oct-2020 |
rillig | make(1): use constant string for Var_Subst
The times where Var_Subst needed a modifiable string are long gone.
|
1.398 |
| 27-Oct-2020 |
rillig | make(1): extract ReadBuiltinRules from main
|
1.397 |
| 27-Oct-2020 |
rillig | make(1): extract InitDefIncPath from main
|
1.396 |
| 27-Oct-2020 |
rillig | make(1): initialize all CmdOpts fiels
|
1.395 |
| 27-Oct-2020 |
rillig | make(1): extract CmdOpts_Init from main
|
1.394 |
| 27-Oct-2020 |
rillig | make(1): move debugVflag to CmdOpts
|
1.393 |
| 27-Oct-2020 |
rillig | make(1): extract UnlimitFiles from main
|
1.392 |
| 26-Oct-2020 |
rillig | make(1): remove "Results: none" from the documentation of void functions
|
1.391 |
| 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.390 |
| 25-Oct-2020 |
rillig | make(1): rename hash functions to identify the type name
This makes it easier to spot mismatches between the function name and its first parameter, although the compiler should already catch most of them. Except for void pointers.
|
1.389 |
| 25-Oct-2020 |
sjg | Skip reading .MAKE.DEPENDFILE if set to "/dev/null" or anything starting with "no".
Ref: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223564
|
1.388 |
| 24-Oct-2020 |
rillig | make(1): convert macros for debug flags into enum
|
1.387 |
| 24-Oct-2020 |
rillig | make(1): remove unused Lst_Find and Lst_FindFrom
|
1.386 |
| 24-Oct-2020 |
rillig | make(1): inline ReadMakefileFailed, eliminating some void pointers
|
1.385 |
| 23-Oct-2020 |
rillig | make(1): remove void pointers from addErrorCMD
|
1.384 |
| 22-Oct-2020 |
rillig | make(1): clean up PrintVar
Conceptually, the last parameters of Var_Subst and Var_Value differ a lot. The former is the actual variable value while the latter is just a pointer to be freed. It will be changed to a void pointer in a few commits.
To keep the number of needed variables small and the code simple, the printf statement is mentioned in each branch. An additional benefit is that in 2 of the 3 branches, no null pointer can occur.
|
1.383 |
| 22-Oct-2020 |
rillig | make(1): extract PrintVar from doPrintVars
|
1.382 |
| 22-Oct-2020 |
rillig | make(1): clean up HandlePWD
|
1.381 |
| 22-Oct-2020 |
rillig | make(1): extract HandlePWD from main
|
1.380 |
| 22-Oct-2020 |
rillig | make(1): remove redundant type casts
This mainly affects the void pointers in callback functions for lists. These had been necessary once when the parameter type was still ClientData instead of void pointer.
|
1.379 |
| 19-Oct-2020 |
rillig | make(1): inline simple Lst getters
The function call variant takes more screen space than the direct field access. Having an abstract API is usually a good idea, in this case of simple read-only member access it makes the code more difficult to read.
LstNode_Set has been kept as a function since it is not a read-only accessor function.
|
1.378 |
| 18-Oct-2020 |
rillig | make(1): rename Lst_Init to Lst_New
For the other types such as HashTable and Buffer, the Init function does not allocate the memory for the structure itself, it only fills it.
|
1.377 |
| 18-Oct-2020 |
rillig | make(1): rename HashEntry.name to key
|
1.376 |
| 18-Oct-2020 |
rillig | make(1): remove underscore from Hash_Table and Hash_Entry
For consistency with the other type names, such as GNodeListNode.
|
1.375 |
| 18-Oct-2020 |
rillig | make(1): prepare for WARNS=6
The FD_* macros from sys/sys/fd_set.h use signed integers on NetBSD 8 and thus produce conversion errors. On NetBSD 9, these macros are fixed to use 1U instead of 1.
|
1.374 |
| 18-Oct-2020 |
rillig | make(1): make API for iterating over hash tables simpler
|
1.373 |
| 18-Oct-2020 |
rillig | make(1): remove USE_IOVEC
When a system call in a child process failed, there was no guarantee that the error message would be written completely. Using writev correctly is harder than building the string in a buffer and then writing it in the traditional way.
According to POSIX 2004, using memory allocation or even calling write(2) from the child process invokes undefined behavior. The remaining code from make has done all this for several years now, successfully, therefore adding one more of that won't hurt.
Make still tries to write the error message atomically by passing the whole buffer at once to write(2), just as in the previous writev(2) implementation.
|
1.372 |
| 18-Oct-2020 |
rillig | make(1): replace execError with execDie
All calls to this function were followed by _exit(1).
|
1.371 |
| 05-Oct-2020 |
rillig | make(1): remove pathname limit for Dir_FindHereOrAbove
While trying to compile the code with GCC's -Wformat-truncation, the snprintf calls felt quite complicated. The function Dir_FindHereOrAbove is not in a bottleneck execution path, therefore it doesn't hurt to dynamically allocate the memory instead of using size-limited stack memory.
|
1.370 |
| 05-Oct-2020 |
rillig | make(1): prepare job.c, main.c, parse.c, suff.c for WARNS=6
In job.c, GCC 5 complains about the macro FILENO that it has type unsigned int, which is then passed as the argument of dup2, which expects a simple int. Maybe this workaround from 1995 is not necessary anymore, or maybe it is but can be restricted to the few affected platforms.
This leaves meta.c and the filemon files to be converted. I didn't do them since they are not well covered by the unit tests.
|
1.369 |
| 05-Oct-2020 |
rillig | make(1): revert previous commit
It had accidentally reverted all the work from the past few days.
|
1.368 |
| 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.367 |
| 05-Oct-2020 |
rillig | make(1): extract init_machine and init_machine_arch from main
|
1.366 |
| 04-Oct-2020 |
rillig | make(1): remove duplicate code for parsing a variable name
|
1.365 |
| 04-Oct-2020 |
rillig | make(1): make documentation of Error more precise
|
1.364 |
| 03-Oct-2020 |
rillig | make(1): clean up #include sections
|
1.363 |
| 03-Oct-2020 |
rillig | make(1): replace backslash-newline with ordinary string literals
The character sequence backslash-newline is not mentioned in ISO C99.
|
1.362 |
| 03-Oct-2020 |
rillig | make(1): allow to disable debug logging options
This is only intended for the unit tests, to selectively enable and disable debug logging as needed. Previously the tests for debug logging required complicated postprocessing that was not obvious when looking at the test .mk file alone, but was specified externally in unit-tests/Makefile.
This is the simplest possible implementation. Another variant would have been to selectively disable individual debug logging options, but that would have made the code more complicated.
The -dL option is not affected by -d0 since that is not really a debug option, even if it is implemented as one.
|
1.361 |
| 01-Oct-2020 |
rillig | make(1): clean up documentation of Main_ParseArgLine
The previous documentation contained lots of irrelevant implementation details.
|
1.360 |
| 01-Oct-2020 |
rillig | make(1): add missing const for Parse_AddIncludeDir
|
1.359 |
| 01-Oct-2020 |
rillig | make(1): clean up option handling
The test for argvalue == NULL for the individual options was unnecessary since that is already done in the common part.
|
1.358 |
| 01-Oct-2020 |
rillig | make(1): format code in MainParseArgs
|
1.357 |
| 01-Oct-2020 |
rillig | make(1): extract handling of the -m option into separate function
|
1.356 |
| 01-Oct-2020 |
rillig | make(1): extract option handling for -j/-J into separate functions
|
1.355 |
| 01-Oct-2020 |
rillig | make(1): extract MainParseArgChdir into separate function
This removes the struct stat from MainParseArg.
|
1.354 |
| 01-Oct-2020 |
rillig | make(1): extract MainParseArg into separate function
That part of the code is long enough and independent enough to get its own function. Having a struct stat in MainParseArgs just didn't feel like a correct abstraction level.
|
1.353 |
| 01-Oct-2020 |
rillig | make(1): remove redundant function prototypes
|
1.352 |
| 28-Sep-2020 |
rillig | make(1): make debugging code shorter
|
1.351 |
| 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.350 |
| 27-Sep-2020 |
rillig | make(1): rename Buf_Size to Buf_Len
The new name better matches the field name Buffer.len as well as the variables around the calls to this function.
|
1.349 |
| 26-Sep-2020 |
rillig | make(1): revert migration from Lst_ForEachUntil to Lst_ForEach
There is a crucial difference between these functions, in that Lst_ForEachUntil can cope with a few concurrent modifications while iterating over the list. This is something that Lst_ForEach doesn't do.
This difference led to a crash very early in NetBSD's build.sh.
|
1.348 |
| 26-Sep-2020 |
rillig | make(1): inline and remove LstNode_Prev and LstNode_Next
These functions made the code larger than necessary. The prev and next fields are published intentionally since navigating in a doubly-linked list is simple to do and there is no need to wrap this in a layer of function calls, not even syntactically. (On the execution level, the function calls had been inlined anyway.)
|
1.347 |
| 26-Sep-2020 |
rillig | make(1): replace a few Lst_ForEachUntil with simpler Lst_ForEach
|
1.346 |
| 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.345 |
| 25-Sep-2020 |
rillig | make(1): fix undefined behavior for .MAKEFLAGS: -f file
Since at least 1993-03-21, adding other makefiles in a .MAKEFILES dependency has invoked undefined behavior because the command line arguments were copied directly into the global makefiles variable, without a proper strdup. Shortly after that, the word list created by Str_Words (formerly brk_string) was freed.
This applies to both the -f and the -v and -V options. Luckily it is an edge case to use these options in .MAKEFLAGS at all.
The -T option had already been fixed at 2000-12-30, but not the other options.
|
1.344 |
| 25-Sep-2020 |
rillig | make(1): extract parsing of the -dF option into separate function
|
1.343 |
| 25-Sep-2020 |
rillig | make(1): extract InitVarTarget from main
|
1.342 |
| 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.341 |
| 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.340 |
| 22-Sep-2020 |
rillig | make(1): fix unnecessary length limitation for -v option
|
1.339 |
| 22-Sep-2020 |
rillig | make(1): fix type of global variable 'create'
|
1.338 |
| 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.337 |
| 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.336 |
| 13-Sep-2020 |
rillig | make(1): remove #endif comments for very short blocks
|
1.335 |
| 13-Sep-2020 |
rillig | make(1): remove redundant VARARGS comments
These had been necessary at a time when the functions were declared with "unknown parameter types".
On 1994-03-05, conditional support for function prototypes was added, for those compilers that already supported this feature.
On 2002-06-15, the prototypes were made mandatory, and since then the VARARGS comments had been completely redundant, or worse, simply wrong (for ParseVErrorInternal).
|
1.334 |
| 13-Sep-2020 |
rillig | make(1): consense documentation for Fatal
|
1.333 |
| 12-Sep-2020 |
rillig | make(1): move PrintAddr to where it belongs
|
1.332 |
| 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.331 |
| 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.330 |
| 30-Aug-2020 |
rillig | make(1): rename Lst_Datum to LstNode_Datum
|
1.329 |
| 29-Aug-2020 |
rillig | make(1): trust that Var_Subst never returns NULL
It really never does, and it doesn't even report errors. It just returns the content of the buffer, up to the first parse error.
|
1.328 |
| 29-Aug-2020 |
rillig | make(1): make getBoolean simpler
This function is so seldom used that there is no point having complicated code for it.
|
1.327 |
| 29-Aug-2020 |
rillig | make(1): rename LstNode functions to match their type
|
1.326 |
| 29-Aug-2020 |
rillig | make(1): rename Lst_FindB back to Lst_Find
The migration from "comparison function" to "match function" is done, the "B" in the names is no longer needed.
|
1.325 |
| 29-Aug-2020 |
rillig | make(1): start replacing Lst_Find with Lst_FindB
Lst_Find is called with a "comparison" function that returns the integer 0 if the desired node is found. This leads to confusion since there are so many different return value conventions for int, such as 0/1 for mimicking false/true, -1/0 as in close(2), and the sign as in strcmp(3). This API is much easier to understand if the "comparison" function is not called a comparison function (since that is too close to strcmp), but a "match" function that just returns a boolean.
In Lst_FindFromB, the node argument may be null. This deviates from the other Lst functions, which require Lst and LstNode to generally be non-null. In this case it is useful though to make the calling code simpler.
In arch.c, this makes a lot of the previous documentation redundant.
In cond.c, the documentation is reduced a little bit since it had already been cleaned up before. It also removes the strange negation from CondFindStrMatch.
In dir.c, the documentation collapses as well.
In main.c, separating the ReadMakefile function from the callbacks for Lst_FindB allows the former to get back its natural function signature, with proper types and no unused parameters.
To catch any accidental mistakes during the migration from Lst_Find to Lst_FindB, the code can be compiled with -DUSE_DOUBLE_BOOLEAN, which will complain about incompatible function pointer types.
|
1.324 |
| 29-Aug-2020 |
rillig | make(1): fix null pointer dereference when sys.mk is not found
This is quite hard to trigger in a real-life scenario since it requires precise timing.
Instead, I created /tmp/sys.mk and ran "./make -m /tmp -f /dev/null" in the debugger, after setting a breakpoint in this line:
ln = Lst_Find(sysMkPath, ReadMakefile, NULL);
Once this line was reached, I removed /tmp/sys.mk to make ReadMakefile fail. Just adding a few parse errors won't help since ReadMakefile only fails if the file cannot be found.
|
1.323 |
| 29-Aug-2020 |
rillig | make(1): allow for strict type checking for Boolean
Having Boolean aliased to int creates ambiguities since int is widely used. Allow to occasionally compile make with -DUSE_DOUBLE_BOOLEAN to check that the type definitions still agree.
|
1.322 |
| 29-Aug-2020 |
rillig | make(1): clean up code in make.c
Var_Subst never returns NULL.
In Main_ExportMAKEFLAGS, don't compare ints with booleans.
In MainParseArgs, use char for the current character. First, that's more precise and correct, and second, it makes debugging easier for those who don't know the ASCII table by heart.
|
1.321 |
| 29-Aug-2020 |
rillig | make(1): rename confusing function ReadAllMakefiles
The old name implied that the function would read multiple files, which was not the case.
The comment above that function was highly confusing. It's not that the function returns a boolean, but rather 0 or non-zero, and 0 means that Lst_Find should stop searching.
One of the next refactorings will be to make Lst_Find return the first list node for which the function returns TRUE. This will reduce the confusion about the several functions called SomethingP in suff.c. The P suffix means to return TRUE or FALSE, not 0 or non-zero.
|
1.320 |
| 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.319 |
| 28-Aug-2020 |
rillig | make(1): migrate Lst_Find to Lst_FindS
|
1.318 |
| 28-Aug-2020 |
rillig | make(1): migrate Lst_First to Lst_FirstS
|
1.317 |
| 27-Aug-2020 |
rillig | make(1): migrate Lst_IsEmpty to Lst_IsEmptyS
|
1.316 |
| 27-Aug-2020 |
rillig | make(1): migrate Lst_Succ to Lst_SuccS
|
1.315 |
| 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.314 |
| 26-Aug-2020 |
rillig | make(1): add stricter variants for remaining Lst functions
In most cases the Lst functions are only called when the arguments are indeed valid. It's not guaranteed though, therefore each function call needs to be analyzed and converted individually.
While here, remove a few statements that were only useful when the Lst functions handled circular lists.
|
1.313 |
| 25-Aug-2020 |
rillig | make(1): fix obvious bugs in -DCLEANUP mode
The outdated type name FreeProc had been renamed to LstFreeProc. Casting the function free to it is not necessary since the type of this function is already exactly the correct type. Anything else would be undefined behavior anyway.
The uninitialized sufflist in Suff_ClearSuffixes was ok until now because the Lst functions had silently skipped any calls with invalid arguments. This silent skipping is a good argument to have strict argument validation since it detects these unintended control flows.
|
1.312 |
| 23-Aug-2020 |
rillig | make(1): make brk_string return size_t for the number of words
|
1.311 |
| 23-Aug-2020 |
rillig | make(1): reverse order of the Lst_Find parameters
The other callbacks all have (function, param), only the Lst_Find had (param, function), which was inconsistent.
|
1.310 |
| 22-Aug-2020 |
rillig | make(1): remove unused variable jobServer
|
1.309 |
| 22-Aug-2020 |
rillig | make(1): fix indentation
|
1.308 |
| 22-Aug-2020 |
rillig | make(1): replace Lst_Datum with non-null guaranteeing Lst_DatumS
|
1.307 |
| 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.306 |
| 22-Aug-2020 |
rillig | make(1): split Dir_Init into two functions
There's just no point in having a function consisting of a big if-then-else.
|
1.305 |
| 21-Aug-2020 |
rillig | make(1): remove unused code for circular lists
The list library had probably been imported from a general-purpose library that also supported circular lists. These are not used by make though.
After replacing Lst_Init(FALSE) with Lst_Init(), only a single call to Lst_Init remained with a non-constant argument, and that was in Lst_Concat, which was to be expected.
|
1.304 |
| 11-Aug-2020 |
rillig | make(1): replace snprintf/malloc in ReadMakefile with str_concat3
|
1.303 |
| 10-Aug-2020 |
rillig | make(1): replace str_concat with str_concat2 and str_concat3
The new functions have a simpler interface, and str_concat3 is even more general-purpose, since the middle string is no longer required to be exactly of length 1.
|
1.302 |
| 09-Aug-2020 |
rillig | make(1): clean up indentation, includes, add documentation
|
1.301 |
| 09-Aug-2020 |
rillig | make(1): remove outdated comment
|
1.300 |
| 09-Aug-2020 |
rillig | make(1): avoid undefined behavior in Cmd_Exec
Iterating the command output backwards was dangerous since at the end, the pointer cp pointed outside of the array. Even without dereferencing this pointer, this already invokes undefined behavior (C11, 6.5.6p8). Don't risk anything. Iterating forwards is probably faster anyway, since it is more common.
|
1.299 |
| 09-Aug-2020 |
rillig | make(1): remove redundant assignment from Cmd_Exec
A Buffer is always null-terminated.
|
1.298 |
| 09-Aug-2020 |
rillig | make(1): split local variable in Cmd_Exec into two
This avoids a mismatch between signed and unsigned types.
|
1.297 |
| 08-Aug-2020 |
rillig | make(1): remove trailing Z from buffer functions
This Z had been useful during the migration from int to size_t. This migration is finished, at least for the Buffer type, so the Z is no longer necessary.
|
1.296 |
| 03-Aug-2020 |
rillig | make(1): no declaration-after-statement anymore
NetBSD make is intended to be maximally portable, therefore it uses only C89. This was not declared in the Makefile before.
There are still a few places in parse.c and metachar.c that use end-of-line comments. These will be fixed in a follow-up commit.
|
1.295 |
| 02-Aug-2020 |
rillig | make(1): replace one instance of strncpy with snprintf
GCC 9 incorrectly claims that the string might not be null-terminated. Since objdir is a global variable, it is initialized to zero, and the +1 in the size guarantees that this byte is always 0.
Still, using strncpy to initialize a string is a waste of memory access, since it is enough if only the actual data is copied, without zeroing out all the remaining bytes.
|
1.294 |
| 01-Aug-2020 |
rillig | make(1): switch Buffer size from int to size_t
This change helps to make the various integer types compatible and is a preparational step for setting WARNS=6 in the Makefile.
The documentation of buf.c has been cleaned up and condensed since it was mostly redundant, and some statements were even slightly wrong.
All code changes are covered by the existing unit tests, except for the few lines in for.c around for_var_len. These changes have been reviewed thoroughly and manually, like all the others in this commit.
Those buffer functions that deal with sizes have been renamed by appending a Z, to make sure that no function call was accidentally forgotten. They will be renamed back in a follow-up commit.
As usual, the scope of a few affected variables has been reduced, and some variables had to be split since they had been incorrectly merged before.
The order of the arguments to Buf_AddBytes has changed from (mem_len, mem) to (mem, mem_len), in order to make it consistent with the functions from the C standard library, such as snprintf.
|
1.293 |
| 01-Aug-2020 |
rillig | make(1): fix parameter name in Cmd_Exec
A format string is not a number.
|
1.292 |
| 01-Aug-2020 |
rillig | make(1): use ordinary string concatenation in usage text
|
1.291 |
| 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.290 |
| 01-Aug-2020 |
rillig | make(1): avoid calls to free(3) in the common case of a NULL pointer
|
1.289 |
| 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.288 |
| 01-Aug-2020 |
rillig | make(1): make Main_SetVarObjdir const-correct and use separate variables
The return value of Var_Value should be const char *, but changing that now would be too large a change.
|
1.287 |
| 01-Aug-2020 |
rillig | make(1): merge duplicate code for concatenating strings
|
1.286 |
| 01-Aug-2020 |
rillig | make(1): eliminate unsatisfiable condition in is_relpath
|
1.285 |
| 31-Jul-2020 |
sjg | Add -dL for LINT
When parsing variable assignments other than := and if value contains '$' attempt Var_Subst the same as for :=, if the value does not parse correctly, we get a fatal error including file an line number.
This can greatly help with finding the cause of problems.
Reviewed by: christos
|
1.284 |
| 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.283 |
| 20-Jul-2020 |
sjg | Make DEBUG_HASH less of a fire-hose.
Reporting keys on every lookup is overkill unless playing with a new HASH, so wrap in #ifdef DEBUG_HASH_LOOKUP Also add some stats at the end so we can see final size and max chain length - maxchain is a better variable name than maxlen.
|
1.282 |
| 19-Jul-2020 |
rillig | make(1): clean up unnecessary snprintf and multi-line function calls
|
1.281 |
| 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.280 |
| 18-Jul-2020 |
sjg | Add -dh for DEBUG_HASH
Allow tracking of max chain length, to see how well the hash tables are working. Pull the actual hash operation into a marco so it can be easily changed - for experimenting.
The current hash, is pretty good.
Reviewed by: christos
|
1.279 |
| 03-Jul-2020 |
rillig | make(1): remove trailing whitespace
|
1.278 |
| 03-Jul-2020 |
rillig | make(1): remove redundant parentheses around return values
|
1.277 |
| 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.276 |
| 22-Jun-2020 |
sjg | dieQuietly: ignore OP_SUBMAKE
Stick to OP_MAKE for deciding when to supress noise as OP_SUBMAKE can be too aggressive.
Reviewed by: gson
|
1.275 |
| 19-Jun-2020 |
sjg | Avoid unnecessary noise when sub-make or sibling dies
When analyzing a build log, the first 'stopped' output from make, is the end of interesting output.
Normally when a build fails deep down in a parallel build the log ends with many blockes of error output from make, with all but the fist being unhelpful.
We add a function dieQuietly() which will return true if we should supress the error output from make. If the failing node was a sub-make, we want to die quietly.
Also when we read an abort token we call dieQuietly telling we want to die quietly.
This behavior is suppressed by -dj or setting .MAKE.DIE_QUIETLY=no
Reviewed by: christos
|
1.274 |
| 30-Mar-2020 |
sjg | make: fix -fno-common build
debug was declared extern, but debug_file was not; correct this and define debug_file in main.c (as debug is) to fix the -fno-common build.
-fno-common will become the default with GCC10/LLVM11.
Patch from kevans at freebsd
|
1.273 |
| 28-Oct-2017 |
sjg | branches: 1.273.4; 1.273.6; Ignore empty MAKEOBJDIR
Otherwise we end up with .OBJDIR = ${.CURDIR}/ which is quivalent, but fails the typial .if ${.OBJDIR} == ${.CURDIR}
|
1.272 |
| 19-Jun-2017 |
christos | Add -v variable that always expands variables; restore -V the way it was.
|
1.271 |
| 19-Jun-2017 |
christos | make the code look like to 1.266
|
1.270 |
| 19-Jun-2017 |
christos | Remove previous variable expansion code; sjg had already added the code to do it. Note that the manual page already documents this behavior and does not need to change:
-dV -V VAR: prints the raw variable -V VAR: prints the expanded variable
|
1.269 |
| 17-Jun-2017 |
christos | a variable that starts with \\ is not expanded.
|
1.268 |
| 17-Jun-2017 |
christos | simplify
|
1.267 |
| 17-Jun-2017 |
christos | -V: try to expand the variable again if the value contains a variable.
|
1.266 |
| 17-Jun-2017 |
christos | move some code out of the gigantic main function; no functional change.
|
1.265 |
| 10-May-2017 |
sjg | branches: 1.265.2; Main_SetObjdir: ensure buf2 is in scope
|
1.264 |
| 20-Apr-2017 |
sjg | branches: 1.264.2; We cannot tollerate things like trailing /.. etc in .CURDIR so only accept -C arg "as is" if it contains no relative components.
|
1.263 |
| 19-Apr-2017 |
sjg | We cannot use buf as both src and destination for snprintf.
|
1.262 |
| 16-Apr-2017 |
riastradh | Factor out parts of cached_realpath.
This wacky API confused Coverity (CID 1405167) and is no good for human readers either.
|
1.261 |
| 16-Apr-2017 |
maya | Use bmake_malloc where we don't test the return value of malloc currently.
Appeases coverity.
|
1.260 |
| 13-Apr-2017 |
christos | PR/52159: Jamie Landeg-Jones: Don't try to expand $'s in paths or system variables. Only expand them ${MAKE} variable values.
|
1.259 |
| 26-Mar-2017 |
sjg | When we change .OBJDIR we should delete any cached realpath results for relative paths.
Reviewed by: christos
|
1.258 |
| 11-Mar-2017 |
sjg | Do not consider using -C arg "as is" for .CURDIR unless it starts with '/'.
Reviewed by: christos
|
1.257 |
| 08-Feb-2017 |
christos | Use strncpy here because we need to be portable, and we have the +1 byte to save us :-)
|
1.256 |
| 07-Feb-2017 |
christos | use the logical path for -C if correct.
|
1.255 |
| 31-Jan-2017 |
sjg | Partially initialize Dir before MainParseArgs can be called.
The rest can be done once curdir is finalized.
|
1.254 |
| 10-Dec-2016 |
christos | branches: 1.254.2; Back in 1993 ${MACHINE} was a unique way to define objdirs for every platform. Thus setting OBJMACHINE, allowed one to keep in-tree objdirs with multiple builds. With the advent of evb*, this has become impossible until now. Introduce OBJMACHINE_ARCH that adds ${MACHINE_ARCH} to the objdir so that we have unique objdirs per build again. Until we restructure things to that this is not necessary, it is the simplest fix.
|
1.253 |
| 07-Dec-2016 |
christos | Don't apply the suffix (curdir) to MAKEOBJDIR
|
1.252 |
| 07-Dec-2016 |
christos | Refactor and simplify objdir setting code.
|
1.251 |
| 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.250 |
| 11-Aug-2016 |
sjg | PR: 51405 Description:
addErrorCMD: in compat mode, cmdp may be NULL, skip it and stop the calls (return 1).
|
1.249 |
| 10-Aug-2016 |
sjg | Set .ERROR_CMD if we can
|
1.248 |
| 07-Jun-2016 |
christos | branches: 1.248.2; fix memory leak, simplify
|
1.247 |
| 05-Jun-2016 |
christos | NUL terminate.
|
1.246 |
| 05-Jun-2016 |
sjg | Avoid breaking !NetBSD build
|
1.245 |
| 03-Jun-2016 |
sjg | Add cached_realpath()
realpath(3) is expensive, and meta mode at least uses it extensively. We use cached_realpath() to save the result of successful calls to realpath(3) in a private variable context.
This improves the worst case performance (eg examining libc with nothing to do) by a factor of 4.
Reviewed by: christos
|
1.244 |
| 05-Apr-2016 |
sjg | Skip looking for .MAKE.JOBS if either of compatMake or forceJob is true.
If -B compatMake will be true and should be honored. If -j forceJobs will be true and the command line supplied .MAKE.JOBS should be respected - for consistency with other usage.
|
1.243 |
| 16-Mar-2016 |
matthias | honor setting .MAKE.JOBS from the makefile. That way one can e.g. do:
CPUS!=sysctl -n hw.ncpuonline .MAKE.JOBS?=$(CPUS)
|
1.242 |
| 07-Mar-2016 |
christos | str2Lst_Append tokenizes the string and uses it in the list so we can't free the string afterwards. Keep a copy of it and cleanup at the end.
|
1.241 |
| 19-Feb-2016 |
sjg | getBoolean: We need :U to ensure we get an empty string if knob isn't set.
|
1.240 |
| 18-Feb-2016 |
sjg | Add .export-literal to avoid the need for $$ dance when trying to put unexpanded variables into environment.
Reviewed by: christos
|
1.239 |
| 18-Feb-2016 |
christos | Collapse the 3 boolean parameter to 1 flags parameter. No functional change.
|
1.238 |
| 17-Jan-2016 |
christos | remove free NULL checks (Tilman Sauerbeck)
|
1.237 |
| 17-Jan-2016 |
christos | provide missing FD_CLOEXEC for the havenots.
|
1.236 |
| 09-Jan-2016 |
christos | Preserve $$ in := assignments..
FOO=\$$CRAP BAR:=${FOO}
all: echo ${FOO} echo ${BAR}
|
1.235 |
| 25-Oct-2015 |
sjg | PrintOnError: fflush stdout before running .ERROR
produces more consistent results in unit-tests.
|
1.234 |
| 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.233 |
| 10-Sep-2015 |
sjg | Output Entering/Leaving messages for objdir when != srcdir and -w flag This helps ensure Emacs can find source of error.
Reviewed by: christos
|
1.232 |
| 26-Mar-2015 |
sjg | Move initialization of savederr to the block where it is used to avoid spurious warning from gcc 5
|
1.231 |
| 09-Sep-2014 |
dholland | Restore apb's 20140820 commit (-r1.228 of main.c): It should not be an error to have VAR != command that prints no output
Joerg reverted a bit too enthusiastically.
|
1.230 |
| 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.229 |
| 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.228 |
| 20-Aug-2014 |
apb | It should not be an error to have VAR != command that prints no output
|
1.227 |
| 08-Aug-2014 |
gson | Fix comment: Error, Fatal, and Punt take any number of arguments, not two.
|
1.226 |
| 07-Feb-2014 |
pooka | branches: 1.226.2; Use Var_Value() instead of getenv() to obtain MAKEOBJDIR{,PREFIX}.
Fixes "make -X MAKEOBJDIR=foo". Purely uncoincidentally, build.sh creates the nbmake wrapper with MAKEFLAGS -X on FreeBSD.
|
1.225 |
| 14-Sep-2013 |
matt | If MAKE_NATIVE, use sysctl to get MACHINE_ARCH from hw.machine_arch.
|
1.224 |
| 04-Sep-2013 |
sjg | Add VAR_INTERNAL as a context for variables set by make itself, which should not override those set by makefiles. Currently MAKEFILE is the only variable affected.
Reviewed by: christos
|
1.223 |
| 04-Aug-2013 |
sjg | Move the call to Job_SetPrefix() to Job_Init() so that makefiles have had a chance to set .MAKE.JOB.PREFIX
|
1.222 |
| 18-Jul-2013 |
sjg | From bmake: move decl of pwd nearer to where it is used so the whole thing can be ifdef'd out without causing unused variable errors.
|
1.221 |
| 16-Jul-2013 |
christos | branches: 1.221.2; use bmake_foo instead of efoo()
|
1.220 |
| 16-Jul-2013 |
christos | More gmake compatibility: 1. add -w flag to print Entering and Leaving directory name the the beginning and the end of processing. 2. export MAKELEVEL=$((MAKELEVEL + 1)) only in the child environment. 3. when printing error messages, prefix them with the program name [$MAKELEVEL] for $MAKELEVEL > 0 4. if $MAKEFLAGS consists only of letters assume it is a set of flags (as allowed by posix), convert them to -f -l -a -g -s, so that they get parsed properly. With those fixes gmake -> bmake -> gmake -> bmake etc. works as expected.
|
1.219 |
| 15-Jul-2013 |
christos | Make this work again like gmake. sjg: see the test program.
|
1.218 |
| 09-Jul-2013 |
sjg | For .MAKE.LEVEL.ENV use VAR_CMD so updates are ignored
|
1.217 |
| 09-Jul-2013 |
sjg | Set .MAKE.LEVEL.ENV to the name of the env variable used to communicate the recursion level to sub-makes.
|
1.216 |
| 06-Jul-2013 |
sjg | If using gmake's MAKELEVEL; use it the same way
|
1.215 |
| 29-Jun-2013 |
christos | PR/47973: Justin Cormack: build uses <sys/signal.h> not in POSIX
|
1.214 |
| 18-Jun-2013 |
sjg | Use a #define for the variable name we put in environment to pass .MAKE.LEVEL in case we don't want to use gmake's MAKELEVEL in a different way.
|
1.213 |
| 10-Jun-2013 |
christos | put back previous change
|
1.212 |
| 10-Jun-2013 |
joerg | Revert last, it doesn't even build.
|
1.211 |
| 10-Jun-2013 |
christos | 1. Don't export .MAKE.LEVEL, because this is an illegal variable name for some shells; export MAKELEVEL like gmake(1) does. 2. It is absurd for the environment variable to be one greater than the make variable!?!?! To wit... printf 'all:\n\t@echo ${.MAKE.LEVEL}; printenv .MAKE.LEVEL' | make -f -
|
1.210 |
| 23-Mar-2013 |
sjg | If built with filemon support, set .MAKE.PATH_FILEMON to _PATH_FILEMON so that makefiles can test for it.
|
1.209 |
| 26-Feb-2013 |
christos | PR/45042: Thomas Cort: HAVE_foo for setrlimit(2) and setpgid(2)
|
1.208 |
| 25-Feb-2013 |
dholland | typo in comment
|
1.207 |
| 16-Feb-2013 |
christos | we need utsname all the time.
|
1.206 |
| 16-Feb-2013 |
christos | Set .MAKE.OS to utsname.sysname so we can tell bogus OS's apart early in the build process.
|
1.205 |
| 26-Jan-2013 |
christos | Check read and write errors to avoid warnings from linux. XXX: Should we print an error and exit instead?
|
1.204 |
| 25-Jan-2013 |
sjg | Remove Check_Cwd - it is no longer needed.
|
1.203 |
| 31-Aug-2012 |
sjg | branches: 1.203.2; Cast sizeof() to int, which is sufficent and consistent with other use within make.
|
1.202 |
| 31-Aug-2012 |
pgoyette | Cast sizeof() to (ssize_t) to avoid build errors.
|
1.201 |
| 30-Aug-2012 |
sjg | Add a knob to control whether -V fully expands a plain variable by default. The default retains the traditional NetBSD behavior, but the knob can be set so that FreeBSD can retain their expected behavior. This is a compromise to be sure.
Add a debug flag -dV to override the above, so that regardless of the knob setting, the raw value of a variable can be easily seen.
|
1.200 |
| 12-Jun-2012 |
joerg | Replace __dead, __unused and the various printf format attributes with versions prefixed by MAKE_ATTR_* to avoid modifying the implementation namespace. Make sure they are available in all places using nonints.h to fix bootstrap on Linux.
|
1.199 |
| 24-Apr-2012 |
sjg | Fix handling of -dF+/tmp/file
|
1.198 |
| 16-Sep-2011 |
joerg | branches: 1.198.2; Use __dead consistently. If it doesn't exist, define it away.
|
1.197 |
| 04-May-2011 |
sjg | Add .MAKE.META.BAILIWICK - to identify the scope of make's control. meta_oodate: if a file that was written or linked within our bailiwick, but outside of .OBJDIR is missing, add it to missingFiles. If we get to the end of the .meta file without seeing it [re]moved, then consider the target out-of-date.
|
1.196 |
| 20-Feb-2011 |
joerg | Use the current directory at start time for .PARSEDIR, if the filename contains no /.
|
1.195 |
| 13-Feb-2011 |
sjg | Mark unused args.
|
1.194 |
| 25-Dec-2010 |
dholland | branches: 1.194.2; Improve confusing error message when getcwd() fails.
|
1.193 |
| 25-Dec-2010 |
dholland | Begin cleanup of the make parser: separate out the logic for reading files from the parsing goo. This will now use mmap for reading if it works and fall back to read only for pipes and such. Step 1 of a cleanup program proposed without objection on tech-toolchain.
|
1.192 |
| 13-Dec-2010 |
dholland | Add const necessary for clean non-native build.
|
1.191 |
| 09-Dec-2010 |
sjg | meta_oodate(): we should track 'latestdir' on a per process basis. Also, only consider target out of date if a not-found file is outside 'CWD'. Ignore anything in "/tmp/" or tmpdir.
|
1.190 |
| 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.189 |
| 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.188 |
| 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.187 |
| 17-May-2010 |
christos | put back canonicalization, but avoid doing it for files that don't contain / From dholland
|
1.186 |
| 10-May-2010 |
sjg | PrintOnError: run .ERROR last, so even if it causes problems we still print MAKE_PRINT_VAR_ON_ERROR.
|
1.185 |
| 05-May-2010 |
christos | Revert bogus patch that attempted to canonicalize a non absolute argv[0] using realpath(3). Consider: touch Makefile; mkdir make; make. This will set $MAKE to $PWD/make so further attempts to use ${MAKE} will try to execute the directory. This needs $ORIGIN to be fixed properly, or alternatively one can duplicate the logic for execvp(3) and search the path for the make executable. Not worth it. It was working just fine before!
|
1.184 |
| 29-Apr-2010 |
sjg | fflush stdout, before writing to stderr.
|
1.183 |
| 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.182 |
| 22-Apr-2010 |
dholland | Use _PATH_TMP instead of a literal /tmp; noted by Christos
|
1.181 |
| 22-Apr-2010 |
dholland | don't use strlcpy; it causes bootstrap issues. (noted by moof)
|
1.180 |
| 22-Apr-2010 |
sjg | Just because $TMPDIR is set does not mean it is valid. Add a central function for creating temp files so we have one place to audit.
Reviewed by: dh
|
1.179 |
| 20-Apr-2010 |
sjg | On some systems realpath will prefix make with cwd, so make sure we can stat(2) the value for .MAKE
|
1.178 |
| 14-Apr-2010 |
sjg | If argv[0] is not an absolute path, attempt to resolve it using realpath() for setting .MAKE
|
1.177 |
| 08-Apr-2010 |
sjg | Process .ERROR the same as .BEGIN, .END etc so that it cannot be the default target. Add unit-tests for .info - .error, and .ERROR.
|
1.176 |
| 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.175 |
| 04-Jan-2010 |
sjg | We need to have set curdir before calling Dir_FindHereOrAbove(). We can call getcwd again if -C is used.
|
1.174 |
| 09-Sep-2009 |
sjg | We must delay setting .CURDIR and .OBJDIR until after MainParseArgs() in case -C is used - in which case we should also ignore $PWD.
|
1.173 |
| 08-Sep-2009 |
sjg | Reviewed by: apb
Use .MAKE.LEVEL to track recursion. The first instance of make will have .MAKE.LEVEL 0, which can be handy for excluding rules which should not apply in a sub-make. gmake and freebsd's make have a similar mechanism, but each uses a different variable to track it. Since we cannot be compatible with both, we allow the makefiles to cope if they want by handling the export of .MAKE.LEVEL+1 in Var_Set().
|
1.172 |
| 03-Sep-2009 |
dholland | Use the W* macros to test wait results. (Mentioned by Joerg in chat a few days ago.)
|
1.171 |
| 26-Aug-2009 |
sjg | Add -C directory, same as gmake and freebsd make.
|
1.170 |
| 24-Mar-2009 |
perry | per dholland, put back MAKE_VERSION for the benefit of third party users.
|
1.169 |
| 20-Mar-2009 |
perry | The Makefile and main.c arranged to put "netbsd-${DATE}" into the executable. Remove this so that different compiles can be binary compared. rcsid's for all files are already embedded in the executable so versions can be easily distinguished. (I didn't catch this on previous passes because I did my builds on the same day.)
Note: there's a special rule for main.o in Makefile with a purpose I can't actually discern -- I think it isn't needed, and I've flagged it with a comment.
|
1.168 |
| 18-Mar-2009 |
christos | use progname instead of getprogname() for portability.
|
1.167 |
| 01-Mar-2009 |
christos | use siginfo to report on the directory we are working on if available.
|
1.166 |
| 24-Jan-2009 |
dsl | branches: 1.166.2; Move the bmake_malloc() functions into their own .c and .h files. Include instead of make.h in a few places.
|
1.165 |
| 23-Jan-2009 |
dsl | Sprinkle some const. In particular for Lst_Find() and Lst_FindFrom(). Remove some unneeded casts and some now-undeeded UNCONST().
|
1.164 |
| 23-Jan-2009 |
dsl | Change 'ClientData' to 'void *' so that relevant parameters can be made 'const void *'.
|
1.163 |
| 17-Jan-2009 |
dsl | Change 'Buffer' so that it is the actual struct, not a pointer to it. Saves having to malloc/free a fixed size structure. Buf_Init() now takes ptr to Buffer to initialiase. Change Buf_Destroy() to return ptr to string when not freed. Remove large number of casts to (Byte) and (Byte *) - 'Byte' is 'char' here. Buf_AddByte[s] guarantees that the data is 0 termininated, so never add '\0'. Keep 'count' not 'left' and 'inPtr', code is simplier with only one update. Fix fallou, no functional change.
|
1.162 |
| 16-Jan-2009 |
dsl | Send output of Error() to debug_file (unless stderr/stdout).
|
1.161 |
| 13-Jan-2009 |
dsl | Sprinkle a const. (arg of Main_ParseArgLine())
|
1.160 |
| 20-Dec-2008 |
dsl | Delete very splurious 'free(buf)' that xtos added. Fixes PR bin/40233
|
1.159 |
| 19-Dec-2008 |
christos | if brk_string fail, so do we.
|
1.158 |
| 13-Dec-2008 |
dholland | fix typo in comment
|
1.157 |
| 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.156 |
| 13-Dec-2008 |
dsl | Do not let the variable name "" be set from the command line (-D "") or from ::= modifiers (${::=foo}).
|
1.155 |
| 07-Dec-2008 |
christos | add debug flag for cwd.
|
1.154 |
| 22-Oct-2008 |
apb | Send debugging output to stderr by default, not to stderr. If you really want debugging to stdout, specify "-dFstdout" in MAKEFLAGS or on the command line.
Discussed in tech-userlevel.
|
1.153 |
| 19-Oct-2008 |
apb | Always make the debugging output unbuffered; in addition, if debugging is enabled but debugging output is not directed to stdout, then make stdout line buffered.
Previously, the code to make debug output unbuffered applied only if debugging to a file, not if debugging to stdout or stderr. Making stdout line buffered when debugging was suggested by Steven Bellovin.
|
1.152 |
| 18-Oct-2008 |
apb | Allow optional "+" in "-dF[+]filename" even if the filename is "stdout" or "stderr". Previously, the "+" was alowed only for real file names, but it's easier to write the documentation if the "+" is always allowed.
|
1.151 |
| 06-Oct-2008 |
joerg | Don't use emalloc and friends directly, but call them consistently bmake_malloc and friends. Implement them via macros for the native case and provide fallback implementations otherwise. Avoid polluting the namespace by not defining enomem globally. Don't bother to provide strdup and strndup, they were only used for the estrdup and estrndup comapt code.
This addresses the presence of emalloc in system libraries on A/UX and resulted strange issues as reported by Timothy E. Larson.
|
1.150 |
| 21-Jul-2008 |
lukem | Remove the \n and tabs from the __COPYRIGHT() strings. Tweak to use a consistent format.
|
1.149 |
| 15-Feb-2008 |
christos | branches: 1.149.6; back all changes out until I fix it properly.
|
1.148 |
| 15-Feb-2008 |
christos | fix != expansion bug I introduced.
|
1.147 |
| 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.146 |
| 19-Jan-2008 |
sjg | Implement -dl (aka LOUD) to override '@' at the start of script lines. Based on supplied patch.
PR: 37202
|
1.145 |
| 21-Dec-2007 |
dsl | If make can't find a rule to create a file it needs to satisfy a rule that came from .depend then just output a message and contine.
|
1.144 |
| 13-Oct-2007 |
apb | * Convert all uses of strdup() to estrdup(); * Use estrndup() in a few cases where it simplifies the code; * Provide compatibility definitions of strndup and estrndup;
|
1.143 |
| 05-Oct-2007 |
sjg | Add the ability to .export variables to the environment.
|
1.142 |
| 01-Oct-2007 |
sjg | Add the ability to tweak the token output before targets in job mode. Eg. .MAKE.JOB.PREFIX=${.newline}---${.MAKE:T}[${.MAKE.PID}] would produce ---make[1234] target ---
|
1.141 |
| 01-Jan-2007 |
dsl | branches: 1.141.4; Since the 'buf' code here is only used by make, we don't need two names for the default buffer size of 256. Also allow for the trailing 0 byte!
|
1.140 |
| 16-Dec-2006 |
dsl | Use open/read/close instead of stdio for makefiles. Commons up the code for reading files and buffers, and allows a further change where we don't copy the data out of the buffer when generating 'lines. This will speed up makefile parsing (esp .if clauses).
|
1.139 |
| 06-Dec-2006 |
dsl | Add anewline to the end of the error message output when the debug log file cannot be opened.
|
1.138 |
| 03-Dec-2006 |
dsl | Some minor changes: - Only test 'printVars' once. Has side effect of not trying to find the 'main' target for '-V varname'. - Only reap the single child process in Cmd_Exec(), I think this is for 'xx != cmd' so probobably no other children should exist. - Don't read and parse .depend if '-r' and '-V varname' are set. I suspect that .depend shouldn't affect the output of any -V command...
|
1.137 |
| 17-Nov-2006 |
dsl | branches: 1.137.2; 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.136 |
| 11-Nov-2006 |
dsl | If the last 3 bytes of the debug filename supplied with -DFxxxx are .%d then replace the %d with getpid(). Allows the trace files for different make process is a big recursive make to be written to different files - and have a slight chance of being useful.
|
1.135 |
| 01-Nov-2006 |
sjg | Use of libutil to provide emalloc et al, should be predicated on a native NetBSD build using TOOLDIR etc. Otherwise use the local versions.
Reviewed by: christos
|
1.134 |
| 27-Oct-2006 |
dsl | Since 'ClientData' is 'void *', nuke almost all the (ClientData) casts.
|
1.133 |
| 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.132 |
| 11-Oct-2006 |
dsl | There is no need to resize the pollfd array, it can only ever have 2+maxJobs entries, so allocate at startup. Use an 'int jobPipe[2]' within the job structure, and create pipes directly into it. Common up the code that creates all the pipes - making them all non-block on the read side in the process. Call Job_CatchChildren() directly from Job_CatchOutput() so that it only gets called when a child actually exits. NB: Something causes a 'pregnant pause' if (for example) you call 'nbmake obj' in src/tools. Introduced between netbsd 3 and 4.
|
1.131 |
| 09-Oct-2006 |
dsl | Rip out the code for the undocumented -P (don't use pipes for command output) option. I'm sure it is baggage from the past.
|
1.130 |
| 26-Aug-2006 |
christos | Fix non-native build.
|
1.129 |
| 26-Aug-2006 |
christos | More programs using efun.
|
1.128 |
| 28-Jul-2006 |
sjg | Fix minor mem leak in PrintOnError().
|
1.127 |
| 29-Jun-2006 |
rillig | Fixed gcc warnings about signed vs. unsigned in comparisons.
|
1.126 |
| 19-May-2006 |
christos | branches: 1.126.2; Coverity CID 3147: Plug memory leak.
|
1.125 |
| 22-Apr-2006 |
christos | Coverity CID 527: Make it painfully obvious that av is freed.
|
1.124 |
| 12-Apr-2006 |
sjg | Change ReadMakefile to return 0 on success so that it better meets the expectations of Lst_Find*. This way we only read the first sys.mk found via sysIncPath. At the same time we need to add a ReadAllMakefiles() for the case where multiple -f makefile args are provided (uncommon, but documented).
|
1.123 |
| 31-Mar-2006 |
dsl | There is no need to count jobs and job tokens. If we don't create the job pipe, use the '-j n' option to limit the number of tokens we will remove from the pipe.
|
1.122 |
| 17-Mar-2006 |
christos | Coverity CID 2719: argvalue can be NULL when passed into functions. De-obfuscate by undefining optarg, and check explicitly for NULL before use.
|
1.121 |
| 11-Mar-2006 |
dsl | Remove most of the code seemed to be there to support 'remote jobs'. It isn't clear that it ever worked, if it did it has almost certainly bitrotted in the last 12 years. I'm not even sure all the required components were present. I suspect it was written to attempt to use a 'farm' of diskless sun3s. In any case the apparant random assignment fo jobs to other systems doesn't actually seem like a good idea! Things like 'distcc' han be used to help slow systems run native builds. Removing this code also simplifies make, and should let me speed up some of its processing - without worrying about bitrotting it further.
|
1.120 |
| 26-Feb-2006 |
apb | Make ".WAIT" apply recursively to all children of nodes on the right hand side of the .WAIT, except when the recursive interpretation would cause a cycle in the dependency graph.
Discussed in tech-toolchain. Reviewed by christos, sjg.
|
1.119 |
| 18-Feb-2006 |
tsutsui | Don't use data in freed stack.
|
1.118 |
| 22-Jan-2006 |
dsl | Make .NOTPARALLEL stop the job engine issuing more than one token (instead of trying to de-jobify the make. You can now put .NOTPARALLEL in a submake of a recursive make (where it is using a job-token pipe from the outer make and have it only run a single job. You can also specify .NOTPARRALEL in the root makefile of a large recursive make and have the submakes run multiple commands. Add some diagnostics printfs (enabled with -dp) to the parser.
|
1.117 |
| 04-Jan-2006 |
dsl | When a parallel make job completes, always put the job token back into the job_pipe and collect another one for the next job. If we are aborting, remove all the 'normal' job tokens and add an 'error' one. If we get an 'error' token, remove any other tokens, re-insert the error token and exit (with error 'cos that is easier). Add the current pid to some of the DEBUG(JOB) traces. Combined effect is that parallel makes actually stop some fairly shortly after an error, rather than running on long enough to fill the scrollback.
|
1.116 |
| 09-Aug-2005 |
christos | Add typedefs for DuplicateProc and FreeProc from Max Okumoto.
|
1.115 |
| 08-Aug-2005 |
christos | From Max Okumoto: - Remove casts to NULL. - Remove space between cast and object.
|
1.114 |
| 05-Aug-2005 |
christos | More KNF cleanups from Max Okumoto
|
1.113 |
| 03-Aug-2005 |
christos | from Max Okumoto: debug should be int, not boolean.
|
1.112 |
| 25-Jul-2005 |
christos | Whitespace KNF cleanup from Max Okumoto
|
1.111 |
| 24-Jun-2005 |
lukem | Revert rev 1.110 and restore the previous "automagic objdir" support; at least until we clean up the objdir semantics in <bsd.obj.mk> for NetBSD builds.
|
1.110 |
| 23-Jun-2005 |
lukem | Deprecate support for automagically setting the .OBJDIR to ./obj.${MACHINE} ./obj /usr/obj/${PWD}
The rules for the default .OBJDIR setting are now simplified to (and documented as) trying the chdir to the following (if the appropriate variable is defined): ${MAKEOBJDIRPREFIX}${.CURDIR} ${MAKEOBJDIR} ${.CURDIR}
.OBJDIR can be overridden in the makefile. <bsd.obj.mk> uses this to provide the "culled" .OBJDIR semantics for NetBSD's /usr/src builds.
MAKEOBJDIRPREFIX & MAKEOBJDIR still can only be provided in the environment or on make(1)'s command line.
Per discussion on tech-toolchain. This should reduce a lot of lossage people have experienced over the years with various .OBJDIR setups.
|
1.109 |
| 17-Jun-2005 |
jmc | Add new debugging option '-dn' which will leave the scripts fed into make on -j jobs in /tmp for debugging purposes. Add a note to the man page that this could cause problems if run a lot (due to the number of files created)
|
1.108 |
| 03-Jun-2005 |
lukem | appease gcc -Wuninitialized
|
1.107 |
| 01-Jun-2005 |
sjg | Add :Ox for random ordering, based on patch from Mike M. Volokhov <mishka@apk.od.ua>
|
1.106 |
| 16-Feb-2005 |
christos | PR/29203, PR/29204: Max Okumoto: KNF changes to make [no functional changes]
|
1.105 |
| 13-Jul-2004 |
wiz | Sync usage with man page; from Kouichirou Hiratsuka in PR 26223.
|
1.104 |
| 01-Jul-2004 |
jmc | Change to use __unused instead and provide a compat definition in make.h if not already defined from cdefs.h
|
1.103 |
| 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.102 |
| 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.101 |
| 22-Apr-2004 |
ross | Recognize -- (dash dash) and apply the usual interpretation.
Notes:
* The immediately previous version of make errored out on --, which is what needs fixing.
* Historic bsd make silently ate -- and continued to process options, so this is a behavior change from that, too, but presumably there is more to gain in fixing it than in being bug-compatible.
|
1.100 |
| 27-Mar-2004 |
enami | branches: 1.100.2; Validate existence of arguemnt. PR#24933.
|
1.99 |
| 24-Mar-2004 |
fair | Fix comment per PR 24437; make(1) tries "makefile" first, and then "Makefile", not the other way around as previously documented.
|
1.98 |
| 05-Feb-2004 |
ross | Parse args with open code to eliminate use of getopt(3). No functional change under NetBSD.
Restarting a getopt(3) loop is an extension to the posix getopt(3) behavior and is not portable.
Fixes tools build (tools/groff) under Cygwin.
|
1.97 |
| 03-Feb-2004 |
chuck | add parent directory search for make as discussed on tech-toolchain. - new dir.c function: Dir_FindHereOrAbove: Search for a path in the current directory and then all the directories above it in turn until the path is found or we reach the root ("/"). - add hooks to use it in main.c for -m and syspath (compiled in _PATH_DEFSYSPATH and $MAKESYSPATH). - updated man page
|
1.96 |
| 05-Jan-2004 |
jmmv | Homogenize usage messages: make the 'usage' word all lowercase, as this seems to be the most common practice in our tree.
|
1.95 |
| 18-Dec-2003 |
jmc | When looking for a makefile and curdir != objdir (i.e. working inside of an objdir) try opening the file from curdir and if that fails try from objdir. This way .depend files get picked up via their full path names rather than just .depend so vars like PARSEDIR, PARSEFILE are then set correctly. This fixes PR#13289 reporting incorrect pathnames for .depends with errors in them
|
1.94 |
| 07-Dec-2003 |
dsl | Add a -Dg3 which outputs the 'input graph' only on error exit. Lets you see the wood for the trees...
|
1.93 |
| 10-Sep-2003 |
jmmv | 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.92 |
| 05-Sep-2003 |
sjg | Allow -V '${FOO}' to print the expanded version of FOO. A side effect of adding and removing a -E option for the above is that the cases in MainParseArgs are now ordered correctly?
|
1.91 |
| 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.90 |
| 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.89 |
| 14-Jul-2003 |
christos | Pass WARNS=3
|
1.88 |
| 10-May-2003 |
jmmv | Remove extra space in usage message.
|
1.87 |
| 14-Mar-2003 |
thorpej | Add a -X option, which prevents make(1) from putting variables set on the command line into the environment individually. This can be useful on systems which have a tight limit on the size of the argument space.
|
1.86 |
| 26-Feb-2003 |
sjg | Add -B to MAKEFLAGS so that it propagates to sub-makes. This allows one to use -j1 -B at some point in a tree to overcome a -jN (which is the main reason one would use -B).
|
1.85 |
| 15-Jun-2002 |
wiz | Remove !__STDC__ stuff, de-__P(), ANSIfy, and de-register.
|
1.84 |
| 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.83 |
| 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.82 |
| 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.81 |
| 11-Dec-2001 |
tv | Allow MAKE_MACHINE to be unset if MAKE_BOOTSTRAP.
|
1.80 |
| 30-Nov-2001 |
thorpej | Clean up some MAKE_BOOTSTRAP issues wrt. MACHINE/MACHINE_ARCH.
|
1.79 |
| 12-Nov-2001 |
tv | Redo the hashtable for "." if .OBJDIR changes.
|
1.78 |
| 12-Nov-2001 |
tv | Add new make variable .ALLTARGETS, which lists all targets in the Makefile. (Makes it possible to search the target list for particular things and apply attributes to all the relevant targets.)
|
1.77 |
| 11-Nov-2001 |
tv | Back out my rev. 1.75 on recommendation of christos.
Instead of skipping the PWD check entirely, add a skip of the PWD override if MAKEOBJDIR is set and contains a variable transform ($). This has similar problems to what happens if MAKEOBJDIRPREFIX is set.
|
1.76 |
| 02-Nov-2001 |
tv | Apparently something was missed in the Main_SetObjdir commit. Fix a TRUE value that should start out FALSE.
|
1.75 |
| 02-Nov-2001 |
tv | Strike getenv("PWD") entirely, based on prior discussion with sjg. This breaks too many situations, including MAKEOBJDIR with a :C,foo,bar, transform in many cases. It's ambiguous and unreliable, as the comment above that code always indicated. In order to have reliable objdirs, they need to work the same way Every Time.
(Note that taking this out is not a performance hit; we were already doing the getcwd() call first. So the getenv("PWD") didn't increase performance.)
|
1.74 |
| 31-Oct-2001 |
tv | Overhaul the initialization and handling of .OBJDIR:
* Replace chdir_verify_path() with Main_SetObjdir(), which can be called externally, and can take a "const char *". (There's a lot of non-const "char *" passing around in var.c of what should be const strings....)
* Rewrite the initial "find my .OBJDIR" code to make use of the new function. This still functions as it had in the past, but the comment above this block was changed to reflect reality: if MAKEOBJDIRPREFIX or MAKEOBJDIR are set in the environment, then *only that value* is tried; make does not fall back to obj.MACHINE, obj, and /usr/obj/`pwd` as it would without these env vars set.
* Add a new special target, .OBJDIR:, which when parsed will cause make to change to a new object directory and reset .OBJDIR, and PWD in the environment. This will allow some makefiles (mainly, src/tools) to override the default objdir semantics in order to add custom logic.
|
1.73 |
| 31-Oct-2001 |
tv | Allow "-m" to be used in a .MAKEFLAGS: special target and get it to work. (This splits out the "default system include paths" into its own Lst variable, and uses it only if sysIncPath is empty. This allows sysIncPath to be filled in by the Makefile itself.)
|
1.72 |
| 16-Sep-2001 |
wiz | Spell 'occurred' with two 'r's.
|
1.71 |
| 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.70 |
| 10-Jun-2001 |
sjg | Simplify the exporting of VAR_CMD's via MAKEFLAGS. We now just list the names of such variables in .MAKEOVERRIDES. When we come to export MAKEFLAGS we quote the value of each exported variable using :Q, using: ${.MAKEOVERRIDES:O:u:@v@$v=${$v:Q}@} The :O:u suppresses duplicate names. Also modifed Parse_DoVar to re-export MAKEFLAGS whenever .MAKEOVERRIDES is assigned to so .MAKEOVERRIDES+= PATH will export PATH=${PATH:Q} to the environment, while .MAKEOVERRIDES= will disable export of VAR_CMD's.
|
1.69 |
| 09-Jun-2001 |
sjg | Do a better job of duplicate suppression in .MAKEOVERRIDES. From Var_Set: We actually want the equivalent of .MAKEOVERRIDES:= ${.MAKEOVERRIDES:Nname=*} name='val' clearing the previous value for name is important, since doing simple duplicate suppression does not handle: $ make FOO=goo which then runs a sub-make with FOO=boo the commands from that sub-make should see just FOO=boo.
|
1.68 |
| 09-Jun-2001 |
sjg | Modify handling of command line variable assignments and their exporting via MAKEFLAGS. Instead of appending them directly to .MAKEFLAGS, put them in .MAKEOVERRIDES (and ensure they are quoted). This is now done in Var_Set when it exports VAR_CMD's. Use ExportMAKEFLAGS() to export MAKEFLAGS, using the combined content of .MAKEFLAGS and .MAKEOVERRIDES (with duplicate supression). If .MAKEFLAGS is assigned to in a Makefile, ExportMAKEFLAGS is called again. This allows a line like: .MAKEOVERRIDES= to effectively stop the exporting of the command line vars in MAKEFLAGS.
|
1.67 |
| 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.66 |
| 29-May-2001 |
christos | better error messages on exec* failures. From Simon Burge.
|
1.65 |
| 16-Jan-2001 |
cgd | Avoid accidental use of trigraphs. Pointed out by development version of gcc.
|
1.64 |
| 14-Jan-2001 |
christos | make the -W arg work; it was not put in the getopt string.
|
1.63 |
| 10-Jan-2001 |
christos | PR/11800: Chris Demetriou: Add -W flag to exit on parse warnings. While I am here, s/make:.*"/%s:\1", progname/
|
1.62 |
| 07-Jan-2001 |
sjg | ReadMakefile: Don't simply fopen() fname before checking if we are in separate objdir. This is the way freebsd does it, and apart from being more correct, saves a lot of pointless fopen() calls.
|
1.61 |
| 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.60 |
| 30-Dec-2000 |
sommerfeld | Avoid token leaks when aborting after an error.
|
1.59 |
| 30-Dec-2000 |
sommerfeld | strdup tracefile so that it doesn't get smashed.
|
1.58 |
| 30-Dec-2000 |
sommerfeld | Add a token-passing scheme to allow a recursive make to successfully use -j; all make's in a recursive build cooperate to limit the total number of jobs, using a token-passing scheme.
The current token passing algorithm is similar to the one implemented by gmake; there is a single pipe which is inherited through the entire process hierarchy; tokens are obtained by reading a byte from the "read end" of the pipe, and are returned by writing them to the "write end". This exact algorithm is likely to change in the future.
Implementation details: - Use the new trace facility to allow measurement of the effectiveness of different token-passing schemes - Get a token in MakeStartJobs(), return it in Make_Update() - Eliminate Job_Full() and the jobFull global since they are redundant with token system. - Add an "internal" -J option (to pass the token pipe fd's down to submakes) and a -T option for tracing. - Change how compatMake is forced so that -j means something when inherited by submakes. - When waiting for a token, poll the token-passing pipe as well as the output pipes of existing jobs.
|
1.57 |
| 06-Jun-2000 |
sjg | Check_Cwd_av: Ensure that word after a '(', '{' etc is considered a command, so that we spot the cd/chdir and don't put one in.
|
1.56 |
| 10-May-2000 |
sjg | branches: 1.56.2; Revert to the original behaviour wrt sysIncPath, ie if sysIncPath is an empty list, use DEFSYSPATH. The current behaviour may have been useful when DEFSYSMK was an absolute path (hasn't been the case since 1996), but right now make -m /no/such/dir will fail to find sys.mk and die.
|
1.55 |
| 29-Apr-2000 |
sjg | Allow MAKESYSPATH in the environment to override the default syspath.
|
1.54 |
| 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.53 |
| 16-Apr-2000 |
christos | prefix errors with the program name.
|
1.52 |
| 14-Apr-2000 |
simonb | Don't declare 'extern opt*' getopt variables.
|
1.51 |
| 08-Feb-2000 |
sjg | Make chdir_verify_path() do variable expansion on path in case someone wants to do freaky stuff with $MAKEOBJDIR. Initialize the Var system and set .CURDIR, MACHINE and MACHINE_ARCH before chdir_verify_path() is called.
|
1.50 |
| 15-Sep-1999 |
mycroft | Rework how :: dependencies are handled. Build a list of `cohorts' as before, but do *not* link each one into all the parent nodes; instead, copy the `cohort' lists into the stream of targets to be built inside Make_ExpandUse(). Also do the attribute propagation as a separate pass after parsing. This eliminates several O(n^2) algorithms.
|
1.49 |
| 15-Sep-1999 |
mycroft | More cleanup code bites it.
|
1.48 |
| 04-Sep-1999 |
christos | PR/8259: Chris Demetriou: Fix stack overflow bugs exposed by the glibc-2.1.1 Makefile. Use snprintf everywhere.
|
1.47 |
| 02-Aug-1999 |
hubertf | Save the walls, use fly swatters instead of machine guns! (s/sscanf/strtol/, per Christos)
|
1.46 |
| 02-Aug-1999 |
hubertf | Detect invalid arguments to -j and -L by using sscanf() instead of atoi(). Fixes PR 6743 by Assar Westerlund <assar@sics.se>
|
1.45 |
| 01-Nov-1998 |
itohy | Reduced memory leaks. I found some more leaks, but are not in inside of iterations.
|
1.44 |
| 01-Nov-1998 |
itohy | Avoid reading outside of allocated memory on command execution if the output is empty.
|
1.43 |
| 13-Oct-1998 |
wsanchez | Use __ARCHITECTURE__, if defined, as MACHINE_ARCH
|
1.42 |
| 02-Apr-1998 |
kleink | Need <time.h> for time() prototype.
|
1.41 |
| 28-Mar-1998 |
christos | PR/5225: Jason Thorpe: make with -j 4 and subdirs core-dumps. This revealed another long standing problem with pmake's port to bsd. .MAKE was not set as the manual page states. Set it and remove another typo in my last commit.
|
1.40 |
| 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.39 |
| 08-Nov-1997 |
lukem | getopt returns -1 not EOF, use memmove instead of bcopy
|
1.38 |
| 28-Sep-1997 |
lukem | branches: 1.38.2; wrap #include <sys/cdefs.h>, __RCSID(...) stuff in #ifndef MAKE_BOOTSTRAP
|
1.37 |
| 01-Jul-1997 |
christos | Add WARNS=1 RCSID police
|
1.36 |
| 08-May-1997 |
gwr | Add the new .NOPATH feature which can be used to disable .PATH search for particular targets, i.e. .depend, objects, etc. (from Christos).
|
1.35 |
| 08-May-1997 |
cjs | If the -m option is used, make will check for the existence of the directory specified, and add it to sysIncPath only if it exists. However, afterwards make tested for the presence of a -m option by checking to see if sysIncPath was an empty list, and assumed that the -m option was not used if it was empty. This obviously breaks if -m specified a non-existent directory. So I have added a flag that is set if the -m option is used, and I test that instead.
|
1.34 |
| 24-Mar-1997 |
gwr | Do not compile-in ${MACHINE} (as per PR#3386, OK'ed by christos)
|
1.33 |
| 28-Jan-1997 |
christos | make $MACHINE_ARCH settable from the environment.
|
1.32 |
| 31-Dec-1996 |
christos | - include <stdlib.h> to get getenv() prototype on SVR4 - if __STDC__ -> ifdef __STDC__ to appease SVR4
|
1.31 |
| 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.30 |
| 13-Aug-1996 |
christos | Add estrdup(), a checked version of strdup and use it.
|
1.29 |
| 28-May-1996 |
christos | - Move -D flags from Makefile to config.h and explain what they do. Add -Wall -Wno-unused to CFLAGS. Add new define SYSVVARSUB to enable SysV style variable substitutions and enable them. - Add SunOS style command substitutions via SUNSHCMD - Fix core dump with '{variable = value'
|
1.28 |
| 31-Mar-1996 |
christos | branches: 1.28.4; make emalloc and erealloc return void *; closes PR/2276
|
1.27 |
| 29-Mar-1996 |
jtc | Added erealloc() function that calls enomem() if the allocation fails (this is like the existing emalloc() function). Changed all realloc() calls to erealloc().
|
1.26 |
| 11-Mar-1996 |
christos | Jonathan Stone's fixes: main.c: Remove double include of <sys/resource.h>; if MACHINE is defined, use that instead of uname. Makefile: Add util.c.
|
1.25 |
| 06-Mar-1996 |
christos | Fix PR/2118; apply sysincludes patch.
|
1.24 |
| 04-Feb-1996 |
christos | fix pr/1421 and pr/1997
|
1.23 |
| 22-Nov-1995 |
christos | 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.22 |
| 08-Nov-1995 |
christos | - Turn compat mode on by default. It gets turned off when the -j without the -B flag is specified. [Thus you can use -j 1 to turn it off]. - Fix malloc -> emalloc as Gordon noted.
|
1.21 |
| 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.20 |
| 27-Sep-1995 |
jtc | include <signal.h> instead of <sys/signal.h>
|
1.19 |
| 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.18 |
| 06-Jan-1995 |
christos | Fixes from Paul Borman (prb@bsdi.com) 1. Honor environment variable $MACHINE if set over uname.machine 2. archives with :: are always out of date, even when they have no children. 3. VAR= a b c # comment, gets the trailing blanks trimmed, unless escaped by \. I'll have to read the posix manul to make sure that it is ok to handle escapes here.
|
1.17 |
| 30-Sep-1994 |
gwr | Get the name of this type of MACHINE from utsname so we can share an executable for similar machines. (i.e. m68k: amiga hp300, mac68k, sun3, ...)
|
1.16 |
| 23-Sep-1994 |
mycroft | Use getcwd(3), not getwd(3), and remove some old, unused compatibility code.
|
1.15 |
| 16-Jun-1994 |
jtc | Christos' fix for quoting variable extraction properly.
|
1.14 |
| 06-Jun-1994 |
jtc | Fixes from Christos Zoulas, who used purify, objectcenter and testcenter to find memory leaks and illegal memory accesses.
|
1.13 |
| 05-Mar-1994 |
cgd | fixes/improvements from Christos Zoulas <christos@deshaw.com>.
|
1.12 |
| 13-Jan-1994 |
jtc | Include appropriate header files to bring prototypes into scope.
|
1.11 |
| 22-Dec-1993 |
pk | Introduced ${.OBJDIR}. The variable is similar to .CURDIR but points at the directory where make builds the targets. It can be used to clean up those cumbersome Makefiles that have to guess at the "obj" directory.
|
1.10 |
| 17-Dec-1993 |
jtc | POSIX.2 added the -S flag (opposite of -k). It was allready there, just #ifdef'ed out.
|
1.9 |
| 15-Dec-1993 |
jtc | Fix bug (PR #42) with -j flag. Doesn't seem to do anything, but at least it doesn't dump core anymore.
|
1.8 |
| 04-Dec-1993 |
cgd | add MACHINE_ARCH
|
1.7 |
| 23-Oct-1993 |
cgd | add support for an obj.${MACHINE} dir, which will be used rather than obj, if both exist. basically, precedence is now: MAKEOBJDIR or (obj.${MACHINE} then obj) .
|
1.6 |
| 23-Aug-1993 |
cgd | fix from chmr@edvz.tu-graz.ac.at (Christoph Robitschko) to get things right if obj is a symlink and points to nowhere.
|
1.5 |
| 01-Aug-1993 |
mycroft | Add RCS identifiers.
|
1.4 |
| 08-Jul-1993 |
cgd | remember curdir as something other than ".", so that makes of things which include files in directories won't get hosed...
|
1.3 |
| 23-Mar-1993 |
cgd | made .CURDIR be absolute, not relative, thereby eliminating the need for some of the makefile trickery when making objects, and fixing a few .PATH bugs
|
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.28.4.1 |
| 26-Jan-1997 |
rat | Update make(1) from trunk, by request from Christos Zoulas. Fixes many bugs.
|
1.38.2.1 |
| 08-May-1998 |
mycroft | Sync with trunk, per request of christos.
|
1.56.2.1 |
| 23-Jun-2000 |
minoura | Sync w/ netbsd-1-5-base.
|
1.100.2.2 |
| 10-May-2004 |
tron | Pull up revision 1.102 (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.100.2.1 |
| 10-May-2004 |
tron | Pull up revision 1.101 (requested by sjg in ticket #282): Recognize -- (dash dash) and apply the usual interpretation. Notes: * The immediately previous version of make errored out on --, which is what needs fixing. * Historic bsd make silently ate -- and continued to process options, so this is a behavior change from that, too, but presumably there is more to gain in fixing it than in being bug-compatible.
|
1.126.2.2 |
| 19-May-2006 |
christos | Coverity CID 3147: Plug memory leak.
|
1.126.2.1 |
| 19-May-2006 |
christos | file main.c was added on branch chap-midi on 2006-05-19 17:21:47 +0000
|
1.137.2.2 |
| 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.137.2.1 |
| 20-Dec-2006 |
bouyer | branches: 1.137.2.1.2; Pull up following revision(s) (requested by dsl in ticket #285): usr.bin/make/cond.c: revision 1.36 usr.bin/make/parse.c: revision 1.121-1.124 usr.bin/make/make.h: revision 1.65 usr.bin/make/targ.c: revision 1.46 usr.bin/make/main.c: revision 1.138-1.139 Simplify the code that processes .if lines. It doesn't need a two-dimensional array to remember the states of .if lines. It would be even simpler if we didn't try to detect .else and .elif lines that follow .else lines. Unfortunately this isn't the code that is stupendously slow... Unknot this code slightly by avoiding 'break/return; else' and by putting the short parts of some conditionals first. First step towards speeding up the parsing of makefiles (esp. the unwanted parts of .if clauses). There should be no changes to the logic. There really is no point calling estrdup() to get a copy of the makefile name into every 'gnode' (aka target), instead just copy a pointer to the string and avoid freeing the original name when we close the file. I can't imagine any makefile set where this gives a larger footprint! Add anewline to the end of the error message output when the debug log file cannot be opened. Put the big block of code that was common to ParseDoInclude() and ParseTraditionalInclude() into a separate routine. Fix the 'use after free' and 'free on item not malloced' that got added to ParseTraditionalInclude() in Feb 2006 (rev 1.111). Kill the 'PTR' struct and put both its members into IFile. Remove the parameter from ParseEOF(), 1 of the 3 calls passed the wrong value! Fortunately another test stopped anything nasty happening, we'll use that test instead. Revert part of a recent commit. ParseEOF() shouldn't close the original file. Some minor changes: - Only test 'printVars' once. Has side effect of not trying to find the 'main' target for '-V varname'. - Only reap the single child process in Cmd_Exec(), I think this is for 'xx != cmd' so probobably no other children should exist. - Don't read and parse .depend if '-r' and '-V varname' are set. I suspect that .depend shouldn't affect the output of any -V command...
|
1.137.2.1.2.1 |
| 03-Sep-2007 |
wrstuden | Sync w/ NetBSD-4-RC_1
|
1.141.4.3 |
| 23-Mar-2008 |
matt | sync with HEAD
|
1.141.4.2 |
| 09-Jan-2008 |
matt | sync with HEAD
|
1.141.4.1 |
| 06-Nov-2007 |
matt | sync with HEAD
|
1.149.6.1 |
| 18-Sep-2008 |
wrstuden | Sync with wrstuden-revivesa-base-2.
|
1.166.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.194.2.2 |
| 05-Mar-2011 |
bouyer | Sync with HEAD
|
1.194.2.1 |
| 17-Feb-2011 |
bouyer | Sync with HEAD
|
1.198.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.198.2.2 |
| 30-Oct-2012 |
yamt | sync with head
|
1.198.2.1 |
| 23-May-2012 |
yamt | sync with head.
|
1.203.2.3 |
| 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.203.2.2 |
| 23-Jun-2013 |
tls | resync from head
|
1.203.2.1 |
| 25-Feb-2013 |
tls | resync with head
|
1.221.2.1 |
| 23-Jul-2013 |
riastradh | sync with HEAD
|
1.226.2.1 |
| 10-Aug-2014 |
tls | Rebase.
|
1.248.2.3 |
| 26-Apr-2017 |
pgoyette | Sync with HEAD
|
1.248.2.2 |
| 20-Mar-2017 |
pgoyette | Sync with HEAD
|
1.248.2.1 |
| 07-Jan-2017 |
pgoyette | Sync with HEAD. (Note that most of these changes are simply $NetBSD$ tag issues.)
|
1.254.2.1 |
| 21-Apr-2017 |
bouyer | Sync with HEAD
|
1.264.2.1 |
| 11-May-2017 |
pgoyette | Sync with HEAD
|
1.265.2.2 |
| 07-May-2021 |
martin | Pull up following revision(s) (requested by mrg in ticket #1678):
bin/pax/options.c: revision 1.119 usr.bin/config/scan.l: revision 1.32 usr.bin/make/main.c: revision 1.274 bin/pax/extern.h: revision 1.60 usr.bin/config/defs.h: revision 1.106 usr.bin/make/make.h: revision 1.105 sbin/newfs_udf/udf_create.c: revision 1.27 (patch) sbin/newfs_udf/newfs_udf.h: revision 1.7 (patch) usr.bin/config/main.c: revision 1.100 usr.sbin/installboot/Makefile: revisions 1.53,1.54 (patch) usr.sbin/installboot/installboot.h: revision 1.41 (patch) usr.sbin/installboot/machines.c: revisisons 1.41,1.42 (patch)
Avoid depending on common symbols.
|
1.265.2.1 |
| 18-Jul-2017 |
snj | Pull up following revision(s) (requested by jmcneill in ticket #113): usr.bin/make/main.c: 1.266-1.272 usr.bin/make/make.1: revision 1.267 move some code out of the gigantic main function; no functional change. -- -V: try to expand the variable again if the value contains a variable. -- simplify -- a variable that starts with \\ is not expanded. -- Remove previous variable expansion code; sjg had already added the code to do it. Note that the manual page already documents this behavior and does not need to change: -dV -V VAR: prints the raw variable -V VAR: prints the expanded variable -- make the code look like to 1.266 -- Add -v variable that always expands variables; restore -V the way it was.
|
1.273.6.1 |
| 30-Apr-2021 |
martin | Pull up following revision(s) (requested by mrg in ticket #1263):
bin/pax/options.c: revision 1.119 usr.bin/config/scan.l: revision 1.32 usr.bin/make/main.c: revision 1.274 bin/pax/extern.h: revision 1.60 usr.bin/config/defs.h: revision 1.106 usr.bin/make/make.h: revision 1.105 sbin/newfs_udf/udf_create.c: revision 1.27 (patch) sbin/newfs_udf/newfs_udf.h: revision 1.7 (patch) usr.bin/config/main.c: revision 1.100
Avoid depending on common symbols.
|
1.273.4.1 |
| 08-Apr-2020 |
martin | Merge changes from current as of 20200406
|
1.624.2.2 |
| 02-Aug-2025 |
perseant | Sync with HEAD
|
1.624.2.1 |
| 01-Jul-2024 |
perseant | Sync with HEAD.
|