Commit Graph

1299 Commits

Author SHA1 Message Date
sjg
5f2f8cfca3 Partially initialize Dir before MainParseArgs can be called.
The rest can be done once curdir is finalized.
2017-01-31 06:54:23 +00:00
sjg
4098307a7f Add :range and :_
:range	replaces var value with an integer sequence one per word
	in the current var value.

:_	stores the current var value in $_ so that it can be referred to
	later in the modifier series.

Reviewed by: christos
2017-01-30 02:46:20 +00:00
sjg
c3ec6594d3 Allow providing a utc value to :{gm,local}time
Reviewed by: christos
2017-01-14 22:58:04 +00:00
christos
34152e53bb Back in 1993 ${MACHINE} was a unique way to define objdirs for
every platform. Thus setting OBJMACHINE, allowed one to keep
in-tree objdirs with multiple builds. With the advent of evb*, this
has become impossible until now. Introduce OBJMACHINE_ARCH that
adds ${MACHINE_ARCH} to the objdir so that we have unique objdirs
per build again. Until we restructure things to that this is not
necessary, it is the simplest fix.
2016-12-10 23:12:39 +00:00
sjg
f65fa017b9 Avoid coredump for
(FOO) = fu

reported by Ori Bernstein
2016-12-09 22:56:21 +00:00
christos
87fc2c3144 Don't apply the suffix (curdir) to MAKEOBJDIR 2016-12-07 19:57:09 +00:00
christos
c977da2cd4 Refactor and simplify objdir setting code. 2016-12-07 15:00:46 +00:00
sjg
46bfaede57 Report node name rather than (null) when modified before src 2016-11-10 23:41:58 +00:00
sevan
39bbc68a3b Drop main() prototype. 2016-09-05 00:40:28 +00:00
dholland
7f48560292 Document .DELETE_ON_ERROR. 2016-08-26 23:37:54 +00:00
dholland
9d33465685 Add a .DELETE_ON_ERROR: magic target that causes *failed* targets as
well as *interrupted* targets to be deleted. The name and behavior of
the variable matches gmake.

Also fix a glitch in newline output on error in compat mode that I
discovered while doing it.

Closes PR 51376.
2016-08-26 23:28:39 +00:00
wiz
e20c5869bb Whitespace. 2016-08-18 19:23:20 +00:00
sjg
2e603a118c Refactor the handling of .MAKE.META.IGNORE_* to meta_ignore()
so that we can call it before adding paths to missingFiles.
Ie. do not track files we have been told to ignore.
2016-08-17 15:52:42 +00:00
sjg
69fc18aad5 Add .MAKE.META.IGNORE_FILTER to allow more complicated filtering of filemon data.
The filter is applied to paths Read or Excuted, and if it expands to
nothing, the entry is skipped.

For example; dirdeps.mk can set this to:

.MAKE.META.IGNORE_FILTER = M*/${.MAKE.DEPENDFILE_PREFIX}*

when checking if DIRDEPS_CACHE is up to date, where only Makefile.depend*
are of interest.
2016-08-15 19:20:17 +00:00
sjg
53f61e0d2c PR: 51405
Description:

addErrorCMD: in compat mode, cmdp may be NULL, skip it
and stop the calls (return 1).
2016-08-11 19:53:17 +00:00
sjg
374771b4a4 Set .ERROR_CMD if we can 2016-08-10 23:49:12 +00:00
sjg
929a26a3de Use Lst_FindFrom and Lst_Succ(ln) to find next entry in missingFiles. 2016-08-10 18:49:40 +00:00
sjg
c2d73114d1 Linux filemon only records D some/dir for rm -rf
rather than D entries for each file removed.
Thus we need a loop to remove all matching missingFiles entries
2016-08-10 18:25:00 +00:00
dholland
b7f11ede62 Fix DEBUG_SRC build. Partly from PR 51191. 2016-06-30 05:34:04 +00:00
dholland
0088fcac6f Cleanse an old mangy way of avoiding an unused variable warning.
PR 51191 from David Binderman.
2016-06-30 05:31:00 +00:00
dholland
f3d720012b Fix botched logic; PR 51191 from David Binderman. 2016-06-30 05:28:23 +00:00
sjg
846bd14287 meta_compat_parent: fflush each line 2016-06-29 22:10:08 +00:00
sjg
fee87d5733 meta_oodate: set needOODATE if oodate due to missing .meta file. 2016-06-14 18:16:06 +00:00
christos
88297dee99 fix memory leak, simplify 2016-06-07 03:04:45 +00:00
sjg
e917da0d70 Extend the mtimes cache used by dir.c so it can be used by others.
We store both st_mtime and st_mode, since some callers care about the
later.

Reviewed by: christos
2016-06-07 00:40:00 +00:00
christos
fcb395931a NUL terminate. 2016-06-05 01:39:17 +00:00
sjg
35fa3446c5 Avoid breaking !NetBSD build 2016-06-05 00:48:58 +00:00
sjg
ec729b232b meta_oodate even when missing-meta is true, we do not make a target in
.CURDIR out of date just because of a missing meta file.

Also we can only be missing filemon data if we had a meta file.
2016-06-04 22:17:14 +00:00
wiz
401a245f9e Fix typo in width argument; end sentence with dot. 2016-06-03 07:07:37 +00:00
sjg
cb28c6994f Add cached_realpath()
realpath(3) is expensive, and meta mode at least uses it extensively.
We use cached_realpath() to save the result of successful calls to
realpath(3) in a private variable context.

This improves the worst case performance (eg examining libc with
nothing to do) by a factor of 4.

Reviewed by: christos
2016-06-03 01:21:59 +00:00
sjg
2d086608a8 Refactor the logic for deciding when a .meta file is needed.
Both meta_create() and meta_oodate() now share meta_needed()
to indicate if a .meta file is needed.

This allows for deciding that missing .meta file is cause of out-of-date.
The new knob 'missing-meta' controlls this, and is off by default
since the side effect files of generators like yacc will typically need
.NOMETA to avoid problems.

This however makes it much easier for folk to switch back and forth
with meta mode (eg. FreeBSD's normal build can leverage meta mode for
improved reliablility without need to clean).

Also if .MAKE.MODE does not contain 'nofilemon', the knob
'missing-filemon' allows control as to whether missing filemon data
should cause the target to be out-of-date.
Again off by default.
2016-06-03 01:16:27 +00:00
sjg
ccfdc94797 Propagate errors from filemon.
If we encounter errors producing a .meta file,
we should not consider the target completed successfully.
2016-05-12 20:28:34 +00:00
sjg
1ea1c693f3 Allow for ignoring paths that match a set of patterns.
This can be expensive, so use with caution.
2016-05-10 23:45:45 +00:00
sjg
83317c9428 Apply realpath() to p before matching against metaIgnorePaths. 2016-05-10 00:02:31 +00:00
gson
4efe3992f9 Fully avoid the nonstandard types u_char, u_int, and u_long, which
were only used inconsistently in a few places anyway.
2016-04-06 09:57:00 +00:00
sjg
f5cd368fff Skip looking for .MAKE.JOBS if either of compatMake or forceJob is true.
If -B compatMake will be true and should be honored.
If -j forceJobs will be true and the command line supplied .MAKE.JOBS
should be respected - for consistency with other usage.
2016-04-05 04:25:43 +00:00
matthias
6c56f993ef honor setting .MAKE.JOBS from the makefile. That way one can e.g. do:
CPUS!=sysctl -n hw.ncpuonline
.MAKE.JOBS?=$(CPUS)
2016-03-16 16:04:44 +00:00
sjg
2271de011e Fix syntax 2016-03-16 00:19:01 +00:00
matthias
5c97c6933e Another small change to make archive member rules work. With this change
archive member rules seem to work as expected again.
2016-03-15 18:30:14 +00:00
matthias
7215e4a264 dynamic dependencies for library member targets are working again. 2016-03-15 06:25:14 +00:00
matthias
00a4845b58 make $@ an alias for $! in archive member rules (compatibility with
other makes).
2016-03-14 07:42:15 +00:00
matthias
d405a55bc6 $% is $(.MEMBER) and not $(.ARCHIVE), $! is $(.ARCHIVE) and not $(.MEMBER) 2016-03-11 15:12:39 +00:00
matthias
449c0b7d1f make parsing of library member targets work. So
lib.a(member.o): something
	cp something member.o
	ar r lib.a member.o
	rm member.o

will work now.
2016-03-11 13:54:47 +00:00
sjg
6067bdd115 Handle missing file for Read the same as for Write, since if it
is Deleted we don't care.

Patch from Bryan Drewery.
2016-03-11 07:01:21 +00:00
christos
e46a288cba str2Lst_Append tokenizes the string and uses it in the list so we can't
free the string afterwards. Keep a copy of it and cleanup at the end.
2016-03-07 21:45:43 +00:00
sjg
ab15168ea5 For :ts numeric escapes \x* is hex, anything else is octal. 2016-03-07 20:20:35 +00:00
christos
f3a4188b98 CID 1025009: Fix wrong code (NULL deref) 2016-02-27 16:20:06 +00:00
christos
e20f46c663 CID 1025008: Free memory returned by Var_Subst 2016-02-27 16:18:47 +00:00
christos
b6546efdb8 CID 1025007: Don't leak missingFiles 2016-02-27 16:17:26 +00:00
christos
0d70c98596 CID 1025006: pbm can't be NULL at this point. 2016-02-27 16:14:23 +00:00