Commit Graph

680 Commits

Author SHA1 Message Date
christos 8533275dab Remove bogus debugging code I accidentally committed. 2006-04-02 00:15:53 +00:00
christos e052a053e4 Add some coverity allocation comments, and change the way the allocator
functions work. When they allocate storage that needs to be freed, instead
of setting a boolean, set the pointer to be freed. Plug some more memory
leaks found by inspection.
2006-03-31 21:58:08 +00:00
dsl 33369a0245 There is no need to count jobs and job tokens.
If we don't create the job pipe, use the '-j n' option to limit the number
of tokens we will remove from the pipe.
2006-03-31 21:05:34 +00:00
christos ec5cc02622 Coverity CID 544: Fix memory leak. 2006-03-31 20:30:46 +00:00
ginsbach a8cd0ffcee - Change where variable substitution is done when processing traditional
include statements so that if a variable expands to more than one file
  name make will "do the right thing".
- Add additional debug print

Reviewed by christos.
2006-03-28 17:41:35 +00:00
wiz 59ba5fe8d1 New sentence, new line. 2006-03-19 10:45:03 +00:00
sjg 98b766c482 Fix :P modifier so it actually works as described.
I.e ${var.c:P} should expand to the absolute path of var.c found via .PATH
2006-03-19 01:54:21 +00:00
sjg 8af5ec82ab Document an interesting kwirk in := handling of undefined variables. 2006-03-19 01:53:01 +00:00
christos 75f03570ec Coverity CID 2719: argvalue can be NULL when passed into functions.
De-obfuscate by undefining optarg, and check explicitly for NULL before
use.
2006-03-17 15:39:44 +00:00
dsl 5f31eae781 nJobs and jobTokensRunning are both counting the same thing.
Kill nJobs and just use the count of tokens in use.
Don't eat job tokens when we are ignoring errors.
2006-03-15 20:33:19 +00:00
dsl f26d89e3d9 JOB_FIRST is always set (since we only execute the shell once for every
target). Nuke it.
2006-03-13 20:35:09 +00:00
dsl b85c051fa8 Remove the 'never non-NULL' 'previous' argument to JobStart.
Looks like it was intended as a minor (and pointless) optimisation to
remove a free() malloc() pair.
Make he comment about the stoppedJobs list more correct.
2006-03-12 20:14:56 +00:00
dsl a484dfd693 It isn't possibly to execute any part of job.c that references compatMake
when it is 'true'.  So delete the unexecutable code.
2006-03-12 19:14:51 +00:00
dsl c9b3912b1e Remove most of the code seemed to be there to support 'remote jobs'.
It isn't clear that it ever worked, if it did it has almost certainly
bitrotted in the last 12 years.  I'm not even sure all the required
components were present.
I suspect it was written to attempt to use a 'farm' of diskless sun3s.
In any case the apparant random assignment fo jobs to other systems doesn't
actually seem like a good idea!
Things like 'distcc' han be used to help slow systems run native builds.
Removing this code also simplifies make, and should let me speed up some of
its processing - without worrying about bitrotting it further.
2006-03-11 17:18:00 +00:00
wiz 904496fbc8 Markup fixes. 2006-03-11 12:02:20 +00:00
christos 5e6b1075e2 PR/33049: OKANO Takayoshi: Fix the spelling of NetBSD RCS tags. 2006-03-10 15:53:55 +00:00
dsl 5e60bf00ce Avoid calling JobRestartJobs() from the SIGCONT signal handler, instead
push a byte through the (now badly named) exit_pipe and call JobRestartJobs()
from the main code path when poll() wakes up.
Part of a plan to remove JobSigLock() and the zillions of system calls
it does.
2006-03-08 22:11:48 +00:00
apb f34c12e989 Make ".WAIT" apply recursively to all children of nodes on the right
hand side of the .WAIT, except when the recursive interpretation would
cause a cycle in the dependency graph.

Discussed in tech-toolchain.  Reviewed by christos, sjg.
2006-02-26 22:45:46 +00:00
wiz 3ea7f78b57 Fix typo. 2006-02-26 22:40:50 +00:00
sjg 701c9d99a7 Using ./bin in the test case, causes problems when 'make test' is
run from 'unit-tests' rather than the parent dir.
2006-02-26 22:20:55 +00:00
sjg 2bc18a45e6 Update man page and add test case for specifying modifiers via variable.
Also allow said variable to appear anywhere in the modifier list.
2006-02-26 21:43:00 +00:00
tsutsui 8c30474280 Don't use data in freed stack. 2006-02-18 04:10:05 +00:00
sjg 051abc7bc4 Allow variable modifiers to be specified via variable. 2006-02-18 01:29:27 +00:00
sjg 555fff313b Fix enum for better portability 2006-02-18 01:28:48 +00:00
apb c5bdb87cca Escape dots in sed regexps. Without this patch, and without
an OBJDIR, "make test" in usr.bin/make fails.
2006-02-13 18:17:36 +00:00
dsl 2bfcea2ea3 Add some more debug prints. 2006-02-11 20:59:49 +00:00
dsl e99202b6cf Actually SIG_DFL the correct signal (not SIGINT every time) just prior to
exec'ing a program in the child.
2006-02-11 20:58:53 +00:00
dsl 26ed52262a Delete obsolete static defn.
Trace number of unmade children on pass 1
2006-02-11 20:19:36 +00:00
dsl 49c83bef6a Debug trace all the targets we are actually intending making.
De-optimise the getting of a job token so we don't re-order the job
list when there are no tokens.
This might have helped etc/Makefile, but isn't enough.
2006-02-11 18:37:36 +00:00
dsl de841c2752 Make .NOTPARALLEL stop the job engine issuing more than one token (instead
of trying to de-jobify the make.
You can now put .NOTPARALLEL in a submake of a recursive make (where it is
using a job-token pipe from the outer make and have it only run a single job.
You can also specify .NOTPARRALEL in the root makefile of a large recursive
make and have the submakes run multiple commands.
Add some diagnostics printfs (enabled with -dp) to the parser.
2006-01-22 19:54:55 +00:00
dsl 363c3a143d Check the 'job_pipe' for the error token 'E' before every job, including
the first one for each make.  This significantly speeds up the detection
of errors in other branches of the make (ie those running in a different
make process).  The cost of reading and writing a byte from the pipe
should be insignificant.
Defer replacing job tokens until we've decided there is an error.
If we detect an error in another branch of the make, then call Fatal(),
setting 'aborting' and failing to return a token leads to infinite loops.
Now parallel makes actually stop with the failing command on the screen.
2006-01-21 19:18:37 +00:00
dsl 8cc9d75901 Include the 'preds' and 'successors' in the diag output.
These are the values that are actually used to control what is built.
(I suspect .WAIT info added in the previous delta isn't always useful.)
2006-01-08 17:43:31 +00:00
dsl 07c6949e33 Don't (try to) use files marked .OPTIONAL as implicit sources.
There existance hasn't been verified at the point the implicit rules are
checked.
2006-01-08 12:59:52 +00:00
dsl 94a49912ba Include .WAIT in the debug output for dependency lists. 2006-01-08 11:54:13 +00:00
dsl 913c34c213 Expunge last references to jobTokensFree 2006-01-04 21:35:44 +00:00
dsl 1f61a1399d When a parallel make job completes, always put the job token back into the
job_pipe and collect another one for the next job.
If we are aborting, remove all the 'normal' job tokens and add an 'error' one.
If we get an 'error' token, remove any other tokens, re-insert the error
token and exit (with error 'cos that is easier).
Add the current pid to some of the DEBUG(JOB) traces.
Combined effect is that parallel makes actually stop some fairly shortly
after an error, rather than running on long enough to fill the scrollback.
2006-01-04 21:31:55 +00:00
dsl 261501b75e F_DUPFD the job_pipe fds onto higher numbers (>15) to make it less likely
that they will get closed in a complex recursive parallel make.
2006-01-04 21:25:03 +00:00
dsl 68ab653c0c For parallel makes, don't recycle the job token when we decide not to
run anything.
2006-01-04 21:16:53 +00:00
dsl 12dafa0b4a If -s (silent) is specified, don't output the target name before target
output in parallel makes.
After all with -s you wouldn't know the command for a non-parallel make.
Makes (sic) the output of parallel NetBSD build fathomable.
2006-01-04 20:56:05 +00:00
perry 0f0296d88a Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:45:08 +00:00
christos efc9df200f PR/31077: Wil L: /usr/bin/make can read off of end of buffer 2005-08-27 08:04:26 +00:00
christos abefed98a7 Add typedefs for DuplicateProc and FreeProc from Max Okumoto. 2005-08-09 21:36:42 +00:00
christos 81b135acdf From Max Okumoto:
- Remove casts to NULL.
- Remove space between cast and object.
2005-08-08 16:42:54 +00:00
christos 6240774069 More KNF cleanups from Max Okumoto 2005-08-05 00:53:18 +00:00
christos 9f80093159 remove unnecessary casts to void * functions (Max Okumoto) 2005-08-04 00:20:12 +00:00
christos 62a6753895 from Max Okumoto: debug should be int, not boolean. 2005-08-03 20:55:01 +00:00
christos b3350d3e14 Remove unused files. From Max Okumoto. 2005-07-30 00:49:13 +00:00
christos 3692d77541 Whitespace KNF cleanup from Max Okumoto 2005-07-25 22:55:58 +00:00
sjg c3c1fc597e Expected results were not updated for comment testing. 2005-07-11 17:55:19 +00:00
christos 3d520edd5e PR/29985: Roland Illig: make(1) interprets backslash wrongly in for
loop expansions, when the expanded variable ends in backslash and
the backslash is the last character on the line. While this fix is
ugly (detect the condition and append a space), it is the least
intrusive for now.
2005-07-01 16:45:38 +00:00
christos b775b6932a Don't apply .DEFAULT commands to special targets (.BEGIN, .END, .INTERRUPT). 2005-06-29 19:59:42 +00:00
wiz 3051d76108 Consistency. Use Pp instead of br. 2005-06-27 09:51:09 +00:00
lukem 2bf924f405 Restore the rework from rev 1.115 and expand the description of .OBJDIR
to document the behaviour that is currently in use (the "./obj" and
"/usr/obj/`pwd`" behaviour).
Hopefully the existing .OBJDIR behaviour is clearer now.
2005-06-27 00:17:08 +00:00
wiz 47fb7786c1 Since the obj dir handling changes in the code have been
reverted, revert them in the man page too (i.e., revert v1.115).
2005-06-26 10:14:43 +00:00
lukem 50e70cd0ee revert previous for now 2005-06-24 04:33:25 +00:00
lukem 62955ed1ec Revert rev 1.110 and restore the previous "automagic objdir" support;
at least until we clean up the objdir semantics in <bsd.obj.mk> for
NetBSD builds.
2005-06-24 02:53:27 +00:00
lukem a6a204d392 Deprecate support for automagically setting the .OBJDIR to
./obj.${MACHINE}
	./obj
	/usr/obj/${PWD}

The rules for the default .OBJDIR setting are now simplified to
(and documented as) trying the chdir to the following
(if the appropriate variable is defined):
	${MAKEOBJDIRPREFIX}${.CURDIR}
	${MAKEOBJDIR}
	${.CURDIR}

.OBJDIR can be overridden in the makefile.
<bsd.obj.mk> uses this to provide the "culled" .OBJDIR semantics
for NetBSD's /usr/src builds.

MAKEOBJDIRPREFIX & MAKEOBJDIR still can only be provided
in the environment or on make(1)'s command line.

Per discussion on tech-toolchain.
This should reduce a lot of lossage people have experienced over
the years with various .OBJDIR setups.
2005-06-23 02:31:31 +00:00
wiz 19a870f516 Fix an article, and drop trailing whitespace. 2005-06-19 17:26:07 +00:00
rpaulo 9e77e5175e Change "non-escaped" to "unescaped".
Reviewed by hubertf.
2005-06-18 14:34:55 +00:00
rpaulo a0c960912d Add a new test case to reflect the problem found on PR toolchain/30536.
Reviewed by sjg and hubertf.
2005-06-18 14:33:15 +00:00
rpaulo f0f2f92389 PR standards/17732: make doesn't honour escaped comment lines. Now with
a real fix.
Ok'ed by sjg and hubertf.
2005-06-18 14:32:04 +00:00
wiz 7fba66045a Bump date for -jn, and add some formatting. 2005-06-17 19:30:49 +00:00
jmc 736ef19188 Add new debugging option '-dn' which will leave the scripts fed into make on
-j jobs in /tmp for debugging purposes. Add a note to the man page that
this could cause problems if run a lot (due to the number of files created)
2005-06-17 19:25:20 +00:00
jmc e72c744fe2 If the line being passed to the shell is a blank line and we're not in compat
mode, use the ignErr template for the command as shell doesn't like an empty
construct of the form { } || <something>. Fixes build breakage on cats
distrib where a command ends up expanding to nothing.
2005-06-16 18:07:45 +00:00
rpaulo a94394c1d9 Back it out while I'm working on a real fix without introducing new bugs. 2005-06-16 14:54:10 +00:00
rpaulo 9eb6f66b9a We now support comments until the end of a non-escaped line.
Ok'ed by hubertf.
2005-06-15 22:39:27 +00:00
rpaulo d0727c5f5b Add a unit-test for comments.
Addition to PR bin/17732.
Approved by sjg and christos.
2005-06-15 22:32:22 +00:00
rpaulo 72c3c708ca PR bin/17732: Allow make to understand escaped comments.
Approved by sjg, christos and hubertf.
2005-06-15 22:26:54 +00:00
lukem 0f422228f9 appease gcc -Wuninitialized 2005-06-03 16:15:46 +00:00
lukem 366252f608 * Improve error handling with unrecognized chars after :t.
* Explicitly goto default_case for unknown chars encountered after
  various : modifiers, rather than multiple FALLTHRUs.
* Appease gcc -Wuninitialized for sv_name and v_ctxt.

Discussed with sjg.
2005-06-03 07:02:39 +00:00
lukem fb0f76d8e8 cosmetic comment tweak 2005-06-03 05:56:25 +00:00
lukem a3b235bbd2 appease gcc -Wuninitialized 2005-06-02 01:53:01 +00:00
wiz 7aee94451b New sentence, new line; grammar improvements. 2005-06-01 17:33:21 +00:00
sjg 5f60a7de65 Add :Ox for random ordering, based on patch from
Mike M. Volokhov <mishka@apk.od.ua>
2005-06-01 17:17:34 +00:00
christos ec9ba17179 Don't complain that we cannot make .END. 2005-05-08 04:19:12 +00:00
christos 733e0e6e72 Now that dependencies in .BEGIN, .END, and .INTERRUPT work, allow them. 2005-05-08 00:38:47 +00:00
christos c9da1629b6 Mark the interrupt job as special so that when we hit ^C with -j and we
have a .INTERRUPT target we don't print "token botch".
2005-05-03 22:58:14 +00:00
christos 592ba37fd4 Don't accept dependencies for .BEGIN, .END, and .INTERRUPT since they
don't make sense or work anyway.
2005-05-01 01:25:36 +00:00
christos 66b68ce36c PR/9566: Arne H. Juul: Document special targets that do not obey dependencies. 2005-05-01 00:37:10 +00:00
christos 13481917e0 When parsing conditional tokens, make sure that the token is followed by
a non-alpha character, so that .elsefoo is not parsed as .else leading
to confusion later.
2005-03-01 04:34:55 +00:00
sjg 34180b9ccc In the case of :? modifier, variable can be an expression - say so. 2005-02-23 17:22:29 +00:00
christos 63fca13660 PR/29203, PR/29204: Max Okumoto: KNF changes to make [no functional changes] 2005-02-16 15:11:52 +00:00
christos 6e40c9e6fb PR/22559: Valeriy E. Ushakov: make -j can execute commands in wrong directory
(not in the obj dir).
Fixed by detecting when we cd, and cd'ing back.
2005-01-31 22:41:43 +00:00
christos f3ff62b84d Add comments in the pmake style, and factor out a local variable.
No functional change.
2004-12-29 01:55:25 +00:00
christos 8415275dbd Dir_MTime did not search for a file using the correct parh; i.e. it was
ignoring suffix-specific path search. So if a node was marked .MADE,
then suffix rules would not be applied to it, and we would look for
the file only in the default path, not the suffix-specific path.

XXX: Now that we looked for the suffix, we can save it in the GNode,
but we don't do this yet.
2004-12-29 00:43:02 +00:00
dsl 108eb2ab42 Add (unsigned char) cast to ctype functions 2004-10-30 20:39:35 +00:00
yamt fb79fa6390 define __GNUC_PREREQ__ if it isn't available on host. 2004-07-15 09:01:29 +00:00
wiz 13d5df6555 Sync usage with man page; from Kouichirou Hiratsuka in PR 26223. 2004-07-13 11:59:12 +00:00
wiz d2c6d0c9f5 Sort options in synopsis. 2004-07-13 11:58:55 +00:00
jmc a2bacbeec5 Change to use __unused instead and provide a compat definition in make.h if
not already defined from cdefs.h
2004-07-01 20:38:09 +00:00
jmc 71a252d58b Add some checks for gcc around a few function declarations and note the
unused variables. Also fix a few other warnings that PR#22118 shows when
trying to compile bmake on non-NetBSD hosts
2004-07-01 04:39:30 +00:00
jmc f648d12d47 Add missing NetBSD ID tags 2004-06-30 03:26:26 +00:00
uwe 06c338a198 Fit ASCII output onto an 80-column terminal. From FreeBSD. 2004-06-27 19:12:33 +00:00
uwe 150ca6a7f2 Fix a few typos. From FreeBSD. 2004-06-27 19:04:54 +00:00
wiz faa47b7058 Add comma in enumerations; fix a sentence; plural needs no apostrophe. 2004-05-07 08:23:31 +00:00
sjg 4d3fc51f60 Remove use of sh -e when running in compat mode.
Its not posix compliant and serves very little purpose.
With this change compat and jobs modes are consistent wrt how
they treat each line of a script.

Add support for the '+' command line prefix as required by posix.
Lines prefixed with '+' are executed even when -n is given.
[Actually posix says they should also be done for -q and -t]

PR:
Reviewed by: jmc
2004-05-07 08:12:15 +00:00
ross 42dbdbd46a Simplify build, no functional changes.
Instead of adding MAKE_BOOTSTRAP for hosted environments, i.e., when
you want things simple, instead add MAKE_NATIVE to get those hugely
important features like __RCSID().

It's now possible to build make on some hosts with: cc *.c */*.c
2004-05-07 00:04:38 +00:00
ross dcdf1bd27a Instead of including from the wrong directory and then fixing it (-I)
in the Makefile, how about just doing the right include?
2004-05-06 23:15:46 +00:00
ross fcce1f91eb Recognize -- (dash dash) and apply the usual interpretation.
Notes:

* The immediately previous version of make errored out on --,
which is what needs fixing.

* Historic bsd make silently ate -- and continued to process
options, so this is a behavior change from that, too, but presumably
there is more to gain in fixing it than in being bug-compatible.
2004-04-22 21:19:02 +00:00
sjg 3c6b696332 Allow "string" and "${varspec}" on lhs of conditionals.
This makes it possible to use expressions like
${("${LIST:Msomething"}):?present:absent}
it also makes treatment of lhs and rhs more consistent, and
makes CondToken easier to read.

Update unit-test/cond1 to test new features.
2004-04-13 16:06:23 +00:00