The NetBSD Project

CVS log for src/usr.bin/make/main.c

[BACK] Up to [cvs.NetBSD.org] / src / usr.bin / make

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.636: download - view: text, markup, annotated - select for diffs
Sat Nov 23 22:59:51 2024 UTC (10 days, 23 hours ago) by rillig
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.635: preferred, colored
Changes since revision 1.635: +4 -3 lines
make: fix confusing error message when overriding a read-only variable

Revision 1.635: download - view: text, markup, annotated - select for diffs
Sun Nov 10 02:39:14 2024 UTC (3 weeks, 3 days ago) by sjg
Branches: MAIN
Diff to: previous 1.634: preferred, colored
Changes since revision 1.634: +16 -2 lines
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

Revision 1.634: download - view: text, markup, annotated - select for diffs
Tue Aug 27 04:52:14 2024 UTC (3 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.633: preferred, colored
Changes since revision 1.633: +4 -10 lines
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.

Revision 1.633: download - view: text, markup, annotated - select for diffs
Sun Aug 25 20:44:31 2024 UTC (3 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.632: preferred, colored
Changes since revision 1.632: +10 -4 lines
make: add more context to error message about recursive variables

Revision 1.632: download - view: text, markup, annotated - select for diffs
Thu Jul 11 20:09:16 2024 UTC (4 months, 3 weeks ago) by sjg
Branches: MAIN
Diff to: previous 1.631: preferred, colored
Changes since revision 1.631: +54 -33 lines
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

Revision 1.631: download - view: text, markup, annotated - select for diffs
Tue Jul 9 19:43:01 2024 UTC (4 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.630: preferred, colored
Changes since revision 1.630: +3 -3 lines
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.

Revision 1.630: download - view: text, markup, annotated - select for diffs
Sun Jul 7 09:54:12 2024 UTC (4 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.629: preferred, colored
Changes since revision 1.629: +5 -6 lines
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.

Revision 1.629: download - view: text, markup, annotated - select for diffs
Sun Jul 7 07:50:57 2024 UTC (4 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.628: preferred, colored
Changes since revision 1.628: +8 -2 lines
make: only generate code for cleanup functions in CLEANUP mode

Revision 1.628: download - view: text, markup, annotated - select for diffs
Sat Jul 6 21:35:48 2024 UTC (4 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.627: preferred, colored
Changes since revision 1.627: +3 -4 lines
make: clean up condition when printing an error

Revision 1.627: download - view: text, markup, annotated - select for diffs
Fri Jul 5 05:11:25 2024 UTC (5 months ago) by rillig
Branches: MAIN
Diff to: previous 1.626: preferred, colored
Changes since revision 1.626: +2 -3 lines
make: reduce lint-specific comments about ARGSUSED

Revision 1.626: download - view: text, markup, annotated - select for diffs
Thu Jul 4 20:18:40 2024 UTC (5 months ago) by rillig
Branches: MAIN
Diff to: previous 1.625: preferred, colored
Changes since revision 1.625: +17 -3 lines
make: on error, print the targets to be made

This helps to understand situations with several nested sub-makes in
varying directories.

Revision 1.624.2.1: download - view: text, markup, annotated - select for diffs
Mon Jul 1 01:01:15 2024 UTC (5 months ago) by perseant
Branches: perseant-exfatfs
Diff to: previous 1.624: preferred, colored; next MAIN 1.625: preferred, colored
Changes since revision 1.624: +11 -6 lines
Sync with HEAD.

Revision 1.625: download - view: text, markup, annotated - select for diffs
Sun Jun 30 11:37:21 2024 UTC (5 months ago) by rillig
Branches: MAIN
CVS tags: perseant-exfatfs-base-20240630
Diff to: previous 1.624: preferred, colored
Changes since revision 1.624: +11 -6 lines
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.

Revision 1.624: download - view: text, markup, annotated - select for diffs
Sun Jun 2 15:31:26 2024 UTC (6 months ago) by rillig
Branches: MAIN
CVS tags: perseant-exfatfs-base
Branch point for: perseant-exfatfs
Diff to: previous 1.623: preferred, colored
Changes since revision 1.623: +14 -15 lines
make: sync VarEvalMode constant names with their debug log names

Revision 1.623: download - view: text, markup, annotated - select for diffs
Sat Jun 1 20:19:41 2024 UTC (6 months ago) by rillig
Branches: MAIN
Diff to: previous 1.622: preferred, colored
Changes since revision 1.622: +3 -6 lines
make: fix memory leak in realpath cache

Revision 1.622: download - view: text, markup, annotated - select for diffs
Sat Jun 1 12:27:31 2024 UTC (6 months ago) by rillig
Branches: MAIN
Diff to: previous 1.621: preferred, colored
Changes since revision 1.621: +5 -7 lines
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.

Revision 1.621: download - view: text, markup, annotated - select for diffs
Sat Jun 1 12:17:41 2024 UTC (6 months ago) by rillig
Branches: MAIN
Diff to: previous 1.620: preferred, colored
Changes since revision 1.620: +3 -3 lines
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.

Revision 1.620: download - view: text, markup, annotated - select for diffs
Sat Jun 1 07:37:19 2024 UTC (6 months ago) by sjg
Branches: MAIN
Diff to: previous 1.619: preferred, colored
Changes since revision 1.619: +6 -5 lines
make: ensure loop termination in purge_relative_cached_realpaths

You cannot ignore the return from HashIter_Next

Revision 1.619: download - view: text, markup, annotated - select for diffs
Fri May 31 05:50:11 2024 UTC (6 months ago) by rillig
Branches: MAIN
Diff to: previous 1.618: preferred, colored
Changes since revision 1.618: +6 -7 lines
make: clean up API for iterating over hash tables

Revision 1.618: download - view: text, markup, annotated - select for diffs
Tue May 28 19:09:04 2024 UTC (6 months, 1 week ago) by sjg
Branches: MAIN
Diff to: previous 1.617: preferred, colored
Changes since revision 1.617: +6 -2 lines
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

Revision 1.617: download - view: text, markup, annotated - select for diffs
Fri May 24 23:02:46 2024 UTC (6 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.616: preferred, colored
Changes since revision 1.616: +4 -3 lines
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.

Revision 1.616: download - view: text, markup, annotated - select for diffs
Sun May 19 17:55:54 2024 UTC (6 months, 2 weeks ago) by sjg
Branches: MAIN
Diff to: previous 1.615: preferred, colored
Changes since revision 1.615: +2 -4 lines
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.

Revision 1.615: download - view: text, markup, annotated - select for diffs
Tue May 7 18:26:22 2024 UTC (6 months, 4 weeks ago) by sjg
Branches: MAIN
Diff to: previous 1.614: preferred, colored
Changes since revision 1.614: +3 -3 lines
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.

Revision 1.614: download - view: text, markup, annotated - select for diffs
Tue Apr 30 16:13:33 2024 UTC (7 months ago) by sjg
Branches: MAIN
Diff to: previous 1.613: preferred, colored
Changes since revision 1.613: +4 -2 lines
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.

Revision 1.613: download - view: text, markup, annotated - select for diffs
Sat Apr 27 17:33:46 2024 UTC (7 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.612: preferred, colored
Changes since revision 1.612: +6 -6 lines
make: simplify freeing of lists

Revision 1.612: download - view: text, markup, annotated - select for diffs
Sun Mar 10 02:53:37 2024 UTC (8 months, 3 weeks ago) by sjg
Branches: MAIN
Diff to: previous 1.611: preferred, colored
Changes since revision 1.611: +5 -2 lines
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:

Revision 1.611: download - view: text, markup, annotated - select for diffs
Fri Mar 1 16:41:42 2024 UTC (9 months ago) by sjg
Branches: MAIN
Diff to: previous 1.610: preferred, colored
Changes since revision 1.610: +3 -3 lines
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.

Revision 1.610: download - view: text, markup, annotated - select for diffs
Wed Feb 7 06:43:02 2024 UTC (9 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.609: preferred, colored
Changes since revision 1.609: +3 -17 lines
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@.

Revision 1.609: download - view: text, markup, annotated - select for diffs
Sun Jan 7 01:33:57 2024 UTC (10 months, 4 weeks ago) by sjg
Branches: MAIN
Diff to: previous 1.608: preferred, colored
Changes since revision 1.608: +3 -2 lines
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

Revision 1.608: download - view: text, markup, annotated - select for diffs
Fri Jan 5 23:22:06 2024 UTC (10 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.607: preferred, colored
Changes since revision 1.607: +5 -6 lines
make: miscellaneous cleanups

Revision 1.607: download - view: text, markup, annotated - select for diffs
Fri Jan 5 22:20:07 2024 UTC (10 months, 4 weeks ago) by sjg
Branches: MAIN
Diff to: previous 1.606: preferred, colored
Changes since revision 1.606: +32 -6 lines
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

Revision 1.606: download - view: text, markup, annotated - select for diffs
Wed Dec 27 00:45:37 2023 UTC (11 months, 1 week ago) by sjg
Branches: MAIN
Diff to: previous 1.605: preferred, colored
Changes since revision 1.605: +3 -3 lines
make: ensure shellPath is set before using it.

Revision 1.605: download - view: text, markup, annotated - select for diffs
Sun Dec 17 09:02:26 2023 UTC (11 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.604: preferred, colored
Changes since revision 1.604: +7 -12 lines
make: clean up unused return value of str2Lst_Append

No functional change.

Revision 1.604: download - view: text, markup, annotated - select for diffs
Sun Dec 17 08:53:55 2023 UTC (11 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.603: preferred, colored
Changes since revision 1.603: +23 -23 lines
make: clean up names of local variables

No binary change.

Revision 1.603: download - view: text, markup, annotated - select for diffs
Thu Nov 2 05:55:22 2023 UTC (13 months ago) by rillig
Branches: MAIN
Diff to: previous 1.602: preferred, colored
Changes since revision 1.602: +8 -8 lines
make: miscellaneous cleanups

No functional change.

Revision 1.602: download - view: text, markup, annotated - select for diffs
Thu Nov 2 05:40:49 2023 UTC (13 months ago) by rillig
Branches: MAIN
Diff to: previous 1.601: preferred, colored
Changes since revision 1.601: +9 -26 lines
make: clean up comments

No functional change.

Revision 1.601: download - view: text, markup, annotated - select for diffs
Thu Nov 2 04:50:44 2023 UTC (13 months ago) by rillig
Branches: MAIN
Diff to: previous 1.600: preferred, colored
Changes since revision 1.600: +3 -3 lines
make: inline a single-line cross-file function

No functional change.

Revision 1.600: download - view: text, markup, annotated - select for diffs
Tue Sep 19 17:43:43 2023 UTC (14 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.599: preferred, colored
Changes since revision 1.599: +6 -6 lines
make: clean up code for parsing the '-j' command line option

No binary change.

Revision 1.599: download - view: text, markup, annotated - select for diffs
Sun Sep 10 21:52:36 2023 UTC (14 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.598: preferred, colored
Changes since revision 1.598: +3 -3 lines
make: fix typo

Revision 1.598: download - view: text, markup, annotated - select for diffs
Sun Sep 10 11:41:32 2023 UTC (14 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.597: preferred, colored
Changes since revision 1.597: +5 -4 lines
make: add more details to usage message of -j option

Revision 1.597: download - view: text, markup, annotated - select for diffs
Sun Sep 10 10:18:05 2023 UTC (14 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.596: preferred, colored
Changes since revision 1.596: +10 -7 lines
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.

Revision 1.596: download - view: text, markup, annotated - select for diffs
Sat Sep 9 16:41:04 2023 UTC (14 months, 3 weeks ago) by sjg
Branches: MAIN
Diff to: previous 1.595: preferred, colored
Changes since revision 1.595: +8 -2 lines
Add .MAKE.JOBS.C to indicate wether -jC is supported

Revision 1.595: download - view: text, markup, annotated - select for diffs
Sat Sep 9 04:38:48 2023 UTC (14 months, 3 weeks ago) by mrg
Branches: MAIN
Diff to: previous 1.594: preferred, colored
Changes since revision 1.594: +3 -3 lines
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...

Revision 1.594: download - view: text, markup, annotated - select for diffs
Sat Sep 9 01:30:59 2023 UTC (14 months, 3 weeks ago) by sjg
Branches: MAIN
Diff to: previous 1.593: preferred, colored
Changes since revision 1.593: +23 -4 lines
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

Revision 1.593: download - view: text, markup, annotated - select for diffs
Tue Mar 28 14:39:31 2023 UTC (20 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.592: preferred, colored
Changes since revision 1.592: +3 -3 lines
make: declare all common symbols in headers, unexport others

No functional change.

Revision 1.592: download - view: text, markup, annotated - select for diffs
Sat Feb 25 00:07:08 2023 UTC (21 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.591: preferred, colored
Changes since revision 1.591: +4 -4 lines
make: rename function for parsing command line options

No binary change.

Revision 1.591: download - view: text, markup, annotated - select for diffs
Wed Feb 15 06:52:58 2023 UTC (21 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.590: preferred, colored
Changes since revision 1.590: +8 -8 lines
make: inline macros for variable names

The variable name '.MAKEOVERRIDES' was already used in the non-macro
form.

No binary change.

Revision 1.590: download - view: text, markup, annotated - select for diffs
Tue Feb 14 21:38:31 2023 UTC (21 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.589: preferred, colored
Changes since revision 1.589: +20 -25 lines
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.

Revision 1.589: download - view: text, markup, annotated - select for diffs
Thu Jan 26 20:48:17 2023 UTC (22 months, 1 week ago) by sjg
Branches: MAIN
Diff to: previous 1.588: preferred, colored
Changes since revision 1.588: +8 -8 lines
make: some variables should be read-only

Make variables like .newline and .MAKE.{GID,PID,PPID,UID} read-only.

Reviewed by: rillig

Revision 1.588: download - view: text, markup, annotated - select for diffs
Tue Jan 24 00:24:02 2023 UTC (22 months, 1 week ago) by sjg
Branches: MAIN
Diff to: previous 1.587: preferred, colored
Changes since revision 1.587: +7 -2 lines
make: .SYSPATH: to add dirs to sysIncPath

.SYSPATH: with no sources will clear sysIncPath
otherwise sources are added

Reviewed by: rillig

Revision 1.587: download - view: text, markup, annotated - select for diffs
Thu Jan 19 21:33:06 2023 UTC (22 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.586: preferred, colored
Changes since revision 1.586: +3 -3 lines
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.

Revision 1.586: download - view: text, markup, annotated - select for diffs
Sun Jan 1 16:46:26 2023 UTC (23 months ago) by rillig
Branches: MAIN
Diff to: previous 1.585: preferred, colored
Changes since revision 1.585: +3 -3 lines
make: don't assemble identifiers from smaller tokens

No binary change.

Revision 1.585: download - view: text, markup, annotated - select for diffs
Mon Oct 10 21:17:25 2022 UTC (2 years, 1 month ago) by rillig
Branches: MAIN
CVS tags: netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10
Diff to: previous 1.584: preferred, colored
Changes since revision 1.584: +6 -6 lines
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.

Revision 1.584: download - view: text, markup, annotated - select for diffs
Mon Oct 10 17:33:35 2022 UTC (2 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.583: preferred, colored
Changes since revision 1.583: +6 -2 lines
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

Revision 1.583: download - view: text, markup, annotated - select for diffs
Wed Sep 28 16:34:47 2022 UTC (2 years, 2 months ago) by sjg
Branches: MAIN
Diff to: previous 1.582: preferred, colored
Changes since revision 1.582: +6 -4 lines
Don't ignore return from snprintf or getcwd

Revision 1.582: download - view: text, markup, annotated - select for diffs
Sat May 7 17:49:47 2022 UTC (2 years, 6 months ago) by rillig
Branches: MAIN
Diff to: previous 1.581: preferred, colored
Changes since revision 1.581: +4 -2 lines
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.

Revision 1.581: download - view: text, markup, annotated - select for diffs
Sat May 7 08:01:20 2022 UTC (2 years, 6 months ago) by rillig
Branches: MAIN
Diff to: previous 1.580: preferred, colored
Changes since revision 1.580: +3 -7 lines
make: rename Compat_Run to Compat_MakeAll

No functional change.

Revision 1.580: download - view: text, markup, annotated - select for diffs
Mon Apr 18 15:06:27 2022 UTC (2 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.579: preferred, colored
Changes since revision 1.579: +3 -2 lines
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.

Revision 1.579: download - view: text, markup, annotated - select for diffs
Tue Mar 22 23:37:09 2022 UTC (2 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.578: preferred, colored
Changes since revision 1.578: +6 -11 lines
make: clean up comments and code for setting debug flags

No binary change.

Revision 1.578: download - view: text, markup, annotated - select for diffs
Wed Feb 9 20:52:06 2022 UTC (2 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.577: preferred, colored
Changes since revision 1.577: +3 -3 lines
make: prefix the warning about read-only .OBJDIR with a colon

For consistency with the other warnings.

Revision 1.577: download - view: text, markup, annotated - select for diffs
Sat Jan 29 09:38:26 2022 UTC (2 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.576: preferred, colored
Changes since revision 1.576: +3 -2 lines
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.

Revision 1.576: download - view: text, markup, annotated - select for diffs
Thu Jan 27 06:02:59 2022 UTC (2 years, 10 months ago) by sjg
Branches: MAIN
Diff to: previous 1.575: preferred, colored
Changes since revision 1.575: +3 -3 lines
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.

Revision 1.575: download - view: text, markup, annotated - select for diffs
Sat Jan 22 18:59:23 2022 UTC (2 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.574: preferred, colored
Changes since revision 1.574: +5 -7 lines
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.

Revision 1.574: download - view: text, markup, annotated - select for diffs
Sat Jan 22 16:24:45 2022 UTC (2 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.573: preferred, colored
Changes since revision 1.573: +5 -5 lines
make: clean up comments

Revision 1.573: download - view: text, markup, annotated - select for diffs
Sat Jan 15 22:18:04 2022 UTC (2 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.572: preferred, colored
Changes since revision 1.572: +3 -3 lines
make: remove extra semicolon after statement

Lint will complain about this very soon.

No binary change.

Revision 1.572: download - view: text, markup, annotated - select for diffs
Sat Jan 15 19:34:07 2022 UTC (2 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.571: preferred, colored
Changes since revision 1.571: +4 -7 lines
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.

Revision 1.571: download - view: text, markup, annotated - select for diffs
Sat Jan 15 19:05:23 2022 UTC (2 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.570: preferred, colored
Changes since revision 1.570: +3 -3 lines
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.

Revision 1.570: download - view: text, markup, annotated - select for diffs
Sat Jan 15 18:34:41 2022 UTC (2 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.569: preferred, colored
Changes since revision 1.569: +3 -10 lines
make: merge duplicate code for expanding variable expressions

No functional change.

Revision 1.569: download - view: text, markup, annotated - select for diffs
Mon Jan 10 20:32:28 2022 UTC (2 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.568: preferred, colored
Changes since revision 1.568: +3 -2 lines
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.

Revision 1.568: download - view: text, markup, annotated - select for diffs
Sun Jan 9 18:49:28 2022 UTC (2 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.567: preferred, colored
Changes since revision 1.567: +19 -23 lines
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.

Revision 1.567: download - view: text, markup, annotated - select for diffs
Fri Jan 7 21:00:49 2022 UTC (2 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.566: preferred, colored
Changes since revision 1.566: +5 -4 lines
make: have as few statements as possible between va_start and va_end

No functional change.

Revision 1.566: download - view: text, markup, annotated - select for diffs
Fri Jan 7 20:37:25 2022 UTC (2 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.565: preferred, colored
Changes since revision 1.565: +20 -20 lines
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.

Revision 1.565: download - view: text, markup, annotated - select for diffs
Sat Jan 1 21:41:50 2022 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.564: preferred, colored
Changes since revision 1.564: +3 -3 lines
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

Revision 1.564: download - view: text, markup, annotated - select for diffs
Sat Jan 1 19:53:40 2022 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.563: preferred, colored
Changes since revision 1.563: +17 -19 lines
make: reduce indentation in Main_SetObjdir

No functional change.

Revision 1.563: download - view: text, markup, annotated - select for diffs
Fri Dec 31 00:18:06 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.562: preferred, colored
Changes since revision 1.562: +3 -6 lines
make: unexport types VarAssignOp and VarAssign

These types are only needed in the parsing module.

No functional change.

Revision 1.562: download - view: text, markup, annotated - select for diffs
Tue Dec 28 21:56:13 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.561: preferred, colored
Changes since revision 1.561: +6 -10 lines
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'.

Revision 1.561: download - view: text, markup, annotated - select for diffs
Tue Dec 28 01:20:24 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.560: preferred, colored
Changes since revision 1.560: +14 -20 lines
make: clean up stylistically

No binary change.

Revision 1.560: download - view: text, markup, annotated - select for diffs
Tue Dec 28 01:11:36 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.559: preferred, colored
Changes since revision 1.559: +3 -3 lines
make: constify cached_realpath

No binary change.

Revision 1.559: download - view: text, markup, annotated - select for diffs
Mon Dec 27 23:44:06 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.558: preferred, colored
Changes since revision 1.558: +12 -16 lines
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.

Revision 1.558: download - view: text, markup, annotated - select for diffs
Mon Dec 27 23:19:41 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.557: preferred, colored
Changes since revision 1.557: +40 -44 lines
make: reduce indentation of Cmd_Exec

No functional change.

Revision 1.557: download - view: text, markup, annotated - select for diffs
Mon Dec 27 23:11:55 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.556: preferred, colored
Changes since revision 1.556: +4 -11 lines
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.

Revision 1.556: download - view: text, markup, annotated - select for diffs
Mon Dec 27 23:06:19 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.555: preferred, colored
Changes since revision 1.555: +5 -7 lines
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.

Revision 1.555: download - view: text, markup, annotated - select for diffs
Mon Dec 27 22:57:26 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.554: preferred, colored
Changes since revision 1.554: +4 -4 lines
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.

Revision 1.554: download - view: text, markup, annotated - select for diffs
Mon Dec 27 22:22:48 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.553: preferred, colored
Changes since revision 1.553: +4 -4 lines
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.

Revision 1.553: download - view: text, markup, annotated - select for diffs
Mon Dec 27 21:27:25 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.552: preferred, colored
Changes since revision 1.552: +11 -11 lines
make: narrow down the return type of ReadMakefile

No functional change.

Revision 1.552: download - view: text, markup, annotated - select for diffs
Mon Dec 27 21:21:17 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.551: preferred, colored
Changes since revision 1.551: +13 -13 lines
make: rename local variables to be simpler

No binary change.

Revision 1.551: download - view: text, markup, annotated - select for diffs
Mon Dec 27 20:59:59 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.550: preferred, colored
Changes since revision 1.550: +15 -20 lines
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.

Revision 1.550: download - view: text, markup, annotated - select for diffs
Mon Dec 27 18:54:19 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.549: preferred, colored
Changes since revision 1.549: +27 -79 lines
make: clean up comments

Revision 1.549: download - view: text, markup, annotated - select for diffs
Mon Dec 27 18:26:22 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.548: preferred, colored
Changes since revision 1.548: +9 -9 lines
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.

Revision 1.548: download - view: text, markup, annotated - select for diffs
Mon Dec 27 17:18:57 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.547: preferred, colored
Changes since revision 1.547: +7 -11 lines
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.

Revision 1.547: download - view: text, markup, annotated - select for diffs
Wed Dec 15 12:58:01 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.546: preferred, colored
Changes since revision 1.546: +31 -16 lines
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.

Revision 1.546: download - view: text, markup, annotated - select for diffs
Wed Dec 15 12:24:13 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.545: preferred, colored
Changes since revision 1.545: +8 -7 lines
make: use consistent indentation for statements and continuations

No binary change, except for line numbers in assertions in suff.c.

Revision 1.545: download - view: text, markup, annotated - select for diffs
Wed Dec 15 11:01:39 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.544: preferred, colored
Changes since revision 1.544: +4 -4 lines
make: remove bmake_free

It was only used in 2 places, and in both these places, the pointer was
never null.

Revision 1.544: download - view: text, markup, annotated - select for diffs
Wed Dec 15 10:57:01 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.543: preferred, colored
Changes since revision 1.543: +3 -2 lines
make: in CLEANUP mode, free interned strings at the very end

Noticed by sjg.

Revision 1.543: download - view: text, markup, annotated - select for diffs
Mon Dec 13 22:26:21 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.542: preferred, colored
Changes since revision 1.542: +25 -25 lines
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.

Revision 1.542: download - view: text, markup, annotated - select for diffs
Mon Dec 13 05:25:04 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.541: preferred, colored
Changes since revision 1.541: +3 -2 lines
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.

Revision 1.541: download - view: text, markup, annotated - select for diffs
Sat Aug 14 13:32:12 2021 UTC (3 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.540: preferred, colored
Changes since revision 1.540: +3 -3 lines
make: rename variable and function for handling parse errors

The word 'fatals' was an unnecessary abbreviation.

No functional change.

Revision 1.540: download - view: text, markup, annotated - select for diffs
Fri Jun 18 12:54:17 2021 UTC (3 years, 5 months ago) by rillig
Branches: MAIN
Diff to: previous 1.539: preferred, colored
Changes since revision 1.539: +9 -9 lines
make: clean up access to character iterator

Having both p[0] and *p intermixed was inconsistent.

No functional change.

Revision 1.265.2.2: download - view: text, markup, annotated - select for diffs
Fri May 7 17:40:31 2021 UTC (3 years, 6 months ago) by martin
Branches: netbsd-8
CVS tags: netbsd-8-3-RELEASE
Diff to: previous 1.265.2.1: preferred, colored; branchpoint 1.265: preferred, colored; next MAIN 1.266: preferred, colored
Changes since revision 1.265.2.1: +5 -3 lines
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.

Revision 1.273.6.1: download - view: text, markup, annotated - select for diffs
Fri Apr 30 14:07:02 2021 UTC (3 years, 7 months ago) by martin
Branches: netbsd-9
CVS tags: netbsd-9-4-RELEASE, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE
Diff to: previous 1.273: preferred, colored; next MAIN 1.274: preferred, colored
Changes since revision 1.273: +5 -3 lines
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.

Revision 1.539: download - view: text, markup, annotated - select for diffs
Mon Apr 19 16:35:11 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
CVS tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Diff to: previous 1.538: preferred, colored
Changes since revision 1.538: +3 -3 lines
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 '/'.

Revision 1.538: download - view: text, markup, annotated - select for diffs
Wed Apr 14 17:24:48 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.537: preferred, colored
Changes since revision 1.537: +8 -8 lines
make: turn run-time string concatenation into compile-time

No functional change.

Revision 1.537: download - view: text, markup, annotated - select for diffs
Wed Apr 14 17:20:48 2021 UTC (3 years, 7 months ago) by rillig
Branches: MAIN
Diff to: previous 1.536: preferred, colored
Changes since revision 1.536: +3 -3 lines
make: remove unnecessary modifier ':U' for certain fixed expressions

No functional change, since the expression is evaluated using
VARE_WANTRES, not using VARE_UNDEFERR.

Revision 1.536: download - view: text, markup, annotated - select for diffs
Sun Apr 4 10:13:09 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.535: preferred, colored
Changes since revision 1.535: +3 -3 lines
make: remove filler word 'Do' from function names for parsing

No functional change, except for debug logging.

Revision 1.535: download - view: text, markup, annotated - select for diffs
Sun Apr 4 10:05:08 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.534: preferred, colored
Changes since revision 1.534: +3 -3 lines
make: rename a few functions to be more descriptive

No functional change.

Revision 1.534: download - view: text, markup, annotated - select for diffs
Sat Apr 3 11:08:40 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.533: preferred, colored
Changes since revision 1.533: +112 -112 lines
make: use C99 bool type instead of defining its own

No functional change.

Revision 1.533: download - view: text, markup, annotated - select for diffs
Fri Feb 5 19:19:17 2021 UTC (3 years, 9 months ago) by sjg
Branches: MAIN
Diff to: previous 1.532: preferred, colored
Changes since revision 1.532: +11 -9 lines
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.

Revision 1.532: download - view: text, markup, annotated - select for diffs
Fri Feb 5 05:15:12 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.531: preferred, colored
Changes since revision 1.531: +13 -13 lines
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.

Revision 1.531: download - view: text, markup, annotated - select for diffs
Fri Feb 5 04:41:17 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.530: preferred, colored
Changes since revision 1.530: +3 -3 lines
make: add shortcut Global_Delete for deleting a global variable

Revision 1.530: download - view: text, markup, annotated - select for diffs
Thu Feb 4 21:33:13 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.529: preferred, colored
Changes since revision 1.529: +27 -27 lines
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.

Revision 1.529: download - view: text, markup, annotated - select for diffs
Wed Feb 3 13:53:12 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.528: preferred, colored
Changes since revision 1.528: +36 -36 lines
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.

Revision 1.528: download - view: text, markup, annotated - select for diffs
Wed Feb 3 08:08:18 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.527: preferred, colored
Changes since revision 1.527: +26 -26 lines
make: replace Global_SetExpand with Global_Set for constant names

Revision 1.527: download - view: text, markup, annotated - select for diffs
Wed Feb 3 08:00:36 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.526: preferred, colored
Changes since revision 1.526: +61 -61 lines
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.

Revision 1.526: download - view: text, markup, annotated - select for diffs
Mon Feb 1 21:04:10 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.525: preferred, colored
Changes since revision 1.525: +3 -3 lines
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.

Revision 1.525: download - view: text, markup, annotated - select for diffs
Mon Feb 1 20:01:26 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.524: preferred, colored
Changes since revision 1.524: +17 -14 lines
make: clean up main.c

Revision 1.524: download - view: text, markup, annotated - select for diffs
Mon Feb 1 19:53:31 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.523: preferred, colored
Changes since revision 1.523: +10 -15 lines
make: simplify MakeMode

Revision 1.523: download - view: text, markup, annotated - select for diffs
Mon Feb 1 19:46:58 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.522: preferred, colored
Changes since revision 1.522: +5 -5 lines
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.

Revision 1.522: download - view: text, markup, annotated - select for diffs
Mon Feb 1 19:43:07 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.521: preferred, colored
Changes since revision 1.521: +14 -14 lines
make: rename functions for parsing command line arguments

The function names now match the names around them.

Revision 1.521: download - view: text, markup, annotated - select for diffs
Mon Feb 1 19:39:31 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.520: preferred, colored
Changes since revision 1.520: +12 -13 lines
make: clean up comments

Revision 1.520: download - view: text, markup, annotated - select for diffs
Sat Jan 30 21:25:10 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.519: preferred, colored
Changes since revision 1.519: +4 -4 lines
make(1): inline Buf_Len

Revision 1.519: download - view: text, markup, annotated - select for diffs
Sat Jan 30 21:03:32 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.518: preferred, colored
Changes since revision 1.518: +3 -3 lines
make(1): inline Buf_GetAll

Revision 1.518: download - view: text, markup, annotated - select for diffs
Sat Jan 30 20:53:29 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.517: preferred, colored
Changes since revision 1.517: +4 -4 lines
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).

Revision 1.517: download - view: text, markup, annotated - select for diffs
Sun Jan 24 20:11:55 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.516: preferred, colored
Changes since revision 1.516: +4 -4 lines
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.

Revision 1.516: download - view: text, markup, annotated - select for diffs
Sat Jan 23 11:34:41 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.515: preferred, colored
Changes since revision 1.515: +7 -7 lines
make(1): rename Dir_AddDir, reorder parameters of SearchPath_ToFlags

Revision 1.515: download - view: text, markup, annotated - select for diffs
Sat Jan 23 10:48:49 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.514: preferred, colored
Changes since revision 1.514: +4 -3 lines
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.

Revision 1.514: download - view: text, markup, annotated - select for diffs
Tue Jan 19 20:51:46 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.513: preferred, colored
Changes since revision 1.513: +3 -3 lines
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.

Revision 1.513: download - view: text, markup, annotated - select for diffs
Sat Jan 16 20:49:31 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.512: preferred, colored
Changes since revision 1.512: +3 -3 lines
make(1): fix a few inconsistencies for lint's strict bool mode

Revision 1.512: download - view: text, markup, annotated - select for diffs
Sun Jan 10 23:59:53 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.511: preferred, colored
Changes since revision 1.511: +6 -6 lines
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.

Revision 1.511: download - view: text, markup, annotated - select for diffs
Sun Jan 10 21:20:46 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.510: preferred, colored
Changes since revision 1.510: +3 -3 lines
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.

Revision 1.510: download - view: text, markup, annotated - select for diffs
Sat Jan 9 16:06:09 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.509: preferred, colored
Changes since revision 1.509: +7 -7 lines
make(1): fix lint warnings

Revision 1.509: download - view: text, markup, annotated - select for diffs
Fri Jan 8 21:46:50 2021 UTC (3 years, 10 months ago) by sjg
Branches: MAIN
Diff to: previous 1.508: preferred, colored
Changes since revision 1.508: +7 -7 lines
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:

Revision 1.508: download - view: text, markup, annotated - select for diffs
Thu Dec 31 17:39:36 2020 UTC (3 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.507: preferred, colored
Changes since revision 1.507: +5 -5 lines
make(1): replace pointers in controlling conditions with booleans

Revision 1.507: download - view: text, markup, annotated - select for diffs
Wed Dec 30 10:03:16 2020 UTC (3 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.506: preferred, colored
Changes since revision 1.506: +58 -30 lines
make(1): format multi-line comments

Revision 1.506: download - view: text, markup, annotated - select for diffs
Mon Dec 28 00:46:24 2020 UTC (3 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.505: preferred, colored
Changes since revision 1.505: +2 -3 lines
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.

Revision 1.505: download - view: text, markup, annotated - select for diffs
Sun Dec 27 11:47:04 2020 UTC (3 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.504: preferred, colored
Changes since revision 1.504: +6 -6 lines
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.

Revision 1.504: download - view: text, markup, annotated - select for diffs
Sun Dec 27 05:16:26 2020 UTC (3 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.503: preferred, colored
Changes since revision 1.503: +4 -4 lines
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.

Revision 1.503: download - view: text, markup, annotated - select for diffs
Sat Dec 26 03:54:48 2020 UTC (3 years, 11 months ago) by sjg
Branches: MAIN
Diff to: previous 1.502: preferred, colored
Changes since revision 1.502: +3 -4 lines
Use .MAKE.DEPENDFILE as makefiles set it

Revision 1.502: download - view: text, markup, annotated - select for diffs
Wed Dec 23 14:13:49 2020 UTC (3 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.501: preferred, colored
Changes since revision 1.501: +6 -5 lines
make(1): fix a few lint warnings

Revision 1.501: download - view: text, markup, annotated - select for diffs
Wed Dec 23 13:50:54 2020 UTC (3 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.500: preferred, colored
Changes since revision 1.500: +5 -5 lines
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".

Revision 1.500: download - view: text, markup, annotated - select for diffs
Sun Dec 20 14:39:46 2020 UTC (3 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.499: preferred, colored
Changes since revision 1.499: +16 -17 lines
make(1): remove constant parameter from MakeMode

Revision 1.499: download - view: text, markup, annotated - select for diffs
Sun Dec 20 14:32:13 2020 UTC (3 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.498: preferred, colored
Changes since revision 1.498: +30 -36 lines
make(1): change return type of Var_Value to FStr

Revision 1.498: download - view: text, markup, annotated - select for diffs
Sun Dec 13 20:14:48 2020 UTC (3 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.497: preferred, colored
Changes since revision 1.497: +3 -6 lines
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.

Revision 1.497: download - view: text, markup, annotated - select for diffs
Sun Dec 13 20:09:02 2020 UTC (3 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.496: preferred, colored
Changes since revision 1.496: +3 -3 lines
make(1): constify progname

Revision 1.496: download - view: text, markup, annotated - select for diffs
Sun Dec 13 02:01:43 2020 UTC (3 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.495: preferred, colored
Changes since revision 1.495: +3 -2 lines
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.

Revision 1.495: download - view: text, markup, annotated - select for diffs
Sat Dec 12 18:53:53 2020 UTC (3 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.494: preferred, colored
Changes since revision 1.494: +3 -3 lines
make(1): rename Var_ExportVars to Var_ReexportVars

Revision 1.494: download - view: text, markup, annotated - select for diffs
Fri Dec 11 23:00:59 2020 UTC (3 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.493: preferred, colored
Changes since revision 1.493: +6 -6 lines
make(1): clean up comments for command line options

Revision 1.493: download - view: text, markup, annotated - select for diffs
Fri Dec 11 22:48:31 2020 UTC (3 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.492: preferred, colored
Changes since revision 1.492: +3 -7 lines
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.

Revision 1.492: download - view: text, markup, annotated - select for diffs
Sat Dec 5 18:38:02 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.491: preferred, colored
Changes since revision 1.491: +3 -3 lines
make(1): define constants for enum zero-values

Revision 1.491: download - view: text, markup, annotated - select for diffs
Tue Dec 1 19:28:32 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.490: preferred, colored
Changes since revision 1.490: +3 -3 lines
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.

Revision 1.490: download - view: text, markup, annotated - select for diffs
Sun Nov 29 01:40:26 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.489: preferred, colored
Changes since revision 1.489: +3 -3 lines
make(1): reduce memory allocation for dirSearchPath

Revision 1.489: download - view: text, markup, annotated - select for diffs
Sun Nov 29 00:42:01 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.488: preferred, colored
Changes since revision 1.488: +3 -3 lines
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.

Revision 1.488: download - view: text, markup, annotated - select for diffs
Sun Nov 29 00:04:22 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.487: preferred, colored
Changes since revision 1.487: +8 -8 lines
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.

Revision 1.487: download - view: text, markup, annotated - select for diffs
Sat Nov 28 23:43:14 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.486: preferred, colored
Changes since revision 1.486: +8 -8 lines
make(1): reduce memory allocation in ReadBuiltinRules

Revision 1.486: download - view: text, markup, annotated - select for diffs
Sat Nov 28 23:39:58 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.485: preferred, colored
Changes since revision 1.485: +9 -9 lines
make(1): reduce memory allocation for CmdOpts.create

Revision 1.485: download - view: text, markup, annotated - select for diffs
Sat Nov 28 23:35:44 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.484: preferred, colored
Changes since revision 1.484: +6 -6 lines
make(1): reduce memory allocation in CmdOpts.variables

Revision 1.484: download - view: text, markup, annotated - select for diffs
Sat Nov 28 23:32:22 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.483: preferred, colored
Changes since revision 1.483: +13 -9 lines
make(1): reduce memory allocation in CmdOpts.makefiles

Revision 1.483: download - view: text, markup, annotated - select for diffs
Sat Nov 28 18:55:52 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.482: preferred, colored
Changes since revision 1.482: +3 -3 lines
make(1): remove pointer indirection from GNode.commands

Just to save a few memory allocations.  No noticeable effect on the
performance though.

Revision 1.482: download - view: text, markup, annotated - select for diffs
Sat Nov 28 10:00:25 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.481: preferred, colored
Changes since revision 1.481: +10 -10 lines
make(1): rename local variable in Cmd_Exec

It conflicts with the global fds in job.c.

Revision 1.481: download - view: text, markup, annotated - select for diffs
Sat Nov 28 08:40:05 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.480: preferred, colored
Changes since revision 1.480: +5 -5 lines
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.

Revision 1.480: download - view: text, markup, annotated - select for diffs
Wed Nov 25 00:50:44 2020 UTC (4 years ago) by sjg
Branches: MAIN
Diff to: previous 1.479: preferred, colored
Changes since revision 1.479: +6 -2 lines
Add .MAKE.UID and .MAKE.GID

Revision 1.479: download - view: text, markup, annotated - select for diffs
Tue Nov 24 19:52:06 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.478: preferred, colored
Changes since revision 1.478: +4 -6 lines
make(1): fix indentation for short expressions in main.c

Revision 1.478: download - view: text, markup, annotated - select for diffs
Mon Nov 23 23:41:11 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.477: preferred, colored
Changes since revision 1.477: +3 -3 lines
make(1): use comparisons in boolean expressions

The generated code stays exactly the same.

Revision 1.477: download - view: text, markup, annotated - select for diffs
Mon Nov 23 20:52:59 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.476: preferred, colored
Changes since revision 1.476: +4 -4 lines
make(1): use properly typed comparisons in boolean contexts

Revision 1.476: download - view: text, markup, annotated - select for diffs
Mon Nov 16 22:08:20 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.475: preferred, colored
Changes since revision 1.475: +4 -5 lines
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.

Revision 1.475: download - view: text, markup, annotated - select for diffs
Mon Nov 16 18:28:27 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.474: preferred, colored
Changes since revision 1.474: +7 -7 lines
make(1): use postfix increment where possible

Revision 1.474: download - view: text, markup, annotated - select for diffs
Sun Nov 15 09:54:16 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.473: preferred, colored
Changes since revision 1.473: +13 -21 lines
make(1): clean up ParseBoolean

Revision 1.473: download - view: text, markup, annotated - select for diffs
Sun Nov 15 09:38:44 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.472: preferred, colored
Changes since revision 1.472: +13 -15 lines
make(1): clean up getTmpdir

Reduce indentation, structure code into paragraphs.

Revision 1.472: download - view: text, markup, annotated - select for diffs
Sun Nov 15 09:33:50 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.471: preferred, colored
Changes since revision 1.471: +25 -20 lines
make(1): clean up PrintOnError

No functional change.

Revision 1.471: download - view: text, markup, annotated - select for diffs
Sun Nov 15 08:12:35 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.470: preferred, colored
Changes since revision 1.470: +4 -3 lines
make(1): fix previous commit for parse_debug_options

Revision 1.470: download - view: text, markup, annotated - select for diffs
Sun Nov 15 08:10:15 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.469: preferred, colored
Changes since revision 1.469: +26 -24 lines
make(1): reduce code size of parse_debug_options

Each access to a global variable requires a relocation.  Skip these.

Revision 1.469: download - view: text, markup, annotated - select for diffs
Sat Nov 14 23:03:08 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.468: preferred, colored
Changes since revision 1.468: +26 -40 lines
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.

Revision 1.468: download - view: text, markup, annotated - select for diffs
Sat Nov 14 22:19:13 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.467: preferred, colored
Changes since revision 1.467: +3 -3 lines
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.

Revision 1.467: download - view: text, markup, annotated - select for diffs
Sat Nov 14 22:16:17 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.466: preferred, colored
Changes since revision 1.466: +3 -3 lines
make(1): fix trailing whitespace in usage (since 2009-08-27)

Revision 1.466: download - view: text, markup, annotated - select for diffs
Sat Nov 14 21:55:22 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.465: preferred, colored
Changes since revision 1.465: +5 -7 lines
make(1): don't modify progname in usage

Revision 1.465: download - view: text, markup, annotated - select for diffs
Sat Nov 14 18:36:27 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.464: preferred, colored
Changes since revision 1.464: +9 -7 lines
make(1): clean up Fatal

Use the shortest possible scope between va_start and the corresponding
va_end.

Revision 1.464: download - view: text, markup, annotated - select for diffs
Sat Nov 14 18:14:34 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.463: preferred, colored
Changes since revision 1.463: +5 -5 lines
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.

Revision 1.463: download - view: text, markup, annotated - select for diffs
Sat Nov 14 18:07:26 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.462: preferred, colored
Changes since revision 1.462: +4 -4 lines
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.

Revision 1.462: download - view: text, markup, annotated - select for diffs
Sat Nov 14 17:39:59 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.461: preferred, colored
Changes since revision 1.461: +7 -6 lines
make(1): remove redundant parameter from str2Lst_Append

Revision 1.461: download - view: text, markup, annotated - select for diffs
Sat Nov 14 17:39:14 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.460: preferred, colored
Changes since revision 1.460: +5 -5 lines
make(1): rename Main_SetVarObjdir to SetVarObjdir

Only exported functions should be prefixed with the module name.

Revision 1.460: download - view: text, markup, annotated - select for diffs
Sat Nov 14 17:29:41 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.459: preferred, colored
Changes since revision 1.459: +4 -4 lines
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.

Revision 1.459: download - view: text, markup, annotated - select for diffs
Sat Nov 14 15:58:01 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.458: preferred, colored
Changes since revision 1.458: +4 -4 lines
make(1): rename DEFAULT to defaultNode

In C, uppercase names are typically used for constants, and this is not
a constant.

Revision 1.458: download - view: text, markup, annotated - select for diffs
Fri Nov 13 19:45:24 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.457: preferred, colored
Changes since revision 1.457: +4 -6 lines
make(1): clean up preprocessor macros in InitVarMachine

Revision 1.457: download - view: text, markup, annotated - select for diffs
Fri Nov 13 08:21:37 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.456: preferred, colored
Changes since revision 1.456: +5 -9 lines
make(1): flatten #ifdef in InitVarMachineArch

Without proper indentation, that chain of nested #ifndef directives was
really hard to read.

Revision 1.456: download - view: text, markup, annotated - select for diffs
Thu Nov 12 23:35:21 2020 UTC (4 years ago) by sjg
Branches: MAIN
Diff to: previous 1.455: preferred, colored
Changes since revision 1.455: +16 -14 lines
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

Revision 1.455: download - view: text, markup, annotated - select for diffs
Sun Nov 8 23:38:02 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.454: preferred, colored
Changes since revision 1.454: +7 -6 lines
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.

Revision 1.454: download - view: text, markup, annotated - select for diffs
Sun Nov 8 15:07:37 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.453: preferred, colored
Changes since revision 1.453: +9 -9 lines
make(1): use strict typing in conditions of the form !var

Revision 1.453: download - view: text, markup, annotated - select for diffs
Sun Nov 8 14:50:24 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.452: preferred, colored
Changes since revision 1.452: +394 -391 lines
make(1): reformat main.c more closely to share/misc/style

Revision 1.452: download - view: text, markup, annotated - select for diffs
Sun Nov 8 14:19:15 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.451: preferred, colored
Changes since revision 1.451: +4 -7 lines
make(1): remove redundant comment from main_ReadFiles

The code has become so simple that it made the comment redundant.

Revision 1.451: download - view: text, markup, annotated - select for diffs
Sun Nov 8 13:10:30 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.450: preferred, colored
Changes since revision 1.450: +6 -6 lines
make(1): rename init_machine to InitVarMachine

For consistency with the other Init functions.

Revision 1.450: download - view: text, markup, annotated - select for diffs
Sun Nov 8 13:05:03 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.449: preferred, colored
Changes since revision 1.449: +22 -23 lines
make(1): move usage further to the top

This avoids a forward declaration.

Revision 1.449: download - view: text, markup, annotated - select for diffs
Sun Nov 8 12:50:57 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.448: preferred, colored
Changes since revision 1.448: +13 -19 lines
make(1): move documentation from main to the phase functions

Revision 1.448: download - view: text, markup, annotated - select for diffs
Sun Nov 8 12:40:04 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.447: preferred, colored
Changes since revision 1.447: +83 -57 lines
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.

Revision 1.447: download - view: text, markup, annotated - select for diffs
Sun Nov 8 12:21:27 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.446: preferred, colored
Changes since revision 1.446: +46 -49 lines
make(1): indent main consistently

Revision 1.446: download - view: text, markup, annotated - select for diffs
Sun Nov 8 12:14:14 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.445: preferred, colored
Changes since revision 1.445: +9 -11 lines
make(1): inline ReadMakefileSucceeded into ReadFirstDefaultMakefile

This gets rid of a few void pointers and an unused function parameter.

Revision 1.445: download - view: text, markup, annotated - select for diffs
Sun Nov 8 12:02:16 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.444: preferred, colored
Changes since revision 1.444: +16 -6 lines
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.

Revision 1.444: download - view: text, markup, annotated - select for diffs
Sun Nov 8 08:53:22 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.443: preferred, colored
Changes since revision 1.443: +4 -6 lines
make(1): use common indentation style for else

Revision 1.443: download - view: text, markup, annotated - select for diffs
Sun Nov 8 02:56:43 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.442: preferred, colored
Changes since revision 1.442: +29 -20 lines
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.

Revision 1.442: download - view: text, markup, annotated - select for diffs
Sun Nov 8 02:05:34 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.441: preferred, colored
Changes since revision 1.441: +9 -7 lines
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.

Revision 1.441: download - view: text, markup, annotated - select for diffs
Sun Nov 8 01:56:54 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.440: preferred, colored
Changes since revision 1.440: +4 -2 lines
make(1): add remarks for missing command line options in MAKEFLAGS

Revision 1.440: download - view: text, markup, annotated - select for diffs
Sun Nov 8 01:52:24 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.439: preferred, colored
Changes since revision 1.439: +5 -4 lines
make(1): parse the internal option -J strictly

Revision 1.439: download - view: text, markup, annotated - select for diffs
Sun Nov 8 01:43:58 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.438: preferred, colored
Changes since revision 1.438: +5 -7 lines
make(1): merge duplicate code in is_relpath

Revision 1.438: download - view: text, markup, annotated - select for diffs
Sun Nov 8 01:40:01 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.437: preferred, colored
Changes since revision 1.437: +12 -21 lines
make(1): clean up overview comment in main.c

Revision 1.437: download - view: text, markup, annotated - select for diffs
Sun Nov 8 01:39:24 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.436: preferred, colored
Changes since revision 1.436: +8 -8 lines
make(1): fix type mismatch between int and PrintVarsMode

Revision 1.436: download - view: text, markup, annotated - select for diffs
Sat Nov 7 21:40:08 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.435: preferred, colored
Changes since revision 1.435: +3 -3 lines
make(1): remove trailing whitespace

Revision 1.435: download - view: text, markup, annotated - select for diffs
Sat Nov 7 14:11:58 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.434: preferred, colored
Changes since revision 1.434: +4 -4 lines
make(1): make API of Buf_Init simpler

In most cases, the caller doesn't want to specify the exact number of
preallocated bytes.

Revision 1.434: download - view: text, markup, annotated - select for diffs
Sat Nov 7 10:25:28 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.433: preferred, colored
Changes since revision 1.433: +4 -3 lines
make(1): document InitDefSysIncPath

Revision 1.433: download - view: text, markup, annotated - select for diffs
Sat Nov 7 10:16:18 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.432: preferred, colored
Changes since revision 1.432: +11 -11 lines
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.

Revision 1.432: download - view: text, markup, annotated - select for diffs
Fri Nov 6 23:11:11 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.431: preferred, colored
Changes since revision 1.431: +27 -27 lines
make(1): rename getBoolean and s2Boolean

Revision 1.431: download - view: text, markup, annotated - select for diffs
Fri Nov 6 23:05:20 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.430: preferred, colored
Changes since revision 1.430: +4 -4 lines
make(1): fix comment of Error

Revision 1.430: download - view: text, markup, annotated - select for diffs
Fri Nov 6 23:04:20 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.429: preferred, colored
Changes since revision 1.429: +10 -23 lines
make(1): clean up Cmd_Exec stylistically

Revision 1.429: download - view: text, markup, annotated - select for diffs
Fri Nov 6 21:20:31 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.428: preferred, colored
Changes since revision 1.428: +8 -9 lines
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.

Revision 1.428: download - view: text, markup, annotated - select for diffs
Fri Nov 6 21:01:43 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.427: preferred, colored
Changes since revision 1.427: +3 -3 lines
make(1): fix typo from previous commit

Revision 1.427: download - view: text, markup, annotated - select for diffs
Fri Nov 6 20:59:52 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.426: preferred, colored
Changes since revision 1.426: +3 -3 lines
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.

Revision 1.426: download - view: text, markup, annotated - select for diffs
Thu Nov 5 17:27:16 2020 UTC (4 years ago) by rillig
Branches: MAIN
Diff to: previous 1.425: preferred, colored
Changes since revision 1.425: +13 -13 lines
make(1): remove redundant parentheses from sizeof operator

The parentheses are only needed if the argument is a type, not an
expression.

Revision 1.425: download - view: text, markup, annotated - select for diffs
Wed Nov 4 13:29:42 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.424: preferred, colored
Changes since revision 1.424: +2 -4 lines
make(1): move declaration of parseIncPath from main.c to make.h

Revision 1.424: download - view: text, markup, annotated - select for diffs
Wed Nov 4 13:22:15 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.423: preferred, colored
Changes since revision 1.423: +4 -4 lines
make(1): rename MAKEFILE_PREFERENCE for consistency

The names of the other special variables are all prefixed with MAKE_.

Revision 1.423: download - view: text, markup, annotated - select for diffs
Wed Nov 4 04:49:32 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.422: preferred, colored
Changes since revision 1.422: +3 -5 lines
make(1): negate discardUndefined to preserveUndefined

Revision 1.422: download - view: text, markup, annotated - select for diffs
Wed Nov 4 03:37:51 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.421: preferred, colored
Changes since revision 1.421: +4 -4 lines
make(1): rename oldVars to discardUndefined

While here, moved all the documentation about this variable into a
single place.

Revision 1.421: download - view: text, markup, annotated - select for diffs
Sun Nov 1 00:24:57 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.420: preferred, colored
Changes since revision 1.420: +8 -4 lines
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.

Revision 1.420: download - view: text, markup, annotated - select for diffs
Sat Oct 31 21:09:22 2020 UTC (4 years, 1 month ago) by sjg
Branches: MAIN
Diff to: previous 1.419: preferred, colored
Changes since revision 1.419: +5 -3 lines
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

Revision 1.419: download - view: text, markup, annotated - select for diffs
Sat Oct 31 16:13:00 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.418: preferred, colored
Changes since revision 1.418: +3 -3 lines
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...

Revision 1.418: download - view: text, markup, annotated - select for diffs
Sat Oct 31 11:34:30 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.417: preferred, colored
Changes since revision 1.417: +3 -3 lines
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.

Revision 1.417: download - view: text, markup, annotated - select for diffs
Sat Oct 31 09:35:58 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.416: preferred, colored
Changes since revision 1.416: +8 -8 lines
make(1): remove redundant :tl from getBoolean

Uppercase and lowercase letters are already handled the same by
s2Boolean, which makes the :tl modifier redundant.

Revision 1.416: download - view: text, markup, annotated - select for diffs
Sat Oct 31 09:27:19 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.415: preferred, colored
Changes since revision 1.415: +16 -18 lines
make(1): remove redundant null check from s2Boolean

Revision 1.415: download - view: text, markup, annotated - select for diffs
Sat Oct 31 09:23:38 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.414: preferred, colored
Changes since revision 1.414: +5 -16 lines
make(1): write s2Boolean in a more compact form

Revision 1.414: download - view: text, markup, annotated - select for diffs
Sat Oct 31 09:20:07 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.413: preferred, colored
Changes since revision 1.413: +8 -8 lines
make(1): clean up mkTempFile

Revision 1.413: download - view: text, markup, annotated - select for diffs
Sat Oct 31 06:18:21 2020 UTC (4 years, 1 month ago) by sjg
Branches: MAIN
Diff to: previous 1.412: preferred, colored
Changes since revision 1.412: +3 -3 lines
Do not use an objdir that is not writable.

Revision 1.412: download - view: text, markup, annotated - select for diffs
Fri Oct 30 20:30:44 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.411: preferred, colored
Changes since revision 1.411: +21 -15 lines
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.

Revision 1.411: download - view: text, markup, annotated - select for diffs
Fri Oct 30 15:39:17 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.410: preferred, colored
Changes since revision 1.410: +3 -3 lines
make(1): fix indentation in source code

Revision 1.410: download - view: text, markup, annotated - select for diffs
Fri Oct 30 07:19:30 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.409: preferred, colored
Changes since revision 1.409: +12 -12 lines
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.

Revision 1.409: download - view: text, markup, annotated - select for diffs
Wed Oct 28 03:21:25 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.408: preferred, colored
Changes since revision 1.408: +12 -10 lines
make(1): rename defIncPath to defSysIncPath

There are two variables, parseIncPath and sysIncPath, which made the
name defIncPath ambiguous.

Revision 1.408: download - view: text, markup, annotated - select for diffs
Tue Oct 27 19:16:46 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.407: preferred, colored
Changes since revision 1.407: +35 -24 lines
make(1): extract InitMaxJobs from main

Revision 1.407: download - view: text, markup, annotated - select for diffs
Tue Oct 27 18:16:19 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.406: preferred, colored
Changes since revision 1.406: +26 -20 lines
make(1): extract InitObjdir from main

Revision 1.406: download - view: text, markup, annotated - select for diffs
Tue Oct 27 18:12:15 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.405: preferred, colored
Changes since revision 1.405: +19 -24 lines
make(1): make InitVarMake simpler and document its intention

Revision 1.405: download - view: text, markup, annotated - select for diffs
Tue Oct 27 17:36:17 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.404: preferred, colored
Changes since revision 1.404: +30 -22 lines
make(1): extract InitVarMake from main

Revision 1.404: download - view: text, markup, annotated - select for diffs
Tue Oct 27 17:09:09 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.403: preferred, colored
Changes since revision 1.403: +13 -9 lines
make(1): extract InitRandom from main

Revision 1.403: download - view: text, markup, annotated - select for diffs
Tue Oct 27 08:05:20 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.402: preferred, colored
Changes since revision 1.402: +27 -21 lines
make(1): extract ReadMakefiles from main

Revision 1.402: download - view: text, markup, annotated - select for diffs
Tue Oct 27 08:00:20 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.401: preferred, colored
Changes since revision 1.401: +36 -30 lines
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.

Revision 1.401: download - view: text, markup, annotated - select for diffs
Tue Oct 27 07:51:43 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.400: preferred, colored
Changes since revision 1.400: +4 -4 lines
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.

Revision 1.400: download - view: text, markup, annotated - select for diffs
Tue Oct 27 07:44:43 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.399: preferred, colored
Changes since revision 1.399: +36 -31 lines
make(1): extract InitVpath from main

Revision 1.399: download - view: text, markup, annotated - select for diffs
Tue Oct 27 07:38:08 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.398: preferred, colored
Changes since revision 1.398: +3 -9 lines
make(1): use constant string for Var_Subst

The times where Var_Subst needed a modifiable string are long gone.

Revision 1.398: download - view: text, markup, annotated - select for diffs
Tue Oct 27 07:34:36 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.397: preferred, colored
Changes since revision 1.397: +19 -15 lines
make(1): extract ReadBuiltinRules from main

Revision 1.397: download - view: text, markup, annotated - select for diffs
Tue Oct 27 07:28:33 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.396: preferred, colored
Changes since revision 1.396: +43 -35 lines
make(1): extract InitDefIncPath from main

Revision 1.396: download - view: text, markup, annotated - select for diffs
Tue Oct 27 07:16:27 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.395: preferred, colored
Changes since revision 1.395: +6 -6 lines
make(1): initialize all CmdOpts fiels

Revision 1.395: download - view: text, markup, annotated - select for diffs
Tue Oct 27 07:13:02 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.394: preferred, colored
Changes since revision 1.394: +29 -18 lines
make(1): extract CmdOpts_Init from main

Revision 1.394: download - view: text, markup, annotated - select for diffs
Tue Oct 27 07:03:55 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.393: preferred, colored
Changes since revision 1.393: +5 -6 lines
make(1): move debugVflag to CmdOpts

Revision 1.393: download - view: text, markup, annotated - select for diffs
Tue Oct 27 06:59:20 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.392: preferred, colored
Changes since revision 1.392: +18 -15 lines
make(1): extract UnlimitFiles from main

Revision 1.392: download - view: text, markup, annotated - select for diffs
Mon Oct 26 23:28:52 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.391: preferred, colored
Changes since revision 1.391: +8 -35 lines
make(1): remove "Results: none" from the documentation of void functions

Revision 1.391: download - view: text, markup, annotated - select for diffs
Mon Oct 26 21:34:10 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.390: preferred, colored
Changes since revision 1.390: +109 -129 lines
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.

Revision 1.390: download - view: text, markup, annotated - select for diffs
Sun Oct 25 19:19:07 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.389: preferred, colored
Changes since revision 1.389: +3 -3 lines
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.

Revision 1.389: download - view: text, markup, annotated - select for diffs
Sun Oct 25 17:37:36 2020 UTC (4 years, 1 month ago) by sjg
Branches: MAIN
Diff to: previous 1.388: preferred, colored
Changes since revision 1.388: +10 -7 lines
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

Revision 1.388: download - view: text, markup, annotated - select for diffs
Sat Oct 24 20:29:40 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.387: preferred, colored
Changes since revision 1.387: +3 -3 lines
make(1): convert macros for debug flags into enum

Revision 1.387: download - view: text, markup, annotated - select for diffs
Sat Oct 24 10:36:23 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.386: preferred, colored
Changes since revision 1.386: +3 -3 lines
make(1): remove unused Lst_Find and Lst_FindFrom

Revision 1.386: download - view: text, markup, annotated - select for diffs
Sat Oct 24 09:28:50 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.385: preferred, colored
Changes since revision 1.385: +12 -22 lines
make(1): inline ReadMakefileFailed, eliminating some void pointers

Revision 1.385: download - view: text, markup, annotated - select for diffs
Fri Oct 23 06:27:39 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.384: preferred, colored
Changes since revision 1.384: +24 -20 lines
make(1): remove void pointers from addErrorCMD

Revision 1.384: download - view: text, markup, annotated - select for diffs
Thu Oct 22 07:12:13 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.383: preferred, colored
Changes since revision 1.383: +16 -12 lines
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.

Revision 1.383: download - view: text, markup, annotated - select for diffs
Thu Oct 22 07:01:25 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.382: preferred, colored
Changes since revision 1.382: +27 -21 lines
make(1): extract PrintVar from doPrintVars

Revision 1.382: download - view: text, markup, annotated - select for diffs
Thu Oct 22 06:54:51 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.381: preferred, colored
Changes since revision 1.381: +25 -18 lines
make(1): clean up HandlePWD

Revision 1.381: download - view: text, markup, annotated - select for diffs
Thu Oct 22 06:38:52 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.380: preferred, colored
Changes since revision 1.380: +42 -32 lines
make(1): extract HandlePWD from main

Revision 1.380: download - view: text, markup, annotated - select for diffs
Thu Oct 22 05:50:02 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.379: preferred, colored
Changes since revision 1.379: +3 -3 lines
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.

Revision 1.379: download - view: text, markup, annotated - select for diffs
Mon Oct 19 21:57:37 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.378: preferred, colored
Changes since revision 1.378: +4 -4 lines
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.

Revision 1.378: download - view: text, markup, annotated - select for diffs
Sun Oct 18 13:02:10 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.377: preferred, colored
Changes since revision 1.377: +6 -6 lines
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.

Revision 1.377: download - view: text, markup, annotated - select for diffs
Sun Oct 18 12:47:43 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.376: preferred, colored
Changes since revision 1.376: +4 -4 lines
make(1): rename HashEntry.name to key

Revision 1.376: download - view: text, markup, annotated - select for diffs
Sun Oct 18 12:36:43 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.375: preferred, colored
Changes since revision 1.375: +3 -3 lines
make(1): remove underscore from Hash_Table and Hash_Entry

For consistency with the other type names, such as GNodeListNode.

Revision 1.375: download - view: text, markup, annotated - select for diffs
Sun Oct 18 11:54:43 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.374: preferred, colored
Changes since revision 1.374: +3 -3 lines
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.

Revision 1.374: download - view: text, markup, annotated - select for diffs
Sun Oct 18 10:44:25 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.373: preferred, colored
Changes since revision 1.373: +7 -6 lines
make(1): make API for iterating over hash tables simpler

Revision 1.373: download - view: text, markup, annotated - select for diffs
Sun Oct 18 08:01:23 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.372: preferred, colored
Changes since revision 1.372: +31 -28 lines
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.

Revision 1.372: download - view: text, markup, annotated - select for diffs
Sun Oct 18 07:46:04 2020 UTC (4 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.371: preferred, colored
Changes since revision 1.371: +6 -5 lines
make(1): replace execError with execDie

All calls to this function were followed by _exit(1).

Revision 1.371: download - view: text, markup, annotated - select for diffs
Mon Oct 5 22:45:47 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.370: preferred, colored
Changes since revision 1.370: +10 -11 lines
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.

Revision 1.370: download - view: text, markup, annotated - select for diffs
Mon Oct 5 21:37:07 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.369: preferred, colored
Changes since revision 1.369: +5 -5 lines
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.

Revision 1.369: download - view: text, markup, annotated - select for diffs
Mon Oct 5 19:27:47 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.368: preferred, colored
Changes since revision 1.368: +74 -60 lines
make(1): revert previous commit

It had accidentally reverted all the work from the past few days.

Revision 1.368: download - view: text, markup, annotated - select for diffs
Mon Oct 5 19:24:29 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.367: preferred, colored
Changes since revision 1.367: +60 -74 lines
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.

Revision 1.367: download - view: text, markup, annotated - select for diffs
Mon Oct 5 17:33:21 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.366: preferred, colored
Changes since revision 1.366: +60 -42 lines
make(1): extract init_machine and init_machine_arch from main

Revision 1.366: download - view: text, markup, annotated - select for diffs
Sun Oct 4 19:36:32 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.365: preferred, colored
Changes since revision 1.365: +7 -5 lines
make(1): remove duplicate code for parsing a variable name

Revision 1.365: download - view: text, markup, annotated - select for diffs
Sun Oct 4 08:22:59 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.364: preferred, colored
Changes since revision 1.364: +5 -11 lines
make(1): make documentation of Error more precise

Revision 1.364: download - view: text, markup, annotated - select for diffs
Sat Oct 3 21:52:50 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.363: preferred, colored
Changes since revision 1.363: +2 -6 lines
make(1): clean up #include sections

Revision 1.363: download - view: text, markup, annotated - select for diffs
Sat Oct 3 13:22:39 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.362: preferred, colored
Changes since revision 1.362: +5 -4 lines
make(1): replace backslash-newline with ordinary string literals

The character sequence backslash-newline is not mentioned in ISO C99.

Revision 1.362: download - view: text, markup, annotated - select for diffs
Sat Oct 3 13:06:56 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.361: preferred, colored
Changes since revision 1.361: +5 -2 lines
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.

Revision 1.361: download - view: text, markup, annotated - select for diffs
Thu Oct 1 23:52:51 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.360: preferred, colored
Changes since revision 1.360: +5 -19 lines
make(1): clean up documentation of Main_ParseArgLine

The previous documentation contained lots of irrelevant implementation
details.

Revision 1.360: download - view: text, markup, annotated - select for diffs
Thu Oct 1 23:44:36 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.359: preferred, colored
Changes since revision 1.359: +4 -4 lines
make(1): add missing const for Parse_AddIncludeDir

Revision 1.359: download - view: text, markup, annotated - select for diffs
Thu Oct 1 23:42:22 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.358: preferred, colored
Changes since revision 1.358: +7 -17 lines
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.

Revision 1.358: download - view: text, markup, annotated - select for diffs
Thu Oct 1 23:28:01 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.357: preferred, colored
Changes since revision 1.357: +15 -15 lines
make(1): format code in MainParseArgs

Revision 1.357: download - view: text, markup, annotated - select for diffs
Thu Oct 1 23:20:48 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.356: preferred, colored
Changes since revision 1.356: +21 -15 lines
make(1): extract handling of the -m option into separate function

Revision 1.356: download - view: text, markup, annotated - select for diffs
Thu Oct 1 23:14:07 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.355: preferred, colored
Changes since revision 1.355: +49 -35 lines
make(1): extract option handling for -j/-J into separate functions

Revision 1.355: download - view: text, markup, annotated - select for diffs
Thu Oct 1 23:06:56 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.354: preferred, colored
Changes since revision 1.354: +26 -21 lines
make(1): extract MainParseArgChdir into separate function

This removes the struct stat from MainParseArg.

Revision 1.354: download - view: text, markup, annotated - select for diffs
Thu Oct 1 23:02:07 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.353: preferred, colored
Changes since revision 1.353: +198 -184 lines
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.

Revision 1.353: download - view: text, markup, annotated - select for diffs
Thu Oct 1 22:42:00 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.352: preferred, colored
Changes since revision 1.352: +2 -3 lines
make(1): remove redundant function prototypes

Revision 1.352: download - view: text, markup, annotated - select for diffs
Mon Sep 28 20:46:11 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.351: preferred, colored
Changes since revision 1.351: +4 -6 lines
make(1): make debugging code shorter

Revision 1.351: download - view: text, markup, annotated - select for diffs
Sun Sep 27 21:35:16 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.350: preferred, colored
Changes since revision 1.350: +10 -10 lines
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.

Revision 1.350: download - view: text, markup, annotated - select for diffs
Sun Sep 27 16:52:22 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.349: preferred, colored
Changes since revision 1.349: +3 -3 lines
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.

Revision 1.349: download - view: text, markup, annotated - select for diffs
Sat Sep 26 17:39:45 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.348: preferred, colored
Changes since revision 1.348: +3 -3 lines
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.

Revision 1.348: download - view: text, markup, annotated - select for diffs
Sat Sep 26 17:15:20 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.347: preferred, colored
Changes since revision 1.347: +4 -4 lines
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.)

Revision 1.347: download - view: text, markup, annotated - select for diffs
Sat Sep 26 16:55:58 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.346: preferred, colored
Changes since revision 1.346: +3 -3 lines
make(1): replace a few Lst_ForEachUntil with simpler Lst_ForEach

Revision 1.346: download - view: text, markup, annotated - select for diffs
Sat Sep 26 16:00:12 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.345: preferred, colored
Changes since revision 1.345: +4 -4 lines
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.

Revision 1.345: download - view: text, markup, annotated - select for diffs
Fri Sep 25 23:18:59 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.344: preferred, colored
Changes since revision 1.344: +9 -16 lines
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.

Revision 1.344: download - view: text, markup, annotated - select for diffs
Fri Sep 25 19:40:23 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.343: preferred, colored
Changes since revision 1.343: +45 -33 lines
make(1): extract parsing of the -dF option into separate function

Revision 1.343: download - view: text, markup, annotated - select for diffs
Fri Sep 25 19:24:56 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.342: preferred, colored
Changes since revision 1.342: +24 -17 lines
make(1): extract InitVarTarget from main

Revision 1.342: download - view: text, markup, annotated - select for diffs
Thu Sep 24 07:11:29 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.341: preferred, colored
Changes since revision 1.341: +3 -3 lines
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.

Revision 1.341: download - view: text, markup, annotated - select for diffs
Tue Sep 22 20:19:46 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.340: preferred, colored
Changes since revision 1.340: +42 -22 lines
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.

Revision 1.340: download - view: text, markup, annotated - select for diffs
Tue Sep 22 19:51:19 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.339: preferred, colored
Changes since revision 1.339: +5 -9 lines
make(1): fix unnecessary length limitation for -v option

Revision 1.339: download - view: text, markup, annotated - select for diffs
Tue Sep 22 05:12:08 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.338: preferred, colored
Changes since revision 1.338: +3 -3 lines
make(1): fix type of global variable 'create'

Revision 1.338: download - view: text, markup, annotated - select for diffs
Tue Sep 22 04:05:41 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.337: preferred, colored
Changes since revision 1.337: +13 -13 lines
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.

Revision 1.337: download - view: text, markup, annotated - select for diffs
Sun Sep 13 15:15:51 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.336: preferred, colored
Changes since revision 1.336: +8 -19 lines
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.

Revision 1.336: download - view: text, markup, annotated - select for diffs
Sun Sep 13 06:15:29 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.335: preferred, colored
Changes since revision 1.335: +4 -4 lines
make(1): remove #endif comments for very short blocks

Revision 1.335: download - view: text, markup, annotated - select for diffs
Sun Sep 13 06:05:56 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.334: preferred, colored
Changes since revision 1.334: +3 -6 lines
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).

Revision 1.334: download - view: text, markup, annotated - select for diffs
Sun Sep 13 05:56:32 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.333: preferred, colored
Changes since revision 1.333: +5 -13 lines
make(1): consense documentation for Fatal

Revision 1.333: download - view: text, markup, annotated - select for diffs
Sat Sep 12 15:15:51 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.332: preferred, colored
Changes since revision 1.332: +3 -10 lines
make(1): move PrintAddr to where it belongs

Revision 1.332: download - view: text, markup, annotated - select for diffs
Fri Sep 11 17:32:36 2020 UTC (4 years, 2 months ago) by rillig
Branches: MAIN
Diff to: previous 1.331: preferred, colored
Changes since revision 1.331: +4 -4 lines
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.

Revision 1.331: download - view: text, markup, annotated - select for diffs
Sun Aug 30 19:56:02 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.330: preferred, colored
Changes since revision 1.330: +8 -11 lines
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.

Revision 1.330: download - view: text, markup, annotated - select for diffs
Sun Aug 30 11:15:05 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.329: preferred, colored
Changes since revision 1.329: +7 -7 lines
make(1): rename Lst_Datum to LstNode_Datum

Revision 1.329: download - view: text, markup, annotated - select for diffs
Sat Aug 29 13:16:54 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.328: preferred, colored
Changes since revision 1.328: +7 -12 lines
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.

Revision 1.328: download - view: text, markup, annotated - select for diffs
Sat Aug 29 13:04:30 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.327: preferred, colored
Changes since revision 1.327: +10 -16 lines
make(1): make getBoolean simpler

This function is so seldom used that there is no point having
complicated code for it.

Revision 1.327: download - view: text, markup, annotated - select for diffs
Sat Aug 29 10:41:12 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.326: preferred, colored
Changes since revision 1.326: +5 -5 lines
make(1): rename LstNode functions to match their type

Revision 1.326: download - view: text, markup, annotated - select for diffs
Sat Aug 29 10:12:06 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.325: preferred, colored
Changes since revision 1.325: +8 -8 lines
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.

Revision 1.325: download - view: text, markup, annotated - select for diffs
Sat Aug 29 09:30:10 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.324: preferred, colored
Changes since revision 1.324: +24 -16 lines
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.

Revision 1.324: download - view: text, markup, annotated - select for diffs
Sat Aug 29 08:59:08 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.323: preferred, colored
Changes since revision 1.323: +4 -4 lines
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.

Revision 1.323: download - view: text, markup, annotated - select for diffs
Sat Aug 29 07:52:55 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.322: preferred, colored
Changes since revision 1.322: +6 -5 lines
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.

Revision 1.322: download - view: text, markup, annotated - select for diffs
Sat Aug 29 07:13:17 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.321: preferred, colored
Changes since revision 1.321: +17 -15 lines
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.

Revision 1.321: download - view: text, markup, annotated - select for diffs
Sat Aug 29 07:05:12 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.320: preferred, colored
Changes since revision 1.320: +7 -18 lines
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.

Revision 1.320: download - view: text, markup, annotated - select for diffs
Fri Aug 28 04:48:57 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.319: preferred, colored
Changes since revision 1.319: +27 -27 lines
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.

Revision 1.319: download - view: text, markup, annotated - select for diffs
Fri Aug 28 04:28:45 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.318: preferred, colored
Changes since revision 1.318: +6 -6 lines
make(1): migrate Lst_Find to Lst_FindS

Revision 1.318: download - view: text, markup, annotated - select for diffs
Fri Aug 28 04:14:31 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.317: preferred, colored
Changes since revision 1.317: +5 -5 lines
make(1): migrate Lst_First to Lst_FirstS

Revision 1.317: download - view: text, markup, annotated - select for diffs
Thu Aug 27 19:15:35 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.316: preferred, colored
Changes since revision 1.316: +8 -8 lines
make(1): migrate Lst_IsEmpty to Lst_IsEmptyS

Revision 1.316: download - view: text, markup, annotated - select for diffs
Thu Aug 27 07:00:29 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.315: preferred, colored
Changes since revision 1.315: +5 -6 lines
make(1): migrate Lst_Succ to Lst_SuccS

Revision 1.315: download - view: text, markup, annotated - select for diffs
Thu Aug 27 06:53:57 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.314: preferred, colored
Changes since revision 1.314: +4 -4 lines
make(1): migrate Lst_ForEach to Lst_ForEachS

Most lists are always valid.  Only the "targets" variable may be null in
some cases, probably.

Revision 1.314: download - view: text, markup, annotated - select for diffs
Wed Aug 26 22:55:46 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.313: preferred, colored
Changes since revision 1.313: +8 -8 lines
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.

Revision 1.313: download - view: text, markup, annotated - select for diffs
Tue Aug 25 16:50:02 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.312: preferred, colored
Changes since revision 1.312: +4 -4 lines
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.

Revision 1.312: download - view: text, markup, annotated - select for diffs
Sun Aug 23 18:26:35 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.311: preferred, colored
Changes since revision 1.311: +6 -6 lines
make(1): make brk_string return size_t for the number of words

Revision 1.311: download - view: text, markup, annotated - select for diffs
Sun Aug 23 16:58:02 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.310: preferred, colored
Changes since revision 1.310: +6 -6 lines
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.

Revision 1.310: download - view: text, markup, annotated - select for diffs
Sat Aug 22 18:47:31 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.309: preferred, colored
Changes since revision 1.309: +3 -5 lines
make(1): remove unused variable jobServer

Revision 1.309: download - view: text, markup, annotated - select for diffs
Sat Aug 22 17:34:25 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.308: preferred, colored
Changes since revision 1.308: +4 -4 lines
make(1): fix indentation

Revision 1.308: download - view: text, markup, annotated - select for diffs
Sat Aug 22 15:17:09 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.307: preferred, colored
Changes since revision 1.307: +8 -10 lines
make(1): replace Lst_Datum with non-null guaranteeing Lst_DatumS

Revision 1.307: download - view: text, markup, annotated - select for diffs
Sat Aug 22 11:35:00 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.306: preferred, colored
Changes since revision 1.306: +7 -7 lines
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.

Revision 1.306: download - view: text, markup, annotated - select for diffs
Sat Aug 22 00:48:02 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.305: preferred, colored
Changes since revision 1.305: +5 -5 lines
make(1): split Dir_Init into two functions

There's just no point in having a function consisting of a big
if-then-else.

Revision 1.305: download - view: text, markup, annotated - select for diffs
Fri Aug 21 02:20:47 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.304: preferred, colored
Changes since revision 1.304: +7 -7 lines
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.

Revision 1.304: download - view: text, markup, annotated - select for diffs
Tue Aug 11 18:52:03 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.303: preferred, colored
Changes since revision 1.303: +7 -14 lines
make(1): replace snprintf/malloc in ReadMakefile with str_concat3

Revision 1.303: download - view: text, markup, annotated - select for diffs
Mon Aug 10 19:53:19 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.302: preferred, colored
Changes since revision 1.302: +4 -4 lines
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.

Revision 1.302: download - view: text, markup, annotated - select for diffs
Sun Aug 9 09:44:14 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.301: preferred, colored
Changes since revision 1.301: +5 -5 lines
make(1): clean up indentation, includes, add documentation

Revision 1.301: download - view: text, markup, annotated - select for diffs
Sun Aug 9 09:27:44 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.300: preferred, colored
Changes since revision 1.300: +3 -4 lines
make(1): remove outdated comment

Revision 1.300: download - view: text, markup, annotated - select for diffs
Sun Aug 9 09:26:21 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.299: preferred, colored
Changes since revision 1.299: +6 -9 lines
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.

Revision 1.299: download - view: text, markup, annotated - select for diffs
Sun Aug 9 09:07:54 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.298: preferred, colored
Changes since revision 1.298: +6 -13 lines
make(1): remove redundant assignment from Cmd_Exec

A Buffer is always null-terminated.

Revision 1.298: download - view: text, markup, annotated - select for diffs
Sun Aug 9 09:01:29 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.297: preferred, colored
Changes since revision 1.297: +16 -18 lines
make(1): split local variable in Cmd_Exec into two

This avoids a mismatch between signed and unsigned types.

Revision 1.297: download - view: text, markup, annotated - select for diffs
Sat Aug 8 18:54:04 2020 UTC (4 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.296: preferred, colored
Changes since revision 1.296: +5 -5 lines
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.

Revision 1.296: download - view: text, markup, annotated - select for diffs
Mon Aug 3 20:26:09 2020 UTC (4 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.295: preferred, colored
Changes since revision 1.295: +19 -12 lines
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.

Revision 1.295: download - view: text, markup, annotated - select for diffs
Sun Aug 2 08:06:35 2020 UTC (4 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.294: preferred, colored
Changes since revision 1.294: +4 -4 lines
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.

Revision 1.294: download - view: text, markup, annotated - select for diffs
Sat Aug 1 21:40:49 2020 UTC (4 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.293: preferred, colored
Changes since revision 1.293: +8 -7 lines
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.

Revision 1.293: download - view: text, markup, annotated - select for diffs
Sat Aug 1 17:45:32 2020 UTC (4 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.292: preferred, colored
Changes since revision 1.292: +14 -15 lines
make(1): fix parameter name in Cmd_Exec

A format string is not a number.

Revision 1.292: download - view: text, markup, annotated - select for diffs
Sat Aug 1 14:52:14 2020 UTC (4 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.291: preferred, colored
Changes since revision 1.291: +8 -8 lines
make(1): use ordinary string concatenation in usage text

Revision 1.291: download - view: text, markup, annotated - select for diffs
Sat Aug 1 14:47:49 2020 UTC (4 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.290: preferred, colored
Changes since revision 1.290: +7 -7 lines
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.

Revision 1.290: download - view: text, markup, annotated - select for diffs
Sat Aug 1 09:55:00 2020 UTC (4 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.289: preferred, colored
Changes since revision 1.289: +11 -11 lines
make(1): avoid calls to free(3) in the common case of a NULL pointer

Revision 1.289: download - view: text, markup, annotated - select for diffs
Sat Aug 1 09:25:36 2020 UTC (4 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.288: preferred, colored
Changes since revision 1.288: +7 -6 lines
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.

Revision 1.288: download - view: text, markup, annotated - select for diffs
Sat Aug 1 09:08:17 2020 UTC (4 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.287: preferred, colored
Changes since revision 1.287: +14 -13 lines
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.

Revision 1.287: download - view: text, markup, annotated - select for diffs
Sat Aug 1 08:55:28 2020 UTC (4 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.286: preferred, colored
Changes since revision 1.286: +5 -7 lines
make(1): merge duplicate code for concatenating strings

Revision 1.286: download - view: text, markup, annotated - select for diffs
Sat Aug 1 08:49:47 2020 UTC (4 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.285: preferred, colored
Changes since revision 1.285: +6 -9 lines
make(1): eliminate unsatisfiable condition in is_relpath

Revision 1.285: download - view: text, markup, annotated - select for diffs
Fri Jul 31 20:22:10 2020 UTC (4 years, 4 months ago) by sjg
Branches: MAIN
Diff to: previous 1.284: preferred, colored
Changes since revision 1.284: +7 -4 lines
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

Revision 1.284: download - view: text, markup, annotated - select for diffs
Tue Jul 28 16:42:22 2020 UTC (4 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.283: preferred, colored
Changes since revision 1.283: +15 -17 lines
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.

Revision 1.283: download - view: text, markup, annotated - select for diffs
Mon Jul 20 18:12:48 2020 UTC (4 years, 4 months ago) by sjg
Branches: MAIN
Diff to: previous 1.282: preferred, colored
Changes since revision 1.282: +8 -3 lines
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.

Revision 1.282: download - view: text, markup, annotated - select for diffs
Sun Jul 19 12:35:30 2020 UTC (4 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.281: preferred, colored
Changes since revision 1.281: +8 -14 lines
make(1): clean up unnecessary snprintf and multi-line function calls

Revision 1.281: download - view: text, markup, annotated - select for diffs
Sun Jul 19 12:26:17 2020 UTC (4 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.280: preferred, colored
Changes since revision 1.280: +15 -15 lines
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".

Revision 1.280: download - view: text, markup, annotated - select for diffs
Sat Jul 18 21:37:38 2020 UTC (4 years, 4 months ago) by sjg
Branches: MAIN
Diff to: previous 1.279: preferred, colored
Changes since revision 1.279: +6 -3 lines
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

Revision 1.279: download - view: text, markup, annotated - select for diffs
Fri Jul 3 08:13:23 2020 UTC (4 years, 5 months ago) by rillig
Branches: MAIN
Diff to: previous 1.278: preferred, colored
Changes since revision 1.278: +16 -16 lines
make(1): remove trailing whitespace

Revision 1.278: download - view: text, markup, annotated - select for diffs
Fri Jul 3 08:02:55 2020 UTC (4 years, 5 months ago) by rillig
Branches: MAIN
Diff to: previous 1.277: preferred, colored
Changes since revision 1.277: +9 -9 lines
make(1): remove redundant parentheses around return values

Revision 1.277: download - view: text, markup, annotated - select for diffs
Thu Jul 2 15:47:38 2020 UTC (4 years, 5 months ago) by rillig
Branches: MAIN
Diff to: previous 1.276: preferred, colored
Changes since revision 1.276: +34 -34 lines
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.

Revision 1.276: download - view: text, markup, annotated - select for diffs
Mon Jun 22 20:15:25 2020 UTC (4 years, 5 months ago) by sjg
Branches: MAIN
Diff to: previous 1.275: preferred, colored
Changes since revision 1.275: +4 -4 lines
dieQuietly: ignore OP_SUBMAKE

Stick to OP_MAKE for deciding when to supress noise
as OP_SUBMAKE can be too aggressive.

Reviewed by: gson

Revision 1.275: download - view: text, markup, annotated - select for diffs
Fri Jun 19 21:17:48 2020 UTC (4 years, 5 months ago) by sjg
Branches: MAIN
Diff to: previous 1.274: preferred, colored
Changes since revision 1.274: +30 -3 lines
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

Revision 1.273.4.1: download - view: text, markup, annotated - select for diffs
Wed Apr 8 14:09:16 2020 UTC (4 years, 7 months ago) by martin
Branches: phil-wifi
Diff to: previous 1.273: preferred, colored; next MAIN 1.274: preferred, colored
Changes since revision 1.273: +5 -3 lines
Merge changes from current as of 20200406

Revision 1.274: download - view: text, markup, annotated - select for diffs
Mon Mar 30 02:41:06 2020 UTC (4 years, 8 months ago) by sjg
Branches: MAIN
CVS tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406
Diff to: previous 1.273: preferred, colored
Changes since revision 1.273: +5 -3 lines
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

Revision 1.273: download - view: text, markup, annotated - select for diffs
Sat Oct 28 21:54:54 2017 UTC (7 years, 1 month ago) by sjg
Branches: MAIN
CVS tags: phil-wifi-base, phil-wifi-20191119, phil-wifi-20190609, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, netbsd-9-base, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, is-mlppp-base, is-mlppp
Branch point for: phil-wifi, netbsd-9
Diff to: previous 1.272: preferred, colored
Changes since revision 1.272: +5 -4 lines
Ignore empty MAKEOBJDIR

Otherwise we end up with .OBJDIR = ${.CURDIR}/
which is quivalent, but fails the typial
.if ${.OBJDIR} == ${.CURDIR}

Revision 1.265.2.1: download - view: text, markup, annotated - select for diffs
Tue Jul 18 15:26:14 2017 UTC (7 years, 4 months ago) by snj
Branches: netbsd-8
CVS tags: netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, matt-nb8-mediatek-base, matt-nb8-mediatek
Diff to: previous 1.265: preferred, colored
Changes since revision 1.265: +99 -73 lines
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.

Revision 1.272: download - view: text, markup, annotated - select for diffs
Mon Jun 19 19:58:24 2017 UTC (7 years, 5 months ago) by christos
Branches: MAIN
CVS tags: perseant-stdc-iso10646-base, perseant-stdc-iso10646
Diff to: previous 1.271: preferred, colored
Changes since revision 1.271: +16 -10 lines
Add -v variable that always expands variables; restore -V the way it was.

Revision 1.271: download - view: text, markup, annotated - select for diffs
Mon Jun 19 15:49:21 2017 UTC (7 years, 5 months ago) by christos
Branches: MAIN
Diff to: previous 1.270: preferred, colored
Changes since revision 1.270: +4 -8 lines
make the code look like to 1.266

Revision 1.270: download - view: text, markup, annotated - select for diffs
Mon Jun 19 14:59:06 2017 UTC (7 years, 5 months ago) by christos
Branches: MAIN
Diff to: previous 1.269: preferred, colored
Changes since revision 1.269: +5 -11 lines
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

Revision 1.269: download - view: text, markup, annotated - select for diffs
Sat Jun 17 19:59:28 2017 UTC (7 years, 5 months ago) by christos
Branches: MAIN
Diff to: previous 1.268: preferred, colored
Changes since revision 1.268: +8 -4 lines
a variable that starts with \\ is not expanded.

Revision 1.268: download - view: text, markup, annotated - select for diffs
Sat Jun 17 16:34:07 2017 UTC (7 years, 5 months ago) by christos
Branches: MAIN
Diff to: previous 1.267: preferred, colored
Changes since revision 1.267: +7 -8 lines
simplify

Revision 1.267: download - view: text, markup, annotated - select for diffs
Sat Jun 17 15:49:56 2017 UTC (7 years, 5 months ago) by christos
Branches: MAIN
Diff to: previous 1.266: preferred, colored
Changes since revision 1.266: +14 -6 lines
-V: try to expand the variable again if the value contains a variable.

Revision 1.266: download - view: text, markup, annotated - select for diffs
Sat Jun 17 15:26:50 2017 UTC (7 years, 5 months ago) by christos
Branches: MAIN
Diff to: previous 1.265: preferred, colored
Changes since revision 1.265: +87 -68 lines
move some code out of the gigantic main function; no functional change.

Revision 1.264.2.1: download - view: text, markup, annotated - select for diffs
Thu May 11 02:58:42 2017 UTC (7 years, 6 months ago) by pgoyette
Branches: prg-localcount2
Diff to: previous 1.264: preferred, colored; next MAIN 1.265: preferred, colored
Changes since revision 1.264: +4 -5 lines
Sync with HEAD

Revision 1.265: download - view: text, markup, annotated - select for diffs
Wed May 10 22:26:14 2017 UTC (7 years, 6 months ago) by sjg
Branches: MAIN
CVS tags: prg-localcount2-base3, prg-localcount2-base2, netbsd-8-base
Branch point for: netbsd-8
Diff to: previous 1.264: preferred, colored
Changes since revision 1.264: +4 -5 lines
Main_SetObjdir: ensure buf2 is in scope

Revision 1.248.2.3: download - view: text, markup, annotated - select for diffs
Wed Apr 26 02:53:35 2017 UTC (7 years, 7 months ago) by pgoyette
Branches: pgoyette-localcount
Diff to: previous 1.248.2.2: preferred, colored; branchpoint 1.248: preferred, colored; next MAIN 1.249: preferred, colored
Changes since revision 1.248.2.2: +92 -30 lines
Sync with HEAD

Revision 1.254.2.1: download - view: text, markup, annotated - select for diffs
Fri Apr 21 16:54:14 2017 UTC (7 years, 7 months ago) by bouyer
Branches: bouyer-socketcan
Diff to: previous 1.254: preferred, colored; next MAIN 1.255: preferred, colored
Changes since revision 1.254: +102 -30 lines
Sync with HEAD

Revision 1.264: download - view: text, markup, annotated - select for diffs
Thu Apr 20 03:57:27 2017 UTC (7 years, 7 months ago) by sjg
Branches: MAIN
CVS tags: prg-localcount2-base1, prg-localcount2-base, pgoyette-localcount-20170426, bouyer-socketcan-base1
Branch point for: prg-localcount2
Diff to: previous 1.263: preferred, colored
Changes since revision 1.263: +30 -4 lines
We cannot tollerate things like trailing /.. etc in .CURDIR
so only accept -C arg "as is" if it contains no relative components.

Revision 1.263: download - view: text, markup, annotated - select for diffs
Wed Apr 19 04:54:17 2017 UTC (7 years, 7 months ago) by sjg
Branches: MAIN
Diff to: previous 1.262: preferred, colored
Changes since revision 1.262: +7 -5 lines
We cannot use buf as both src and destination for snprintf.

Revision 1.262: download - view: text, markup, annotated - select for diffs
Sun Apr 16 20:14:49 2017 UTC (7 years, 7 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.261: preferred, colored
Changes since revision 1.261: +44 -29 lines
Factor out parts of cached_realpath.

This wacky API confused Coverity (CID 1405167) and is no good for
human readers either.

Revision 1.261: download - view: text, markup, annotated - select for diffs
Sun Apr 16 20:00:58 2017 UTC (7 years, 7 months ago) by maya
Branches: MAIN
Diff to: previous 1.260: preferred, colored
Changes since revision 1.260: +4 -4 lines
Use bmake_malloc where we don't test the return value of malloc currently.

Appeases coverity.

Revision 1.260: download - view: text, markup, annotated - select for diffs
Thu Apr 13 13:55:23 2017 UTC (7 years, 7 months ago) by christos
Branches: MAIN
Diff to: previous 1.259: preferred, colored
Changes since revision 1.259: +20 -18 lines
PR/52159: Jamie Landeg-Jones: Don't try to expand $'s in paths or system
variables. Only expand them ${MAKE} variable values.

Revision 1.259: download - view: text, markup, annotated - select for diffs
Sun Mar 26 17:16:03 2017 UTC (7 years, 8 months ago) by sjg
Branches: MAIN
Diff to: previous 1.258: preferred, colored
Changes since revision 1.258: +21 -4 lines
When we change .OBJDIR we should delete any cached realpath results
for relative paths.

Reviewed by: christos

Revision 1.248.2.2: download - view: text, markup, annotated - select for diffs
Mon Mar 20 06:58:04 2017 UTC (7 years, 8 months ago) by pgoyette
Branches: pgoyette-localcount
Diff to: previous 1.248.2.1: preferred, colored; branchpoint 1.248: preferred, colored
Changes since revision 1.248.2.1: +14 -4 lines
Sync with HEAD

Revision 1.258: download - view: text, markup, annotated - select for diffs
Sat Mar 11 23:59:02 2017 UTC (7 years, 8 months ago) by sjg
Branches: MAIN
CVS tags: pgoyette-localcount-20170320
Diff to: previous 1.257: preferred, colored
Changes since revision 1.257: +5 -4 lines
Do not consider using -C arg "as is" for .CURDIR unless it starts with '/'.

Reviewed by: christos

Revision 1.257: download - view: text, markup, annotated - select for diffs
Wed Feb 8 17:47:36 2017 UTC (7 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.256: preferred, colored
Changes since revision 1.256: +4 -4 lines
Use strncpy here because we need to be portable, and we have the +1 byte
to save us :-)

Revision 1.256: download - view: text, markup, annotated - select for diffs
Tue Feb 7 21:16:31 2017 UTC (7 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.255: preferred, colored
Changes since revision 1.255: +9 -3 lines
use the logical path for -C if correct.

Revision 1.255: download - view: text, markup, annotated - select for diffs
Tue Jan 31 06:54:23 2017 UTC (7 years, 10 months ago) by sjg
Branches: MAIN
Diff to: previous 1.254: preferred, colored
Changes since revision 1.254: +7 -4 lines
Partially initialize Dir before MainParseArgs can be called.

The rest can be done once curdir is finalized.

Revision 1.248.2.1: download - view: text, markup, annotated - select for diffs
Sat Jan 7 08:56:58 2017 UTC (7 years, 10 months ago) by pgoyette
Branches: pgoyette-localcount
Diff to: previous 1.248: preferred, colored
Changes since revision 1.248: +34 -25 lines
Sync with HEAD.  (Note that most of these changes are simply $NetBSD$
tag issues.)

Revision 1.254: download - view: text, markup, annotated - select for diffs
Sat Dec 10 23:12:39 2016 UTC (7 years, 11 months ago) by christos
Branches: MAIN
CVS tags: pgoyette-localcount-20170107, bouyer-socketcan-base
Branch point for: bouyer-socketcan
Diff to: previous 1.253: preferred, colored
Changes since revision 1.253: +4 -3 lines
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.

Revision 1.253: download - view: text, markup, annotated - select for diffs
Wed Dec 7 19:57:09 2016 UTC (7 years, 11 months ago) by christos
Branches: MAIN
Diff to: previous 1.252: preferred, colored
Changes since revision 1.252: +7 -7 lines
Don't apply the suffix (curdir) to MAKEOBJDIR

Revision 1.252: download - view: text, markup, annotated - select for diffs
Wed Dec 7 15:00:46 2016 UTC (7 years, 11 months ago) by christos
Branches: MAIN
Diff to: previous 1.251: preferred, colored
Changes since revision 1.251: +33 -25 lines
Refactor and simplify objdir setting code.

Revision 1.251: download - view: text, markup, annotated - select for diffs
Fri Aug 26 23:28:39 2016 UTC (8 years, 3 months ago) by dholland
Branches: MAIN
CVS tags: pgoyette-localcount-20161104, localcount-20160914
Diff to: previous 1.250: preferred, colored
Changes since revision 1.250: +5 -3 lines
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.

Revision 1.250: download - view: text, markup, annotated - select for diffs
Thu Aug 11 19:53:17 2016 UTC (8 years, 3 months ago) by sjg
Branches: MAIN
Diff to: previous 1.249: preferred, colored
Changes since revision 1.249: +5 -3 lines
PR: 51405
Description:

addErrorCMD: in compat mode, cmdp may be NULL, skip it
and stop the calls (return 1).

Revision 1.249: download - view: text, markup, annotated - select for diffs
Wed Aug 10 23:49:12 2016 UTC (8 years, 3 months ago) by sjg
Branches: MAIN
Diff to: previous 1.248: preferred, colored
Changes since revision 1.248: +11 -3 lines
Set .ERROR_CMD if we can

Revision 1.248: download - view: text, markup, annotated - select for diffs
Tue Jun 7 03:04:45 2016 UTC (8 years, 6 months ago) by christos
Branches: MAIN
CVS tags: pgoyette-localcount-base, pgoyette-localcount-20160806, pgoyette-localcount-20160726
Branch point for: pgoyette-localcount
Diff to: previous 1.247: preferred, colored
Changes since revision 1.247: +11 -19 lines
fix memory leak, simplify

Revision 1.247: download - view: text, markup, annotated - select for diffs
Sun Jun 5 01:39:17 2016 UTC (8 years, 6 months ago) by christos
Branches: MAIN
Diff to: previous 1.246: preferred, colored
Changes since revision 1.246: +6 -5 lines
NUL terminate.

Revision 1.246: download - view: text, markup, annotated - select for diffs
Sun Jun 5 00:48:58 2016 UTC (8 years, 6 months ago) by sjg
Branches: MAIN
Diff to: previous 1.245: preferred, colored
Changes since revision 1.245: +7 -3 lines
Avoid breaking !NetBSD build

Revision 1.245: download - view: text, markup, annotated - select for diffs
Fri Jun 3 01:21:59 2016 UTC (8 years, 6 months ago) by sjg
Branches: MAIN
Diff to: previous 1.244: preferred, colored
Changes since revision 1.244: +38 -4 lines
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

Revision 1.244: download - view: text, markup, annotated - select for diffs
Tue Apr 5 04:25:43 2016 UTC (8 years, 8 months ago) by sjg
Branches: MAIN
Diff to: previous 1.243: preferred, colored
Changes since revision 1.243: +5 -4 lines
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.

Revision 1.243: download - view: text, markup, annotated - select for diffs
Wed Mar 16 16:04:44 2016 UTC (8 years, 8 months ago) by matthias
Branches: MAIN
Diff to: previous 1.242: preferred, colored
Changes since revision 1.242: +32 -11 lines
honor setting .MAKE.JOBS from the makefile. That way one can e.g. do:

CPUS!=sysctl -n hw.ncpuonline
.MAKE.JOBS?=$(CPUS)

Revision 1.242: download - view: text, markup, annotated - select for diffs
Mon Mar 7 21:45:43 2016 UTC (8 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.241: preferred, colored
Changes since revision 1.241: +6 -3 lines
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.

Revision 1.241: download - view: text, markup, annotated - select for diffs
Fri Feb 19 00:11:45 2016 UTC (8 years, 9 months ago) by sjg
Branches: MAIN
Diff to: previous 1.240: preferred, colored
Changes since revision 1.240: +4 -4 lines
getBoolean:
We need :U to ensure we get an empty string if knob isn't set.

Revision 1.240: download - view: text, markup, annotated - select for diffs
Thu Feb 18 20:25:08 2016 UTC (8 years, 9 months ago) by sjg
Branches: MAIN
Diff to: previous 1.239: preferred, colored
Changes since revision 1.239: +42 -25 lines
Add .export-literal to avoid the need for $$ dance when trying to put
unexpanded variables into environment.

Reviewed by: christos

Revision 1.239: download - view: text, markup, annotated - select for diffs
Thu Feb 18 18:29:14 2016 UTC (8 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.238: preferred, colored
Changes since revision 1.238: +14 -14 lines
Collapse the 3 boolean parameter to 1 flags parameter. No functional change.

Revision 1.238: download - view: text, markup, annotated - select for diffs
Sun Jan 17 17:45:21 2016 UTC (8 years, 10 months ago) by christos
Branches: MAIN
Diff to: previous 1.237: preferred, colored
Changes since revision 1.237: +10 -15 lines
remove free NULL checks (Tilman Sauerbeck)

Revision 1.237: download - view: text, markup, annotated - select for diffs
Sun Jan 17 15:32:38 2016 UTC (8 years, 10 months ago) by christos
Branches: MAIN
Diff to: previous 1.236: preferred, colored
Changes since revision 1.236: +3 -4 lines
provide missing FD_CLOEXEC for the havenots.

Revision 1.236: download - view: text, markup, annotated - select for diffs
Sat Jan 9 00:55:17 2016 UTC (8 years, 10 months ago) by christos
Branches: MAIN
Diff to: previous 1.235: preferred, colored
Changes since revision 1.235: +14 -14 lines
Preserve $$ in := assignments..

FOO=\$$CRAP
BAR:=${FOO}

all:
	echo ${FOO}
	echo ${BAR}

Revision 1.235: download - view: text, markup, annotated - select for diffs
Sun Oct 25 05:24:44 2015 UTC (9 years, 1 month ago) by sjg
Branches: MAIN
Diff to: previous 1.234: preferred, colored
Changes since revision 1.234: +5 -3 lines
PrintOnError: fflush stdout before running .ERROR

produces more consistent results in unit-tests.

Revision 1.234: download - view: text, markup, annotated - select for diffs
Sun Oct 11 04:51:24 2015 UTC (9 years, 1 month ago) by sjg
Branches: MAIN
Diff to: previous 1.233: preferred, colored
Changes since revision 1.233: +18 -14 lines
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

Revision 1.233: download - view: text, markup, annotated - select for diffs
Thu Sep 10 17:15:11 2015 UTC (9 years, 2 months ago) by sjg
Branches: MAIN
Diff to: previous 1.232: preferred, colored
Changes since revision 1.232: +11 -3 lines
Output Entering/Leaving messages for objdir when != srcdir and -w flag
This helps ensure Emacs can find source of error.

Reviewed by: christos

Revision 1.232: download - view: text, markup, annotated - select for diffs
Thu Mar 26 22:20:42 2015 UTC (9 years, 8 months ago) by sjg
Branches: MAIN
Diff to: previous 1.231: preferred, colored
Changes since revision 1.231: +4 -4 lines
Move initialization of savederr to the block where it is used
to avoid spurious warning from gcc 5

Revision 1.231: download - view: text, markup, annotated - select for diffs
Tue Sep 9 06:18:17 2014 UTC (10 years, 2 months ago) by dholland
Branches: MAIN
Diff to: previous 1.230: preferred, colored
Changes since revision 1.230: +9 -5 lines
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.

Revision 1.230: download - view: text, markup, annotated - select for diffs
Sun Sep 7 20:55:34 2014 UTC (10 years, 2 months ago) by joerg
Branches: MAIN
Diff to: previous 1.229: preferred, colored
Changes since revision 1.229: +6 -38 lines
Revert all make changes except the unit tests to the state of three
weeks ago. Individual changes can be reapplied after review.

Revision 1.229: download - view: text, markup, annotated - select for diffs
Sat Aug 23 15:05:40 2014 UTC (10 years, 3 months ago) by christos
Branches: MAIN
Diff to: previous 1.228: preferred, colored
Changes since revision 1.228: +32 -4 lines
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

Revision 1.228: download - view: text, markup, annotated - select for diffs
Wed Aug 20 08:37:25 2014 UTC (10 years, 3 months ago) by apb
Branches: MAIN
Diff to: previous 1.227: preferred, colored
Changes since revision 1.227: +9 -5 lines
It should not be an error to have VAR != command that prints no output

Revision 1.203.2.3: download - view: text, markup, annotated - select for diffs
Wed Aug 20 00:05:00 2014 UTC (10 years, 3 months ago) by tls
Branches: tls-maxphys
Diff to: previous 1.203.2.2: preferred, colored; branchpoint 1.203: preferred, colored; next MAIN 1.204: preferred, colored
Changes since revision 1.203.2.2: +113 -25 lines
Rebase to HEAD as of a few days ago.

Revision 1.226.2.1: download - view: text, markup, annotated - select for diffs
Sun Aug 10 06:58:27 2014 UTC (10 years, 3 months ago) by tls
Branches: tls-earlyentropy
Diff to: previous 1.226: preferred, colored; next MAIN 1.227: preferred, colored
Changes since revision 1.226: +7 -7 lines
Rebase.

Revision 1.227: download - view: text, markup, annotated - select for diffs
Fri Aug 8 19:20:39 2014 UTC (10 years, 3 months ago) by gson
Branches: MAIN
CVS tags: tls-maxphys-base, tls-earlyentropy-base, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7
Diff to: previous 1.226: preferred, colored
Changes since revision 1.226: +7 -7 lines
Fix comment: Error, Fatal, and Punt take any number of arguments, not two.

Revision 1.198.2.3: download - view: text, markup, annotated - select for diffs
Thu May 22 11:42:46 2014 UTC (10 years, 6 months ago) by yamt
Branches: yamt-pagecache
Diff to: previous 1.198.2.2: preferred, colored; branchpoint 1.198: preferred, colored; next MAIN 1.199: preferred, colored
Changes since revision 1.198.2.2: +128 -227 lines
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")

Revision 1.226: download - view: text, markup, annotated - select for diffs
Fri Feb 7 17:23:35 2014 UTC (10 years, 9 months ago) by pooka
Branches: MAIN
CVS tags: yamt-pagecache-base9, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3
Branch point for: tls-earlyentropy
Diff to: previous 1.225: preferred, colored
Changes since revision 1.225: +13 -8 lines
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.

Revision 1.225: download - view: text, markup, annotated - select for diffs
Sat Sep 14 15:09:34 2013 UTC (11 years, 2 months ago) by matt
Branches: MAIN
Diff to: previous 1.224: preferred, colored
Changes since revision 1.224: +21 -3 lines
If MAKE_NATIVE, use sysctl to get MACHINE_ARCH from hw.machine_arch.

Revision 1.224: download - view: text, markup, annotated - select for diffs
Wed Sep 4 15:38:26 2013 UTC (11 years, 3 months ago) by sjg
Branches: MAIN
Diff to: previous 1.223: preferred, colored
Changes since revision 1.223: +5 -5 lines
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

Revision 1.223: download - view: text, markup, annotated - select for diffs
Sun Aug 4 16:48:15 2013 UTC (11 years, 4 months ago) by sjg
Branches: MAIN
Diff to: previous 1.222: preferred, colored
Changes since revision 1.222: +3 -4 lines
Move the call to Job_SetPrefix() to Job_Init() so that
makefiles have had a chance to set .MAKE.JOB.PREFIX

Revision 1.221.2.1: download - view: text, markup, annotated - select for diffs
Tue Jul 23 21:07:39 2013 UTC (11 years, 4 months ago) by riastradh
Branches: riastradh-drm2
Diff to: previous 1.221: preferred, colored; next MAIN 1.222: preferred, colored
Changes since revision 1.221: +19 -13 lines
sync with HEAD

Revision 1.222: download - view: text, markup, annotated - select for diffs
Thu Jul 18 15:31:49 2013 UTC (11 years, 4 months ago) by sjg
Branches: MAIN
CVS tags: riastradh-drm2-base2, riastradh-drm2-base1
Diff to: previous 1.221: preferred, colored
Changes since revision 1.221: +19 -13 lines
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.

Revision 1.221: download - view: text, markup, annotated - select for diffs
Tue Jul 16 14:22:13 2013 UTC (11 years, 4 months ago) by christos
Branches: MAIN
CVS tags: riastradh-drm2-base
Branch point for: riastradh-drm2
Diff to: previous 1.220: preferred, colored
Changes since revision 1.220: +6 -6 lines
use bmake_foo instead of efoo()

Revision 1.220: download - view: text, markup, annotated - select for diffs
Tue Jul 16 14:00:53 2013 UTC (11 years, 4 months ago) by christos
Branches: MAIN
Diff to: previous 1.219: preferred, colored
Changes since revision 1.219: +66 -8 lines
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.

Revision 1.219: download - view: text, markup, annotated - select for diffs
Mon Jul 15 20:33:11 2013 UTC (11 years, 4 months ago) by christos
Branches: MAIN
Diff to: previous 1.218: preferred, colored
Changes since revision 1.218: +4 -4 lines
Make this work again like gmake. sjg: see the test program.

Revision 1.218: download - view: text, markup, annotated - select for diffs
Tue Jul 9 18:44:41 2013 UTC (11 years, 4 months ago) by sjg
Branches: MAIN
Diff to: previous 1.217: preferred, colored
Changes since revision 1.217: +4 -4 lines
For .MAKE.LEVEL.ENV use VAR_CMD so updates are ignored

Revision 1.217: download - view: text, markup, annotated - select for diffs
Tue Jul 9 18:13:14 2013 UTC (11 years, 4 months ago) by sjg
Branches: MAIN
Diff to: previous 1.216: preferred, colored
Changes since revision 1.216: +5 -3 lines
Set .MAKE.LEVEL.ENV to the name of the env variable used to communicate
the recursion level to sub-makes.

Revision 1.216: download - view: text, markup, annotated - select for diffs
Sat Jul 6 18:19:17 2013 UTC (11 years, 5 months ago) by sjg
Branches: MAIN
Diff to: previous 1.215: preferred, colored
Changes since revision 1.215: +4 -4 lines
If using gmake's MAKELEVEL; use it the same way

Revision 1.215: download - view: text, markup, annotated - select for diffs
Sat Jun 29 15:19:32 2013 UTC (11 years, 5 months ago) by christos
Branches: MAIN
Diff to: previous 1.214: preferred, colored
Changes since revision 1.214: +4 -4 lines
PR/47973: Justin Cormack: build uses <sys/signal.h> not in POSIX

Revision 1.203.2.2: download - view: text, markup, annotated - select for diffs
Sun Jun 23 06:29:00 2013 UTC (11 years, 5 months ago) by tls
Branches: tls-maxphys
Diff to: previous 1.203.2.1: preferred, colored; branchpoint 1.203: preferred, colored
Changes since revision 1.203.2.1: +13 -12 lines
resync from head

Revision 1.214: download - view: text, markup, annotated - select for diffs
Tue Jun 18 20:06:09 2013 UTC (11 years, 5 months ago) by sjg
Branches: MAIN
Diff to: previous 1.213: preferred, colored
Changes since revision 1.213: +4 -4 lines
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.

Revision 1.213: download - view: text, markup, annotated - select for diffs
Mon Jun 10 20:24:58 2013 UTC (11 years, 5 months ago) by christos
Branches: MAIN
Diff to: previous 1.212: preferred, colored
Changes since revision 1.212: +7 -9 lines
put back previous change

Revision 1.212: download - view: text, markup, annotated - select for diffs
Mon Jun 10 19:07:09 2013 UTC (11 years, 5 months ago) by joerg
Branches: MAIN
Diff to: previous 1.211: preferred, colored
Changes since revision 1.211: +6 -4 lines
Revert last, it doesn't even build.

Revision 1.211: download - view: text, markup, annotated - select for diffs
Mon Jun 10 16:46:19 2013 UTC (11 years, 5 months ago) by christos
Branches: MAIN
Diff to: previous 1.210: preferred, colored
Changes since revision 1.210: +7 -9 lines
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 -

Revision 1.210: download - view: text, markup, annotated - select for diffs
Sat Mar 23 05:31:29 2013 UTC (11 years, 8 months ago) by sjg
Branches: MAIN
CVS tags: agc-symver-base, agc-symver
Diff to: previous 1.209: preferred, colored
Changes since revision 1.209: +7 -4 lines
If built with filemon support, set .MAKE.PATH_FILEMON to _PATH_FILEMON
so that makefiles can test for it.

Revision 1.209: download - view: text, markup, annotated - select for diffs
Tue Feb 26 00:45:27 2013 UTC (11 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.208: preferred, colored
Changes since revision 1.208: +4 -4 lines
PR/45042: Thomas Cort: HAVE_foo for setrlimit(2) and setpgid(2)

Revision 1.203.2.1: download - view: text, markup, annotated - select for diffs
Mon Feb 25 00:30:37 2013 UTC (11 years, 9 months ago) by tls
Branches: tls-maxphys
Diff to: previous 1.203: preferred, colored
Changes since revision 1.203: +12 -200 lines
resync with head

Revision 1.208: download - view: text, markup, annotated - select for diffs
Mon Feb 25 00:15:09 2013 UTC (11 years, 9 months ago) by dholland
Branches: MAIN
CVS tags: dholland-make-base
Diff to: previous 1.207: preferred, colored
Changes since revision 1.207: +4 -4 lines
typo in comment

Revision 1.207: download - view: text, markup, annotated - select for diffs
Sat Feb 16 02:39:27 2013 UTC (11 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.206: preferred, colored
Changes since revision 1.206: +3 -7 lines
we need utsname all the time.

Revision 1.206: download - view: text, markup, annotated - select for diffs
Sat Feb 16 02:11:11 2013 UTC (11 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.205: preferred, colored
Changes since revision 1.205: +10 -8 lines
Set .MAKE.OS to utsname.sysname so we can tell bogus OS's apart early in
the build process.

Revision 1.205: download - view: text, markup, annotated - select for diffs
Sat Jan 26 15:53:00 2013 UTC (11 years, 10 months ago) by christos
Branches: MAIN
Diff to: previous 1.204: preferred, colored
Changes since revision 1.204: +5 -4 lines
Check read and write errors to avoid warnings from linux.
XXX: Should we print an error and exit instead?

Revision 1.204: download - view: text, markup, annotated - select for diffs
Fri Jan 25 02:01:10 2013 UTC (11 years, 10 months ago) by sjg
Branches: MAIN
Diff to: previous 1.203: preferred, colored
Changes since revision 1.203: +3 -190 lines
Remove Check_Cwd - it is no longer needed.

Revision 1.198.2.2: download - view: text, markup, annotated - select for diffs
Tue Oct 30 19:00:21 2012 UTC (12 years, 1 month ago) by yamt
Branches: yamt-pagecache
CVS tags: yamt-pagecache-tag8
Diff to: previous 1.198.2.1: preferred, colored; branchpoint 1.198: preferred, colored
Changes since revision 1.198.2.1: +69 -6 lines
sync with head

Revision 1.203: download - view: text, markup, annotated - select for diffs
Fri Aug 31 07:00:36 2012 UTC (12 years, 3 months ago) by sjg
Branches: MAIN
CVS tags: yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6
Branch point for: tls-maxphys
Diff to: previous 1.202: preferred, colored
Changes since revision 1.202: +5 -5 lines
Cast sizeof() to int, which is sufficent and consistent with other use
within make.

Revision 1.202: download - view: text, markup, annotated - select for diffs
Fri Aug 31 02:59:37 2012 UTC (12 years, 3 months ago) by pgoyette
Branches: MAIN
Diff to: previous 1.201: preferred, colored
Changes since revision 1.201: +5 -5 lines
Cast sizeof() to (ssize_t) to avoid build errors.

Revision 1.201: download - view: text, markup, annotated - select for diffs
Thu Aug 30 21:17:05 2012 UTC (12 years, 3 months ago) by sjg
Branches: MAIN
Diff to: previous 1.200: preferred, colored
Changes since revision 1.200: +66 -3 lines
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.

Revision 1.200: download - view: text, markup, annotated - select for diffs
Tue Jun 12 19:21:51 2012 UTC (12 years, 5 months ago) by joerg
Branches: MAIN
Diff to: previous 1.199: preferred, colored
Changes since revision 1.199: +6 -6 lines
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.

Revision 1.198.2.1: download - view: text, markup, annotated - select for diffs
Wed May 23 10:08:25 2012 UTC (12 years, 6 months ago) by yamt
Branches: yamt-pagecache
Diff to: previous 1.198: preferred, colored
Changes since revision 1.198: +6 -5 lines
sync with head.

Revision 1.199: download - view: text, markup, annotated - select for diffs
Tue Apr 24 20:35:04 2012 UTC (12 years, 7 months ago) by sjg
Branches: MAIN
CVS tags: yamt-pagecache-base5
Diff to: previous 1.198: preferred, colored
Changes since revision 1.198: +6 -5 lines
Fix handling of -dF+/tmp/file

Revision 1.198: download - view: text, markup, annotated - select for diffs
Fri Sep 16 15:38:04 2011 UTC (13 years, 2 months ago) by joerg
Branches: MAIN
CVS tags: yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus
Branch point for: yamt-pagecache
Diff to: previous 1.197: preferred, colored
Changes since revision 1.197: +4 -4 lines
Use __dead consistently. If it doesn't exist, define it away.

Revision 1.197: download - view: text, markup, annotated - select for diffs
Wed May 4 20:38:31 2011 UTC (13 years, 7 months ago) by sjg
Branches: MAIN
CVS tags: cherry-xenmp-base, cherry-xenmp
Diff to: previous 1.196: preferred, colored
Changes since revision 1.196: +4 -4 lines
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.

Revision 1.194.2.2: download - view: text, markup, annotated - select for diffs
Sat Mar 5 15:10:59 2011 UTC (13 years, 9 months ago) by bouyer
Branches: bouyer-quota2
Diff to: previous 1.194.2.1: preferred, colored; branchpoint 1.194: preferred, colored; next MAIN 1.195: preferred, colored
Changes since revision 1.194.2.1: +4 -4 lines
Sync with HEAD

Revision 1.196: download - view: text, markup, annotated - select for diffs
Sun Feb 20 23:12:09 2011 UTC (13 years, 9 months ago) by joerg
Branches: MAIN
CVS tags: bouyer-quota2-nbase
Diff to: previous 1.195: preferred, colored
Changes since revision 1.195: +4 -4 lines
Use the current directory at start time for .PARSEDIR, if the filename
contains no /.

Revision 1.194.2.1: download - view: text, markup, annotated - select for diffs
Thu Feb 17 12:00:56 2011 UTC (13 years, 9 months ago) by bouyer
Branches: bouyer-quota2
Diff to: previous 1.194: preferred, colored
Changes since revision 1.194: +4 -4 lines
Sync with HEAD

Revision 1.195: download - view: text, markup, annotated - select for diffs
Sun Feb 13 21:24:43 2011 UTC (13 years, 9 months ago) by sjg
Branches: MAIN
CVS tags: bouyer-quota2-base
Diff to: previous 1.194: preferred, colored
Changes since revision 1.194: +4 -4 lines
Mark unused args.

Revision 1.194: download - view: text, markup, annotated - select for diffs
Sat Dec 25 20:34:08 2010 UTC (13 years, 11 months ago) by dholland
Branches: MAIN
CVS tags: matt-mips64-premerge-20101231
Branch point for: bouyer-quota2
Diff to: previous 1.193: preferred, colored
Changes since revision 1.193: +5 -4 lines
Improve confusing error message when getcwd() fails.

Revision 1.193: download - view: text, markup, annotated - select for diffs
Sat Dec 25 04:57:07 2010 UTC (13 years, 11 months ago) by dholland
Branches: MAIN
Diff to: previous 1.192: preferred, colored
Changes since revision 1.192: +4 -4 lines
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.

Revision 1.192: download - view: text, markup, annotated - select for diffs
Mon Dec 13 01:48:50 2010 UTC (13 years, 11 months ago) by dholland
Branches: MAIN
Diff to: previous 1.191: preferred, colored
Changes since revision 1.191: +4 -4 lines
Add const necessary for clean non-native build.

Revision 1.191: download - view: text, markup, annotated - select for diffs
Thu Dec 9 22:30:16 2010 UTC (13 years, 11 months ago) by sjg
Branches: MAIN
Diff to: previous 1.190: preferred, colored
Changes since revision 1.190: +24 -15 lines
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.

Revision 1.190: download - view: text, markup, annotated - select for diffs
Mon Sep 13 15:36:57 2010 UTC (14 years, 2 months ago) by sjg
Branches: MAIN
Diff to: previous 1.189: preferred, colored
Changes since revision 1.189: +10 -3 lines
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).

Revision 1.189: download - view: text, markup, annotated - select for diffs
Sat Aug 7 06:44:08 2010 UTC (14 years, 4 months ago) by sjg
Branches: MAIN
Diff to: previous 1.188: preferred, colored
Changes since revision 1.188: +6 -5 lines
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.

Revision 1.188: download - view: text, markup, annotated - select for diffs
Thu Jun 3 15:40:16 2010 UTC (14 years, 6 months ago) by sjg
Branches: MAIN
Diff to: previous 1.187: preferred, colored
Changes since revision 1.187: +4 -4 lines
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.

Revision 1.187: download - view: text, markup, annotated - select for diffs
Mon May 17 17:01:16 2010 UTC (14 years, 6 months ago) by christos
Branches: MAIN
Diff to: previous 1.186: preferred, colored
Changes since revision 1.186: +19 -4 lines
put back canonicalization, but avoid doing it for files that don't contain /
From dholland

Revision 1.186: download - view: text, markup, annotated - select for diffs
Mon May 10 15:54:21 2010 UTC (14 years, 6 months ago) by sjg
Branches: MAIN
Diff to: previous 1.185: preferred, colored
Changes since revision 1.185: +12 -13 lines
PrintOnError: run .ERROR last, so even if it causes problems we
still print MAKE_PRINT_VAR_ON_ERROR.

Revision 1.185: download - view: text, markup, annotated - select for diffs
Wed May 5 14:10:39 2010 UTC (14 years, 7 months ago) by christos
Branches: MAIN
Diff to: previous 1.184: preferred, colored
Changes since revision 1.184: +4 -11 lines
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!

Revision 1.184: download - view: text, markup, annotated - select for diffs
Thu Apr 29 23:12:21 2010 UTC (14 years, 7 months ago) by sjg
Branches: MAIN
Diff to: previous 1.183: preferred, colored
Changes since revision 1.183: +6 -3 lines
fflush stdout, before writing to stderr.

Revision 1.183: download - view: text, markup, annotated - select for diffs
Fri Apr 23 00:18:50 2010 UTC (14 years, 7 months ago) by sjg
Branches: MAIN
Diff to: previous 1.182: preferred, colored
Changes since revision 1.182: +8 -5 lines
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.

Revision 1.182: download - view: text, markup, annotated - select for diffs
Thu Apr 22 22:39:13 2010 UTC (14 years, 7 months ago) by dholland
Branches: MAIN
Diff to: previous 1.181: preferred, colored
Changes since revision 1.181: +4 -4 lines
Use _PATH_TMP instead of a literal /tmp; noted by Christos

Revision 1.181: download - view: text, markup, annotated - select for diffs
Thu Apr 22 20:25:16 2010 UTC (14 years, 7 months ago) by dholland
Branches: MAIN
Diff to: previous 1.180: preferred, colored
Changes since revision 1.180: +4 -4 lines
don't use strlcpy; it causes bootstrap issues. (noted by moof)

Revision 1.180: download - view: text, markup, annotated - select for diffs
Thu Apr 22 19:11:17 2010 UTC (14 years, 7 months ago) by sjg
Branches: MAIN
Diff to: previous 1.179: preferred, colored
Changes since revision 1.179: +48 -3 lines
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

Revision 1.179: download - view: text, markup, annotated - select for diffs
Tue Apr 20 17:18:08 2010 UTC (14 years, 7 months ago) by sjg
Branches: MAIN
Diff to: previous 1.178: preferred, colored
Changes since revision 1.178: +4 -4 lines
On some systems realpath will prefix make with cwd, so make sure
we can stat(2) the value for .MAKE

Revision 1.178: download - view: text, markup, annotated - select for diffs
Wed Apr 14 16:16:17 2010 UTC (14 years, 7 months ago) by sjg
Branches: MAIN
Diff to: previous 1.177: preferred, colored
Changes since revision 1.177: +13 -5 lines
If argv[0] is not an absolute path, attempt to resolve it
using realpath() for setting .MAKE

Revision 1.177: download - view: text, markup, annotated - select for diffs
Thu Apr 8 17:41:29 2010 UTC (14 years, 8 months ago) by sjg
Branches: MAIN
Diff to: previous 1.176: preferred, colored
Changes since revision 1.176: +6 -4 lines
Process .ERROR the same as .BEGIN, .END etc
so that it cannot be the default target.
Add unit-tests for .info - .error, and .ERROR.

Revision 1.176: download - view: text, markup, annotated - select for diffs
Wed Apr 7 00:11:27 2010 UTC (14 years, 8 months ago) by sjg
Branches: MAIN
Diff to: previous 1.175: preferred, colored
Changes since revision 1.175: +88 -16 lines
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.

Revision 1.175: download - view: text, markup, annotated - select for diffs
Mon Jan 4 17:05:25 2010 UTC (14 years, 11 months ago) by sjg
Branches: MAIN
Diff to: previous 1.174: preferred, colored
Changes since revision 1.174: +16 -9 lines
We need to have set curdir before calling Dir_FindHereOrAbove().
We can call getcwd again if -C is used.

Revision 1.174: download - view: text, markup, annotated - select for diffs
Wed Sep 9 17:09:49 2009 UTC (15 years, 2 months ago) by sjg
Branches: MAIN
CVS tags: matt-premerge-20091211
Diff to: previous 1.173: preferred, colored
Changes since revision 1.173: +70 -65 lines
We must delay setting .CURDIR and .OBJDIR until after MainParseArgs()
in case -C is used - in which case we should also ignore $PWD.

Revision 1.173: download - view: text, markup, annotated - select for diffs
Tue Sep 8 17:29:20 2009 UTC (15 years, 2 months ago) by sjg
Branches: MAIN
Diff to: previous 1.172: preferred, colored
Changes since revision 1.172: +8 -3 lines
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().

Revision 1.172: download - view: text, markup, annotated - select for diffs
Thu Sep 3 06:45:23 2009 UTC (15 years, 3 months ago) by dholland
Branches: MAIN
Diff to: previous 1.171: preferred, colored
Changes since revision 1.171: +6 -4 lines
Use the W* macros to test wait results.
(Mentioned by Joerg in chat a few days ago.)

Revision 1.171: download - view: text, markup, annotated - select for diffs
Wed Aug 26 23:17:11 2009 UTC (15 years, 3 months ago) by sjg
Branches: MAIN
Diff to: previous 1.170: preferred, colored
Changes since revision 1.170: +15 -5 lines
Add -C directory, same as gmake and freebsd make.

Revision 1.166.2.1: download - view: text, markup, annotated - select for diffs
Wed May 13 19:19:56 2009 UTC (15 years, 6 months ago) by jym
Branches: jym-xensuspend
Diff to: previous 1.166: preferred, colored; next MAIN 1.167: preferred, colored
Changes since revision 1.166: +22 -3 lines
Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html

Revision 1.170: download - view: text, markup, annotated - select for diffs
Tue Mar 24 13:53:21 2009 UTC (15 years, 8 months ago) by perry
Branches: MAIN
CVS tags: jym-xensuspend-nbase, jym-xensuspend-base
Diff to: previous 1.169: preferred, colored
Changes since revision 1.169: +6 -3 lines
per dholland, put back MAKE_VERSION for the benefit of third party users.

Revision 1.169: download - view: text, markup, annotated - select for diffs
Fri Mar 20 20:48:00 2009 UTC (15 years, 8 months ago) by perry
Branches: MAIN
Diff to: previous 1.168: preferred, colored
Changes since revision 1.168: +3 -6 lines
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.

Revision 1.168: download - view: text, markup, annotated - select for diffs
Wed Mar 18 22:02:49 2009 UTC (15 years, 8 months ago) by christos
Branches: MAIN
Diff to: previous 1.167: preferred, colored
Changes since revision 1.167: +4 -5 lines
use progname instead of getprogname() for portability.

Revision 1.167: download - view: text, markup, annotated - select for diffs
Sun Mar 1 01:49:17 2009 UTC (15 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.166: preferred, colored
Changes since revision 1.166: +23 -3 lines
use siginfo to report on the directory we are working on if available.

Revision 1.166: download - view: text, markup, annotated - select for diffs
Sat Jan 24 11:59:39 2009 UTC (15 years, 10 months ago) by dsl
Branches: MAIN
Branch point for: jym-xensuspend
Diff to: previous 1.165: preferred, colored
Changes since revision 1.165: +3 -81 lines
Move the bmake_malloc() functions into their own .c and .h files.
Include instead of make.h in a few places.

Revision 1.165: download - view: text, markup, annotated - select for diffs
Fri Jan 23 21:58:27 2009 UTC (15 years, 10 months ago) by dsl
Branches: MAIN
Diff to: previous 1.164: preferred, colored
Changes since revision 1.164: +10 -10 lines
Sprinkle some const.
In particular for Lst_Find() and Lst_FindFrom().
Remove some unneeded casts and some now-undeeded UNCONST().

Revision 1.164: download - view: text, markup, annotated - select for diffs
Fri Jan 23 21:26:30 2009 UTC (15 years, 10 months ago) by dsl
Branches: MAIN
Diff to: previous 1.163: preferred, colored
Changes since revision 1.163: +7 -7 lines
Change 'ClientData' to 'void *' so that relevant parameters can
be made 'const void *'.

Revision 1.163: download - view: text, markup, annotated - select for diffs
Sat Jan 17 13:29:37 2009 UTC (15 years, 10 months ago) by dsl
Branches: MAIN
Diff to: previous 1.162: preferred, colored
Changes since revision 1.162: +7 -7 lines
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.

Revision 1.162: download - view: text, markup, annotated - select for diffs
Fri Jan 16 21:13:13 2009 UTC (15 years, 10 months ago) by dsl
Branches: MAIN
Diff to: previous 1.161: preferred, colored
Changes since revision 1.161: +18 -9 lines
Send output of Error() to debug_file (unless stderr/stdout).

Revision 1.161: download - view: text, markup, annotated - select for diffs
Tue Jan 13 18:22:34 2009 UTC (15 years, 10 months ago) by dsl
Branches: MAIN
Diff to: previous 1.160: preferred, colored
Changes since revision 1.160: +4 -4 lines
Sprinkle a const. (arg of Main_ParseArgLine())

Revision 1.160: download - view: text, markup, annotated - select for diffs
Sat Dec 20 09:42:02 2008 UTC (15 years, 11 months ago) by dsl
Branches: MAIN
Diff to: previous 1.159: preferred, colored
Changes since revision 1.159: +3 -4 lines
Delete very splurious 'free(buf)' that xtos added.
Fixes PR bin/40233

Revision 1.159: download - view: text, markup, annotated - select for diffs
Fri Dec 19 22:03:41 2008 UTC (15 years, 11 months ago) by christos
Branches: MAIN
Diff to: previous 1.158: preferred, colored
Changes since revision 1.158: +9 -3 lines
if brk_string fail, so do we.

Revision 1.158: download - view: text, markup, annotated - select for diffs
Sat Dec 13 18:11:53 2008 UTC (15 years, 11 months ago) by dholland
Branches: MAIN
Diff to: previous 1.157: preferred, colored
Changes since revision 1.157: +4 -4 lines
fix typo in comment

Revision 1.157: download - view: text, markup, annotated - select for diffs
Sat Dec 13 15:19:29 2008 UTC (15 years, 11 months ago) by dsl
Branches: MAIN
Diff to: previous 1.156: preferred, colored
Changes since revision 1.156: +11 -11 lines
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 :-)

Revision 1.156: download - view: text, markup, annotated - select for diffs
Sat Dec 13 14:26:10 2008 UTC (15 years, 11 months ago) by dsl
Branches: MAIN
Diff to: previous 1.155: preferred, colored
Changes since revision 1.155: +4 -4 lines
Do not let the variable name "" be set from the command line (-D "")
or from ::= modifiers (${::=foo}).

Revision 1.155: download - view: text, markup, annotated - select for diffs
Sun Dec 7 04:50:15 2008 UTC (16 years ago) by christos
Branches: MAIN
Diff to: previous 1.154: preferred, colored
Changes since revision 1.154: +32 -23 lines
add debug flag for cwd.

Revision 1.154: download - view: text, markup, annotated - select for diffs
Wed Oct 22 15:04:49 2008 UTC (16 years, 1 month ago) by apb
Branches: MAIN
CVS tags: netbsd-5-base, netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, netbsd-5, matt-nb5-pq3-base, matt-nb5-pq3, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b, matt-mips64-base2
Diff to: previous 1.153: preferred, colored
Changes since revision 1.153: +5 -5 lines
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.

Revision 1.153: download - view: text, markup, annotated - select for diffs
Sun Oct 19 08:30:10 2008 UTC (16 years, 1 month ago) by apb
Branches: MAIN
Diff to: previous 1.152: preferred, colored
Changes since revision 1.152: +18 -12 lines
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.

Revision 1.152: download - view: text, markup, annotated - select for diffs
Sat Oct 18 14:35:32 2008 UTC (16 years, 1 month ago) by apb
Branches: MAIN
Diff to: previous 1.151: preferred, colored
Changes since revision 1.151: +11 -11 lines
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.

Revision 1.151: download - view: text, markup, annotated - select for diffs
Mon Oct 6 22:09:21 2008 UTC (16 years, 2 months ago) by joerg
Branches: MAIN
Diff to: previous 1.150: preferred, colored
Changes since revision 1.150: +46 -35 lines
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.

Revision 1.149.6.1: download - view: text, markup, annotated - select for diffs
Thu Sep 18 04:29:16 2008 UTC (16 years, 2 months ago) by wrstuden
Branches: wrstuden-revivesa
Diff to: previous 1.149: preferred, colored; next MAIN 1.150: preferred, colored
Changes since revision 1.149: +5 -5 lines
Sync with wrstuden-revivesa-base-2.

Revision 1.150: download - view: text, markup, annotated - select for diffs
Mon Jul 21 14:19:24 2008 UTC (16 years, 4 months ago) by lukem
Branches: MAIN
CVS tags: wrstuden-revivesa-base-3, wrstuden-revivesa-base-2
Diff to: previous 1.149: preferred, colored
Changes since revision 1.149: +5 -5 lines
Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.

Revision 1.141.4.3: download - view: text, markup, annotated - select for diffs
Sun Mar 23 00:49:02 2008 UTC (16 years, 8 months ago) by matt
Branches: matt-armv6
Diff to: previous 1.141.4.2: preferred, colored; branchpoint 1.141: preferred, colored; next MAIN 1.142: preferred, colored
Changes since revision 1.141.4.2: +6 -3 lines
sync with HEAD

Revision 1.149: download - view: text, markup, annotated - select for diffs
Fri Feb 15 21:29:50 2008 UTC (16 years, 9 months ago) by christos
Branches: MAIN
CVS tags: yamt-pf42-baseX, yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-pf42-base, yamt-pf42, wrstuden-revivesa-base-1, wrstuden-revivesa-base, matt-armv6-nbase, keiichi-mipv6-nbase, keiichi-mipv6-base, keiichi-mipv6, hpcarm-cleanup-nbase, hpcarm-cleanup-base
Branch point for: wrstuden-revivesa
Diff to: previous 1.148: preferred, colored
Changes since revision 1.148: +26 -30 lines
back all changes out until I fix it properly.

Revision 1.148: download - view: text, markup, annotated - select for diffs
Fri Feb 15 02:38:07 2008 UTC (16 years, 9 months ago) by christos
Branches: MAIN
CVS tags: christos-broken
Diff to: previous 1.147: preferred, colored
Changes since revision 1.147: +6 -6 lines
fix != expansion bug I introduced.

Revision 1.147: download - view: text, markup, annotated - select for diffs
Thu Feb 14 22:11:20 2008 UTC (16 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.146: preferred, colored
Changes since revision 1.146: +27 -23 lines
- use pid_t/size_t as appropriate instead of int.
- use %ld to print pids.
- fix a bit of lint.
- WARNS=4

Revision 1.146: download - view: text, markup, annotated - select for diffs
Sat Jan 19 06:52:14 2008 UTC (16 years, 10 months ago) by sjg
Branches: MAIN
Diff to: previous 1.145: preferred, colored
Changes since revision 1.145: +6 -3 lines
Implement -dl (aka LOUD) to override '@' at the start of script lines.
Based on supplied patch.

PR: 37202

Revision 1.141.4.2: download - view: text, markup, annotated - select for diffs
Wed Jan 9 02:00:47 2008 UTC (16 years, 11 months ago) by matt
Branches: matt-armv6
Diff to: previous 1.141.4.1: preferred, colored; branchpoint 1.141: preferred, colored
Changes since revision 1.141.4.1: +8 -4 lines
sync with HEAD

Revision 1.145: download - view: text, markup, annotated - select for diffs
Fri Dec 21 20:32:24 2007 UTC (16 years, 11 months ago) by dsl
Branches: MAIN
CVS tags: matt-armv6-base
Diff to: previous 1.144: preferred, colored
Changes since revision 1.144: +8 -4 lines
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.

Revision 1.141.4.1: download - view: text, markup, annotated - select for diffs
Tue Nov 6 23:36:00 2007 UTC (17 years, 1 month ago) by matt
Branches: matt-armv6
CVS tags: matt-armv6-prevmlocking
Diff to: previous 1.141: preferred, colored
Changes since revision 1.141: +33 -4 lines
sync with HEAD

Revision 1.144: download - view: text, markup, annotated - select for diffs
Sat Oct 13 16:16:41 2007 UTC (17 years, 1 month ago) by apb
Branches: MAIN
CVS tags: cube-autoconf-base, cube-autoconf
Diff to: previous 1.143: preferred, colored
Changes since revision 1.143: +18 -4 lines
* 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;

Revision 1.143: download - view: text, markup, annotated - select for diffs
Fri Oct 5 15:27:45 2007 UTC (17 years, 2 months ago) by sjg
Branches: MAIN
Diff to: previous 1.142: preferred, colored
Changes since revision 1.142: +5 -3 lines
Add the ability to .export variables to the environment.

Revision 1.142: download - view: text, markup, annotated - select for diffs
Mon Oct 1 22:14:10 2007 UTC (17 years, 2 months ago) by sjg
Branches: MAIN
Diff to: previous 1.141: preferred, colored
Changes since revision 1.141: +16 -3 lines
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 ---

Revision 1.137.2.1.2.1: download - view: text, markup, annotated - select for diffs
Mon Sep 3 07:05:29 2007 UTC (17 years, 3 months ago) by wrstuden
Branches: wrstuden-fixsa
Diff to: previous 1.137.2.1: preferred, colored; next MAIN 1.137.2.2: preferred, colored
Changes since revision 1.137.2.1: +17 -13 lines
Sync w/ NetBSD-4-RC_1

Revision 1.137.2.2: download - view: text, markup, annotated - select for diffs
Tue Jun 5 20:53:29 2007 UTC (17 years, 6 months ago) by bouyer
Branches: netbsd-4
CVS tags: wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0
Diff to: previous 1.137.2.1: preferred, colored; branchpoint 1.137: preferred, colored; next MAIN 1.138: preferred, colored
Changes since revision 1.137.2.1: +17 -13 lines
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.

Revision 1.141: download - view: text, markup, annotated - select for diffs
Mon Jan 1 21:29:01 2007 UTC (17 years, 11 months ago) by dsl
Branches: MAIN
CVS tags: matt-mips64-base, matt-mips64, hpcarm-cleanup
Branch point for: matt-armv6
Diff to: previous 1.140: preferred, colored
Changes since revision 1.140: +4 -4 lines
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!

Revision 1.137.2.1: download - view: text, markup, annotated - select for diffs
Wed Dec 20 22:42:11 2006 UTC (17 years, 11 months ago) by bouyer
Branches: netbsd-4
Branch point for: wrstuden-fixsa
Diff to: previous 1.137: preferred, colored
Changes since revision 1.137: +39 -35 lines
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...

Revision 1.140: download - view: text, markup, annotated - select for diffs
Sat Dec 16 08:59:29 2006 UTC (17 years, 11 months ago) by dsl
Branches: MAIN
Diff to: previous 1.139: preferred, colored
Changes since revision 1.139: +16 -12 lines
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).

Revision 1.139: download - view: text, markup, annotated - select for diffs
Wed Dec 6 20:38:21 2006 UTC (18 years ago) by dsl
Branches: MAIN
Diff to: previous 1.138: preferred, colored
Changes since revision 1.138: +4 -4 lines
Add anewline to the end of the error message output when the debug log
file cannot be opened.

Revision 1.138: download - view: text, markup, annotated - select for diffs
Sun Dec 3 20:37:39 2006 UTC (18 years ago) by dsl
Branches: MAIN
Diff to: previous 1.137: preferred, colored
Changes since revision 1.137: +38 -34 lines
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...

Revision 1.137: download - view: text, markup, annotated - select for diffs
Fri Nov 17 22:07:39 2006 UTC (18 years ago) by dsl
Branches: MAIN
CVS tags: netbsd-4-base
Branch point for: netbsd-4
Diff to: previous 1.136: preferred, colored
Changes since revision 1.136: +5 -8 lines
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).

Revision 1.136: download - view: text, markup, annotated - select for diffs
Sat Nov 11 22:07:37 2006 UTC (18 years ago) by dsl
Branches: MAIN
Diff to: previous 1.135: preferred, colored
Changes since revision 1.135: +24 -13 lines
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.

Revision 1.135: download - view: text, markup, annotated - select for diffs
Wed Nov 1 23:48:20 2006 UTC (18 years, 1 month ago) by sjg
Branches: MAIN
Diff to: previous 1.134: preferred, colored
Changes since revision 1.134: +4 -4 lines
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

Revision 1.134: download - view: text, markup, annotated - select for diffs
Fri Oct 27 21:00:19 2006 UTC (18 years, 1 month ago) by dsl
Branches: MAIN
Diff to: previous 1.133: preferred, colored
Changes since revision 1.133: +8 -8 lines
Since 'ClientData' is 'void *', nuke almost all the (ClientData) casts.

Revision 1.133: download - view: text, markup, annotated - select for diffs
Sun Oct 15 08:38:21 2006 UTC (18 years, 1 month ago) by dsl
Branches: MAIN
Diff to: previous 1.132: preferred, colored
Changes since revision 1.132: +111 -73 lines
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.

Revision 1.132: download - view: text, markup, annotated - select for diffs
Wed Oct 11 07:01:44 2006 UTC (18 years, 1 month ago) by dsl
Branches: MAIN
Diff to: previous 1.131: preferred, colored
Changes since revision 1.131: +14 -14 lines
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.

Revision 1.131: download - view: text, markup, annotated - select for diffs
Mon Oct 9 14:36:41 2006 UTC (18 years, 2 months ago) by dsl
Branches: MAIN
Diff to: previous 1.130: preferred, colored
Changes since revision 1.130: +4 -10 lines
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.

Revision 1.130: download - view: text, markup, annotated - select for diffs
Sat Aug 26 22:19:03 2006 UTC (18 years, 3 months ago) by christos
Branches: MAIN
Diff to: previous 1.129: preferred, colored
Changes since revision 1.129: +4 -4 lines
Fix non-native build.

Revision 1.129: download - view: text, markup, annotated - select for diffs
Sat Aug 26 18:17:42 2006 UTC (18 years, 3 months ago) by christos
Branches: MAIN
Diff to: previous 1.128: preferred, colored
Changes since revision 1.128: +12 -10 lines
More programs using efun.

Revision 1.128: download - view: text, markup, annotated - select for diffs
Fri Jul 28 17:06:14 2006 UTC (18 years, 4 months ago) by sjg
Branches: MAIN
CVS tags: abandoned-netbsd-4-base, abandoned-netbsd-4
Diff to: previous 1.127: preferred, colored
Changes since revision 1.127: +11 -7 lines
Fix minor mem leak in PrintOnError().

Revision 1.127: download - view: text, markup, annotated - select for diffs
Thu Jun 29 22:02:06 2006 UTC (18 years, 5 months ago) by rillig
Branches: MAIN
Diff to: previous 1.126: preferred, colored
Changes since revision 1.126: +4 -4 lines
Fixed gcc warnings about signed vs. unsigned in comparisons.

Revision 1.126.2.2: download - view: text, markup, annotated - select for diffs
Fri May 19 17:21:47 2006 UTC (18 years, 6 months ago) by christos
Branches: chap-midi
Diff to: previous 1.126.2.1: preferred, colored; branchpoint 1.126: preferred, colored; next MAIN 1.127: preferred, colored
Changes since revision 1.126.2.1: +1762 -0 lines
Coverity CID 3147: Plug memory leak.

Revision 1.126.2.1
Fri May 19 17:21:46 2006 UTC (18 years, 6 months ago) by christos
Branches: chap-midi
FILE REMOVED
Changes since revision 1.126: +0 -1762 lines
file main.c was added on branch chap-midi on 2006-05-19 17:21:47 +0000

Revision 1.126: download - view: text, markup, annotated - select for diffs
Fri May 19 17:21:46 2006 UTC (18 years, 6 months ago) by christos
Branches: MAIN
CVS tags: chap-midi-nbase, chap-midi-base
Branch point for: chap-midi
Diff to: previous 1.125: preferred, colored
Changes since revision 1.125: +6 -4 lines
Coverity CID 3147: Plug memory leak.

Revision 1.125: download - view: text, markup, annotated - select for diffs
Sat Apr 22 18:48:46 2006 UTC (18 years, 7 months ago) by christos
Branches: MAIN
Diff to: previous 1.124: preferred, colored
Changes since revision 1.124: +6 -6 lines
Coverity CID 527: Make it painfully obvious that av is freed.

Revision 1.124: download - view: text, markup, annotated - select for diffs
Wed Apr 12 20:32:27 2006 UTC (18 years, 7 months ago) by sjg
Branches: MAIN
Diff to: previous 1.123: preferred, colored
Changes since revision 1.123: +22 -10 lines
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).

Revision 1.123: download - view: text, markup, annotated - select for diffs
Fri Mar 31 21:05:34 2006 UTC (18 years, 8 months ago) by dsl
Branches: MAIN
Diff to: previous 1.122: preferred, colored
Changes since revision 1.122: +10 -7 lines
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.

Revision 1.122: download - view: text, markup, annotated - select for diffs
Fri Mar 17 15:39:44 2006 UTC (18 years, 8 months ago) by christos
Branches: MAIN
Diff to: previous 1.121: preferred, colored
Changes since revision 1.121: +42 -36 lines
Coverity CID 2719: argvalue can be NULL when passed into functions.
De-obfuscate by undefining optarg, and check explicitly for NULL before
use.

Revision 1.121: download - view: text, markup, annotated - select for diffs
Sat Mar 11 17:18:00 2006 UTC (18 years, 8 months ago) by dsl
Branches: MAIN
Diff to: previous 1.120: preferred, colored
Changes since revision 1.120: +9 -36 lines
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.

Revision 1.120: download - view: text, markup, annotated - select for diffs
Sun Feb 26 22:45:46 2006 UTC (18 years, 9 months ago) by apb
Branches: MAIN
Diff to: previous 1.119: preferred, colored
Changes since revision 1.119: +5 -3 lines
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.

Revision 1.119: download - view: text, markup, annotated - select for diffs
Sat Feb 18 04:10:05 2006 UTC (18 years, 9 months ago) by tsutsui
Branches: MAIN
Diff to: previous 1.118: preferred, colored
Changes since revision 1.118: +6 -5 lines
Don't use data in freed stack.

Revision 1.118: download - view: text, markup, annotated - select for diffs
Sun Jan 22 19:54:55 2006 UTC (18 years, 10 months ago) by dsl
Branches: MAIN
Diff to: previous 1.117: preferred, colored
Changes since revision 1.117: +7 -3 lines
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.

Revision 1.117: download - view: text, markup, annotated - select for diffs
Wed Jan 4 21:31:55 2006 UTC (18 years, 11 months ago) by dsl
Branches: MAIN
Diff to: previous 1.116: preferred, colored
Changes since revision 1.116: +3 -4 lines
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.

Revision 1.116: download - view: text, markup, annotated - select for diffs
Tue Aug 9 21:36:42 2005 UTC (19 years, 4 months ago) by christos
Branches: MAIN
Diff to: previous 1.115: preferred, colored
Changes since revision 1.115: +4 -4 lines
Add typedefs for DuplicateProc and FreeProc from Max Okumoto.

Revision 1.115: download - view: text, markup, annotated - select for diffs
Mon Aug 8 16:42:54 2005 UTC (19 years, 4 months ago) by christos
Branches: MAIN
Diff to: previous 1.114: preferred, colored
Changes since revision 1.114: +5 -5 lines
From Max Okumoto:
- Remove casts to NULL.
- Remove space between cast and object.

Revision 1.114: download - view: text, markup, annotated - select for diffs
Fri Aug 5 00:53:18 2005 UTC (19 years, 4 months ago) by christos
Branches: MAIN
Diff to: previous 1.113: preferred, colored
Changes since revision 1.113: +4 -4 lines
More KNF cleanups from Max Okumoto

Revision 1.113: download - view: text, markup, annotated - select for diffs
Wed Aug 3 20:55:01 2005 UTC (19 years, 4 months ago) by christos
Branches: MAIN
Diff to: previous 1.112: preferred, colored
Changes since revision 1.112: +4 -4 lines
from Max Okumoto: debug should be int, not boolean.

Revision 1.112: download - view: text, markup, annotated - select for diffs
Mon Jul 25 22:55:58 2005 UTC (19 years, 4 months ago) by christos
Branches: MAIN
Diff to: previous 1.111: preferred, colored
Changes since revision 1.111: +27 -27 lines
Whitespace KNF cleanup from Max Okumoto

Revision 1.111: download - view: text, markup, annotated - select for diffs
Fri Jun 24 02:53:27 2005 UTC (19 years, 5 months ago) by lukem
Branches: MAIN
Diff to: previous 1.110: preferred, colored
Changes since revision 1.110: +11 -0 lines
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.

Revision 1.110: download - view: text, markup, annotated - select for diffs
Thu Jun 23 02:31:31 2005 UTC (19 years, 5 months ago) by lukem
Branches: MAIN
Diff to: previous 1.109: preferred, colored
Changes since revision 1.109: +3 -14 lines
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.

Revision 1.109: download - view: text, markup, annotated - select for diffs
Fri Jun 17 19:25:20 2005 UTC (19 years, 5 months ago) by jmc
Branches: MAIN
Diff to: previous 1.108: preferred, colored
Changes since revision 1.108: +6 -3 lines
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)

Revision 1.108: download - view: text, markup, annotated - select for diffs
Fri Jun 3 16:15:46 2005 UTC (19 years, 6 months ago) by lukem
Branches: MAIN
Diff to: previous 1.107: preferred, colored
Changes since revision 1.107: +6 -3 lines
appease gcc -Wuninitialized

Revision 1.107: download - view: text, markup, annotated - select for diffs
Wed Jun 1 17:17:34 2005 UTC (19 years, 6 months ago) by sjg
Branches: MAIN
Diff to: previous 1.106: preferred, colored
Changes since revision 1.106: +11 -3 lines
Add :Ox for random ordering, based on patch from
Mike M. Volokhov <mishka@apk.od.ua>

Revision 1.106: download - view: text, markup, annotated - select for diffs
Wed Feb 16 15:11:52 2005 UTC (19 years, 9 months ago) by christos
Branches: MAIN
CVS tags: netbsd-3-base, netbsd-3-1-RELEASE, netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-1-1-RELEASE, netbsd-3-1, netbsd-3-0-RELEASE, netbsd-3-0-RC6, netbsd-3-0-RC5, netbsd-3-0-RC4, netbsd-3-0-RC3, netbsd-3-0-RC2, netbsd-3-0-RC1, netbsd-3-0-3-RELEASE, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE, netbsd-3-0, netbsd-3
Diff to: previous 1.105: preferred, colored
Changes since revision 1.105: +6 -6 lines
PR/29203, PR/29204: Max Okumoto: KNF changes to make [no functional changes]

Revision 1.105: download - view: text, markup, annotated - select for diffs
Tue Jul 13 11:59:12 2004 UTC (20 years, 4 months ago) by wiz
Branches: MAIN
Diff to: previous 1.104: preferred, colored
Changes since revision 1.104: +6 -6 lines
Sync usage with man page; from Kouichirou Hiratsuka in PR 26223.

Revision 1.104: download - view: text, markup, annotated - select for diffs
Thu Jul 1 20:38:09 2004 UTC (20 years, 5 months ago) by jmc
Branches: MAIN
Diff to: previous 1.103: preferred, colored
Changes since revision 1.103: +4 -8 lines
Change to use __unused instead and provide a compat definition in make.h if
not already defined from cdefs.h

Revision 1.103: download - view: text, markup, annotated - select for diffs
Thu Jul 1 04:39:30 2004 UTC (20 years, 5 months ago) by jmc
Branches: MAIN
Diff to: previous 1.102: preferred, colored
Changes since revision 1.102: +7 -3 lines
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

Revision 1.100.2.2: download - view: text, markup, annotated - select for diffs
Mon May 10 15:42:07 2004 UTC (20 years, 7 months ago) by tron
Branches: netbsd-2-0
CVS tags: netbsd-2-base, netbsd-2-1-RELEASE, netbsd-2-1-RC6, netbsd-2-1-RC5, netbsd-2-1-RC4, netbsd-2-1-RC3, netbsd-2-1-RC2, netbsd-2-1-RC1, netbsd-2-1, netbsd-2-0-RELEASE, netbsd-2-0-RC5, netbsd-2-0-RC4, netbsd-2-0-RC3, netbsd-2-0-RC2, netbsd-2-0-RC1, netbsd-2-0-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE, netbsd-2
Diff to: previous 1.100.2.1: preferred, colored; branchpoint 1.100: preferred, colored; next MAIN 1.101: preferred, colored
Changes since revision 1.100.2.1: +3 -3 lines
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

Revision 1.100.2.1: download - view: text, markup, annotated - select for diffs
Mon May 10 15:32:44 2004 UTC (20 years, 7 months ago) by tron
Branches: netbsd-2-0
Diff to: previous 1.100: preferred, colored
Changes since revision 1.100: +9 -6 lines
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.

Revision 1.102: download - view: text, markup, annotated - select for diffs
Fri May 7 00:04:38 2004 UTC (20 years, 7 months ago) by ross
Branches: MAIN
Diff to: previous 1.101: preferred, colored
Changes since revision 1.101: +6 -6 lines
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

Revision 1.101: download - view: text, markup, annotated - select for diffs
Thu Apr 22 21:19:02 2004 UTC (20 years, 7 months ago) by ross
Branches: MAIN
Diff to: previous 1.100: preferred, colored
Changes since revision 1.100: +9 -6 lines
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.

Revision 1.100: download - view: text, markup, annotated - select for diffs
Sat Mar 27 00:17:08 2004 UTC (20 years, 8 months ago) by enami
Branches: MAIN
CVS tags: netbsd-2-0-base
Branch point for: netbsd-2-0
Diff to: previous 1.99: preferred, colored
Changes since revision 1.99: +10 -3 lines
Validate existence of arguemnt.  PR#24933.

Revision 1.99: download - view: text, markup, annotated - select for diffs
Wed Mar 24 00:59:40 2004 UTC (20 years, 8 months ago) by fair
Branches: MAIN
Diff to: previous 1.98: preferred, colored
Changes since revision 1.98: +4 -4 lines
Fix comment per PR 24437; make(1) tries "makefile" first, and then
"Makefile", not the other way around as previously documented.

Revision 1.98: download - view: text, markup, annotated - select for diffs
Thu Feb 5 23:31:34 2004 UTC (20 years, 10 months ago) by ross
Branches: MAIN
Diff to: previous 1.97: preferred, colored
Changes since revision 1.97: +58 -16 lines
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.

Revision 1.97: download - view: text, markup, annotated - select for diffs
Tue Feb 3 19:25:29 2004 UTC (20 years, 10 months ago) by chuck
Branches: MAIN
Diff to: previous 1.96: preferred, colored
Changes since revision 1.96: +24 -7 lines
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

Revision 1.96: download - view: text, markup, annotated - select for diffs
Mon Jan 5 23:23:35 2004 UTC (20 years, 11 months ago) by jmmv
Branches: MAIN
Diff to: previous 1.95: preferred, colored
Changes since revision 1.95: +4 -4 lines
Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.

Revision 1.95: download - view: text, markup, annotated - select for diffs
Thu Dec 18 22:36:18 2003 UTC (20 years, 11 months ago) by jmc
Branches: MAIN
Diff to: previous 1.94: preferred, colored
Changes since revision 1.94: +13 -3 lines
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

Revision 1.94: download - view: text, markup, annotated - select for diffs
Sun Dec 7 20:30:28 2003 UTC (21 years ago) by dsl
Branches: MAIN
Diff to: previous 1.93: preferred, colored
Changes since revision 1.93: +8 -4 lines
Add a -Dg3 which outputs the 'input graph' only on error exit.
Lets you see the wood for the trees...

Revision 1.93: download - view: text, markup, annotated - select for diffs
Wed Sep 10 18:04:22 2003 UTC (21 years, 2 months ago) by jmmv
Branches: MAIN
Diff to: previous 1.92: preferred, colored
Changes since revision 1.92: +6 -3 lines
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.

Revision 1.92: download - view: text, markup, annotated - select for diffs
Fri Sep 5 06:52:11 2003 UTC (21 years, 3 months ago) by sjg
Branches: MAIN
Diff to: previous 1.91: preferred, colored
Changes since revision 1.91: +21 -16 lines
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?

Revision 1.91: download - view: text, markup, annotated - select for diffs
Thu Aug 7 11:14:53 2003 UTC (21 years, 4 months ago) by agc
Branches: MAIN
Diff to: previous 1.90: preferred, colored
Changes since revision 1.90: +33 -3 lines
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.

Revision 1.90: download - view: text, markup, annotated - select for diffs
Fri Aug 1 00:39:53 2003 UTC (21 years, 4 months ago) by sjg
Branches: MAIN
Diff to: previous 1.89: preferred, colored
Changes since revision 1.89: +7 -5 lines
Allow .SHELL: to control the shell used by compat mode too.
Add a shell spec for ksh - a nice portable posix shell.
Document .SHELL:

Revision 1.89: download - view: text, markup, annotated - select for diffs
Mon Jul 14 18:19:12 2003 UTC (21 years, 4 months ago) by christos
Branches: MAIN
Diff to: previous 1.88: preferred, colored
Changes since revision 1.88: +24 -22 lines
Pass WARNS=3

Revision 1.88: download - view: text, markup, annotated - select for diffs
Sat May 10 19:21:40 2003 UTC (21 years, 7 months ago) by jmmv
Branches: MAIN
Diff to: previous 1.87: preferred, colored
Changes since revision 1.87: +4 -4 lines
Remove extra space in usage message.

Revision 1.87: download - view: text, markup, annotated - select for diffs
Fri Mar 14 05:19:43 2003 UTC (21 years, 8 months ago) by thorpej
Branches: MAIN
Diff to: previous 1.86: preferred, colored
Changes since revision 1.86: +10 -5 lines
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.

Revision 1.86: download - view: text, markup, annotated - select for diffs
Wed Feb 26 08:59:12 2003 UTC (21 years, 9 months ago) by sjg
Branches: MAIN
Diff to: previous 1.85: preferred, colored
Changes since revision 1.85: +4 -3 lines
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).

Revision 1.85: download - view: text, markup, annotated - select for diffs
Sat Jun 15 18:24:57 2002 UTC (22 years, 5 months ago) by wiz
Branches: MAIN
CVS tags: fvdl_fs64_base
Diff to: previous 1.84: preferred, colored
Changes since revision 1.84: +39 -97 lines
Remove !__STDC__ stuff, de-__P(), ANSIfy, and de-register.

Revision 1.84: download - view: text, markup, annotated - select for diffs
Sat Apr 27 15:14:30 2002 UTC (22 years, 7 months ago) by bjh21
Branches: MAIN
CVS tags: netbsd-1-6-base, netbsd-1-6-RELEASE, netbsd-1-6-RC3, netbsd-1-6-RC2, netbsd-1-6-RC1, netbsd-1-6-PATCH002-RELEASE, netbsd-1-6-PATCH002-RC4, netbsd-1-6-PATCH002-RC3, netbsd-1-6-PATCH002-RC2, netbsd-1-6-PATCH002-RC1, netbsd-1-6-PATCH002, netbsd-1-6-PATCH001-RELEASE, netbsd-1-6-PATCH001-RC3, netbsd-1-6-PATCH001-RC2, netbsd-1-6-PATCH001-RC1, netbsd-1-6-PATCH001, netbsd-1-6
Diff to: previous 1.83: preferred, colored
Changes since revision 1.83: +4 -4 lines
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.

Revision 1.83: download - view: text, markup, annotated - select for diffs
Thu Mar 14 16:08:39 2002 UTC (22 years, 8 months ago) by pk
Branches: MAIN
Diff to: previous 1.82: preferred, colored
Changes since revision 1.82: +11 -8 lines
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.

Revision 1.82: download - view: text, markup, annotated - select for diffs
Sun Jan 27 01:50:54 2002 UTC (22 years, 10 months ago) by reinoud
Branches: MAIN
Diff to: previous 1.81: preferred, colored
Changes since revision 1.81: +8 -8 lines
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.

Revision 1.81: download - view: text, markup, annotated - select for diffs
Tue Dec 11 20:50:58 2001 UTC (22 years, 11 months ago) by tv
Branches: MAIN
Diff to: previous 1.80: preferred, colored
Changes since revision 1.80: +8 -4 lines
Allow MAKE_MACHINE to be unset if MAKE_BOOTSTRAP.

Revision 1.80: download - view: text, markup, annotated - select for diffs
Fri Nov 30 01:29:48 2001 UTC (23 years ago) by thorpej
Branches: MAIN
Diff to: previous 1.79: preferred, colored
Changes since revision 1.79: +6 -6 lines
Clean up some MAKE_BOOTSTRAP issues wrt. MACHINE/MACHINE_ARCH.

Revision 1.79: download - view: text, markup, annotated - select for diffs
Mon Nov 12 21:58:18 2001 UTC (23 years ago) by tv
Branches: MAIN
Diff to: previous 1.78: preferred, colored
Changes since revision 1.78: +7 -11 lines
Redo the hashtable for "." if .OBJDIR changes.

Revision 1.78: download - view: text, markup, annotated - select for diffs
Mon Nov 12 01:33:48 2001 UTC (23 years ago) by tv
Branches: MAIN
Diff to: previous 1.77: preferred, colored
Changes since revision 1.77: +4 -3 lines
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.)

Revision 1.77: download - view: text, markup, annotated - select for diffs
Sun Nov 11 21:40:05 2001 UTC (23 years ago) by tv
Branches: MAIN
Diff to: previous 1.76: preferred, colored
Changes since revision 1.76: +25 -6 lines
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.

Revision 1.76: download - view: text, markup, annotated - select for diffs
Fri Nov 2 15:37:41 2001 UTC (23 years, 1 month ago) by tv
Branches: MAIN
Diff to: previous 1.75: preferred, colored
Changes since revision 1.75: +4 -4 lines
Apparently something was missed in the Main_SetObjdir commit.  Fix a TRUE
value that should start out FALSE.

Revision 1.75: download - view: text, markup, annotated - select for diffs
Fri Nov 2 03:52:21 2001 UTC (23 years, 1 month ago) by tv
Branches: MAIN
Diff to: previous 1.74: preferred, colored
Changes since revision 1.74: +6 -22 lines
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.)

Revision 1.74: download - view: text, markup, annotated - select for diffs
Wed Oct 31 03:59:42 2001 UTC (23 years, 1 month ago) by tv
Branches: MAIN
Diff to: previous 1.73: preferred, colored
Changes since revision 1.73: +54 -67 lines
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.

Revision 1.73: download - view: text, markup, annotated - select for diffs
Wed Oct 31 01:15:57 2001 UTC (23 years, 1 month ago) by tv
Branches: MAIN
Diff to: previous 1.72: preferred, colored
Changes since revision 1.72: +26 -25 lines
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.)

Revision 1.72: download - view: text, markup, annotated - select for diffs
Sun Sep 16 16:34:43 2001 UTC (23 years, 2 months ago) by wiz
Branches: MAIN
Diff to: previous 1.71: preferred, colored
Changes since revision 1.71: +4 -4 lines
Spell 'occurred' with two 'r's.

Revision 1.71: download - view: text, markup, annotated - select for diffs
Tue Jun 12 23:36:17 2001 UTC (23 years, 5 months ago) by sjg
Branches: MAIN
Diff to: previous 1.70: preferred, colored
Changes since revision 1.70: +18 -18 lines
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

Revision 1.70: download - view: text, markup, annotated - select for diffs
Sun Jun 10 02:31:00 2001 UTC (23 years, 6 months ago) by sjg
Branches: MAIN
Diff to: previous 1.69: preferred, colored
Changes since revision 1.69: +6 -5 lines
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.

Revision 1.69: download - view: text, markup, annotated - select for diffs
Sat Jun 9 05:57:31 2001 UTC (23 years, 6 months ago) by sjg
Branches: MAIN
Diff to: previous 1.68: preferred, colored
Changes since revision 1.68: +4 -5 lines
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.

Revision 1.68: download - view: text, markup, annotated - select for diffs
Sat Jun 9 05:22:47 2001 UTC (23 years, 6 months ago) by sjg
Branches: MAIN
Diff to: previous 1.67: preferred, colored
Changes since revision 1.67: +30 -14 lines
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.

Revision 1.67: download - view: text, markup, annotated - select for diffs
Fri Jun 1 20:33:37 2001 UTC (23 years, 6 months ago) by sjg
Branches: MAIN
Diff to: previous 1.66: preferred, colored
Changes since revision 1.66: +42 -6 lines
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

Revision 1.66: download - view: text, markup, annotated - select for diffs
Tue May 29 17:37:52 2001 UTC (23 years, 6 months ago) by christos
Branches: MAIN
Diff to: previous 1.65: preferred, colored
Changes since revision 1.65: +40 -5 lines
better error messages on exec* failures. From Simon Burge.

Revision 1.65: download - view: text, markup, annotated - select for diffs
Tue Jan 16 02:37:03 2001 UTC (23 years, 10 months ago) by cgd
Branches: MAIN
Diff to: previous 1.64: preferred, colored
Changes since revision 1.64: +5 -4 lines
Avoid accidental use of trigraphs.  Pointed out by development version of gcc.

Revision 1.64: download - view: text, markup, annotated - select for diffs
Sun Jan 14 05:33:53 2001 UTC (23 years, 10 months ago) by christos
Branches: MAIN
Diff to: previous 1.63: preferred, colored
Changes since revision 1.63: +5 -5 lines
make the -W arg work; it was not put in the getopt string.

Revision 1.63: download - view: text, markup, annotated - select for diffs
Wed Jan 10 15:54:00 2001 UTC (23 years, 10 months ago) by christos
Branches: MAIN
Diff to: previous 1.62: preferred, colored
Changes since revision 1.62: +36 -23 lines
PR/11800: Chris Demetriou: Add -W flag to exit on parse warnings.
While I am here, s/make:.*"/%s:\1", progname/

Revision 1.62: download - view: text, markup, annotated - select for diffs
Sun Jan 7 06:16:02 2001 UTC (23 years, 11 months ago) by sjg
Branches: MAIN
Diff to: previous 1.61: preferred, colored
Changes since revision 1.61: +5 -6 lines
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.

Revision 1.61: download - view: text, markup, annotated - select for diffs
Mon Jan 1 15:47:37 2001 UTC (23 years, 11 months ago) by sommerfeld
Branches: MAIN
Diff to: previous 1.60: preferred, colored
Changes since revision 1.60: +15 -11 lines
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.

Revision 1.60: download - view: text, markup, annotated - select for diffs
Sat Dec 30 14:21:23 2000 UTC (23 years, 11 months ago) by sommerfeld
Branches: MAIN
Diff to: previous 1.59: preferred, colored
Changes since revision 1.59: +4 -3 lines
Avoid token leaks when aborting after an error.

Revision 1.59: download - view: text, markup, annotated - select for diffs
Sat Dec 30 02:52:03 2000 UTC (23 years, 11 months ago) by sommerfeld
Branches: MAIN
Diff to: previous 1.58: preferred, colored
Changes since revision 1.58: +4 -4 lines
strdup tracefile so that it doesn't get smashed.

Revision 1.58: download - view: text, markup, annotated - select for diffs
Sat Dec 30 02:05:21 2000 UTC (23 years, 11 months ago) by sommerfeld
Branches: MAIN
Diff to: previous 1.57: preferred, colored
Changes since revision 1.57: +61 -16 lines
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.

Revision 1.56.2.1: download - view: text, markup, annotated - select for diffs
Fri Jun 23 16:39:42 2000 UTC (24 years, 5 months ago) by minoura
Branches: minoura-xpg4dl
Diff to: previous 1.56: preferred, colored; next MAIN 1.57: preferred, colored
Changes since revision 1.56: +14 -6 lines
Sync w/ netbsd-1-5-base.

Revision 1.57: download - view: text, markup, annotated - select for diffs
Tue Jun 6 03:00:11 2000 UTC (24 years, 6 months ago) by sjg
Branches: MAIN
CVS tags: netbsd-1-5-base, netbsd-1-5-RELEASE, netbsd-1-5-PATCH003, netbsd-1-5-PATCH002, netbsd-1-5-PATCH001, netbsd-1-5-BETA2, netbsd-1-5-BETA, netbsd-1-5-ALPHA2, netbsd-1-5
Diff to: previous 1.56: preferred, colored
Changes since revision 1.56: +14 -6 lines
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.

Revision 1.56: download - view: text, markup, annotated - select for diffs
Wed May 10 07:49:35 2000 UTC (24 years, 7 months ago) by sjg
Branches: MAIN
CVS tags: minoura-xpg4dl-base
Branch point for: minoura-xpg4dl
Diff to: previous 1.55: preferred, colored
Changes since revision 1.55: +4 -6 lines
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.

Revision 1.55: download - view: text, markup, annotated - select for diffs
Sat Apr 29 12:15:16 2000 UTC (24 years, 7 months ago) by sjg
Branches: MAIN
Diff to: previous 1.54: preferred, colored
Changes since revision 1.54: +13 -5 lines
Allow MAKESYSPATH in the environment to override the default syspath.

Revision 1.54: download - view: text, markup, annotated - select for diffs
Thu Apr 20 11:23:26 2000 UTC (24 years, 7 months ago) by sjg
Branches: MAIN
Diff to: previous 1.53: preferred, colored
Changes since revision 1.53: +193 -4 lines
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.

Revision 1.53: download - view: text, markup, annotated - select for diffs
Sun Apr 16 23:24:23 2000 UTC (24 years, 7 months ago) by christos
Branches: MAIN
Diff to: previous 1.52: preferred, colored
Changes since revision 1.52: +9 -3 lines
prefix errors with the program name.

Revision 1.52: download - view: text, markup, annotated - select for diffs
Fri Apr 14 06:11:09 2000 UTC (24 years, 7 months ago) by simonb
Branches: MAIN
Diff to: previous 1.51: preferred, colored
Changes since revision 1.51: +3 -5 lines
Don't declare 'extern opt*' getopt variables.

Revision 1.51: download - view: text, markup, annotated - select for diffs
Tue Feb 8 12:43:25 2000 UTC (24 years, 10 months ago) by sjg
Branches: MAIN
Diff to: previous 1.50: preferred, colored
Changes since revision 1.50: +15 -8 lines
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.

Revision 1.50: download - view: text, markup, annotated - select for diffs
Wed Sep 15 10:47:37 1999 UTC (25 years, 2 months ago) by mycroft
Branches: MAIN
CVS tags: wrstuden-devbsize-base, wrstuden-devbsize-19991221, wrstuden-devbsize, comdex-fall-1999-base, comdex-fall-1999
Diff to: previous 1.49: preferred, colored
Changes since revision 1.49: +8 -3 lines
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.

Revision 1.49: download - view: text, markup, annotated - select for diffs
Wed Sep 15 08:48:17 1999 UTC (25 years, 2 months ago) by mycroft
Branches: MAIN
Diff to: previous 1.48: preferred, colored
Changes since revision 1.48: +5 -3 lines
More cleanup code bites it.

Revision 1.48: download - view: text, markup, annotated - select for diffs
Sat Sep 4 04:21:28 1999 UTC (25 years, 3 months ago) by christos
Branches: MAIN
Diff to: previous 1.47: preferred, colored
Changes since revision 1.47: +17 -8 lines
PR/8259: Chris Demetriou: Fix stack overflow bugs exposed by the glibc-2.1.1
Makefile. Use snprintf everywhere.

Revision 1.47: download - view: text, markup, annotated - select for diffs
Mon Aug 2 17:23:58 1999 UTC (25 years, 4 months ago) by hubertf
Branches: MAIN
Diff to: previous 1.46: preferred, colored
Changes since revision 1.46: +9 -8 lines
Save the walls, use fly swatters instead of machine guns!
(s/sscanf/strtol/, per Christos)

Revision 1.46: download - view: text, markup, annotated - select for diffs
Mon Aug 2 15:23:11 1999 UTC (25 years, 4 months ago) by hubertf
Branches: MAIN
Diff to: previous 1.45: preferred, colored
Changes since revision 1.45: +14 -6 lines
Detect invalid arguments to -j and -L by using sscanf() instead of atoi().
Fixes PR 6743 by Assar Westerlund <assar@sics.se>

Revision 1.45: download - view: text, markup, annotated - select for diffs
Sun Nov 1 03:07:34 1998 UTC (26 years, 1 month ago) by itohy
Branches: MAIN
CVS tags: netbsd-1-4-base, netbsd-1-4-RELEASE, netbsd-1-4-PATCH003, netbsd-1-4-PATCH002, netbsd-1-4-PATCH001, netbsd-1-4
Diff to: previous 1.44: preferred, colored
Changes since revision 1.44: +4 -3 lines
Reduced memory leaks.
I found some more leaks, but are not in inside of iterations.

Revision 1.44: download - view: text, markup, annotated - select for diffs
Sun Nov 1 03:01:53 1998 UTC (26 years, 1 month ago) by itohy
Branches: MAIN
Diff to: previous 1.43: preferred, colored
Changes since revision 1.43: +5 -5 lines
Avoid reading outside of allocated memory
on command execution if the output is empty.

Revision 1.43: download - view: text, markup, annotated - select for diffs
Tue Oct 13 17:08:34 1998 UTC (26 years, 1 month ago) by wsanchez
Branches: MAIN
Diff to: previous 1.42: preferred, colored
Changes since revision 1.42: +7 -3 lines
Use __ARCHITECTURE__, if defined, as MACHINE_ARCH

Revision 1.38.2.1: download - view: text, markup, annotated - select for diffs
Fri May 8 06:12:07 1998 UTC (26 years, 7 months ago) by mycroft
Branches: netbsd-1-3
CVS tags: netbsd-1-3-PATCH003-CANDIDATE2, netbsd-1-3-PATCH003-CANDIDATE1, netbsd-1-3-PATCH003-CANDIDATE0, netbsd-1-3-PATCH003, netbsd-1-3-PATCH002
Diff to: previous 1.38: preferred, colored; next MAIN 1.39: preferred, colored
Changes since revision 1.38: +19 -7 lines
Sync with trunk, per request of christos.

Revision 1.42: download - view: text, markup, annotated - select for diffs
Thu Apr 2 10:33:17 1998 UTC (26 years, 8 months ago) by kleink
Branches: MAIN
Diff to: previous 1.41: preferred, colored
Changes since revision 1.41: +4 -3 lines
Need <time.h> for time() prototype.

Revision 1.41: download - view: text, markup, annotated - select for diffs
Sat Mar 28 22:29:04 1998 UTC (26 years, 8 months ago) by christos
Branches: MAIN
Diff to: previous 1.40: preferred, colored
Changes since revision 1.40: +5 -4 lines
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.

Revision 1.40: download - view: text, markup, annotated - select for diffs
Thu Mar 26 19:20:37 1998 UTC (26 years, 8 months ago) by christos
Branches: MAIN
Diff to: previous 1.39: preferred, colored
Changes since revision 1.39: +16 -6 lines
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

Revision 1.39: download - view: text, markup, annotated - select for diffs
Sat Nov 8 09:33:16 1997 UTC (27 years, 1 month ago) by lukem
Branches: MAIN
Diff to: previous 1.38: preferred, colored
Changes since revision 1.38: +4 -4 lines
getopt returns -1 not EOF, use memmove  instead of bcopy

Revision 1.38: download - view: text, markup, annotated - select for diffs
Sun Sep 28 03:31:07 1997 UTC (27 years, 2 months ago) by lukem
Branches: MAIN
CVS tags: netbsd-1-3-base, netbsd-1-3-RELEASE, netbsd-1-3-PATCH001, netbsd-1-3-BETA
Branch point for: netbsd-1-3
Diff to: previous 1.37: preferred, colored
Changes since revision 1.37: +6 -2 lines
wrap #include <sys/cdefs.h>, __RCSID(...) stuff in #ifndef MAKE_BOOTSTRAP

Revision 1.37: download - view: text, markup, annotated - select for diffs
Tue Jul 1 21:17:28 1997 UTC (27 years, 5 months ago) by christos
Branches: MAIN
Diff to: previous 1.36: preferred, colored
Changes since revision 1.36: +5 -5 lines
Add WARNS=1
RCSID police

Revision 1.36: download - view: text, markup, annotated - select for diffs
Thu May 8 21:24:44 1997 UTC (27 years, 7 months ago) by gwr
Branches: MAIN
Diff to: previous 1.35: preferred, colored
Changes since revision 1.35: +14 -11 lines
Add the new .NOPATH feature which can be used to disable .PATH search
for particular targets, i.e. .depend, objects, etc.  (from Christos).

Revision 1.35: download - view: text, markup, annotated - select for diffs
Thu May 8 05:19:46 1997 UTC (27 years, 7 months ago) by cjs
Branches: MAIN
Diff to: previous 1.34: preferred, colored
Changes since revision 1.34: +5 -3 lines
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.

Revision 1.34: download - view: text, markup, annotated - select for diffs
Mon Mar 24 20:56:36 1997 UTC (27 years, 8 months ago) by gwr
Branches: MAIN
Diff to: previous 1.33: preferred, colored
Changes since revision 1.33: +5 -5 lines
Do not compile-in ${MACHINE} (as per PR#3386, OK'ed by christos)

Revision 1.33: download - view: text, markup, annotated - select for diffs
Tue Jan 28 23:58:00 1997 UTC (27 years, 10 months ago) by christos
Branches: MAIN
Diff to: previous 1.32: preferred, colored
Changes since revision 1.32: +14 -7 lines
make $MACHINE_ARCH settable from the environment.

Revision 1.28.4.1: download - view: text, markup, annotated - select for diffs
Sun Jan 26 05:51:43 1997 UTC (27 years, 10 months ago) by rat
Branches: netbsd-1-2
CVS tags: netbsd-1-2-PATCH001
Diff to: previous 1.28: preferred, colored; next MAIN 1.29: preferred, colored
Changes since revision 1.28: +281 -81 lines
Update make(1) from trunk, by request from Christos Zoulas.  Fixes many bugs.

Revision 1.32: download - view: text, markup, annotated - select for diffs
Tue Dec 31 17:54:16 1996 UTC (27 years, 11 months ago) by christos
Branches: MAIN
Diff to: previous 1.31: preferred, colored
Changes since revision 1.31: +10 -9 lines
- include <stdlib.h> to get getenv() prototype on SVR4
- if __STDC__ -> ifdef __STDC__ to appease SVR4

Revision 1.1.1.2 (vendor branch): download - view: text, markup, annotated - select for diffs
Sat Dec 28 04:41:09 1996 UTC (27 years, 11 months ago) by tls
Branches: WFJ-920714, CSRG
CVS tags: lite-2
Diff to: previous 1.1.1.1: preferred, colored
Changes since revision 1.1.1.1: +216 -54 lines
Import 4.4BSD-Lite2 sources onto CSRG branch (already merged at head)

Revision 1.31: download - view: text, markup, annotated - select for diffs
Wed Nov 6 17:59:12 1996 UTC (28 years, 1 month ago) by christos
Branches: MAIN
Diff to: previous 1.30: preferred, colored
Changes since revision 1.30: +125 -78 lines
- 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.

Revision 1.30: download - view: text, markup, annotated - select for diffs
Tue Aug 13 16:42:08 1996 UTC (28 years, 3 months ago) by christos
Branches: MAIN
Diff to: previous 1.29: preferred, colored
Changes since revision 1.29: +18 -3 lines
Add estrdup(), a checked version of strdup and use it.

Revision 1.29: download - view: text, markup, annotated - select for diffs
Tue May 28 23:34:41 1996 UTC (28 years, 6 months ago) by christos
Branches: MAIN
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +139 -2 lines
- 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'

Revision 1.28: download - view: text, markup, annotated - select for diffs
Sun Mar 31 21:30:05 1996 UTC (28 years, 8 months ago) by christos
Branches: MAIN
CVS tags: netbsd-1-2-base, netbsd-1-2-RELEASE, netbsd-1-2-BETA
Branch point for: netbsd-1-2
Diff to: previous 1.27: preferred, colored
Changes since revision 1.27: +9 -11 lines
make emalloc and erealloc return void *; closes PR/2276

Revision 1.27: download - view: text, markup, annotated - select for diffs
Fri Mar 29 02:17:24 1996 UTC (28 years, 8 months ago) by jtc
Branches: MAIN
Diff to: previous 1.26: preferred, colored
Changes since revision 1.26: +18 -2 lines
Added erealloc() function that calls enomem() if the allocation fails
(this is like the existing emalloc() function).  Changed all realloc()
calls to erealloc().

Revision 1.26: download - view: text, markup, annotated - select for diffs
Mon Mar 11 13:45:33 1996 UTC (28 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +6 -3 lines
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.

Revision 1.25: download - view: text, markup, annotated - select for diffs
Wed Mar 6 00:15:17 1996 UTC (28 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.24: preferred, colored
Changes since revision 1.24: +48 -11 lines
Fix PR/2118; apply sysincludes patch.

Revision 1.24: download - view: text, markup, annotated - select for diffs
Sun Feb 4 22:20:49 1996 UTC (28 years, 10 months ago) by christos
Branches: MAIN
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +3 -3 lines
fix pr/1421 and pr/1997

Revision 1.23: download - view: text, markup, annotated - select for diffs
Wed Nov 22 17:40:14 1995 UTC (29 years ago) by christos
Branches: MAIN
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +3 -3 lines
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.

Revision 1.22: download - view: text, markup, annotated - select for diffs
Wed Nov 8 02:30:58 1995 UTC (29 years, 1 month ago) by christos
Branches: MAIN
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +11 -6 lines
- 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.

Revision 1.21: download - view: text, markup, annotated - select for diffs
Thu Nov 2 23:54:54 1995 UTC (29 years, 1 month ago) by christos
Branches: MAIN
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +47 -10 lines
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.

Revision 1.20: download - view: text, markup, annotated - select for diffs
Wed Sep 27 18:42:21 1995 UTC (29 years, 2 months ago) by jtc
Branches: MAIN
CVS tags: netbsd-1-1-base, netbsd-1-1-RELEASE, netbsd-1-1-PATCH001, netbsd-1-1
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +3 -3 lines
include <signal.h> instead of <sys/signal.h>

Revision 1.19: download - view: text, markup, annotated - select for diffs
Wed Jun 14 15:19:34 1995 UTC (29 years, 5 months ago) by christos
Branches: MAIN
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +7 -2 lines
- $NetBSD$ rcsids
- Fixed so that .[A-Z]* targets that do not match keywords are ignored as
  Posix mandates
- Added .PHONY target keyword

Revision 1.18: download - view: text, markup, annotated - select for diffs
Fri Jan 6 19:57:27 1995 UTC (29 years, 11 months ago) by christos
Branches: MAIN
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +11 -7 lines
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.

Revision 1.17: download - view: text, markup, annotated - select for diffs
Fri Sep 30 03:14:21 1994 UTC (30 years, 2 months ago) by gwr
Branches: MAIN
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +17 -5 lines
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, ...)

Revision 1.16: download - view: text, markup, annotated - select for diffs
Fri Sep 23 09:33:21 1994 UTC (30 years, 2 months ago) by mycroft
Branches: MAIN
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +3 -3 lines
Use getcwd(3), not getwd(3), and remove some old, unused compatibility code.

Revision 1.15: download - view: text, markup, annotated - select for diffs
Thu Jun 16 18:50:13 1994 UTC (30 years, 5 months ago) by jtc
Branches: MAIN
CVS tags: netbsd-1-0-base, netbsd-1-0-RELEASE, netbsd-1-0-PATCH1, netbsd-1-0-PATCH06, netbsd-1-0-PATCH05, netbsd-1-0-PATCH04, netbsd-1-0-PATCH03, netbsd-1-0-PATCH02, netbsd-1-0-PATCH0, netbsd-1-0
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +2 -3 lines
Christos' fix for quoting variable extraction properly.

Revision 1.14: download - view: text, markup, annotated - select for diffs
Mon Jun 6 22:45:33 1994 UTC (30 years, 6 months ago) by jtc
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +35 -7 lines
Fixes from Christos Zoulas, who used purify, objectcenter and testcenter
to find memory leaks and illegal memory accesses.

Revision 1.13: download - view: text, markup, annotated - select for diffs
Sat Mar 5 00:34:53 1994 UTC (30 years, 9 months ago) by cgd
Branches: MAIN
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +158 -57 lines
fixes/improvements from Christos Zoulas <christos@deshaw.com>.

Revision 1.12: download - view: text, markup, annotated - select for diffs
Thu Jan 13 21:01:55 1994 UTC (30 years, 10 months ago) by jtc
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +4 -2 lines
Include appropriate header files to bring prototypes into scope.

Revision 1.11: download - view: text, markup, annotated - select for diffs
Wed Dec 22 00:25:57 1993 UTC (30 years, 11 months ago) by pk
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +5 -1 lines
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.

Revision 1.10: download - view: text, markup, annotated - select for diffs
Fri Dec 17 23:55:57 1993 UTC (30 years, 11 months ago) by jtc
Branches: MAIN
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +3 -3 lines
POSIX.2 added the -S flag (opposite of -k).  It was allready there,
just #ifdef'ed out.

Revision 1.9: download - view: text, markup, annotated - select for diffs
Wed Dec 15 18:26:40 1993 UTC (30 years, 11 months ago) by jtc
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +3 -3 lines
Fix bug (PR #42) with -j flag.  Doesn't seem to do anything, but at
least it doesn't dump core anymore.

Revision 1.8: download - view: text, markup, annotated - select for diffs
Sat Dec 4 02:12:40 1993 UTC (31 years ago) by cgd
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +2 -1 lines
add MACHINE_ARCH

Revision 1.7: download - view: text, markup, annotated - select for diffs
Sat Oct 23 02:32:03 1993 UTC (31 years, 1 month ago) by cgd
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +19 -6 lines
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)
	.

Revision 1.6: download - view: text, markup, annotated - select for diffs
Mon Aug 23 05:29:31 1993 UTC (31 years, 3 months ago) by cgd
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +5 -6 lines
fix from chmr@edvz.tu-graz.ac.at (Christoph Robitschko)
to get things right if obj is a symlink and points to nowhere.

Revision 1.5: download - view: text, markup, annotated - select for diffs
Sun Aug 1 18:11:47 1993 UTC (31 years, 4 months ago) by mycroft
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +2 -8 lines
Add RCS identifiers.

Revision 1.4: download - view: text, markup, annotated - select for diffs
Thu Jul 8 03:41:58 1993 UTC (31 years, 5 months ago) by cgd
Branches: MAIN
CVS tags: netbsd-0-9-base, netbsd-0-9-RELEASE, netbsd-0-9-BETA, netbsd-0-9-ALPHA2, netbsd-0-9-ALPHA, netbsd-0-9
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +11 -11 lines
remember curdir as something other than ".", so that makes
of things which include files in directories won't get hosed...

Revision 1.3: download - view: text, markup, annotated - select for diffs
Tue Mar 23 07:26:38 1993 UTC (31 years, 8 months ago) by cgd
Branches: MAIN
CVS tags: netbsd-alpha-1, netbsd-0-8
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +4 -8 lines
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

Revision 1.2: download - view: text, markup, annotated - select for diffs
Sun Mar 21 18:04:42 1993 UTC (31 years, 8 months ago) by cgd
Branches: MAIN
CVS tags: patchkit-0-2-2
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +11 -1 lines
after 0.2.2 "stable" patches applied

Revision 1.1.1.1 (vendor branch): download - view: text, markup, annotated - select for diffs
Sun Mar 21 09:45:37 1993 UTC (31 years, 8 months ago) by cgd
Branches: WFJ-920714, CSRG
CVS tags: WFJ-386bsd-01
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +0 -0 lines
initial import of 386bsd-0.1 sources

Revision 1.1: download - view: text, markup, annotated - select for diffs
Sun Mar 21 09:45:37 1993 UTC (31 years, 8 months ago) by cgd
Branches: MAIN
Initial revision

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options

CVSweb <webmaster@jp.NetBSD.org>