Commit Graph

969 Commits

Author SHA1 Message Date
sjg c37859c219 Only need to getcwd() once 2011-03-06 17:41:11 +00:00
sjg b9fa549592 CWD should be compared against cwd 2011-03-06 04:34:25 +00:00
sjg 8892f885fd Add unit tests to check that exists(some/dir/) works
Also fix handling of sysV substitutions when lhs and variable are empty.

Also that modifiers do not cause errors during conditional tests
when undefined variables should otherwise be ok.
Ie. .if defined(nosuch) && ${nosuch:Mx} != ""
2011-03-06 00:02:14 +00:00
sjg be4a1e2c49 Treat some/dir/ the same as some/dir/. 2011-03-05 23:57:05 +00:00
sjg 47311dc80a main.c now exports curdir[] so we can use it. 2011-03-04 04:55:51 +00:00
nakayama c09c2a7b34 Fix build on Solaris 10. 2011-03-03 14:53:01 +00:00
sjg 4fab365c37 Fix rendering of :? example 2011-02-26 01:17:24 +00:00
joerg bfc4d64e8a Use the current directory at start time for .PARSEDIR, if the filename
contains no /.
2011-02-20 23:12:09 +00:00
dholland 51eafd380d Remove the extra blank line after "Fatal errors encountered -- cannot
continue". This has been there since 1.1 but I don't think it was
intentional. If anyone actually cares about the blank line being there
for some reason, go ahead and revert this change...
2011-02-20 20:17:35 +00:00
dholland 90b9a73922 Remove stray extra newline in error message. 2011-02-20 20:15:36 +00:00
sjg 0734782fbf Mark unused args. 2011-02-13 21:24:42 +00:00
sjg 8bb1fe5d14 When making a target that involves creating itermediate dirs,
realpath() will fail until after those dirs exist.
Try to ensure the same meta file name is used regardless.
2011-02-13 21:22:41 +00:00
sjg 8d31de3127 tmplen should be static 2011-02-08 05:29:13 +00:00
dholland 626c509661 erm. fix previous... 2010-12-25 21:39:11 +00:00
dholland ad5f4cbc2e Maybe fix a problem that appeared on loonix. 2010-12-25 20:46:18 +00:00
dholland f8d6aa2c68 Many C libraries don't set errno when malloc fails, so always use
strerror(ENOMEM).
2010-12-25 20:35:25 +00:00
dholland 305d151446 Improve confusing error message when getcwd() fails. 2010-12-25 20:34:08 +00:00
dholland e05b408d55 Uses stat; needs sys/stat.h. No idea what's pulling it in implicitly on
NetBSD so I didn't notice. Woops. Noted by Kurt Schreiner on current-users.
2010-12-25 17:19:04 +00:00
dholland 3f9d98c828 Begin cleanup of the make parser: separate out the logic for reading files
from the parsing goo. This will now use mmap for reading if it works and
fall back to read only for pipes and such. Step 1 of a cleanup program
proposed without objection on tech-toolchain.
2010-12-25 04:57:07 +00:00
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