Commit Graph

378 Commits

Author SHA1 Message Date
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
Ruslan Ermilov
36c4697a65 Mention that the left-hand side of the comparison
conditional must always be a variable expansion.

Obtained from:	PMake

Do not lie that debugging .for loops is a no-op.
2002-10-29 09:48:49 +00:00
Juli Mallett
85779f0ead Split var.c into var.c and var_modify.c and move all the modification funcs
to var_modify.c, for readability.  constify some low hanging fruit (string
manipulation functions) and the upper layers appropriately.  No longer use
the private strstr(3) implementation, while changing string code.

Tested by:      lots of successful make buildworld.
2002-10-28 23:33:57 +00:00
Juli Mallett
5d46839577 Fix problem with my ability to tell the difference between 'r' and 'l'... We
want to check var[1], not val[1].

Submitted by:	Mark Valentine <mark@thuvia.demon.co.uk>
Pointed out by:	sam
Pointy hat to:	jmallett
2002-10-24 20:37:58 +00:00
Juli Mallett
85ec8fdb1d When expanding a specific [1-char] variable, only expand said specific
[1-char] variable.  Don't just automatically expand something which
starts with that character.

Obtained from:	OpenBSD [3 years ago!]
2002-10-24 12:57:42 +00:00
Juli Mallett
775fb1e81e Duplicate the variable name in the v->name field, as otherwise it points to
data that will be modified.  And do the appropriate thing now and free the
v->name buffer along with other relinquished memory.

XXX There is duplication here of destroying a Var, which is probably bogus,
and probably missed in a few places.
2002-10-24 04:10:55 +00:00
Juli Mallett
cbfcb39874 Remove efree(), it isn't used consistently enough to even pretend that it
might help on the systems it could possibly be used as a bandaid for.  In
fact, the only thing it's useful for is instrumenting free(3) calls, and in
that capacity, it's better served as a local patch, than a public wrapper.
2002-10-23 23:16:43 +00:00
Juli Mallett
1d5e8e35b5 De-obfuscate and correct the include path handling for SysV style includes.
PR:		32759
Submitted by:	Mark Valentine
Reviewed by:	Matthew Emmerton" <matt@gsicomp.on.ca>
MFC after:	15 days
2002-10-23 01:57:33 +00:00
Juli Mallett
f8137bcf93 Move utilitarian routines to util.c, which isn't the same as the old
compatability-geared util.c.  These are things like message printers
and the PrintAddr function for traversing lists.  Other general-purpose
utilities inside make(1) can go here, in time.
2002-10-10 19:27:48 +00:00
Juli Mallett
4526ed6ffb Convert make(1) to use ANSI style function declarations. Variable
documentation already adequatedly existed in the description in most
cases.  Where it did not, it was added.  If no documentation existed
beforehand, then none was added.  Some unused dummies for use in the
traversal functions were marked as __unused during the conversion.
Occasionally, local style fixes were applied to lines already being
modified or influenced.

Now make(1) should always build with WARNS=3.
2002-10-09 03:42:10 +00:00
Juli Mallett
0ce3fbf191 Use __FBSDID in the lst.lib files, to match to main make(1) files. It is
defined to __RCSID when bootstrapping, by the Makefile, but this change is
for consistency
2002-10-09 02:00:22 +00:00
Juli Mallett
15c11220ee Remove extern declarations from functions and source files where they would
happily fit into headers.
2002-10-09 01:56:02 +00:00
Juli Mallett
cf382f5bb1 Remove unused local-locals, where upper-level locals may safely be used. 2002-10-09 01:51:00 +00:00
Juli Mallett
7e75296d52 Reference the correct local variable in all parts of a for loop, so we
operate on the correct data (properly).

Tracked down by:	Dan Nelson
2002-10-08 21:29:04 +00:00
Poul-Henning Kamp
5fd43411f3 Give make(1) the ability to use KQUEUE to wait for worker processes
instead of polling for them.

Unfortunately we cannot enable it yet because it panics the kernel
somewhere in kqueue.

Submitted by:	Stefan Farfeleder <e0026813@stud3.tuwien.ac.at>
2002-10-04 20:30:03 +00:00
Juli Mallett
80ce40f394 In lieu of a good way to prevent every possible looping in make(1), stop
there from being more than 500 processes forked by make(1), to prevent a
forkbomb from happening, in a dumb and mechanical way.

PR:		alane
Submitted by:	bin/42772
MFC after:	2 weeks
2002-10-03 04:32:47 +00:00
Juli Mallett
03f3a2a645 Code that has been #if0'd with the comment "WHY" since revision 1.1 can
disappear.
2002-10-02 16:06:39 +00:00
Juli Mallett
0b6a3508ac Remove 6-years-stale #if0, the behaviour isn't ever going to be limited to
compatible mode, as far as I know, since we use it...
2002-10-02 16:03:26 +00:00
Juli Mallett
40eecdba73 Fix spurious three-space indentation in a four-space indentation file. 2002-09-29 00:20:28 +00:00
Juli Mallett
3873e563fc Fix ability to use csh(1) as the make(1) shell.
Sponsored by:	Bright Path Solutions
2002-09-29 00:02:04 +00:00
Juli Mallett
763d9eb177 Make make(1) WARNS=6 clean except for const issues. This mostly involves
renaming variables to not shadow libc functions or greater scope locals.  Kinda
makes one wonder if the extern ones weren't meant in some of these places :)

The only thing I'd still like to do WRT this is possibly combine rstat and
status in compat.c -- that should be fine, as I do not think the codepaths
will want both around at once.

Sponsored by:	Bright Path Solutions
2002-09-28 23:35:07 +00:00
Juli Mallett
76e8db31fc Fix merge error in previous commit.
Sponsored by:	Bright Path Solutions
2002-09-28 20:04:17 +00:00
Juli Mallett
1e3d8881cf Add empty default cases where they should be, remove non-local execution stuff
in compat.c which doesn't even have preprocessor-conditional-hidden support
code, and add a debugging statement where we might end up with a nil list
somehow, but where I doubt it.

First confirmed userland kill for Flexelint.

Sponsored by:	Bright Path Solutions
2002-09-28 20:03:26 +00:00
Ruslan Ermilov
2420b40463 Document the parsing bug. 2002-09-27 09:21:07 +00:00
Juli Mallett
a08239b5d0 Remove a semicolon that appears to be a lie.
Spotted by:	SPARC64 make WARNS=3
Sponsored by:	Rachel Hestilow <rachel@jerkcity.com>
2002-09-26 06:44:30 +00:00
Juli Mallett
cac04057f2 When formatting the time for a target, use %H instead of %k, which is mostly
the same, but uses a non-extension option.

Sponsored by:	Rachel Hestilow <rachel@jerkcity.com>
2002-09-26 06:40:04 +00:00
Juli Mallett
4fed818c7e Don't declare things as extern when they will be static.
Sponsored by:	Rachel Hestilow <rachel@jerkcity.com>
2002-09-26 01:39:22 +00:00
Juli Mallett
2dbb6cf1cb Make the DEBUGF() macro portable by (ugh) adding a Debug() function, which
is merely printf() but to stderr.  This takes care of the caveat which lead
to the use of a vararg macro -- getting everything to stderr.
2002-09-18 16:13:03 +00:00
Juli Mallett
cdba64071c Move common use of if (DEBUG(FOO)) printf... to DEBUGF(FOO, ...), using
variable length arguments to a macro.  Bump version as this makes DEBUG
statements *always* go to stderr rather than sometimes stdout.  There are
a few stragglers, which I will take care of as soon as I can.  Mostly these
relate to the need-for-death-of some of the remote job code.

Nearby stylistic nits and XXX added/fixed where appropriate.
2002-09-17 22:31:26 +00:00
Juli Mallett
37721c8309 #define<space> -> #define<tab> 2002-09-17 21:29:06 +00:00
Juli Mallett
0fd9fa89a9 Print debugging from DEBUG(VAR) level to stderr. About to macroise this.
(Read: More commits to come).

MFC in:		4 days.
2002-09-17 21:26:57 +00:00
Archie Cobbs
1b69f09c39 Make it clear that the ":C" variable modifier expects an extended
regular expression instead of an obsolete regular expression.
Also, cross-reference re_format(7) instead of regex(3).

MFC after:	3 days
2002-09-06 17:33:11 +00:00
Peter Wemm
7b2f27b0fe Deal with bootstrapping from an old -current (almost exactly a year old)
which fails the make tests (doesn't understand ${notdef:U}) and therefore
fails on __FBSDID in usr.bin/make/*.  -DBOOTSTRAPPING is no help here since
this is before we are using the new share/mk/* files, and it would conflict
with the builtin -DBOOTSTRAPPING support later.. so use a different flag.
2002-08-31 07:18:40 +00:00
Juli Mallett
acdb9a105e Add a -C ala GNU make(1) for Makefiles which are too lazy to use $(MAKE) and
this particular GNU flag.  It changes into the given directory for the
operation in question.  This just goes into said directory at the time of
parsing the argument for getopt(3).

Submitted by:	Rachel Hestilow <rachel@jerkcity.com>
2002-08-25 02:45:04 +00:00
Ruslan Ermilov
4612010cdd Allow embedded :' and !' in target names.
PR:		bin/6612
Obtained from:	OpenBSD
MFC after:	1 week
2002-08-20 12:50:32 +00:00
Juli Mallett
3a7fc8ce59 Remove local prototypes for main(). 2002-08-19 03:07:56 +00:00
Ruslan Ermilov
ef3a89cfe8 main.c:450: warning: `targs' might be used uninitialized in this function
Spotted by:	patrick@godloveya.com, naddy, -Wuninitialized

This segfaulted alpha and sparc64; i386 had this magically zeroed.
2002-08-11 11:10:43 +00:00
Ruslan Ermilov
19d732af8b Pacify ``make -f /dev/null -V FOO''. 2002-08-07 13:25:51 +00:00
Juli Mallett
716297c2d3 Print a warning when we are given two scripts for one target. This is neither
as wide-reaching nor intensive as NetBSD's similar, but the warning uses the
same text.

Inspired by:	NetBSD
2002-07-28 03:52:41 +00:00
Warner Losh
a366365a74 Back out jmallett's realpath changes. They break a set of makefiles that
we use in sublte ways with relative paths.  Until they can be resolved,
back out these changes and put a big comment about why using realpath is
busted.

Approved by: jmallett
MFC After:  100 millifortnights
2002-07-26 21:50:36 +00:00
Juli Mallett
19074b91d3 Bit-width fields should be of type 'int'. 2002-07-15 06:57:25 +00:00
Juli Mallett
9739527ffb Use %zu to print size_t. 2002-07-15 06:57:01 +00:00
Juli Mallett
9f3d7bf758 Fix a bug fixed by NetBSD in revision 1.42 of parse.c by christos which caused
an example Makefile I was showing someone just last night to report a variable
as being recursive.

Obtained from:	NetBSD
2002-06-20 19:51:13 +00:00
Juli Mallett
7fc2a9f90c More unsigned char casts to isupper(3).
Obtained from:	NetBSD
2002-06-20 19:45:44 +00:00
Juli Mallett
536dddacf1 Provide a heuristic for RCS conflicts.
Obtained from:	NetBSD
2002-06-20 19:44:34 +00:00
Juli Mallett
2431da5c7e Look for wildcards, and balanced meta-characters such as { and } like NetBSD
does.

Obtained from:	NetBSD
2002-06-20 19:41:21 +00:00
Juli Mallett
a63d92ee89 Expand a buffer to reduce diffs to NetBSD.
Obtained from:	NetBSD
2002-06-20 19:31:55 +00:00
Juli Mallett
83739a1077 Diff reduction for great justice against NetBSD, cast to unsigned char when
passing an argument to isspace(3).
2002-06-20 19:28:00 +00:00
Juli Mallett
fe36b03b4c Fix a memory leak from previous commit by freeing the possibly expanded
string at the first opportunity, being sure to now always allocate the
new string from VarPossiblyExpand.  Oops.
2002-06-19 17:39:36 +00:00
Juli Mallett
0a9c401f9a Possibly expand the variable name's embedded variables before using it, as
seen (somewhat) in NetBSD.  This catches a few extra recursion cases that
could be hidden by expanding a NIL variable causing an existing variable to
be returned (which caused infinite looping and climbing memory usage in at
least one case).

Obtained from:	NetBSD (in principle)
2002-06-19 17:23:08 +00:00
Juli Mallett
be2694ca0e make(I) appeared in PWB UNIX. 2002-06-17 13:43:15 +00:00
Juli Mallett
a446b510a4 Avoid classy use of a variable one time with a constant value. 2002-06-13 08:57:53 +00:00
Juli Mallett
536ceed1fc Use %p to print a pointer, not %lx and a cast to (unsigned long). Yuck. 2002-06-13 08:55:29 +00:00
Juli Mallett
bea86ac44d Don't do stupid things to avoid unused parameters, mark them __unused. 2002-06-13 08:54:16 +00:00
Juli Mallett
d2c462cec8 String lengths and sizeof()s are size_t not int. Mark an unused parameter
of ReadMakefile as __unused, it's there because this function is used by
the abstracted list interface which normally deals with item handlers which
take two arguments.  Add a missing static prototype.
2002-06-12 04:18:31 +00:00
Juli Mallett
22c26d85e3 The error functions take constant pointers to strings for their format. 2002-06-12 04:11:01 +00:00
Juli Mallett
30617de0f3 Remove a stray asterisk in a comment. 2002-06-01 00:52:28 +00:00
Ruslan Ermilov
1ab9d5a384 mdoc(7) police: removed unnecessary .Ns's. 2002-05-30 05:47:50 +00:00
Ruslan Ermilov
1737392273 Back out the ``run shell from $PATH'' change; this was an overkill
and is insecure.

Requested by:	bde
2002-05-24 15:51:27 +00:00
Juli Mallett
e0bd05dc2f Set the MAKEFILE variable to the value passed to ReadMakefile(), not the full
path to it.  Use the full path only for parsing it.
2002-05-23 12:01:54 +00:00
Juli Mallett
8eccf3b248 str_concat() doesn't really take const arguments.
Submitted by:	bde
Pointy hat to:	jmallett
2002-05-22 15:34:00 +00:00
Ruslan Ermilov
ea98f295f7 Do not run shell from /bin, run it from $PATH.
Bump MAKE_VERSION to 5200205221.
2002-05-22 14:53:18 +00:00
Ruslan Ermilov
8e9bddc97b Added the MAKE_VERSION global that could be useful in determining
if a given make(1) is feature-compatible with a set of makefiles.

When merged, this will be used to replace the ugly upgrade_checks
hacks in src/Makefile.

Version has the RYYYYMMDDX format, where R is from RELENG_<R> and
X allows for 10 distinguishable changes per day.

Discussed with:	bde
2002-05-22 14:35:47 +00:00
Juli Mallett
27ffa61f2a Replace the evil that is __DECONST() with (void *). This is one of the least
evil things we can do involving the const qualifier and a pointer.

Submitted by:	bde, ru
2002-05-22 11:16:48 +00:00
Juli Mallett
21b8b7cb3c Make ReadMakefile() operate using the realpath(3) name for the file handed to
it, which means that relative paths will be expanded to absolute paths, and
filenames without a path will end up with their absolute path included as
well.  This aids tremendously in debugging a build using our make(1) with
multiple Makefile's, such as when there is a syntax error in a file in a
sub-directory as per <bsd.subdir.mk>.  Normally we'd end up with just
"Makefile" known about the Makefile in question, which means that an error
would be useless for someone trying to debug their build system, now we
end up with a complete real pathname for the Makefile.

So mostly this is useful in a debugging context, but possibly others too
(I haven't thought of them yet, but they probably are more useful if you
make Dir_FindFile use realpath(3), but that's another story).

Reviewed by:	-current
MFC after:	2 weeks
2002-05-21 20:24:46 +00:00
Tom Rhodes
46c2a2cfa4 More consistancy. file system > filesystem 2002-05-16 02:19:14 +00:00
Juli Mallett
417485c74a Fix make(1) behaviour regarding SysV-style substitution when given a nil
left-hand-side.

PR:		bin/5297
Submitted by:	"Matthew Emmerton" <matt@gsicomp.on.ca>
MFC after:	1 week
2002-05-05 19:04:58 +00:00
Philippe Charnier
e8937ba009 Use `The .Nm utility' 2002-04-20 12:18:28 +00:00
David E. O'Brien
ccf3ce3e97 Move the sysV variable substitution up with the BSD feature that replaced it. 2002-04-19 04:08:35 +00:00
Ruslan Ermilov
78257b6288 Do not reset MAKEFILE when reading ".depend" as this rather
eliminates the usefulness of ${MAKEFILE}.

Obtained from:	NetBSD
MFC after:	1 week
2002-04-18 12:04:34 +00:00
David E. O'Brien
75a778e9f8 Back out rev 1.17, it breaks dependencies.
With rev 1.7 one cannot build src/bin/sh -- because make fails to create
the buildtools before trying to use them.  Actually it does compile the
buildtools into .o's before trying to use them, but not all the way into
binaries.
2002-04-14 04:15:34 +00:00
David E. O'Brien
ade4ded301 Revision 1.17 seems to break a subsequent buildworld (i.e. with the new
make installed) in gnu/usr.bin/groff/src/preproc/eqn (which, being a
build tool itself, is built with the original make during buildworld).

The problem seems to be that in str_concat(), the string is not
terminated when the length of the second string is 0.
This apparently can happen during null suffix rule processing.

Submitted by:	tmm
2002-04-13 19:36:47 +00:00
David E. O'Brien
79f407f91e Fix a minor lint warning. 2002-04-13 12:20:51 +00:00
David E. O'Brien
664a5a88d4 Prefer BSDmakefile over makefile and Makefile.
Submitted by:	jmallett
Obtained from:	OpenBSD
2002-04-13 12:18:00 +00:00
David E. O'Brien
9b24805230 Fix copyrights, and undo SCS ID damage. 2002-04-13 10:57:56 +00:00
David E. O'Brien
4d1f4209a6 Update SCM ID method. 2002-04-13 10:17:18 +00:00
David E. O'Brien
302d0b1426 Make str_concat handle NULL arguments properly (a-la how ODE-2.3.6 make does).
Submitted by:	jmallett
Inspired by:	CMU BUILDTOOLS4 coredumping, ODE-2.3.6 make(1)
2002-04-13 10:13:39 +00:00
David E. O'Brien
a59e308cd7 De'register. 2002-04-13 10:05:30 +00:00
David E. O'Brien
46f905209d Constify str_concat()
Submitted by:	jmallett
2002-04-13 09:49:33 +00:00
David E. O'Brien
da363cd56a Check to make sure fdopen() succeeds in make(1).
Submitted by:	jmallett
Inspired by:	NetBSD
2002-04-13 09:10:07 +00:00
Philippe Charnier
2cafd1dca7 Un.Ar makefile. The add of .Ar was part of my last commit.
Asked by:	ru
2002-04-12 16:05:53 +00:00
Philippe Charnier
cb497d661f Reorder #include. Cast arg #2 of lseek to an off_t when constant. No need to
test if failsafe memory allocation fails, it can't. perror -> warn. Use
failsafe memory allocation provided.

Use .Pa and .Ar. Uppercase (first letter) programname after dot.
2002-04-12 13:23:33 +00:00
Warner Losh
c120448ada o unifdef -D__STDC__
o remove badly bit-rotted compat file that likely won't work on the systems
  it purports to support.
2002-03-23 23:30:30 +00:00
Warner Losh
d3cb5ded92 remove __P 2002-03-22 01:33:25 +00:00
Crist J. Clark
c62ec993b4 make(1) claims to ignore the remainder of a conditional once its value
has been determined similar to C. That is, one expects a construction
like,

.if defined(TEST) && (${TEST:L} == "test")

Never to generate an error since the second expression should never be
evaluated when TEST is undefined.

However, this was not the case. The above fails with the current
make(1) if TEST is undefined. This patch fixes the above and many
similar cases.

PR:		bin/34032
Submitted by:	Alan Eldridge <alane@geeksrus.net>
MFC after:	1 week
2002-02-20 14:31:19 +00:00
Jens Schweikhardt
e3e5c7667e Make substitutions in internal macros like $(@F:.o=.c) work.
This should not affect our build process, as

	find /usr/src -name Makefile | xargs grep '@[DF]'

has no matches (other than FreeBSD.org email addresses :-)

PR:		bin/24377
Submitted by:	Mark Valentine <mark@thuvia.demon.co.uk>
Reviewed by:	Matthew Emmerton <matt@gsicomp.on.ca>
MFC after:	4 weeks
2002-01-12 10:45:27 +00:00
Ruslan Ermilov
57e4378bf6 mdoc(7) police: protect trailing full stops of abbreviations
with a trailing zero-width space: `e.g.\&'.
2001-08-10 13:45:36 +00:00
Sheldon Hearn
e1b4d8d074 Use STD{ERR,IN,OUT}_FILENO instead of their numeric values. The
definitions are more readable, and it's possible that they're
more portable to pathalogical platforms.

Submitted by:   David Hill <david@phobia.ms>
2001-07-26 11:02:39 +00:00
Ruslan Ermilov
f72acdd4c9 Clarify that MAKEOBJDIR and MAKEOBJDIRPREFIX are environment variables.
Submitted by:	bde
2001-07-16 15:33:34 +00:00
Dima Dorfman
f247324df7 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
David E. O'Brien
f23466b9fd Note that sys.mk is read before any other file (even Makefile) 2001-05-23 18:21:36 +00:00
Maxim Sobolev
6649ab78e1 By default build make(1) as a static binary. It costs only 100k of additional
disk space, buf provides measureable speed increase for make-intensive
operations, such as pkg_version(1), `make world' and so on.

MFC after:	1 week
2001-05-18 09:05:56 +00:00
Dima Dorfman
f238e04f6f mdoc(7) police: remove hard sentence breaks. 2001-04-30 23:20:43 +00:00
Will Andrews
40adb1a63b Remove GCC-ism (-Wall).
Submitted by:	bde
2001-04-26 04:40:57 +00:00
Ruslan Ermilov
9aa8f5f68a Add -Wall. 2001-04-25 14:59:16 +00:00
Ruslan Ermilov
f8532548a6 -Wall cleanup. 2001-04-25 14:45:36 +00:00
Ruslan Ermilov
73295d34c7 unifdef -UWANT_ENV_PWD.
No one ever going to use this bugfeature.
2001-04-25 14:44:42 +00:00
Ruslan Ermilov
43403d166a Make ${.OBJDIR} canonical.
Reviewed by:	bde
2001-04-25 14:22:38 +00:00
Bill Fumerola
bdc8631e01 with my mentor hat on...
remove the concept of a 'maintainer' of our make. there really isn't a
need for any one committer to hold an exclusive lock or serve as a filter
for this code.
2001-03-15 10:33:00 +00:00
Will Andrews
fdcd2e7d3a Revert previous change -- apparently it's not quite right. It broke
src/sys/modules/if_ef and possibly other things.  I tested the build with
a make based on rev. 1.26, and it worked fine.  Since I'm not particularly
inclined to figure out what's going on with this, it's probably prudent
just to back it out for now.

Found by:	jkh
Suggested by:	jhay
2001-03-15 10:22:50 +00:00
Will Andrews
fff8dac495 Fix make(1) bug: nested comments may be placed in .if, .else .if, and
.endif statements but can't be placed in .elif.  Basically, the problem
was that ParseSkipLine() didn't handle comments the same way that
ParseReadLine() did, and thus you had errors with comments that are on a
conditional line (i.e. "^.") rather than a non-conditional line.

MFC candidate for 4.3-STABLE and 3.5-STABLE.

PR:			25627
Bug found by:		jhs
Fix submitted by:	Seth Kingsley <sethk@osd.bsdi.com>  (thanks!!)
2001-03-15 02:51:11 +00:00
Thomas Moestl
a333d4f752 Fix two bugs in null suffix handling. Both occured only after the suffix
list was cleared.
Rules with null suffixes would not be rebuilt when the suffixes were
added again.
Adding null suffix rules would fail when a rule for the same source was
declared before the suffix list was cleared.

PR:		23328, 24102
Reviewed by:	will
Approved by:	rwatson
2001-03-08 00:55:08 +00:00
Warner Losh
e829cbf262 Include -DDEFSHELL=1 in Makefile.dist so people boostrapping will
have a sane default.

Also add $FreeBSD$ while I'm here.

Pointed out by: bde
2001-03-01 06:26:32 +00:00
Warner Losh
20b367cea1 MAXPATHLEN includes the trailing NUL.
Correct array sizes to reflect this.
Correct NUL termination after strncpy.

# Didn't to strncpy -> strlcpy change.
2001-03-01 06:03:17 +00:00
Kris Kennaway
0937df81ca Introduce support for using OpenSSL ASM optimizations. This is done
through the use of a new build directive, MACHINE_CPU, which contains a
list of the CPU generations/features for which optimizations are desired.
This feature will be extended to cover the ports tree in the future.

Currently OpenSSL provides optimizations for i386, i586 and i686-class
CPUs. Currently it has not been tested on an i386 or i486.

Teach make(1) to provide sensible defaults for MACHINE_CPU if it is not
defined (namely, the lowest common denominator CPU we support for each
architecture).  Currently this is i386 for the i386 architecture and ev4
for the alpha.  sys.mk also sets the variable as a last resort for
consistency with MACHINE_ARCH and bootstrapping from very old versions of
make.

Benchmarks show a significant speed increase even in the i386 case, with
additional improvements for i586 and i686 systems.  For maximum performance
define MACHINE_CPU=i686 i586 i386 in /etc/make.conf.

Based on a patch submitted by:  Mike Silbersack <silby@silby.com>
Reviewed by:    current
2001-02-19 03:59:05 +00:00
Jeroen Ruigrok van der Werven
d7d97eb0aa Preceed/preceeding are not english words. Use precede and preceding. 2001-02-18 10:43:53 +00:00
David Malone
d3d8587299 Uname is in section 3 of the manual pages.
PR:		25008
Submitted by:	fullermd@over-yonder.net
2001-02-11 21:19:31 +00:00
Will Andrews
2de6a43d0a Fix nasty bug where make(1) assumed that you could read the directory it
was in.  This shall be MFC'd in about three days (probably not a good idea
to MFC the stylistic changes though - see below).

PR:		19978
Submitted by:	Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
Patch by:	roam (slightly modified by me to use NULL not NIL)
2001-02-10 07:12:18 +00:00
Ruslan Ermilov
d0353b836e mdoc(7) police: split punctuation characters + misc fixes. 2001-02-01 16:38:02 +00:00
Will Andrews
e3cb529472 Fix style(9) bug; use ISDOT[DOT,]() macro available in util.c by moving
it to make.h so both dir.c and util.c can use it, although bde didn't
particularly like this part of the idea, IMO it's cleaner than it was.

Submitted by:	bde
2001-01-21 08:24:41 +00:00
Ruslan Ermilov
1bfea903ed Prepare for mdoc(7)NG. 2001-01-16 09:39:23 +00:00
Will Andrews
111632fd99 Fix for the case where the first two entries returned by readdir() are
actually NOT '.' and '..'.  Apparently this isn't the case when accessing
a directory via XFS over NFS on SGI systems.  Since I don't have access to
an environment like that, this will sit out in -current for at least six
weeks.  However, the patch proposed by the submitter seems acceptable, so
I've decided to commit it to the tree, in the hope that it will solve some
problems without bringing up others.

PR:		23300
Submitted by:	Jim Pirzyk <Jim.Pirzyk@disney.com>
2000-12-26 07:36:07 +00:00
Ruslan Ermilov
9b88faecd3 Prepare for mdoc(7)NG. 2000-12-19 16:00:12 +00:00