Commit Graph

290 Commits

Author SHA1 Message Date
Hartmut Brandt
d010007507 Bump the date in .Dd for the recent '+' flag commit.
Requested by: ru
2004-07-29 16:54:42 +00:00
Hartmut Brandt
34c9c43931 Implement POSIX's '+' flag for command lines. This flag causes a line
to be executed even when -n is given on the command line to make. This is
very handy for calls to submakes.

This is slightly changed from the original patch as obtained from NetBSD.
The NetBSD variant prints lines which have both '+' and '@' when -n
is specified. The commited version always obeys '@'.

Bump MAKE_VERSION so Makefiles can use this conditionally.

PR:		standards/66357 (partly)
Submitted by:	Mark Baushke <mdb@juniper.net>
Obtained from:	NetBSD
2004-07-29 14:29:23 +00:00
Hartmut Brandt
19a7439edd Fix handling of comments on .elif lines. The patch given in a followup
to the PR failed, because the line skipping function is actually called
from two places in the code to do quite different things (this should
be two functions probably): in a false .if to skip to the next line
beginning with a dot and to collect .for loops. In the seconds case we
should not skip comments, because they are actually harder to handle than
we need for the .if case and should defer this to the main code.

PR:		bin/25627
Submitted by:	Seth Kingsley (original patch)
2004-07-22 11:12:01 +00:00
Hartmut Brandt
91540c5b62 Improve make's diagnostic of mistmatched .if-.endif. This patch is
slightly different from the patch in the PR. The problem is, that
make handles .if clauses inside false .if clauses simply by
counting them - it doesn't put them onto the conditional stack, nor even
parses them so we need an extra line number stack for these ifs.

PR:		bin/61257
Submitted by:	Mikhail Teterin <mi@aldan.algebra.com>
2004-07-20 07:42:06 +00:00
Hartmut Brandt
e9345b8636 Make it clearer what means 'won't work' for .if string == ${VAR}.
Replace the use of '=' in conditionals in the examples
by the more correct '=='.

Clarify the example explaining that .for expansion takes place before
.if handling by showing the correct code instead of saying 'the other
way around'. Change a variable name there so the example is more parseable
to the human reader.

PR:		docs/65400
Submitted by:	Roman Neuhauser <neuhauser@chello.cz>
2004-07-19 14:42:57 +00:00
Giorgos Keramidas
ebca193729 Remove the dependency of the :C/regexp/replacement/ variable modifier
from the :S modifier which follows a bit further below.  This way the
reader can read each of these two descriptions without having to jump
back and forth in the manpage.

PR:		docs/26943
Submitted by:	Alex Kapranoff <alex@kapran.bitmcnit.bryansk.su>
2004-07-18 02:26:30 +00:00
Ruslan Ermilov
6a3e8b0adc Mechanically kill hard sentence breaks. 2004-07-02 22:22:35 +00:00
Oliver Eikemeier
406e58e038 manlint
Obtained from:	ru
2004-07-02 12:34:13 +00:00
Oliver Eikemeier
f695b5ceca New variable `.MAKEFILE_LIST', useful for tracing, debugging and dependency tracking.
Use
  make -V .MAKEFILE_LIST | tr \  \\n | awk '$0==".." {l--; next} {l++; printf "%*s%s\n", l, " ", $0}'
to print a tree of all included makefiles.

Approved by:	joerg
MFC after:	1 week
2004-07-02 12:30:28 +00:00
Ruslan Ermilov
af52678ebd Markup nits. 2004-05-19 09:51:58 +00:00
Brian Feldman
59fb7e543f Treat kevent(2) returning an error EINTR as the non-error it is. 2004-04-20 22:04:12 +00:00
Ruslan Ermilov
57d9d1d762 The .DEFAULT target with no commands caused a null pointer dereference.
PR:		bin/63405
Obtained from:	NetBSD
2004-04-12 20:05:11 +00:00
Ruslan Ermilov
07b80458ef Document the new .warning directive. 2004-04-12 18:00:54 +00:00
Ruslan Ermilov
dba067b170 Added the new .warning directive.
Submitted by:	Cyrille Lefevre
2004-04-12 17:57:51 +00:00
Ruslan Ermilov
78f104db9c Unbreak compilation on RELENG_4.
Submitted by:	des
2004-04-05 17:02:08 +00:00
Dag-Erling Smørgrav
3a0ad2fe74 Sort #includes, remove <sys/types.h> (made redundant by <sys/param.h>),
add <signal.h> (needed for sigaction())

Noticed by:	Stefan Farfeleder <stefan@fafoe.narf.at>
2004-04-05 06:16:48 +00:00
Ruslan Ermilov
30b800de8e Reworked the fix to print the useful line number on error in
the .for loop:

- Replaced four global variables in parse.c with one.
- Made Parse_FromString() accept the "lineno" as an argument.
- Fixed line numbering when there are escaped newlines in the
  body of the .for loop.

Adopted from:	NetBSD
2004-03-10 21:51:06 +00:00
Ruslan Ermilov
577cf233eb Make it possible to ``.undef ${VAR}'' (expanding VAR to get
the variable name to undef).

Submitted by:	Cyrille Lefevre
2004-03-09 17:36:55 +00:00
Ruslan Ermilov
d56ed147ae Fixed line numbering inside the .for loops.
Submitted by:	Cyrille Lefevre
2004-03-09 08:09:33 +00:00
Ruslan Ermilov
a59f8cc52c Fixed a bug that previous revision has introduced -- we missed
the double quotes ("" and '') as a separate argument.

Reported by:	ache

The fix in this and previous revisions combined is functionally
equivalent to the below patch against rev. 1.27 but the code is
now much easier to follow:

%%%
Index: str.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/make/str.c,v
retrieving revision 1.27
diff -u -r1.27 str.c
--- str.c	28 Oct 2002 23:33:57 -0000	1.27
+++ str.c	25 Jan 2004 12:09:21 -0000
@@ -168,7 +168,7 @@
 				inquote = (char) ch;
 				/* Don't miss "" or '' */
 				if (start == NULL && p[1] == inquote) {
-					start = t + 1;
+					start = t;
 					break;
 				}
 			}
%%%
2004-01-25 12:28:36 +00:00
Ruslan Ermilov
cc7282659a Fixed broken logic when parsing double quotes.
PR:		bin/61673
MFC after:	1 month
2004-01-22 18:17:44 +00:00
Jens Schweikhardt
ef6885585b Revert previous commit, ru has ideas how to better document this
elsewhere.
2004-01-21 17:58:33 +00:00
Jens Schweikhardt
863fa48f65 Document __MAKE_CONF and its default, /etc/make.conf.
MFC-After:	2 weeks
2004-01-19 21:44:58 +00:00
Hartmut Brandt
10a527618c Allow variable substitutions in SYSV variable substitutions like
$(SRC:.c=$O). This brings us closer to other makes.

Reviewed by:	ru
Obtained from:	NetBSD
2004-01-12 10:35:46 +00:00
Ruslan Ermilov
1c43e2766b Moved the code for :U and :L modifiers where it belongs, so that
the fallback for SysV (now in POSIX) variable substitution works
for old_string arguments starting with 'U' or 'L'.
2004-01-10 16:30:29 +00:00
Scott Long
d11fc0ae6f Change the select timeout from 100ms to 2 seconds now that SIGCHILD is
handled.
2003-12-19 11:18:37 +00:00
Dag-Erling Smørgrav
4358431405 Install a SIGCHLD handler so select(2) will be interrupted when a child
terminates.  Without this patch, 'make -j1 buildworld' takes about 30%
longer than 'make -B buildworld' on my 2.4 GHz P4; the difference is
probably even larger on faster systems.  With this patch, there is no
perceptible difference in wall time between the two.

Submitted by:	bde
MFC after:	3 days
2003-12-13 15:26:27 +00:00
Ruslan Ermilov
ae43b8065d Fix a bug in variable parsing code that could cause a segfault.
PR:		bin/46203
Submitted by:	Stefan Farfeleder <stefan@fafoe.dyndns.org>
2003-10-06 17:37:20 +00:00
Ruslan Ermilov
277a49999a Make the -q option DTRT in the compat mode.
PR:	48210
2003-10-03 21:33:39 +00:00
Ruslan Ermilov
21159d1687 Fix a bug that prevented exists() from finding "foo/", "foo/."
and "foo/.." when ".PATH: foo" was also given.

PR:		bin/34062
2003-10-02 21:30:30 +00:00
Ruslan Ermilov
94212a14e9 Document the recently added `O' modifier. 2003-10-02 18:38:23 +00:00
Marcel Moolenaar
e964232cd5 Implement the O modifier. The O modifier sorts the words in a
variable. The implementation is based upon the patch sent to
arch@, but modified to be compatible with NetBSD. The modifier
that does a reverse sort has been dropped for now, but the
ability to add one later has been preserved.
2003-09-18 03:15:57 +00:00
Ruslan Ermilov
faf94801fd - Cut out the code that caches the "." directory out of Dir_Init()
into a separate function, Dir_InitDot().

- Postpone the current and object directories detection (and caching
  of the "." directory) until after all command line arguments are
  parsed.  This makes the -C option DTRT.

PR:		bin/47149
2003-09-14 12:31:33 +00:00
Ruslan Ermilov
04a398293c Command line variables take precedence over global variables.
Make this true in the .for loops too.  The following fragment,

	FOO=	foo bar

	all:
	.for f in ${FOO}
		@echo ${f}
	.endfor

when run as "make FOO=xxx" should print "xxx".  (OpenBSD had
this bug fixed for some time.)
2003-09-08 08:23:29 +00:00
Warner Losh
87fdc84cba Keep up with minor changes to NetBSD. Consider a variable empty when
not define.

Obtained From: NetBSD (rev 1.18; sjg)
2003-09-07 02:16:10 +00:00
Ruslan Ermilov
c94d70434f Fixed broken arithmetic expression parser.
Reminded by:	bde
In memory of:	alane
2003-07-04 13:33:48 +00:00
Ruslan Ermilov
fa01047efc Sync usage() with SYNOPSIS. 2003-04-15 14:27:21 +00:00
Warner Losh
9d6fd8f041 No need to check to see if we're running a version of FreeBSD 3.0 current or
newer anymore.
2003-04-04 04:17:14 +00:00
Tom Rhodes
63b18a5211 Remove another unused Makefile. 2003-02-03 04:15:53 +00:00
Marcel Moolenaar
7da1dd01e6 Change the handling of non-anchored global substitutions of the empty
string from a silent implicit non-global substitution to a non-silent
explicit fatal error. Archored substitutions are those containing '^'
or '$'.
The problem with changing the substitution to prevent an infinite
number of matches is that it doesn't provide the necessary feedback
to the user that there's a bug in the/a makefile. Reporting the bug
without making the condition fatal makes the feedback mostly useless
due to the way that make fails to prefix the error with program name,
makefile file name and line number information.
Note that global substitutions of the empty string anchored with '^'
(start of string) or '$' (end of string) do not cause an infinite
number of matches and are therefore not reported and hence are non-
fatal.

Suggested by: bde
Tested with: buildworld
2003-01-15 22:36:15 +00:00
Marcel Moolenaar
597b8f6add Prevent infinite substitution of the empty string by forcing non-
global substitution. In general it's a makefile bug to globally
substitute the empty string, but it's a bug in make(1) if a bug
in the makefile yields an infinite running time of make(1).

Not objected to by: arch@
2003-01-13 23:53:46 +00:00
Jens Schweikhardt
d64ada501a Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/
Add FreeBSD Id tag where missing.
2002-12-30 21:18:15 +00:00
Ruslan Ermilov
463cfa804d Fixed the abuses of .Ql visible on stderr in troff mode.
PR:		docs/37176
2002-12-23 16:04:51 +00:00
Sean Chittenden
85994822df Check the return status of chdir() when using the -C option.
Reviewed by:	bright && jmallet
MFC after:	1 day
2002-12-17 04:26:22 +00:00
Ruslan Ermilov
9f80feb348 Bootstrapping aid from pre-kqueue(2) systems, e.g. 4.0-RELEASE.
Submitted by:	jmallett
Approved by:	re (bmah)
2002-12-01 13:38:25 +00:00
Ruslan Ermilov
43b92fef62 Finish the fix in revision 1.39 -- make(1)'s behavior is now
"greedy" with respect to finding the dependency operators.

Approved by:	re
2002-11-28 12:47:56 +00:00
Juli Mallett
15ac7b352e Convert some broken cases where Error is called, but we try to continue,
to Fatal errors, because the logic that we use to try to continue is far
too broken, and makes things look and act weird, because we end up pointing
past the end of a buffer boundry into freed memory in the caller, as we
don't come close to setting the lengthPtr to a sane value.

Reviewed by:	make@

(This only changes failure cases which would have died horrid deaths to
 explicit clean death failure cases.)
2002-11-08 16:59:11 +00:00
Ruslan Ermilov
79c45f3bf9 Document the confusing behavior that the .if conditional defaults
to defined(), e.g., ``.if 1'' is equivalent to ``.if defined(1)'',
which is only true when the ${1} variable is defined.
2002-11-01 08:40:32 +00:00
Ruslan Ermilov
b382ba4fb1 bsd.doc.mk changes:
Don't gratuitously pipe thru a cat(1) if NODOCCOMPRESS.

Only create _stamp.extra when necessary.

Get rid of SOELIMPP and OBJS.

Use Groff version of soelim(1); we need its -I option
for the following to work.

Don't needlessly chdir to SRCDIR.  Only a few documents
need CD_HACK, and those that need it either use refer(1)
or .PSPIC macro which internally uses the .psbb call.
2002-10-29 14:56:09 +00:00
Juli Mallett
f67b533a2e In VarHead(), look into the correct (modified) string. 2002-10-29 12:11:56 +00:00