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
* 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.
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.
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.
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.
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
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
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
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
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.
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.
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.
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
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
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
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.
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.
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.
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.
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
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.
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
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