Commit Graph

950 Commits

Author SHA1 Message Date
sjg b3f04f7310 Invalidate meta_fname when we finish a job, so that in compat
mode, we do not report a previous .meta file as being involved
in an error.
2010-12-15 23:03:35 +00:00
dholland 75724edb45 typo in comment 2010-12-13 05:01:56 +00:00
dholland a0bf60f562 Tables used by parser logic should be const. 2010-12-13 03:36:39 +00:00
dholland 0b6f5dd2c0 Remove stray extern definition that's already in jobs.h. 2010-12-13 03:35:13 +00:00
dholland 460acf6f5e Cosmetic: declare types before variables, group variables by role,
update some comments, format comments properly, etc. No functional
change intended.
2010-12-13 03:32:25 +00:00
dholland e8acbf7847 Add const necessary for clean non-native build. 2010-12-13 01:48:50 +00:00
sjg e2f0bc58ba fix style 2010-12-10 00:37:23 +00:00
sjg d196fd3962 Need to export LC_ALL=C too 2010-12-10 00:36:33 +00:00
sjg 2550dc933f meta_oodate(): we should track 'latestdir' on a per process basis.
Also, only consider target out of date if a not-found file is outside
'CWD'.  Ignore anything in "/tmp/" or tmpdir.
2010-12-09 22:30:16 +00:00
christos 24e17e276b From Aleksey Cheusov: Fix unexpected behavior with:
all: test1 test2
test1:
	@echo ${foo::=foo-text}
test2:
	@echo $(foo::=foo-text)
Saying:
nbmake: Unclosed substitution for foo (} missing)
for test 2
2010-12-02 16:46:22 +00:00
christos 8d8e09f9aa add commented out a possible addition that provides $^ like gmake, but
I am not sure if we should add it, since we already have $> for it.
2010-12-02 16:36:55 +00:00
christos f18b98792f fix typo (thanks simon) 2010-11-27 16:00:09 +00:00
sjg 1b59e5d011 When a source file moves, make will ignore the stale dependency,
but if the file in question is one that needs to be compiled (.c or .cc),
it still hands the bogus name to the compiler.

If Dir_MTime() cannot find such a file (gn->iParents is not empty),
see if the basename can be found via .PATH, and if so set gn->path to
the found file.   This prevents the stale path being given to the
compiler.

In meta_oodate(), if a referenced file no longer exists, consider the
target out-of-date.

Also, if meta_oodate() decides a target is out-of-date, and it
it uses .OODATE in its commands, we need .OODATE recomputed.
Undo our call to Make_DoAllVar() so that the call from Make_OODate()
will do the right thing.
2010-11-27 05:02:35 +00:00
christos f8063a37d7 check for NULL before de-referencing. 2010-11-26 15:14:29 +00:00
christos d670c5cfeb Instead of keeping around the mtime of the youngest child, keep a pointer
to it, so that we can print it when we do the out of date determination.
2010-11-25 21:31:08 +00:00
wiz 218cd6edd9 Remove trailing spaces, add a few serial commas. 2010-09-14 11:57:03 +00:00
sjg e7543dc43a tools/make/buildmake.sh compiles *.c, make sure meta.c does nothing
unless USE_META is defined.
2010-09-13 21:31:59 +00:00
sjg 796c4b0282 We do not need filemon(9) to have a .meta file 2010-09-13 20:34:21 +00:00
sjg c0dfab6508 Bump date 2010-09-13 16:32:00 +00:00
sjg 4db43f7e0c Add meta.c which implements "meta" mode for make.
In this mode, a .meta file is created for each target, capturing
the expanded commands used, any command output, and if filemon(9)
is available, a record of system calls which are of interest.
Not enabled unless USE_META=yes is set when building make.
Also, if FILEMON_H exists, meta.c will be compiled to use filemon(9).
2010-09-13 15:36:57 +00:00
sjg 5bc2a55818 In jobs mode, if we cannot make a target we die without any further
clue.  Call PrintOnError() before DieHorribly().
2010-08-07 21:28:40 +00:00
sjg 55b9a99afa wait[pid]() is called in several places.
If we encounter an error and run the .ERROR target, we may
reap a pid which jobs is waiting for.  Ensure that we
cleanup so that make isn't left waiting for an already
deceased child.
2010-08-07 06:44:08 +00:00
christos 703b8bafda PR/43643: David A. Holland: dash prefix broken with make -j
As the comment says in JobPrintJob set JOB_IGNERR with - commands. Fix
whitespace so that the output is consistent, although there are two separate
execution logic implementations (command.c, job.c)
2010-07-20 16:39:27 +00:00
dholland 6b10e71eb2 Revert 1.80, which somehow manages to produce different (wrong)
behavior with -jN. Unfixes PR 43534. Need a different approach...
2010-07-06 03:56:59 +00:00
dholland a472ed2f77 Document that suffix rules are not applied to PHONY targets, and also
document the .TARGETS builtin variable, which has existed since 4.4 days.
Bump date. Arises from discussion in PR 43502.
2010-06-30 01:03:54 +00:00
dholland d6bfe606f5 Set .PREFIX early the same place .TARGET is set. This makes sure it's
defined even in cases where the suffix search logic is skipped, such
as .PHONY targets, and fixes PR 43534.

Note: because .PHONY targets do not get suffix searching, .PREFIX will
not have any suffixes removed. This seems vaguely logical, although
it's not the only reasonable interpretation.

We may also want to reconsider whether suffix rules are skipped for
phony targets, too. That behavior is somewhat counterintuitive.
2010-06-30 00:25:04 +00:00
dholland 563d98c883 fix previous, the source isn't exactly crystal clear and there's a bug that
makes the behavior misleading.
2010-06-27 00:53:32 +00:00
dholland 35590dfabc Clarify $(.PREFIX) / $*. Bump date. 2010-06-27 00:06:32 +00:00
sjg aa86bc2068 JobFinish: call PrintOnError if we detected an error we are not ignoring.
This gives the .ERROR target a chance to run at the first sign of trouble.
2010-06-17 03:36:05 +00:00
wiz e2a56e055d Whitespace. 2010-06-10 18:35:22 +00:00
christos 801f2ebf67 Explain variable expansion better. Requested by Aleksey Cheusov 2010-06-09 16:58:22 +00:00
wiz 76aa4cd57b Bump date for previous. 2010-06-06 17:28:48 +00:00
sjg fbb620d711 Add .export-env which tells make to export a variable to the environment
but not to track it - as is done for .export
This allows the variable to be updated without affecting what was put
into the environment.
Older versions of make will simply treat this as .export
2010-06-06 01:13:12 +00:00
sjg 945e78bffe We have required sigaction() for quite a while.
Use bmake_signal() - a wrapper around sigaction()
rather than signal() to ensure that signals are handled
consistently.
2010-06-03 15:40:15 +00:00
sjg 3e3df25ba3 Don't missinterpret targets that start with .info 2010-05-24 21:04:49 +00:00
christos b724c2d39e put back canonicalization, but avoid doing it for files that don't contain /
From dholland
2010-05-17 17:01:16 +00:00
joerg 3fc43397e7 Drop trailing white space. Use .Oo / .Oc explicitly to annotate that the
empty content is intended.
2010-05-13 18:10:16 +00:00
sjg 21d8983546 PrintOnError: run .ERROR last, so even if it causes problems we
still print MAKE_PRINT_VAR_ON_ERROR.
2010-05-10 15:54:21 +00:00
christos 9612529ef4 Revert bogus patch that attempted to canonicalize a non absolute argv[0] using
realpath(3). Consider: touch Makefile; mkdir make; make. This will set $MAKE
to $PWD/make so further attempts to use ${MAKE} will try to execute the
directory. This needs $ORIGIN to be fixed properly, or alternatively one
can duplicate the logic for execvp(3) and search the path for the make
executable. Not worth it. It was working just fine before!
2010-05-05 14:10:39 +00:00
sjg 25ba15c805 gcc defines __svr4__
SunPro compiler defines __SVR4
We need to check both to ensure that on SunOS signal is hooked into
sigaction - otherwise we do not pass the unit-tests due to missing
a SIGCHLD
2010-05-05 07:05:33 +00:00
sjg b4a3c0bec3 fflush stdout, before writing to stderr. 2010-04-29 23:12:21 +00:00
sjg 83fb10e649 PR: 42850
Reviewed by:

Reduced the "expected to exist" dirs in path to just
/ /bin and /tmp
and change the "not expected to exist" dir to something
even less likely.
Add a comment to suggest why.
2010-04-23 15:43:28 +00:00
sjg 24157036cd On darwin at least, vfork() fails in child of vfork().
It probably shouldn't work anyway, so avoid this.
We use the macro vFork() - a function seems to cause problems
and is unnecessary overhead.
2010-04-23 00:18:50 +00:00
dholland d1466497fc Use _PATH_TMP instead of a literal /tmp; noted by Christos 2010-04-22 22:39:13 +00:00
sjg 1870812db3 Force LANG=C to ensure sort(1) behaves as expected 2010-04-22 21:41:11 +00:00
dholland fb0f75db1f don't use strlcpy; it causes bootstrap issues. (noted by moof) 2010-04-22 20:25:16 +00:00
sjg 7254a559b2 PR: 42850
Reviewed by:

modmisc: since we apply an exists() test to $paths, be conservative
in what we expect.

Run the unit tests with -r -m / so that we do not fail if there
is no sys.mk present.
2010-04-22 19:15:23 +00:00
sjg a71a4119cf Just because $TMPDIR is set does not mean it is valid.
Add a central function for creating temp files so we have one place to
audit.

Reviewed by: dh
2010-04-22 19:11:17 +00:00
sjg 862d4ff05d If we do .export (all) and have any variables that involve :sh
we will hit an error (var is recursive) while trying to evaluate that.
Fix, and add a unit test for this.
2010-04-21 04:25:27 +00:00
sjg b7f72d44a7 Behavior of realpath() appears to vary.
To ensure consistent results, use stat(2) as a final check for success.
2010-04-20 17:48:16 +00:00