the .MAKEFLAGS variable so that these are also passed to sub-makes.
This makes the handling of variables in the command environment more
consistent.
PR: bin/68853
Submitted by: Martin Kamerhofer <data@sbox.tugraz.at>
as environment variables and should not be set on make's command
line. They happen to work accidentially as command line variables
too when none of the sub-makes wants to play games with them (because
make is putting command line variables into the environment and will
find them there later on). Makefile.inc1 wants to change
MAKEOBJDIRPREFIX. In this case one cannot set it on the command line.
the MFLAGS target. Document that variable assignments from the MAKEFLAGS
environment variable and the .MAKEFLAGS and .MFLAGS target have the
same precedence as command line variable assignments.
variable as required by POSIX. This causes such variables to be
pushed into all sub-makes called by the make (except when the MAKEFLAGS
variable is explicitely changed in the sub-make's environment).
This makes them also mostly un-overrideable in sub-makes except on the
sub-make's command line. Therefor specifying 'make CC=icc' will cause
icc to be used as C compiler in all sub-makes no matter what the Makefiles
itself try to do to the CC variable.
This patch also corrects the handling of the MFLAGS variable. MFLAGS
contains all the command line flags but not the command line variable
assignments. The evaluation of the .MFLAGS or .MAKEFLAGS target now
changes both MFLAGS and MAKEFLAGS (they used to change MAKEFLAGS only).
Makefiles can use MFLAGS for their own purposes given that they do not
except MFLAGS to be undefined at the beginning and that they don't evaluate
.MFLAGS or .MAKEFLAGS. MFLAGS should be removed for POSIX compliance,
but it is unfortunately heavily used by the X makefiles.
This has been extensively tested by port builds (thanks to portmgr), new
worlds and kernels.
PR: standards/57295 (1st part above)
Submitted by: James E. Flemer <jflemer@alum.rpi.edu>
Approved by: portmgr
Obtained from: NetBSD (1st part above)
MFC after: 4 weeks
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
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)
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>
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>
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>
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
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
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;
}
}
%%%
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
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.
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
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.)
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
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@