Commit Graph

686 Commits

Author SHA1 Message Date
Yaroslav Tykhiy
b9d442c148 The non-POSIX environment variable MAKE was superseded
by MAKEFLAGS ages ago, so don't mention it in comments.

Tested with:	cmp(1)
2008-03-05 20:24:38 +00:00
Yaroslav Tykhiy
0c35219978 Don't forget to set MAKEFLAGS in the childs' environment
from the .MAKEFLAGS global variable even if it's empty or
unset.  This means setting MAKEFLAGS to just an empty string
in the latter case.

If not doing so, make(1) behaved inconsistently WRT MAKEFLAGS.
In particular, it would let a `-f foo' option down to sub-makes
if .MAKEFLAGS was unset.  E.g.,

	env MAKEFLAGS="-f mymakefile" make

would pass `-f mymakefile' down to sub-makes via their environment
(unless mymakefile added something to .MAKEFLAGS).
But any additional options appearing would change this behaviour to
not passing `-f mymakefile' to sub-makes, as in:

	env MAKEFLAGS="-f mymakefile" make -D DUMMY

or

	env MAKEFLAGS="-f mymakefile -D DUMMY" make

(unless mymakefile cleared .MAKEFLAGS).

Also make(1) would leave MAKEFLAGS at its initial value if the
makefile set .MAKEFLAGS to an empty value.  I.e., it was impossible
to override MAKEFLAGS with an empty value.  (Note well that makefiles
are not to touch MAKEFLAGS directly, they alter .MAKEFLAGS instead.
So make(1) can filter out things such as -f when copying MAKEFLAGS
to .MAKEFLAGS at startup.  Direct modifications to MAKEFLAGS just go
nowhere.)

While the original intentions of the BSD make authors are somewhat
unclear here, the bug proves that NOT passing -f options down is
the settled behaviour because the opposite behaviour is totally
unreliable in the presence of any other options.  In addition, not
passing down -f's found in the environment is consistent with doing
so WRT the command line.

Update the manpage accordingly and make the whole description of
MAKEFLAGS and .MAKEFLAGS more consistent as this change indeed
brings more consistency into the reliable behaviour of make(1).

Submitted by:	ru (main.c)
Tested with:	make world
2008-03-05 20:11:04 +00:00
David E. O'Brien
e6da40107e It seems some don't care for the anchient joke. Add WITHOUT_OLD_JOKE
to your CFLAGS if you fall into this camp.
2008-03-04 22:51:37 +00:00
David E. O'Brien
e3730a90c4 No need to tell make to DTRT with "make love", just do it.
Also remove the 2002/08/31 bootstrapping aid for upgrades from
year old (mid-2001) systems.
2008-03-04 22:32:58 +00:00
Warner Losh
d40ca10a58 <limits.h> is necessary for using INT_MIN, so included it here
explicitly rather than relying on name space pollution to pull it in
for us.

NB: The usage of INT_MIN is somewhat bogus and suspect to my eye, but this
commit doesn't address that issue.
2008-03-04 15:56:17 +00:00
Yaroslav Tykhiy
9966971b24 Move a stray paragraph on .Ev MAKEFLAGS to where it belongs. 2008-03-04 11:28:54 +00:00
Yaroslav Tykhiy
bfabc524aa Revise the description of how .Ev MAKEFILE and .Va .MAKEFILE relate.
The most important point is that -f option(s) are never copied from
.Ev MAKEFILE to .Va .MAKEFILE by make(1), which is consistent with
handling the command line.  (-f silently sit in .Ev MAKEFILE and go
to make's children unless overwritten via .Va .MAKEFILE)

Bump .Dd.
2008-03-04 11:25:23 +00:00
Yaroslav Tykhiy
ea5b47c61c Split descriptions of .Ev MAKEFILE and .Va .MAKEFLAGS for clarity. 2008-03-04 10:33:42 +00:00
Warner Losh
51f0bfca68 Note 7.0 was the first version that FreeBSD/pc98 had a MACHINE of pc98
instead of i386.
2008-03-04 06:08:59 +00:00
Warner Losh
db18a02be9 Linux requires -D__dead2= and -D__unused= to get rid of the
sys/cdef.h-isms in the make source.  The variant of linux I tried it
on doesn't have arc4random, so -Darc4random=random too.
2008-03-04 05:35:27 +00:00
Warner Losh
640360c2f4 Use a clever definition of __FBSDID to allow building on !FreeBSD systems. 2007-12-09 16:48:51 +00:00
Max Khon
cb0ed6eefb Fix -jX when makefiles are remade. 2007-11-25 20:43:27 +00:00
Yaroslav Tykhiy
7773f5ddf9 Give more details on the following topics:
o How global, command-line, and environment variables relate.
o What peculiarities the -f option has WRT ${MAKEFLAGS}.
2007-10-31 08:20:09 +00:00
Max Khon
6d000893b4 Change directory back to ${.CURDIR} when remaking Makefiles.
Pointed out by:	ru
2007-06-01 04:20:19 +00:00
Max Khon
45352bae07 Improve logging when -dm is specified: if the node is considered
out-of-date print not only "modified before source" message
but also the path of youngest source.
2007-04-20 06:33:25 +00:00
Max Khon
bc5748e31f When remaking makefiles check that mtime has actually changed.
This fixes infinite restart in the following case:

Makefile: foo

foo: bar
	do-something

Unlike GNU make, BSD make considers "Makefile" node as remade even
if "foo" is up-to-date and was not actually rebuilt.
GNU make does not consider nodes without commands as remade if child nodes
were not actually rebuilt.

Most probably, more proper fix would be to bring BSD make behaviour in-line
with GNU make but this would be more intrusive change.
2007-04-20 06:25:45 +00:00
Ruslan Ermilov
edd57853f5 In .error and .warning, prefer command-line variables
to globals, as per documentation.

Nudged by:	Jeremie Le Hen
2007-04-12 18:14:00 +00:00
Max Khon
d2742a2b29 Better English. 2007-03-08 14:05:45 +00:00
Max Khon
9a81351403 Implement "Remaking Makefiles" feature:
After reading Makefile and all the files that are included using .include
or .sinclude directives (source Makefiles) make considers each source
Makefile as a target and tries to rebuild it.  Both explicit and implicit
rules are checked and all source Makefiles are updated if necessary. If
any of the source Makefiles were rebuilt, make restarts from clean state.

To prevent infinite loops the following source Makefile targets are
ignored:
- :: targets that have no prerequisites but have commands
- ! targets
- targets that have .PHONY or .EXEC attributes
- targets without prerequisites and without commands

When remaking a source Makefile options -t (touch target), -q (query
mode), and -n (no exec) do not take effect, unless source Makefile is
specified explicitly as a target in make command line.
Additionally, system makefiles and .depend are not considered as a
Makefiles that can be rebuilt.

Reviewed by:	harti
2007-03-08 09:16:11 +00:00
Will Andrews
ffb7adf38e Fix a bug where the standard input (fifoFd == 0) was confused with an
error return from open(2), leading to an erroneous value of maxJobs and
a hung make when -f is standard input and -j is used.

PR:		bin/101232
Submitted by:	Nate Eldredge <nge@cs.hmc.edu>
2007-03-08 07:57:43 +00:00
Maxim Konovalov
1bfbae3533 o Grammar: is appears -> appears.
PR:		docs/107306
Submitted by:	Tomas Mozes
MFC after:	1 week
2006-12-31 07:22:55 +00:00
Yaroslav Tykhiy
9b3d1b0253 Fix a group of typos:
preceed -> precede,
preceeded -> preceded,
preceeding -> preceding.

Submitted by:	Andre Guibert de Bruet <andy@siliconlandmark.com>
2006-12-29 13:08:46 +00:00
Ruslan Ermilov
93f4bf61d4 Don't go beyond the provided string when parsing the `\' character.
PR:		bin/99985
Submitted by:	Nate Eldredge
MFC after:	3 days
2006-10-09 19:37:26 +00:00
Ruslan Ermilov
c4baa2453c Markup nit. 2006-09-29 21:17:10 +00:00
Ruslan Ermilov
cb29445a92 Markup fixes. 2006-09-29 15:20:48 +00:00
David E. O'Brien
38a1ab4173 Tell when a .include is processed with '-dd'. 2006-07-22 14:00:31 +00:00
David E. O'Brien
2cae2b7d30 VarAdd() already does the debug printing, so Var_Set() only needs to do it
in the case the var already exists.
2006-07-17 21:05:27 +00:00
David E. O'Brien
99f08b7740 whitespace fixing 2006-07-17 19:16:12 +00:00
Ruslan Ermilov
1e967a0b4e So, what's it supposed to say when you type "make love"? 2006-05-11 18:08:44 +00:00
Max Khon
99d3c2c46c Update comment about var modifiers (add 'N' and 'O' descriptions). 2006-04-08 07:02:39 +00:00
Max Khon
66b07418fa Add :u var modifier (remove adjacent duplicate words like uniq(1).
Reviewed by:	harti
Obtained from:	NetBSD (mostly)
2006-04-08 06:59:54 +00:00
Ruslan Ermilov
8c7a62275a Prepare for MACHINE and hw.machine switching to "pc98" on FreeBSD/pc98.
Reviewed by:	nyan
2005-12-05 14:22:12 +00:00
David Xu
0f2755724b Quickly fix brokeness in revision 1.157, that change was
free()ing stack memory which causes the program to abort,
and I can no longer make buildworld.
2005-12-01 05:59:45 +00:00
Max Khon
7d81571413 - match_var: do not address memory at invalid address (`len' can be greater
than strlen(var) + 1)
- ReadMakeFile: prevent `fname' memory leak
- ReadMakeFile: prevent double free (caused by double fclose) --
ParsePopInput() closes input file

Reviewed by:	harti
2005-11-30 20:38:03 +00:00
Ruslan Ermilov
fd9070970c Make sure that files included using ".include <foo>" are really
looked for in the system make file directory or in the specified
-m paths instead of always looking in the other -I and .PATH
specified paths.  (Commit log shamelessly stolen from NetBSD.)

Reviewed by:	yar
2005-10-17 15:56:26 +00:00
Yaroslav Tykhiy
aeb2a851ad Revise the manpage to a certain extent, mostly with respect to
make's processing of top-level and included makefiles.  Point
out at make.conf(5) and __MAKE_CONF when telling about sys.mk.

Reviewed by:	ru
2005-10-14 23:54:20 +00:00
Yaroslav Tykhiy
9c4e83a46c __MAKE_CONF doesn't really belong here because it is
a FreeBSD extension of sys.mk.  A xref to make.conf(5)
will be enough here.

Requested by:	ru
2005-10-12 10:09:36 +00:00
Yaroslav Tykhiy
253c3c7312 Clarify the usage and effects of sys.mk, make.conf(5), and __MAKE_CONF.
MFC after:	2 weeks
2005-10-10 14:49:55 +00:00
Scott Long
1030a78a12 Make sure that the created fifo gets deleted if the top level make instance
exits due to a signal.
2005-10-09 06:36:51 +00:00
Ruslan Ermilov
762fcdcf7d Remove redundant `\&' escapes. 2005-09-27 08:06:21 +00:00
Ruslan Ermilov
0b13db0306 Fixup previous commit. 2005-09-27 08:02:03 +00:00
Poul-Henning Kamp
1b56a319fe Please ship the pointy hat to its home position. 2005-09-26 22:07:59 +00:00
Poul-Henning Kamp
c711b5fe88 Update coordinates for "mph" hash generator now that it lives in ports. 2005-09-26 20:34:21 +00:00
Poul-Henning Kamp
2e5ee2bfac Add a .sinclude directive which does the exact same as .include, except
whine when the file cannot be found and opened.
2005-09-26 20:31:00 +00:00
Hartmut Brandt
724b6284e3 Fix the type of the variable 'debug'. It is used as a bitmap, so the
type should be int rather than Boolean.

PR:		bin/84528
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
MFC after:	3 weeks
2005-09-07 07:34:24 +00:00
Giorgos Keramidas
6fb9b618f5 Fix all the spelling mistakes I could find in the man pages for words
that have at least 3 characters.

MFC after:	1 week
Thanks to:	Music band ``Chingon''
		for keeping me company while searching for these.
2005-07-31 03:30:48 +00:00
Hartmut Brandt
bc7ab08ab3 Fix the "..." special command. If this command is found all further
commands for this target are appended to the .END target instead
of beeing executed now. They are executed when the graph is finished.
There was a bug with executing the .END target which came in when
doing conversion to LST_FOREACH() which caused make to dump core.

PR:		bin/83698
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
MFC after:	3 days
2005-07-19 07:03:26 +00:00
Ruslan Ermilov
39c59153e9 Markup and wording fixes.
Approved by:	re (blanket)
2005-06-14 11:50:53 +00:00
Hartmut Brandt
0eabc7bf8f Under certain conditions the condition parser would go one past end of
the string. Until now this caused no harm, because the buffer code used
to tack two NULs onto buffers. With the new, soon to come, parsing code
this isn't the case anymore in all cases, so fix this.
2005-05-25 16:06:14 +00:00
Hartmut Brandt
691a610b4d Document why there is a dependency of certain object files from the
Makefile.

Requested by:	ru
2005-05-25 08:46:31 +00:00