Commit graph

42 commits

Author SHA1 Message Date
Simon J. Gerraty 84691af931 Import bmake-20240711
Intersting/relevant changes since bmake-20240625

ChangeLog since bmake-20240625

2024-07-13  Simon J Gerraty  <sjg@beast.crufty.net>

	* cleanup redundant differences from NetBSD make
	o parse.c: no longer uses mmap
	o var.c: check __STDC_VERSION__ not __STDC__

2024-07-12  Simon J Gerraty  <sjg@beast.crufty.net>

	* Apply some patches from NetBSD pkgsrc to reduce divergence
	o meta.c: requires sys/select.h if available
	o var.c: ensure SIZE_MAX has a value
	o util.c: ensure SA_RESTART is defined

	* configure.in: use *ksh* rather than just *ksh to match
	ksh shell specification.

	* unit-tests/Makefile: expand BROKEN_TESTS for ksh and
	mksh in particular

2024-07-11  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240711
	Merge with NetBSD make, pick up
	o compat.c: allow Compat_RunCommand to also handle very long
	commands by writing to a temp file when needed.
	o main.c: extract the temp file logic recently added to Cmd_Exec
	to Cmd_Argv so it can be leveraged by Compat_RunCommand.

2024-07-09  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240709
	Merge with NetBSD make, pick up
	o error out on parse/evaluation errors in shell commands
	o var.c: error out on syntax errors in ':M' and ':N' modifiers

2024-07-07  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240707
	Merge with NetBSD make, pick up
	o only generate code for cleanup functions in CLEANUP mode
	o hash.c: don't track hash table chain lengths during lookup
	unless debugging
	o main.c: move initialization of variable scopes to targ.c
	o var.c: remove Var_End as it is now unnecessary

2024-07-06  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240706
	Merge with NetBSD make, pick up
	o reduce lint comments about ARGSUSED
	o cond.c: error out on conditions containing the operators '&' and '|'
	o str.c: error out on a matching malformed matching pattern '[['
	o var.c: in error messages, distinguish parsing from evaluating
	in error messages for anonymous variables, log the value
	error out on unclosed expressions during parse time

2024-07-04  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240704
	Merge with NetBSD make, pick up
	o add more context information to error messages
	o main.c: on error, print the targets to be made
	add detailed exit status to message for failed sub-commands
	o var.c: error out on the "Bad modifier" error message

2024-07-01  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240701
	Merge with NetBSD make, pick up
	o var.c: add :tt for Title case

2024-06-30  Simon J Gerraty  <sjg@beast.crufty.net>

	* configure.in: 20240630 further refine check for whether
	TZ=Europe/Berlin works

	* VERSION (_MAKE_VERSION): 20240630
	Merge with NetBSD make, pick up
	o job.c: reduce use of UNCONST
	o main.c: add detailed exit status to message for failed sub-commands
	o var.c: error out on some more syntax errors
	add more context to "returned non-zero status" message
2024-07-20 12:41:55 -07:00
Simon J. Gerraty dbb5be7f07 Import bmake-20240625
Intersting/relevant changes since bmake-20240520

ChangeLog since bmake-20240520

2024-06-25  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240625
	Merge with NetBSD make, pick up
	o job.c: ensure shellPath is always duped, avoid upsetting free()

2024-06-16  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240616
	Merge with NetBSD make, pick up
	o clean up collection of context information for error messages
	o in warnings, move the word "warning" to the front
	o var.c: throw an error on attempt to override an internal
	read-only variable

2024-06-10  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240610
	Merge with NetBSD make, pick up
	o for.c: remove redundant shortcut for building the .for loop body

2024-06-02  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240602
	Merge with NetBSD make, pick up
	o rename some VarEvalMode constants to better match debug names.
	o var.c: avoid out-of-bounds read when parsing indirect modifiers.

2024-06-01  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240601
	Merge with NetBSD make, pick up
	o add .export-all rather than allow .export with no argument
	which can happen accidentally.
	o if lua is available, run check-expect.lua after unit-tests
	o main.c: use snprintf rather than strncpy
	fix memory leak when purging realpath cache.

2024-05-28  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240528
	Merge with NetBSD make, pick up
	o fix a number of memory leaks
	o replace magic numbers with POSIX FILENO constants
	o hash.c: remove dead code from HashTable_DeleteEntry
	o main.c: when complaining about unusable .OBJDIR
	call PrintOnError if MAKE_DEBUG_OBJDIR_CHECK_WRITABLE is true.
	o parse.c: use fewer technical terms in debug message for dependency

mk/ChangeLog since bmake-20240520

2024-06-22  Simon J Gerraty  <sjg@beast.crufty.net>

	* install-mk (MK_VERSION): 20240616

	* dirdeps.mk: apply DEP_DIRDEPS_BUILD_DIR_FILTER after we have
	computed build dirs, since some filters cannot be easily expressed via
	DEP_DIRDEPS_FILTER.

2024-05-31  Simon J Gerraty  <sjg@beast.crufty.net>

	* dirdeps.mk: move reset of DIRDEPS_EXPORT_VARS
	until after we a finished with it if building a cache.
2024-06-28 17:16:32 -07:00
Simon J. Gerraty 507951f550 Import bmake-20240430
Intersting/relevant changes since bmake-20240309

ChangeLog since bmake-20240309

2024-04-30  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240430
	Merge with NetBSD make, pick up
	o main.c: ensure '.include <makefile>' respects MAKESYSPATH.
	Dir_FindFile will search .CURDIR first unless ".DOTLAST" is seen.

2024-04-28  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240428
	Merge with NetBSD make, pick up
	o simplify freeing of lists
	o arch.c: trim pointless comments
	o var.c: delay variable assignments until actually needed
	don't reallocate memory after evaluating an expression, result is
	almost always short-lived.

2024-04-26  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240426
	Merge with NetBSD make, pick up
	o job.c: in debug output, print the directory in which a job
	failed at same time as failed target so it is more easily found in
	build log.

2024-04-24  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240424
	Merge with NetBSD make, pick up
	o clean up comments, code and tests

2024-04-23  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240422
	Merge with NetBSD make, pick up
	o var.c: avoid LazyBuf for :*time modifiers.
	LazyBuf's are not nul terminated so not suitable for passing to
	functions that expect that. These modifiers are used sparingly so
	an extra allocation is not a problem.

2024-04-20  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240420
	Merge with NetBSD make, pick up
	o provide more context information for parse/evaluate errors

2024-04-14  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240414
	Merge with NetBSD make, pick up
	o parse.c: print -dp debug info earlier so we see which
	.if or .for line is being parsed.

2024-04-04  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240404
	Merge with NetBSD make, pick up
	o fix some unit tests for Cygwin
	o parse.c: exit immediately after reading a null byte from a makefile

	* fix generation of bmake.cat1

2024-03-19  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240314
	Add/Improve support for Cygwin
	o uname -s output isn't useful so allow configure to
	set FORCE_MAKE_OS - to force the value of .MAKE.OS
	and use Cygwin which matches uname -o
	o fix some unit-tests for Cygwin

	* configure.in: use_makefile=no for Cygwin et al.
	NOTE: bmake does not support Cygwin and likely never will,

mk/ChangeLog since bmake-20240309

2024-04-24  Simon J Gerraty  <sjg@beast.crufty.net>

	* meta.autodep.mk: do not override start_utc

2024-04-18  Simon J Gerraty  <sjg@beast.crufty.net>

	* sys.dirdeps.mk: set defaults for DEP_* at level 0 too.
	These help when first include of Makefile.depend happens in a leaf
	dir.

	* install-mk (MK_VERSION): 20240414

2024-04-09  Simon J Gerraty  <sjg@beast.crufty.net>

	* install-mk (MK_VERSION): 20240408

	* init.mk: allow for _ as well as . to join V
	and Q from QUALIFIED_VAR_LIST and VAR_QUALIFIER_LIST.

	* progs.mk: avoid overlap between PROG_VARS and
	init.mk's QUALIFIED_VAR_LIST since PROG would also
	match its VAR_QUALIFIER_LIST,
	libs.mk does not have the same issue.

	* subdir.mk: _SUBDIRUSE for realinstall should run install
	remove include of ${.CURDIR}/Makefile.inc that can be done via
	local.subdir.mk where needed

	* own.mk: do not conflict with man.mk

2024-03-19  Simon J Gerraty  <sjg@beast.crufty.net>

	* install-mk (MK_VERSION): 20240314

	* add sys/Cygwin.mk from Christian Franke
2024-05-03 15:43:12 -07:00
Simon J. Gerraty 7a05a7153a Import bmake-20240108
Interesting/relevant changes since bmake-20230909

	* VERSION (_MAKE_VERSION): 20240106
	Merge with NetBSD make, pick up
	o fix duplicate progname when reporting an unknown target
	o unit tests for Cmd_Exec using temp file

	* VERSION (_MAKE_VERSION): 20240105
	Merge with NetBSD make, pick up
	o main.c: Cmd_Exec write cmd to a file if too big
	avoid blowing commandline/env limits

	* VERSION (_MAKE_VERSION): 20240101
	o util.c: flesh out more of strftime
	* configure.in: add --with-bmake-strftime
	it is not a full implementation but enough to pass all
	the unit-tests.
	* parse.c: LoadFile do not append \n to empty buffer.

	* VERSION (_MAKE_VERSION): 20231230
	Merge with NetBSD make, pick up
	o simplify memory allocation for string buffers
	o fix declared types of list nodes
	o suff.c: clean up freeing of suffixes
	o var.c: simplify debug message for the ':@var@...@' modifier
	clean up variable handling

	* VERSION (_MAKE_VERSION): 20231226
	Merge with NetBSD make, pick up
	o compat.c: ensure make's output is correctly ordered with that of
	the target when not going to a tty
	o main.c: check for shellPath whether to call Shell_Init()

	* VERSION (_MAKE_VERSION): 20231224
	Merge with NetBSD make, pick up
	o compat.c: check for shellPath whether to call Shell_Init()
	tweak the unit test to detect the bug thus fixed.
	o make.1: do not claim .SHELL is only used by jobs mode.

	* VERSION (_MAKE_VERSION): 20231220
	Merge with NetBSD make, pick up
	o str.c: speed up pattern matching in the ':M' modifier
	o var.c: fix confusing debug logging when deleting a variable
	use consistent debug messages style when ignoring variables

	* VERSION (_MAKE_VERSION): 20231210
	Merge with NetBSD make, pick up
	o var.c: avoid segfault on empty :C match expression
	explain in debug log why variable assignment is ignored.

	* VERSION (_MAKE_VERSION): 20231208
	Merge with NetBSD make, pick up
	o var.c: ensure fromCmd is set correctly for variables set on
	command line.

	* VERSION (_MAKE_VERSION): 20231124
	Merge with NetBSD make, pick up
	o main.c: cleanup processing of -j
	fix lint warning about strchr
	o var.c: more accurate error message for invalid ':mtime' argument
	cleanup :[...] modifier
	avoid reading beyond substring when comparing
	o unit-tests cover all cases of :mtime, test and explain exporting
	of variables
	o cleanup comments

	* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
	$FreeBSD$ tag, so avoid adding it.

mk/ChangeLog since bmake-20230909

	* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
	limits on command line length, so skip export of lists to env.

	* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
	point.  This keeps JOB_MAX numeric incase another makefile does
	comparisons.

	* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-13 17:16:25 -08:00
Simon J. Gerraty 1012cf15f7 Import bmake-20230909
Update import.sh to generate below

ChangeLog since bmake-20230622

2023-09-09  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20230909
	Merge with NetBSD make, pick up
	o main.c: 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
	.MAKE.JOBS.C will be "yes" if -jC is supported

2023-08-20  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20230820
	Merge with NetBSD make, pick up
	o make.1: note that :localtime is better for %s
	o parse.c: improve error messages for invalid input.
	o var.c: fix for %s:L:gmtime - set TZ=UTC and use localtime to get
	correct result, it is still better to use %s:L:localtime.

2023-08-18  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20230818
	Merge with NetBSD make, pick up
	o meta.c: meta_ignore - check raw path against metaIgnorePaths
	to potentially skip call to realpath.
	o var.c: be strict when parsing the argument of the ':mtime' modifier
	o unit-tests/varmod-mtime.mk: document why '${%s:L:localtime}'
	should be used to get an equivalent value to time(3).

2023-08-16  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20230816
	Merge with NetBSD make, pick up
	o cond.c: clean up multiple-inclusion guards

2023-07-25  Simon J Gerraty  <sjg@beast.crufty.net>

	* unit-tests/Makefile: addd varmod-localtime to BROKEN_TESTS
	if configure cannot work out how to control TZ.
	Remove varmod-localtime from BROKEN_TESTS for IRIX*

2023-07-24  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20230723

	* configure.in: fix the test for wether TZ=Europe/Berlin works.
	Depending on the time of year, if run between 22:00 and 00:00 UTC
	the check in configure would fail incorrectly.
	Take the day into account as well.

2023-07-18  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20230711
	Merge with NetBSD make, pick up
	o make.1: clean up wording, clarify scope of '!' in conditions

2023-07-15  Simon J Gerraty  <sjg@beast.crufty.net>

	* make-bootstrap.sh.in: set prefix
	If configure is run using ksh we get unexpanded ${prefix} in
	DEFAULT_SYS_PATH, by ensuring prefix is set we should still get
	correct result.

2023-07-13  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20230711
	bump version for IRIX tweaks

	* make.h: undef OP_NONE if defined

	* unit-tests/Makefile: set BROKEN_TESTS for IRIX

	* configure.in: override INSTALL on IRIX

2023-06-27  Simon J Gerraty  <sjg@beast.crufty.net>

	* boot-strap op_test: ensure we set TEST_MAKE as we want it.

mk/ChangeLog since bmake-20230622

2023-09-09  Simon J Gerraty  <sjg@beast.crufty.net>

	* jobs.mk (JOB_MAX): use -jC if we can
	we actually use JOB_MAX_C which defaults to 1.33C

2023-08-18  Simon J Gerraty  <sjg@beast.crufty.net>

	* now_utc: %s only works with :localtime

2023-07-14  Simon J Gerraty  <sjg@beast.crufty.net>

	* install-sh: ignore -c as claimed and only insist on
	a directory for destination when more than one file to copy.

	* sys.mk: when looking for SYS_OS_MK try ${.MAKE.OS} and
	${.MAKE.OS:S,64,,} early (so we find sys/IRIX.mk for IRIX64)

2023-07-13  Simon J Gerraty  <sjg@beast.crufty.net>

	* install-mk (MK_VERSION): 20230711

	* sys.mk: set SYS_MK and INSTALL_SH for systems with incompatible
	install(1)

	* sys/IRIX.mk:  when setting ROOT_GROUP only match the first :0:
	set INSTALL to install-sh rather than pathname that may not exist
	(yet).

2023-07-07  Simon J Gerraty  <sjg@beast.crufty.net>

	* dirdeps.mk: pass DIRDEP_TARGETS to DIRDEP_MAKE
	normally this is empty - for the default target, but there are
	use-cases where we might set it to something else.

2023-07-04  Simon J Gerraty  <sjg@beast.crufty.net>

	* install-mk (MK_VERSION): 20230704

	* dirdeps.mk: apply DEBUG_DIRDEPS_LIST_FILTER to lists we output
	when DEBUG_DIRDEPS is in effect.
	Eg. DEBUG_DIRDEPS_LIST_FILTER=ts\n
	can greatly improve readability.
2023-09-17 10:03:11 -07:00
Simon J. Gerraty 51d8a8b4ac Import bmake-20230414
Relevant/interesting changes:

	* make.1: document seemingly unexplained Error code 6.
	o compat.c: CompatDeleteTarget skip .PHONY targets to be
	consistent with JobDeleteTarget.
	o job.c: fix memory leak in handling sysv :from=to modifiers
	o unit tests for .MAKE.META.IGNORE_{FILTER,PATHS,PATTERNS}
	o var.c: fix parsing of unevaluated subexpressions with
	unbalanced '{}'
	o cond.c: reduce complexity of evaluating expressions
2023-04-24 16:44:30 -07:00
Simon J. Gerraty 2e36ab2363 Import bmake-20230126
Relevant/interesting changes (see ChangeLog for more):

	o variables like .newline and .MAKE.{GID,PID,PPID,UID}
	should be read-only.
	o .[NO]READONLY: for control of read-only variables
	o .SYSPATH: for controlling the path searched for makefiles
	o allow for white-space between command specifiers @+-
	o add more details to warning 'Extra targets ignored'
	o make.1: sync list of built-in variables with reality
	sort list of built-in variables
	o cond.c: add more details to error message for numeric comparison
	o job.c: fix handling of null bytes in output
	o Allow .break to terminate a .for loop early
	o var.c: fix out-of-bounds errors when parsing
	o fix exit status for '-q' (since 1994)
2023-01-27 16:23:54 -08:00
Simon J. Gerraty 2061c94e6f Import bmake-20220418
Most relevant change:

	o ignore '.POSIX:' if not in first non-comment line
	of Makefile as specified by POSIX.
	add unit-tests for above.
2022-04-22 13:34:55 -07:00
Simon J. Gerraty a052cb4320 Import bmake-20220330
Most relevant change:

	o parse.c: try to include 'posix.mk' the first time
	.POSIX: is encountered, to allow for beter POSIX compliance.

Others

	o cond.c: make debug logging for comparisons less technical
	o lst.c: fix mem leak in Lst_Remove
	o job.c: fix echoing of command with '-' in silent target in jobs mode
	o var.c: make debug logs more readable
	prefer 'long long' over 'long' on 32-bit C99 platforms
	fix crash on .undef of an environment variable
2022-04-03 12:52:08 -07:00
Simon J. Gerraty 535c59a6a9 Import bmake-20220208
* unit-tests/Makefile: disable opt-debug-x-trace on Linux if there
	is any chance we have dash as .SHELL

	* meta.c: use a variable to hold command line to be filtered
	to avoid any side effects from content of command line.
2022-02-09 09:22:21 -08:00
Simon J. Gerraty cdde9e894d Import bmake-20220204
Features of interest:

Allow setting target local variables (similar to gmake)

In META_MODE .MAKE.META.CMP_FILTER can be used for filtering commands
before comparion.

contrib/bmake/mk/cc-wrap.mk is an example of using these

See ChangeLog for the gory details.
2022-02-05 12:03:50 -08:00
Simon J. Gerraty 2935fe8237 Import bmake-20211212
Relevant changes see ChangeLog for details:

Add support for ${.SUFFIXES} as read-only variable.

Fix memory leak in cond.c

Punt on write errors - ENOSPC etc.

Lots of code refactoring, rework to reduce memory allocations.

More unit-tests.
2021-12-17 23:27:22 -08:00
Simon J. Gerraty ee914ef902 Import bmake-20210621
Lots more unit tests and code cleanup

Relevant changes from ChangeLog

	o job.c: Print -de error information when running multiple jobs
	o var.c: only report error for unmatched regex subexpression
	when linting (-dL) since we cannot tell when an unmatched
	subexpression is an expected result.
	reduce memory allocations in the modifiers ':D' and ':U'
	reduce memory allocation and strlen calls in modifier ':from=to'
	in the ':Q' modifier, only allocate memory if necessary
	improve performance for LazyBuf
	reduce debug logging and memory allocation for ${:U...}
	reduce verbosity of the -dv debug logging for standard cases
	fix double varname expansion in the variable modifier '::='
	o var.c: avoid evaluating many modifiers in parse only mode
	in strict mode (-dL) many variable references are parsed twice,
	the first time just to report parse errors early, so we want to
	avoid side effects and wasted effort to the extent possible.
2021-06-25 11:16:24 -07:00
Simon J. Gerraty 8b6f73e37b Import bmake-20210206
Changes of interest

  o unit-tests: use private TMPDIR to avoid errors from other users
  o avoid strdup in mkTempFile
  o always use vfork
  o job.c: do not create empty shell files in jobs mode
    reduce unnecessary calls to waitpid
  o cond.c: fix debug output for comparison operators in conditionals
2021-02-10 17:51:11 -08:00
Simon J. Gerraty 8e11a9b425 Import bmake-20210110
Quite a lot of churn on style, but lots of
good work refactoring complicated functions
and lots more unit-tests.
Thanks mostly to rillig at NetBSD

Some interesting entries from ChangeLog

o .MAKE.{UID,GID} represent uid and gid running make.

o allow env var MAKE_OBJDIR_CHECK_WRITABLE=no to skip writable
  checks in InitObjdir.  Explicit .OBJDIR target always allows
  read-only directory.

o add more unit tests for META MODE

Change-Id: I4d3bcf08b4c864d98b343f602efe5a75dbfa7a94
2021-01-13 17:24:34 -08:00
Simon J. Gerraty 1b65f0bd2b Import bmake-20201117
o allow env var MAKE_OBJDIR_CHECK_WRITABLE=no to skip writable
  checks in InitObjdir.  Explicit .OBJDIR target always allows
  read-only directory.

o Fix building and unit-tests on non-BSD.

o More code cleanup and refactoring.

o More unit tests
2020-11-20 03:54:37 +00:00
Simon J. Gerraty 302da1a3d3 Import bmake-20201101
Lots of new unit-tests increase code coverage.

Lots of refactoring, cleanup and simlpification to reduce
code size.

Fixes for Bug 223564 and 245807

Updates to dirdeps.mk and meta2deps.py
2020-11-07 19:39:21 +00:00
Simon J. Gerraty 6bbc783f48 Import bmake-20200902
Lots of code refactoring, simplification and cleanup.
Lots of new unit-tests providing much higher code coverage.
All courtesy of rillig at netbsd.

Other significant changes:

o new read-only variable .SHELL which provides the path of the shell
  used to run scripts (as defined by  the .SHELL target).

o new debug option -dl: LINT mode, does the equivalent of := for all
  variable assignments so that file and line number are reported for
  variable parse errors.
2020-09-05 16:11:04 +00:00
Simon J. Gerraty 367d32e2b1 Import bmake-20200710
from ChangeLog:

    o filemon/filemon_dev.c: use O_CLOEXEC rather than extra syscall
    o meta.c: target flagged .META is out-of-date if meta file missing
    o cond.c: fix for compare_expression when doEval=0
    o unit-tests/Makefile: rework
    o filemon/filemon_dev.c: ensure filemon fd is closed on exec.
2020-07-11 22:45:05 +00:00
Simon J. Gerraty 1a2b743f6b Import bmake-20200704
from ChangeLog:

    (most of this by rillig@)
    o lots of style and white-space cleanup
    o lots more unit tests for variable modifiers
    o simplified description of some functions
    o str.c: refactor Str_Match
    o var.c: debugging output for :@
      constify VarModify parameter
      fix :hash modifier on 16-bit platforms
      remove unnecessary forward declarations
      refactor ApplyModifier_SysV to have less indentation
      simplify code for :E and :R
      clean up code for :H and :T
      refactor ApplyModifiers

    * var.c: we need stdint.h on some platforms to get uint32_t
    * unit-test/Makefile: we need to supress the specific error
    for RE substitution error in modmisc, since it varies accross
    different OS.
2020-07-08 18:32:15 +00:00
Simon J. Gerraty 6e0296234f Import bmake-20200629
from ChangeLog:

    o cond.c: do not eval unnecessary terms of conditionals.

    o meta.c: report error if lseek in filemon_read fails

    o str.c: performance improvement for Str_Match for multiple '*'

    o dieQuietly: supress the failure output from make
    when failing node is a sub-make or a sibling failed.
    This cuts down greatly on unhelpful noise at the end of
    build log.  Disabled by -dj or .MAKE.DIE_QUIETLY=no

    o unit test for :Or
2020-07-01 02:13:04 +00:00
Simon J. Gerraty b897d72a5a Import bmake-20200517
Changes since 20181221 are mostly portability related
hence the large gap in versions imported.

There are however some bug fixes, and a rework of filemon handling.
In NetBSD make/filemon/filemon_ktrace.c allows use of fktrace
and elimination of filemon(4) which has not had the TLC it needs.

FreeBSD filemon(4) is in much better shape, so bmake/filemon/filemon_dev.c
allows use of that, with a bit less overhead than the ktrace model.

Summary of changes from ChangeLog

	o str.c: empty string does not match % pattern
	  plus unit-test changes
	o var.c: import handling of old sysV style modifier using '%'
	o str.c: refactor brk_string
	o meta.c: meta_oodate, CHECK_VALID_META is too aggressive for CMD
	  a blank command is perfectly valid.
	o meta.c: meta_oodate, check for corrupted meta file
	  earlier and more often.
	* meta.c: meta_compat_parent check for USE_FILEMON
	  patch from Soeren Tempel
	o meta.c: fix compat mode, need to call meta_job_output()
	o job.c: extra fds for meta mode not needed if using filemon_dev
	o meta.c: avoid passing NULL to filemon_*() when meta_needed()
	  returns FALSE.
	o filemon/filemon_{dev,ktrace}.c: allow selection of
	  filemon implementation.  filemon_dev.c uses the kernel module
	  while filemon_ktrace.c leverages the fktrace api available in
	  NetBSD.  filemon_ktrace.c can hopefully form the basis for
	  adding support for other tracing mechanisms such as strace on
	  Linux.
	o meta.c: when target is out-of-date per normal make rules
	  record value of .OODATE in meta file.
	o parse.c: don't pass NULL to realpath(3)
	  some versions cannot handle it.
	o parse.c: ParseDoDependency: free paths rather than assert

plus more unit-tests
2020-05-20 19:34:48 +00:00
Simon J. Gerraty 2358deb654 Import bmake-20180222
From ChangeLog

* VERSION: 20180222
  Merge with NetBSD make, pick up
  o parse.c: avoid calling sysconf for every call to loadfile

* VERSION: 20180218
  Merge with NetBSD make, pick up
  o var.c: Var_Set handle NULL value anytime.

* VERSION: 20180212
  Merge with NetBSD make, pick up
  o parse.c: do not treat .info as warning with -W

* VERSION: 20171207
  Merge with NetBSD make, pick up
  o var.c: Var_Append use Var_Set if var not previously set
    so that VAR_CMD is handled correctly.
    Add a suitable unit-test.

* VERSION: 20171126

* aclocal.m4: use AC_LINK_IFELSE for AC_C___ATTRIBUTE__
  since AC_TRY_COMPILE puts input inside main()
  which upsets modern compilers.

* VERSION: 20171118
  Merge with NetBSD make, pick up
  o var.c: do not append to variable set on command line
    add unit-test to catch this.
2018-03-01 23:45:44 +00:00
Simon J. Gerraty ade1697bee Import bmake-20171028
From ChangeLog

2017-10-28  Simon J. Gerraty  <sjg@bad.crufty.net>

        * VERSION: 20171028
          Merge with NetBSD make, pick up
          o main.c: ignore empty MAKEOBJDIR

        * Makefile.config.in:
          make @prefix@ @machine*@ and @default_sys_path@ defaults.

2017-10-05  Simon J. Gerraty  <sjg@bad.crufty.net>

        * VERSION: 20171005

        * unit-tests/dotwait.mk: redirect stderr through pipe for more
          consistent result on some platforms.

2017-08-13  Simon J. Gerraty  <sjg@bad.crufty.net>

        * machine.sh: entry for AIX

2017-08-12  Simon J. Gerraty  <sjg@bad.crufty.net>

        * VERSION (_MAKE_VERSION): Move the setting of _MAKE_VERSION
          to a file that can be included by configure as well as make.
          This allows configure to set set _MAKE_VERSION in make-bootstrap.sh

2017-08-10  Simon J. Gerraty  <sjg@bad.crufty.net>

        * Makefile (_MAKE_VERSION): 20170810
          Merge with NetBSD make, pick up
          o meta.c: if target is in subdir we only need subdir name in
            meta_name.
2017-11-01 23:16:32 +00:00
Simon J. Gerraty 7ef48313e3 Import bmake-20170711
Several misc cleanups, refactor main() to reduce size.
Adds -v option to always fully expand variables (only interesting to NetBSD)
And in particular (from ChangeLog):

  o meta.c: ensure command output in meta file has ending newline
    even when filemon not being used.
    When matching ${.MAKE.META.IGNORE_PATTERNS} do not use
    pathname via ':L' since any ':' in pathname breaks that.
    Instead set a '${.p.}' to pathname in the target context and
    use that.
2017-07-15 18:43:39 +00:00
Simon J. Gerraty 60a7ffecc7 Import bmake-20170301 2017-03-06 19:54:54 +00:00
Simon J. Gerraty cdfa59c89c Import bmake-20160818
Interesting changes:

	  o meta.c: move handling of .MAKE.META.IGNORE_* to meta_ignore()
	    so we can call it before adding entries to missingFiles.
	    Thus we do not track files we have been told to ignore.
	  o meta_oodate: apply .MAKE.META.IGNORE_FILTER (if defined) to
	    pathnames, and skip if the expansion is empty.
	    Useful for dirdeps.mk when checking DIRDEPS_CACHE.
	  o meta.c: remove all missingFiles entries that match a deleted
	    dir.
	  o main.c: set .ERROR_CMD if possible.
2016-09-08 23:49:33 +00:00
Simon J. Gerraty e6b08231c8 Import bmake-20160606
From ChangeLog:

          o dir.c: extend mtimes cache to others via cached_stat()
2016-06-08 15:38:06 +00:00
Simon J. Gerraty e944e081cf Import bmake-20160604
Interesting items from ChangeLog:

          o cached_realpath(): avoid hitting filesystem more than necessary.
          o meta.c: refactor need_meta decision, add knobs for
            missing meta file and filemon data wrt out-of-datedness.
          o meta.c: missing filemon data is only relevant if we read a
            meta file.
            Also do not return oodate for a missing metafile if gn->path
            points to .CURDIR
2016-06-05 15:57:18 +00:00
Simon J. Gerraty e917534a84 Import bmake-20160512
Interesting changes (from ChangeLog):
o meta.c: ignore paths that match .MAKE.META.IGNORE_PATTERNS
  this is useful for gcov builds.
o propagate errors from filemon(4).
o meta.c: apply realpath() before matching against metaIgnorePaths
o allow makefile to set .MAKE.JOBS
2016-05-20 16:19:56 +00:00
Simon J. Gerraty b7ff84ad75 Import bmake-20160315 2016-03-18 17:27:26 +00:00
Simon J. Gerraty d58aa1959c Import bmake-20160307 2016-03-11 00:37:02 +00:00
Simon J. Gerraty 7c6c27a0ba Import bmake-20151201 2015-12-07 22:51:25 +00:00
Simon J. Gerraty ce40971ce2 Import bmake-20151020 2015-10-21 22:14:23 +00:00
Simon J. Gerraty 023e89e5ef Import bmake-20150418 2015-04-20 03:45:54 +00:00
Simon J. Gerraty d4343fd891 Import bmake-20140101 2014-01-26 07:40:17 +00:00
Simon J. Gerraty e0f69e1d23 Import bmake-20130730 - allows folk to supress job tokens. 2013-08-02 05:23:57 +00:00
Simon J. Gerraty dca4585d16 Import bmake-20130520 to keep us in sync. 2013-05-20 22:35:32 +00:00
Simon J. Gerraty 3784f43e18 Import bmake-20130330 2013-04-01 21:12:55 +00:00
Simon J. Gerraty 70bd6b310d Import bmake-20130123
Approved by:	marcel (mentor)
2013-01-31 16:44:23 +00:00
David E. O'Brien e6157a0b0c Import the 20120704 release of the "Portable" BSD make tool (from NetBSD).
Submitted by:	Simon Gerraty <sjg@juniper.net>
2012-07-06 00:03:45 +00:00
David E. O'Brien b379932fc0 Import the 6-May-2012 release of the "Portable" BSD make tool (from NetBSD).
Submitted by:	sjg@juniper.net
2012-06-08 21:57:36 +00:00