Commit Graph

75 Commits

Author SHA1 Message Date
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
29efb3dcae Import bmake-20240520
Intersting/relevant changes since bmake-20240508

ChangeLog since bmake-20240508

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

	* VERSION (_MAKE_VERSION):
	Merge with NetBSD make, pick up
	o dir.c: in FindFile restore last search of .CURDIR even for
	includes, as a number of existing makefiles are broken otherwise.

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

	* VERSION (_MAKE_VERSION): 20240519
	Merge with NetBSD make, pick up
	o dir.c: Add Dir_FindInclude, FindFile without looking in .CURDIR.
	Also fix Dir_SetSYSPATH to use defSysIncPath if sysIncPath is empty.
	o main.c: no need to set .DOTLAST in sysIncPath
2024-05-23 13:08:58 -07:00
Simon J. Gerraty
3c2ab5fddc Import bmake-20240508
Intersting/relevant changes since bmake-20240430

ChangeLog since bmake-20240430

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

	* VERSION (_MAKE_VERSION): 20240508
	Merge with NetBSD make, pick up
	o make: ensure variables set on command line get added to
	.MAKEOVERRIDES (even if they start with '.') so they are passed to
	sub-makes.

mk/ChangeLog since bmake-20240430

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

	* install-mk (MK_VERSION): 20240504

	* dirdeps.mk: allow BUILD_DIRDEPS_OVERRIDES to pass overrides to
	sub-make building DIRDEPS_CACHE.
2024-05-13 21:13:22 -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
368b06ce6b Need a blank line after brief summary 2024-03-13 19:16:35 -07:00
Simon J. Gerraty
a6b892e1c7 Import bmake-20240309
Intersting/relevant changes since bmake-20240108

ChangeLog since bmake-20240108

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

	* boot-strap: tests can take a long time; use a cookie to
	skip them if bmake has not been updated since tests last
	ran successfully.

	* Makefile: Cygwin handles MANTARGET man

	* unit-tests/Makefile: set BROKEN_TESTS for Cygwin

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

	* VERSION (_MAKE_VERSION): 20240309
	Merge with NetBSD make, pick up
	o set .ERROR_EXIT to the exit status of .ERROR_TARGET
	this allows a .ERROR target to ignore the case of
	.ERROR_EXIT==6 which just means that the build actually
	failed somewhere else.

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

	* VERSION (_MAKE_VERSION): 20240303

	* var.c: on IRIX we need both inttypes.h and stdint.h

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

	* VERSION (_MAKE_VERSION): 20240301
	Merge with NetBSD make, pick up
	o export variables with value from target scope
	when appropriate.

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

	* VERSION (_MAKE_VERSION): 20240212
	Merge with NetBSD make, pick up
	o remove unneeded conditional-compilation toggles
	INCLUDES, LIBRARIES, POSIX, SYSVINCLUDE, SYSVVARSUB,
	GMAKEEXPORT NO_REGEX and SUNSHCMD

	* configure.in: add check for regex.h

	* var.c: replace use of NO_REGEX with HAVE_REGEX_H

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

	* VERSION (_MAKE_VERSION): 20240204
	Merge with NetBSD make, pick up
	o var.c: fix some lint (-dL) mode parsing issues

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

	* VERSION: (_MAKE_VERSION): 20240202
	Merge with NetBSD make, pick up
	o make.1: note that arg to :D and :U can be empty
	o var.c: $$ is not a parse error when .MAKE.SAVE_DOLLARS=no

mk/ChangeLog since bmake-20240108

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

	* install-mk (MK_VERSION): 20240309

	* meta.sys.mk: _metaError: if .ERROR_EXIT == 6, we do not
	want to save the .ERROR_META_FILE

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

	* install-mk (MK_VERSION): 20240220

	* sys.dirdeps.mk, dirdeps-targets.mk, init.mk:
	do not set .MAIN: dirdeps in sys.dirdeps.mk
	dirdeps-targets.mk will do that for top-level builds
	and init.mk will do it for others.
	This allows a Makefile which has no need of 'dirdeps' to
	set .MAIN for itself and "just work".

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

	* bsd.*.mk: for makefiles that get a bsd. symlink,
	use _this in  multiple inclusion tags since .PARSEFILE will not
	DTRT when such a makefile is included directly by Makefile and
	automatically (without bsd. prefix).
	Since we cannot guarantee that our sys.mk will be used, we provide
	a default _this in each makefile that gets a bsd. prefix such that
	the value is the same regardless of bsd. prefix.

	* subdir.mk: drop the !target guard on $SUBDIR_TARGETS

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

	* install-mk (MK_VERSION): 20240212

	* SPDX-License-Identifier: BSD-2-Clause
	Add SPDX-License-Identifier to inidicate that I consider
	my copyright on any of these makefiles equivalent to BSD-2-Clause

	* autoconf.mk: allow for configure.ac as currently recommended

	* subdir.mk: support @auto
	which is replaced with each subdir that
	has a [Mm]akefile.

	* subdir.mk: include local.subdir.mk if it exists.

	* subdir.mk: rework to handle .WAIT

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

	* subdir.mk: _SUBDIRUSE report the target we are entering subdirs for.

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

	* prog.mk: treat empty SRCS the same as undefined

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

	* Avoid undefined errors in lint (-dL) mode

	* man.mk (CMT2DOC_FLAGS): note that -mm does mdoc(7)

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

	* install-mk (MK_VERSION): 20240128

	* FILES: add ccm.dep.mk for C++ modules
	add suffixes.mk for common location for generic SUFFIX rules.

	* auto.dep.mk autodep.mk meta.autodep.mk: include ccm.dep.mk
	replace OBJ_EXTENSIONS with OBJ_SUFFIXES

	* autodep.mk: leverage CXX_SUFFIXES for __depsrcs
	and update style (spaces around = etc)

	* init.mk: add OBJS_SRCS_FILTER to filter SRCS when
	setting OBJS

	* meta2deps.py: handle multiple ./ embedded in path better.
2024-03-13 19:14:41 -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
3e39ce563b Import bmake-20230622
Relevant/interesting changes:

	o optimize string matching for ':M' and ':N'
	o warn about malformed patterns in ':M', ':N' and '.if make(...)'
	o allow guards to be targets as well as variables
	The guard targets may include variable references like
	__${.PARSEDIR:tA}/${.PARSEFILE}__
	o optimization for makefiles protected from multiple-inclusion
	skip even opening the file after first include.
	o var.c: do not allow delete of readOnly variable
	o parse.c: .break takes no args
2023-06-27 13:29:43 -07:00
Simon J. Gerraty
945078deae Import bmake-20230510
Relevant/interesting changes:

	o parse.c: don't print null filename in stack traces
	o for.c: skip syntactically wrong .for loops
	o var.c: allow for :gmtime=${mtime}
	add :mtime[=timestamp] where timestamp is used if stat(2)
	fails, if :mtime=error stat(2) failure causes error.
	o make.1: fix documentation of .PREFIX to match reality and POSIX
	o unit-tests: improved var-scope-local
2023-05-13 10:03:50 -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
f4d5109868 Import bmake-20230208
ChangeLog since bmake-20230126

        * VERSION (_MAKE_VERSION): 20230208
        Merge with NetBSD make, pick up
        o var.c: always use SCOPE_GLOBAL for :_ to avoid problems
        when it has been used within conditional expressions

        * install-sh: if making directories ensure umask is set
        to match mode.

        * Makefile: use DIRMODE for directories and
        NONBINMODE for man pages and mk files
2023-02-09 17:20:05 -08: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
31a96ca5f0 Import bmake-20220726
Relevant/interesting changes:

	* Auto-create objdir for bmake/unit-tests if appropriate
2022-07-27 08:56:53 -07:00
Simon J. Gerraty
308a28d6cd Import bmake-20220724
Relevant/interesting changes:

	o parse.c: fix out-of-bounds read when parsing an invalid line
        https://bugs.freebsd.org/265119
	fix memory leak in wildcard targets and sources
	fix off-by-one error in buffer for .WAIT nodes
	o allow to randomize build order of targets
	.MAKE.MODE += randomize-targets can help uncover dependency bugs
2022-07-26 08:52:53 -07:00
Simon J. Gerraty
92bfae0e6b Add -m to post.sh 2022-04-22 13:38:42 -07: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
abd272d7ca Import bmake-20200606
Relevant items from ChangeLog:

	o dir.c: cached_stats - don't confuse stat and lstat results.
	o var.c: add :Or for reverse sort.
2020-06-09 02:07:26 +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
Kyle Evans
14ade6f031 bmake: import -fno-common fix build back from upstream
sjg@ committed the local patch previously committed upstream; pull it in to
vendor/ to ease any potential stress of future imports.
2020-03-30 16:20:04 +00:00
Simon J. Gerraty
4e6c593faa Import bmake-20181221
o parse.c: ParseVErrorInternal use .PARSEDIR
  and apply if relative, and then use .PARSEFILE
  for consistent result.
o var.c: avoid SEGFAULT in .unexport-env
  when MAKELEVEL is not set
2018-12-22 21:32:17 +00:00
Simon J. Gerraty
14ed4acf37 Import bmake-20180919 2018-12-06 00:13:35 +00:00
Simon J. Gerraty
a5422567f9 Import bmake-20180512
Of relevance:

  o job.c: skip polling job token pipe
  o parse.c: be more cautious about detecting depenency line
    rather than sysV style include.

also in mk:

* dirdeps.mk: include local.dirdeps-build.mk when .MAKE.LEVEL > 0
  ie. we are building something.
* FILES: add dirdeps-options.mk to deal with optional DIRDEPS.
* ldorder.mk: describe how to use LDORDER_EXTERN_BARRIER
  if needed.
2018-05-18 19:49:54 +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
56028c60f4 Import bmake-20170720
compat.c: pass SIGINT etc onto child and wait for it to exit
before we self-terminate.
2017-07-24 00:52:52 +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
0b13d2e561 Import bmake-20170510 2017-05-10 22:40:27 +00:00
Simon J. Gerraty
f62a02334b Import bmake-20170420
Only use -C arg "as is" if it contains no relative component.
Fix Main_SetObjdir() for relative paths (eg obj).
Fix a number of coverity complaints.
2017-04-20 23:12:37 +00:00
Simon J. Gerraty
85813b0c12 Import bmake-20170413 2017-04-15 00:51:18 +00:00
Simon J. Gerraty
60a7ffecc7 Import bmake-20170301 2017-03-06 19:54:54 +00:00
Simon J. Gerraty
b9b4b0cc41 Import bmake-20161212
From ChangeLog
2016-12-12  Simon J. Gerraty  <sjg@bad.crufty.net>

	* Makefile (_MAKE_VERSION): 20161212
	  Merge with NetBSD make, pick up
          o main.c: look for obj.${MACHINE}-${MACHINE_ARCH} too.

2016-12-09  Simon J. Gerraty  <sjg@bad.crufty.net>

	* Makefile (_MAKE_VERSION): 20161209
	  Merge with NetBSD make, pick up
	  o main.c: cleanup setting of .OBJDIR
	  o parse.c: avoid coredump from (var)=val

2016-11-26  Simon J. Gerraty  <sjg@bad.crufty.net>

	* Makefile (_MAKE_VERSION): 20161126
	  Merge with NetBSD make, pick up
	  o make.c: Make_OODate: report src node name if path not set

2016-09-26  Simon J. Gerraty  <sjg@bad.crufty.net>

	* Makefile (_MAKE_VERSION): 20160926
	  Merge with NetBSD make, pick up
	  o support for .DELETE_ON_ERROR: (remove targets that fail)

2016-09-26  Simon J. Gerraty  <sjg@bad.crufty.net>

	* Makefile MAN: tweak .Dt to match ${PROG}

mk/ChangeLog

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

	* install-mk (MK_VERSION): 20161212

	* meta2deps.py: set pid_cwd[pid] when we process 'C'hdir,
	rather than when we detect pid change.

2016-12-07  Simon J. Gerraty  <sjg@bad.crufty.net>

	* install-mk (MK_VERSION): 20161207

	* meta.stage.mk: add stage_as_and_symlink for staging packages.
	  We build foo.tgz stage_as foo-${VERSION}.tgz but want to be able
	  to use foo.tgz to reference the latest staged version - so we
	  make foo.tgz a symlink to it.
	  Using a target to do both operations ensures we stay in sync.

2016-11-26  Simon J. Gerraty  <sjg@bad.crufty.net>

	* install-mk (MK_VERSION): 20161126

	* dirdeps.mk: set DIRDEPS_CACHE before we include local.dirdeps.mk
	  so it can add dependencies.

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

	* dirdeps.mk: set DEP_* before we expand .MAKE.DEPENDFILE_PREFERENCE
	  do that they can influence the result correctly.

	* dirdeps.mk (${DIRDEPS_CACHE}): make sure we pass on TARGET_SPEC

	* dirdeps.mk: Add ONLY_TARGET_SPEC_LIST and NOT_TARGET_SPEC_LIST
	  similar to ONLY_MACHINE_LIST and NOT_MACHINE_LIST

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

	* dirdeps.mk: remove dependence on jot (normal situations anyway).
	  Before we read another Makefile.depend* set DEP_* vars from
	  _DEP_TARGET_SPEC in case it uses any of them with :=
	  When bootstrapping, trim any ,* from extention of chosen _src
	  Makefile.depend* to get the machine value we subst for.

2016-09-30  Simon J. Gerraty  <sjg@bad.crufty.net>

	* dirdeps.mk: use TARGET_SPEC_VARS to qualify components added to
	  DEP_SKIP_DIR and DEP_DIRDEPS_FILTER

	* sys.mk: extract some bits to sys.{debug,vars}.mk
	  for easier re-use by others.

2016-09-23  Simon Gerraty  <sjg@sjg-mba13>

	* lib.mk: Use ${PICO} for extension for PIC objects.
	  default to .pico (like NetBSD) safe on case insensitive filesystem.

2016-08-19  Simon J. Gerraty  <sjg@bad.crufty.net>

	* meta.sys.mk (META_COOKIE_TOUCH): use ${.OBJDIR}/${.TARGET:T} as default
2016-12-19 21:50:59 +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