Commit Graph

95 Commits

Author SHA1 Message Date
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
pk 86c078cb11 JobPrintCommand: avoid stale pointers on a node's command list.
The debugging value of the code that did this is limited, so drop it
altogether.
2002-02-06 16:20:25 +00:00
sjg 9c66252a02 When attempting to chdir to .CURDIR because Check_Cwd_Cmd says we need to
make sure that the dir actually exists.  In compat mode the corresponding
chdir simply fails and all is well - the issue only arises when playing
tricky games with the value of .CURDIR.

Reviewed: christos
2001-10-16 18:06:29 +00:00
wiz 1e378c4c12 precede, not preceed. 2001-08-20 12:00:46 +00:00
matt 2850b6d11e Print out errno when vfork fails. 2001-07-24 05:06:40 +00:00
christos 147dd16dac add .USEBEFORE Attribute 2001-07-03 18:08:50 +00:00
sjg e28cc22621 Add 4th arg (flags) to Var_Set so that VarLoopExpand can tell it not
to export interator variables when using context VAR_CMD.

Reviewed: christos
2001-06-12 23:36:17 +00:00
christos 815427002e Revert Job_CatchOutput() change; it adds a considerable delay to make, and
it is not clear what problem it is trying to fix.
2001-06-11 04:20:32 +00:00
sjg 9cfd89292b A number of semi-related changes.
1. make -dx turns on DEBUG_SHELL which causes sh -x to be used where
   possible.
2. PrintOnError() is now called when make is stopping due to an error.
   This routine reports the curdir and the value of any variables listed
   in MAKE_PRINT_VAR_ON_ERROR.
3. Variables set via command line, are propagated to child-makes via
   MAKEFLAGS.  This behaviour appears to be necessary for POSIX (according
   to the GNU folk anyway).
4. Do not reset MAKEFILE when reading ".depend" as this rather eliminates the
   usefulness of ${MAKEFILE}.
5. Added ${.newline} as a simple means of being able to include \n in the
   result of a :@ loop expansion.
6. Set ${MAKE_VERSION} if defined.  Need to come up with a useful value.

Reviewed: christos
2001-06-01 20:33:37 +00:00
christos d0c243e9e5 better error messages on exec* failures. From Simon Burge. 2001-05-29 17:37:51 +00:00
sommerfeld 46608f023e bin/12734: fix SIGTSTP/SIGCONT handling.
- install SIGCONT handler which reestablishes SIGTSTP handler and then calls
JobRestartJobs() to restart all the suspended jobs.
 - when SIGTSTP is handled, call JobCatchChildren() so *** Suspended messages
get printed before make stops rather than after.
2001-05-01 03:27:50 +00:00
christos bda102d681 PR/11800: Chris Demetriou: Add -W flag to exit on parse warnings.
While I am here, s/make:.*"/%s:\1", progname/
2001-01-10 15:54:00 +00:00