Commit Graph

116 Commits

Author SHA1 Message Date
christos abefed98a7 Add typedefs for DuplicateProc and FreeProc from Max Okumoto. 2005-08-09 21:36:42 +00:00
christos 81b135acdf From Max Okumoto:
- Remove casts to NULL.
- Remove space between cast and object.
2005-08-08 16:42:54 +00:00
christos 6240774069 More KNF cleanups from Max Okumoto 2005-08-05 00:53:18 +00:00
christos 62a6753895 from Max Okumoto: debug should be int, not boolean. 2005-08-03 20:55:01 +00:00
christos 3692d77541 Whitespace KNF cleanup from Max Okumoto 2005-07-25 22:55:58 +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
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
lukem 0f422228f9 appease gcc -Wuninitialized 2005-06-03 16:15:46 +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 63fca13660 PR/29203, PR/29204: Max Okumoto: KNF changes to make [no functional changes] 2005-02-16 15:11:52 +00:00
wiz 13d5df6555 Sync usage with man page; from Kouichirou Hiratsuka in PR 26223. 2004-07-13 11:59:12 +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
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 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
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
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
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
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
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
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
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
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
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
sjg 3716ad7f49 Allow .SHELL: to control the shell used by compat mode too.
Add a shell spec for ksh - a nice portable posix shell.
Document .SHELL:
2003-08-01 00:39:52 +00:00
christos 6a7d20bb25 Pass WARNS=3 2003-07-14 18:19:11 +00:00
jmmv afa06162bc Remove extra space in usage message. 2003-05-10 19:21:40 +00:00
thorpej c5007c219b Add a -X option, which prevents make(1) from putting variables
set on the command line into the environment individually.  This
can be useful on systems which have a tight limit on the size
of the argument space.
2003-03-14 05:19:43 +00:00
sjg cc9d340ac8 Add -B to MAKEFLAGS so that it propagates to sub-makes.
This allows one to use -j1 -B at some point in a tree to
overcome a -jN (which is the main reason one would use -B).
2003-02-26 08:59:12 +00:00
wiz 86ebbc3a0e Remove !__STDC__ stuff, de-__P(), ANSIfy, and de-register. 2002-06-15 18:24:55 +00:00
bjh21 b846107274 Rather than hardcoding "/bin/sh", use _PATH_BSHELL. To allow bootstrapping,
provide a default for this in pathnames.h, and only include <paths.h> ifndef
MAKE_BOOTSTRAP.
2002-04-27 15:14:30 +00:00
pk 0debc78bef JobExec(): don't use Punt() in the child; it can't possibly DTRT, and will also
mess up the parents variables.

Instead, use execError() for all error paths in the child code.
2002-03-14 16:08:37 +00:00
reinoud a233fbd53e Fix major bug in make(1) ... due to shadowing of the dotLast path used for
the .DOTLAST primitive by a boolean variable with the same name, this whole
mechanism was broken ... it doesn't save much stat calls but it was wrong.

Thanks to Jason Thorpe for the other shadow-variable fixing patches he
made.
2002-01-27 01:50:54 +00:00
tv 87ab66e132 Allow MAKE_MACHINE to be unset if MAKE_BOOTSTRAP. 2001-12-11 20:50:58 +00:00
thorpej 9f434e6392 Clean up some MAKE_BOOTSTRAP issues wrt. MACHINE/MACHINE_ARCH. 2001-11-30 01:29:47 +00:00
tv e4b456f8b8 Redo the hashtable for "." if .OBJDIR changes. 2001-11-12 21:58:17 +00:00
tv f3c05f752e Add new make variable .ALLTARGETS, which lists all targets in the Makefile.
(Makes it possible to search the target list for particular things and
apply attributes to all the relevant targets.)
2001-11-12 01:33:48 +00:00
tv e8c8d143cc Back out my rev. 1.75 on recommendation of christos.
Instead of skipping the PWD check entirely, add a skip of the PWD override
if MAKEOBJDIR is set and contains a variable transform ($).  This has
similar problems to what happens if MAKEOBJDIRPREFIX is set.
2001-11-11 21:40:05 +00:00
tv 1c31149727 Apparently something was missed in the Main_SetObjdir commit. Fix a TRUE
value that should start out FALSE.
2001-11-02 15:37:41 +00:00
tv 17159cd70f Strike getenv("PWD") entirely, based on prior discussion with sjg. This
breaks too many situations, including MAKEOBJDIR with a :C,foo,bar,
transform in many cases.  It's ambiguous and unreliable, as the comment
above that code always indicated.  In order to have reliable objdirs, they
need to work the same way Every Time.

(Note that taking this out is not a performance hit; we were already doing
the getcwd() call first.  So the getenv("PWD") didn't increase performance.)
2001-11-02 03:52:21 +00:00
tv 053d51348d Overhaul the initialization and handling of .OBJDIR:
* Replace chdir_verify_path() with Main_SetObjdir(), which can be called
  externally, and can take a "const char *".  (There's a lot of non-const
  "char *" passing around in var.c of what should be const strings....)

* Rewrite the initial "find my .OBJDIR" code to make use of the new
  function.  This still functions as it had in the past, but the comment
  above this block was changed to reflect reality:  if MAKEOBJDIRPREFIX
  or MAKEOBJDIR are set in the environment, then *only that value* is
  tried; make does not fall back to obj.MACHINE, obj, and /usr/obj/`pwd`
  as it would without these env vars set.

* Add a new special target, .OBJDIR:, which when parsed will cause make to
  change to a new object directory and reset .OBJDIR, and PWD in the
  environment.  This will allow some makefiles (mainly, src/tools)
  to override the default objdir semantics in order to add custom logic.
2001-10-31 03:59:42 +00:00
tv 41783071da Allow "-m" to be used in a .MAKEFLAGS: special target and get it to work.
(This splits out the "default system include paths" into its own Lst
variable, and uses it only if sysIncPath is empty.  This allows sysIncPath
to be filled in by the Makefile itself.)
2001-10-31 01:15:57 +00:00
wiz 456dff6cb8 Spell 'occurred' with two 'r's. 2001-09-16 16:34:23 +00:00
sjg e28cc22621 Add 4th arg (flags) to Var_Set so that VarLoopExpand can tell it not
to export interator variables when using context VAR_CMD.

Reviewed: christos
2001-06-12 23:36:17 +00:00
sjg fc0df160d8 Simplify the exporting of VAR_CMD's via MAKEFLAGS.
We now just list the names of such variables in .MAKEOVERRIDES.
When we come to export MAKEFLAGS we quote the value of each exported variable
using :Q, using: ${.MAKEOVERRIDES:O:u:@v@$v=${$v:Q}@}
The :O:u suppresses duplicate names.
Also modifed Parse_DoVar to re-export MAKEFLAGS whenever .MAKEOVERRIDES
is assigned to so .MAKEOVERRIDES+= PATH will export PATH=${PATH:Q}
to the environment, while .MAKEOVERRIDES= will disable export of VAR_CMD's.
2001-06-10 02:31:00 +00:00
sjg d7c22ce2d7 Do a better job of duplicate suppression in .MAKEOVERRIDES.
From Var_Set: We actually want the equivalent of
.MAKEOVERRIDES:= ${.MAKEOVERRIDES:Nname=*} name='val'
clearing the previous value for name is important, since
doing simple duplicate suppression does not handle:
$ make FOO=goo
which then runs a sub-make with FOO=boo
the commands from that sub-make should see just FOO=boo.
2001-06-09 05:57:31 +00:00
sjg 44372a7be4 Modify handling of command line variable assignments and their exporting
via MAKEFLAGS.  Instead of appending them directly to .MAKEFLAGS, put
them in .MAKEOVERRIDES (and ensure they are quoted).  This is now done
in Var_Set when it exports VAR_CMD's.
Use ExportMAKEFLAGS() to export MAKEFLAGS, using the combined content
of .MAKEFLAGS and .MAKEOVERRIDES (with duplicate supression).
If .MAKEFLAGS is assigned to in a Makefile, ExportMAKEFLAGS is called again.
This allows a line like:
.MAKEOVERRIDES=
to effectively stop the exporting of the command line vars in MAKEFLAGS.
2001-06-09 05:22:47 +00:00
sjg 9cfd89292b A number of semi-related changes.
1. make -dx turns on DEBUG_SHELL which causes sh -x to be used where
   possible.
2. PrintOnError() is now called when make is stopping due to an error.
   This routine reports the curdir and the value of any variables listed
   in MAKE_PRINT_VAR_ON_ERROR.
3. Variables set via command line, are propagated to child-makes via
   MAKEFLAGS.  This behaviour appears to be necessary for POSIX (according
   to the GNU folk anyway).
4. Do not reset MAKEFILE when reading ".depend" as this rather eliminates the
   usefulness of ${MAKEFILE}.
5. Added ${.newline} as a simple means of being able to include \n in the
   result of a :@ loop expansion.
6. Set ${MAKE_VERSION} if defined.  Need to come up with a useful value.

Reviewed: christos
2001-06-01 20:33:37 +00:00