Commit graph

34 commits

Author SHA1 Message Date
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 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 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 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 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 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 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 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 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 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 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 c86c1f1254 bmake-20150606 2015-06-10 20:10:48 +00:00
Simon J. Gerraty 023e89e5ef Import bmake-20150418 2015-04-20 03:45:54 +00:00
Simon J. Gerraty 769742d3af Import bmake-20140620 2014-07-02 21:24:54 +00:00
Simon J. Gerraty d4343fd891 Import bmake-20140101 2014-01-26 07:40:17 +00:00
Simon J. Gerraty 55ec07f91d Import bmake-20130904 2013-09-05 15:49:22 +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 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
Simon J. Gerraty bdf7c19d9b Import bmake-20121010
Relevant items from ChangeLog:
          o [Makefile.in:] protect syntax that only bmake parses correctly.
          o compat.c: ignore empty commands - same as jobs mode.
          o make.1: document meta chars that cause use of shell

Approved by:	marcelm (mentor)
2012-10-25 20:31:22 +00:00
Marcel Moolenaar f74e4d18d1 Import the 20120831 release of the "Portable" BSD make tool (from NetBSD).
Submitted by:   Simon Gerraty <sjg@juniper.net>
2012-09-11 02:56:02 +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