Commit Graph

106 Commits

Author SHA1 Message Date
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
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
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 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 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 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
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 3692d77541 Whitespace KNF cleanup from Max Okumoto 2005-07-25 22:55:58 +00:00
christos b775b6932a Don't apply .DEFAULT commands to special targets (.BEGIN, .END, .INTERRUPT). 2005-06-29 19:59:42 +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
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 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
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
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
jmc 1664a90985 Fixes for PR#18573 (make -j not stopping correctly on error).
Using -e in sh/ksh to stop on error doesn't work with grouped commands. At
least for any SUSE compliant sh(1). Instead, extend the Shell struct and add
errOut which provides a template to use to check error status from commands.
2003-12-20 00:18:22 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
sjg 3716ad7f49 Allow .SHELL: to control the shell used by compat mode too.
Add a shell spec for ksh - a nice portable posix shell.
Document .SHELL:
2003-08-01 00:39:52 +00:00
itojun a5450bcac9 backout. make(1) either uses strcpy() to malloc'ed region (enough size),
or function signature prohibits us from using strlcpy().
2003-07-16 07:16:24 +00:00
itojun bd8e1178ee strlcpy (fixed) 2003-07-15 05:39:28 +00:00
itojun 885eddc2ed strlcpy 2003-07-15 05:38:24 +00:00
christos 6a7d20bb25 Pass WARNS=3 2003-07-14 18:19:11 +00:00
christos 9d921a9a8d PR/1523: Chris Demetriou: don't count a library as built, if there is no way
to build it.
2003-04-08 17:46:59 +00:00
gson 936f6a1c3c When JobExec() was called from JobRestartJobs() via JobRestart(), it
executed the make job with sigprocmask(SIG_BLOCK) in effect for a
number of signals including SIGCHLD.  This caused recursive submakes
of the make process in question not to receive SIGCHLDs when their
jobs exited.  This was a second, independent cause of bin/18895 in
addition to the race condition already fixed.  Fixed by unblocking all
signals before executing the job.
2002-12-09 01:23:53 +00:00
enami b3e831985f Call fcntl() on the right file descriptors. 2002-11-26 05:30:01 +00:00
gson 96f1cc8289 Fixed race condition that would cause make -j to pause for five
seconds if a SIGCHLD arrived while make was not blocked in poll(),
by making the SIGCHLD handler write to a pipe included in the poll.
Avoided the need to implement a duplicate fix for the USE_SELECT case
by emulating poll() in terms of select() when USE_SELECT is defined.
Fixes bin/18895.
2002-11-16 22:22:23 +00:00
wiz 86ebbc3a0e Remove !__STDC__ stuff, de-__P(), ANSIfy, and de-register. 2002-06-15 18:24:55 +00:00
christos 3baa6002c6 PR/16361: J. Mallett: make(1)'s job.c does not properly initialise postCommands 2002-04-15 12:45:33 +00:00
pk 48f5b2bd9d Fix some of the syntax errors (in unused code) and layout glitches. 2002-03-18 13:32:36 +00:00
pk b9f8785382 Block signals during Lst_Open/Lst_Close list traverals and in JobExec
while setting up a child process. This prevents the major sources of
list inconsistencies that may result from doing list manipulations
from a signal handler.

XXX - all Lst_*() operations are at risk; look for ways to avoid touching
so much global state from the signal handlers.
2002-03-18 13:28:25 +00:00
pk f41ec821b9 Fix signal-handling bogons in JobPassSig():
- don't block the signal we're about to send to ourselves to
	  take the default action for
	- restore the signal handler for the current signal
	- remove duplicate sigprocmask() call

As a result, restoring the SIGTSTP handler in JobContinueSig() is no longer
necessary.
2002-03-18 12:28:07 +00:00
pk e962f03d24 JobInterrupt(): don't try to unlink JOIN or PHONY targets. 2002-03-18 08:23:33 +00:00
pk fe31442363 Remove bogons from JobMatchShell() 2002-03-18 07:54:33 +00:00
pk 9fee4daa5f Job_ParseShell(): fix keyword counting error. 2002-03-15 15:54:41 +00:00
pk 0debc78bef JobExec(): don't use Punt() in the child; it can't possibly DTRT, and will also
mess up the parents variables.

Instead, use execError() for all error paths in the child code.
2002-03-14 16:08:37 +00:00
pk e84cfe875b Job_AbortAll(): add missing Lst_Close(). 2002-03-14 08:07:55 +00:00
pk 542708dea8 JobInterrupt(): add missing and fix a misplaced Lst_Close(). 2002-03-13 17:46:03 +00:00
pk e98ee34b4c Add the job's name to the `*** Error/Suspended/Continuing' informational
output. Useful when doing, e.g. a `make -j42'
2002-03-13 17:43:31 +00:00
enami 9b95f1b1f3 We don't want token while we're aborting. Otherwise, make spins wasting cpu. 2002-03-04 00:34:35 +00:00
pk fa714e8390 Fix for previous: JobRestart() return value check was reversed. 2002-02-10 12:01:59 +00:00
pk 6c012e68f5 JobRestartJobs() should cease scheduling stopped jobs if the maximum
number of running jobs limit has been reached, otherwise an infinite
loop is the result.

Give JobStart() a return value to report this condition.
2002-02-08 17:44:23 +00:00
pk c36b1263ac JobStart(): if there no commands to execute for a node, set its status
to MADE before calling Make_Update(). This is necessary to complete
all rules associated with sources on an .ORDER dependency.
2002-02-08 17:31:38 +00:00