Commit Graph

631 Commits

Author SHA1 Message Date
christos 3d520edd5e PR/29985: Roland Illig: make(1) interprets backslash wrongly in for
loop expansions, when the expanded variable ends in backslash and
the backslash is the last character on the line. While this fix is
ugly (detect the condition and append a space), it is the least
intrusive for now.
2005-07-01 16:45:38 +00:00
christos b775b6932a Don't apply .DEFAULT commands to special targets (.BEGIN, .END, .INTERRUPT). 2005-06-29 19:59:42 +00:00
wiz 3051d76108 Consistency. Use Pp instead of br. 2005-06-27 09:51:09 +00:00
lukem 2bf924f405 Restore the rework from rev 1.115 and expand the description of .OBJDIR
to document the behaviour that is currently in use (the "./obj" and
"/usr/obj/`pwd`" behaviour).
Hopefully the existing .OBJDIR behaviour is clearer now.
2005-06-27 00:17:08 +00:00
wiz 47fb7786c1 Since the obj dir handling changes in the code have been
reverted, revert them in the man page too (i.e., revert v1.115).
2005-06-26 10:14:43 +00:00
lukem 50e70cd0ee revert previous for now 2005-06-24 04:33:25 +00:00
lukem 62955ed1ec Revert rev 1.110 and restore the previous "automagic objdir" support;
at least until we clean up the objdir semantics in <bsd.obj.mk> for
NetBSD builds.
2005-06-24 02:53:27 +00:00
lukem a6a204d392 Deprecate support for automagically setting the .OBJDIR to
./obj.${MACHINE}
	./obj
	/usr/obj/${PWD}

The rules for the default .OBJDIR setting are now simplified to
(and documented as) trying the chdir to the following
(if the appropriate variable is defined):
	${MAKEOBJDIRPREFIX}${.CURDIR}
	${MAKEOBJDIR}
	${.CURDIR}

.OBJDIR can be overridden in the makefile.
<bsd.obj.mk> uses this to provide the "culled" .OBJDIR semantics
for NetBSD's /usr/src builds.

MAKEOBJDIRPREFIX & MAKEOBJDIR still can only be provided
in the environment or on make(1)'s command line.

Per discussion on tech-toolchain.
This should reduce a lot of lossage people have experienced over
the years with various .OBJDIR setups.
2005-06-23 02:31:31 +00:00
wiz 19a870f516 Fix an article, and drop trailing whitespace. 2005-06-19 17:26:07 +00:00
rpaulo 9e77e5175e Change "non-escaped" to "unescaped".
Reviewed by hubertf.
2005-06-18 14:34:55 +00:00
rpaulo a0c960912d Add a new test case to reflect the problem found on PR toolchain/30536.
Reviewed by sjg and hubertf.
2005-06-18 14:33:15 +00:00
rpaulo f0f2f92389 PR standards/17732: make doesn't honour escaped comment lines. Now with
a real fix.
Ok'ed by sjg and hubertf.
2005-06-18 14:32:04 +00:00
wiz 7fba66045a Bump date for -jn, and add some formatting. 2005-06-17 19:30:49 +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
rpaulo a94394c1d9 Back it out while I'm working on a real fix without introducing new bugs. 2005-06-16 14:54:10 +00:00
rpaulo 9eb6f66b9a We now support comments until the end of a non-escaped line.
Ok'ed by hubertf.
2005-06-15 22:39:27 +00:00
rpaulo d0727c5f5b Add a unit-test for comments.
Addition to PR bin/17732.
Approved by sjg and christos.
2005-06-15 22:32:22 +00:00
rpaulo 72c3c708ca PR bin/17732: Allow make to understand escaped comments.
Approved by sjg, christos and hubertf.
2005-06-15 22:26:54 +00:00
lukem 0f422228f9 appease gcc -Wuninitialized 2005-06-03 16:15:46 +00:00
lukem 366252f608 * Improve error handling with unrecognized chars after :t.
* Explicitly goto default_case for unknown chars encountered after
  various : modifiers, rather than multiple FALLTHRUs.
* Appease gcc -Wuninitialized for sv_name and v_ctxt.

Discussed with sjg.
2005-06-03 07:02:39 +00:00
lukem fb0f76d8e8 cosmetic comment tweak 2005-06-03 05:56:25 +00:00
lukem a3b235bbd2 appease gcc -Wuninitialized 2005-06-02 01:53:01 +00:00
wiz 7aee94451b New sentence, new line; grammar improvements. 2005-06-01 17:33:21 +00:00
sjg 5f60a7de65 Add :Ox for random ordering, based on patch from
Mike M. Volokhov <mishka@apk.od.ua>
2005-06-01 17:17:34 +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 592ba37fd4 Don't accept dependencies for .BEGIN, .END, and .INTERRUPT since they
don't make sense or work anyway.
2005-05-01 01:25:36 +00:00
christos 66b68ce36c PR/9566: Arne H. Juul: Document special targets that do not obey dependencies. 2005-05-01 00:37:10 +00:00
christos 13481917e0 When parsing conditional tokens, make sure that the token is followed by
a non-alpha character, so that .elsefoo is not parsed as .else leading
to confusion later.
2005-03-01 04:34:55 +00:00
sjg 34180b9ccc In the case of :? modifier, variable can be an expression - say so. 2005-02-23 17:22:29 +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
christos f3ff62b84d Add comments in the pmake style, and factor out a local variable.
No functional change.
2004-12-29 01:55:25 +00:00
christos 8415275dbd Dir_MTime did not search for a file using the correct parh; i.e. it was
ignoring suffix-specific path search. So if a node was marked .MADE,
then suffix rules would not be applied to it, and we would look for
the file only in the default path, not the suffix-specific path.

XXX: Now that we looked for the suffix, we can save it in the GNode,
but we don't do this yet.
2004-12-29 00:43:02 +00:00
dsl 108eb2ab42 Add (unsigned char) cast to ctype functions 2004-10-30 20:39:35 +00:00
yamt fb79fa6390 define __GNUC_PREREQ__ if it isn't available on host. 2004-07-15 09:01:29 +00:00
wiz 13d5df6555 Sync usage with man page; from Kouichirou Hiratsuka in PR 26223. 2004-07-13 11:59:12 +00:00
wiz d2c6d0c9f5 Sort options in synopsis. 2004-07-13 11:58:55 +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
jmc f648d12d47 Add missing NetBSD ID tags 2004-06-30 03:26:26 +00:00
uwe 06c338a198 Fit ASCII output onto an 80-column terminal. From FreeBSD. 2004-06-27 19:12:33 +00:00
uwe 150ca6a7f2 Fix a few typos. From FreeBSD. 2004-06-27 19:04:54 +00:00
wiz faa47b7058 Add comma in enumerations; fix a sentence; plural needs no apostrophe. 2004-05-07 08:23:31 +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
ross dcdf1bd27a Instead of including from the wrong directory and then fixing it (-I)
in the Makefile, how about just doing the right include?
2004-05-06 23:15:46 +00:00
ross fcce1f91eb Recognize -- (dash dash) and apply the usual interpretation.
Notes:

* The immediately previous version of make errored out on --,
which is what needs fixing.

* Historic bsd make silently ate -- and continued to process
options, so this is a behavior change from that, too, but presumably
there is more to gain in fixing it than in being bug-compatible.
2004-04-22 21:19:02 +00:00
sjg 3c6b696332 Allow "string" and "${varspec}" on lhs of conditionals.
This makes it possible to use expressions like
${("${LIST:Msomething"}):?present:absent}
it also makes treatment of lhs and rhs more consistent, and
makes CondToken easier to read.

Update unit-test/cond1 to test new features.
2004-04-13 16:06:23 +00:00
sjg df910819de Revised patch for catching extraneous .else's
We actually need to tack condTop and skipIfLevel.
Bump MAXIF while here.
Enhance the unit-test for conditionals to exercise more code.

PR: 24420
2004-04-08 07:24:26 +00:00
sjg ab4f0bc644 Back out previous patch for now.
Breaks bsd.obj.mk
2004-04-08 01:35:33 +00:00
sjg 8bef426d13 Add check for extraneous .else's - based on patch from Arne H. Juul
in PR/24420.
Add a unit-test for conditionals.
Also in the unit-test makefile strip any .CURDIR in output.

PR: 24420
2004-04-08 00:59:01 +00:00
enami 84b05f6e6e Validate existence of arguemnt. PR#24933. 2004-03-27 00:17:08 +00:00
fair 11b2aeb6e2 Fix comment per PR 24437; make(1) tries "makefile" first, and then
"Makefile", not the other way around as previously documented.
2004-03-24 00:59:40 +00:00
enami 222e389ef2 Print useful line number on error while executing .for directive. 2004-03-06 03:57:07 +00:00
sjg a3cc11808b Fix :M so that modifiers in nested variables don't terminate parsing
early.  Add a unit-test to verify it works and keeps working.
Re-jig the unit-tests so that all are sub makefiles.
2004-02-20 09:03:26 +00:00
sjg 79e5bb77fc Use ${.MAKE:S,^./,${.CURDIR}/,} so that when someone does
./make test
it works.  Note use .CURDIR rather than .OBJDIR since the later
_may_ not always be correct (eg. symlink in .CURDIR for make).
2004-02-15 19:05:45 +00:00
wiz e3fc4b66c3 Spell the plural of suffix "suffixes", not "suffices".
Inspired by PR 24400 by Todd Vierling.
2004-02-13 17:56:17 +00:00
wiz 56bb942672 Bump date; uppercase POSIX. 2004-02-05 23:51:46 +00:00
ross 3856fab870 Briefly document the posix command line order and add that this
is (unfortunately) not enforced.
2004-02-05 23:40:52 +00:00
ross 380bdcb7fb Parse args with open code to eliminate use of getopt(3).
No functional change under NetBSD.

Restarting a getopt(3) loop is an extension to the posix getopt(3)
behavior and is not portable.

Fixes tools build (tools/groff) under Cygwin.
2004-02-05 23:31:34 +00:00
wiz c732f0a853 Use more mdoc macros; new sentence, new line; bump date for previous. 2004-02-04 00:37:45 +00:00
chuck 51659857a7 add parent directory search for make as discussed on tech-toolchain.
- new dir.c function: Dir_FindHereOrAbove:
      Search for a path in the current directory and then all the directories
      above it in turn until the path is found or we reach the root ("/").
 - add hooks to use it in main.c for -m and syspath (compiled in
      _PATH_DEFSYSPATH and $MAKESYSPATH).
 - updated man page
2004-02-03 19:25:29 +00:00
lukem f83f942f81 Document more SPECIAL SOURCES (aka ATTRIBUTES).
Improve description of variable modifiers.
In the variable list, be more specific referring to "environment variables"
rather than just relying upon the formatting difference between .Ev and .Va.
2004-01-27 01:38:01 +00:00
dsl c3032ca9a0 Restore correct name string when VarGetPattern() returns.
Stops error from free() evaluating ${x::=y} when x is undefined.
(Erm why is free() allowed to write to fd 2?)
2004-01-24 19:58:54 +00:00
sjg 4d32648363 ternary is .PHONY 2004-01-19 00:32:26 +00:00
dsl 4169574d6f Reindent search loop in SuffFindCmds using 'continue' and 'break' instead
of netsted ifs.  No logic change.
2004-01-11 17:24:25 +00:00
dsl 742a98df46 Change DEBUG(DIR) traces to indent subsequent filenames instead of
generating very long lines (basically changes "..." into " ...\n   ").
2004-01-11 12:22:40 +00:00
sjg 71746b839b Add unit test for ternary modifier 2004-01-09 00:56:44 +00:00
sjg 1752434408 Fix :?: modifier so that it works again. 2004-01-08 23:55:05 +00:00
sjg 345311007d Handle more complex conditional expressions.
CondCvtArg now returns NULL if it consumed all input, or a pointer
to any left overs.
2004-01-06 01:18:52 +00:00
jmmv b635f565e7 Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
2004-01-05 23:23:32 +00:00
wiz 8114895bf3 Bump date for previous; use macros for marking up
the dollar sign.
2003-12-26 23:22:31 +00:00
jmc 31e37b335f Note that variable expansion can occur within SYSV style = substitions. 2003-12-26 23:18:18 +00:00
jmc 3eb499682d Support variable expansions inside of SYSV style = substitutions. Better matches
expectations (and some cases of historical behavior I've found). Also fixes
PR#3865
2003-12-26 23:13:32 +00:00
jmc c7c6bf2bbd Don't assume startc is always {, set delim to endc when separating the args to
the ? test.
2003-12-26 08:03:06 +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
jmc be1cdb8652 When looking for a makefile and curdir != objdir (i.e. working inside of an
objdir) try opening the file from curdir and if that fails try from objdir.
This way .depend files get picked up via their full path names rather than
just .depend so vars like PARSEDIR, PARSEFILE are then set correctly. This
fixes PR#13289 reporting incorrect pathnames for .depends with errors in
them
2003-12-18 22:36:18 +00:00
wiz 15dcc3baa6 Drop trailing spaces. 2003-12-07 20:48:25 +00:00
dsl 2bd419cb33 Add back 'on error' that got deleted by mistake. 2003-12-07 20:46:44 +00:00
dsl 7da2fe51b3 Add a -Dg3 which outputs the 'input graph' only on error exit.
Lets you see the wood for the trees...
2003-12-07 20:30:28 +00:00
dsl eceb7dddfb Don't create targets if dependant files marked .OPTIONAL are missing. 2003-11-14 22:32:44 +00:00
lukem a2f8083d5d Add some subsections in the VARIABLE ASSIGNMENTS section.
In the "modifier description" list, show each modifier with the leading `:'.
Rationale: it's hard to search for modifiers without it, and we already do
the same thing in the -options and .makecommands lists.  I now find it much
easier to find the description for a modifier in the man page.
2003-11-07 01:01:46 +00:00
lukem 171d653219 Overhaul how `build.sh tools' are used:
*	Rename "config.h" to "nbtool_config.h" and
	HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
	This makes in more obvious in the source when we're using
	tools/compat/config.h versus "standard autoconf" config.h

    *	Consistently move the inclusion of nbtool_config.h to before
    	<sys/cdefs.h> so that the former can provide __RCSID() (et al),
    	and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
	#if HAVE_NBTOOL_CONFIG_H
	#include "nbtool_config.h"
	#endif
to the top of the source files (for the general case).
2003-10-27 00:12:41 +00:00
jmc 89996408fa Fixes from PR#23210 to eliminate use of asprintf which makes cross building
on non-NetBSD hosts work again
2003-10-23 15:58:29 +00:00
jdolecek e9a93e256b properly dottify .\" comments; this fixes output of [range] paragraph 2003-10-09 16:56:06 +00:00
sjg d388dcd1a3 Implement :[] modifier to allow picking a range of words out of a variable.
Also :tW and a W flag to :C and :S to allow treating value as a single word.
Add unit tests for the above, and fix some corner cases.
Based on patches supplied by Alan Barrett <apb@cequrux.com>
2003-09-27 21:29:37 +00:00
jmmv 6c008dec3b Add the 'e' debug flag (i.e., '-d e'): when enabled, show the "target
failed" and "command failed" messages added recently.  These introduce
too much noise when debugging some kind of problems, specially in pkgsrc.
2003-09-10 18:04:22 +00:00
jmmv 328ce86893 Document the '-d f' flag. 2003-09-10 08:44:31 +00:00
lukem f741d2d094 when displaying the 'Failed command:', collapse runs of whitespace in the
command to a single space.   suggested by David Laight in private mail.
2003-09-09 16:16:02 +00:00
drochner 1a9a16338e Remove some code which makes file lookup rely on the fact that
the first two directory entries are "." and "..".
This behaviour is not required by applicable standards, and
actually not provided by "coda".
Now we get the "." and ".." into the per-directiry hash tables,
but this should not hurt.
2003-09-09 14:44:35 +00:00
lukem 16cddad1c8 don't free cmdStart too early, as cmd points somewhere in there and we
may want cmd for error messages.
should fix [bin/22705] from itojun@
2003-09-08 23:54:54 +00:00
sjg 435f6fef84 Make empty() consider an undefined variable as empty,
rather than throw a syntax error.
2003-09-06 06:52:08 +00:00
wiz 91f2a1b827 Whitespace nits. 2003-09-05 06:55:46 +00:00
sjg 9ab525fdf0 Allow -V '${FOO}' to print the expanded version of FOO.
A side effect of adding and removing a -E option for the above is that
the cases in MainParseArgs are now ordered correctly?
2003-09-05 06:52:11 +00:00
lukem 5bb8036aeb Also display failed target. Given
printf "all:\n\ttrue\n\t@false\n" | make -f -
the error output now looks like:
	*** Failed target:  all
	*** Failed command: false
	*** Error code 1
instead of just
	*** Error code 1

XXX: add this support for  make -j  builds.
2003-09-02 23:40:11 +00:00
lukem ea878e8983 display the command that failed.
this is useful if the command-line had been suppressed.
2003-09-02 12:17:40 +00:00
sjg a41eaef46a Hook make unit-tests into regress 2003-08-08 06:42:38 +00:00