Commit Graph

55 Commits

Author SHA1 Message Date
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
dsl eceb7dddfb Don't create targets if dependant files marked .OPTIONAL are missing. 2003-11-14 22:32:44 +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
wiz 86ebbc3a0e Remove !__STDC__ stuff, de-__P(), ANSIfy, and de-register. 2002-06-15 18:24:55 +00:00
pk 53dab8cf3b Darn.. remove test code from previous commit. 2002-03-21 11:42:21 +00:00
pk 971b06b979 When looking at predecessor/successor dependencies, we need to consult a
cohort's centurion as well.
2002-03-21 11:34:17 +00:00
pk e9b668c861 Xref: parse.c, rev 1.46; make.c, rev 1.23
In these revisions `::' dependency handling was simplified by not linking
the cohort nodes into the dependency graph. This broke dependency checking
on all but the first instance of a `::' target since all of the cohort nodes
now just form a collection of disconnected dependency graphs.

Fix this by keeping a back-reference in each cohort to its leader (the
first instance of a :: node with the same name) and a count of the number
of cohorts that need to be made before dependent nodes are scheduled.

Classically, we'd need six centurions for cohort, but in this case one
suffices...
2002-03-20 18:10:30 +00:00
pk 605f6cf148 MakeAddAllSrc(): check for empty .ALLSRC variable before using its value. 2002-03-12 23:52:35 +00:00
pk 24ed3538ca Propagate a .JOIN node's .ALLSRC contents to the parent's .ALLSRC. 2002-03-08 23:22:38 +00:00
pk 3efeed43b5 Make{_}HandleUse(): update comments and layout, re-arrange to avoid some
code duplication.
2002-02-18 12:13:59 +00:00
pk 13a2e60c3c The use of OP_MARK in the MakeHandleUse() list callback function prevents
the removal of .USE nodes from a node's children list in case a given .USE
nodes appears multiple times on that list, preventing the target from ever
making it on the `to be made' queue.

Since the suffix rule processing code deals itself with removing the
transformation nodes from the parents to which it applies them, arrange
for doing the same for .USE nodes in MakeHandleUse() instead of in
Make_HandleUse(), and still use the OP_MARK stuff to avoid duplication
of commands.

Also, since Make_HandleUse() is not a list callback function and its
return value is no longer used, make its return type void.
2002-02-18 00:33:40 +00:00
pk d5e7cd89bf When making a node which is the source of both a .MADE target and a
normal target (the latter dependency being the reason why it's made),
the .MADE parent should not be put on the `toBeMade' list again (in
Make_Update()) since it was already put on it in Make_ExpandUse().
Doing so would cause the rules for the .MADE target to be executed
(at least) twice, and also mess up the unmade children count of _its_
parent, resulting in spurious graph cylce detection.

To achieve this, make sure the unmade children count of the .MADE target
is set to zero before enqueueing it on the `toBeMade' list in
Make_ExpandUse(). Then, in Make_Update(), check if the parent has the
.MADE attribute before diddling with the queue.

For the same reason the status of a node must not be set to UPTODATE
unconditionally in compat mode, since that will prevent the node from
being built even if it is the source of a normal target. Instead,
check both its state and the type of the parent to decide whether to
continue on behalf of the current parent.
2002-02-07 16:48:22 +00:00
pk 58e7f3798e Don't bother to apply suffix rules to find sources for a target marked
as .MADE.
2002-02-03 19:58:15 +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
christos 147dd16dac add .USEBEFORE Attribute 2001-07-03 18:08:50 +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
wiz 40ac848024 Fix various misspellings of compatible/compatibility. 2001-06-11 01:50:48 +00:00
sjg cefcce2537 Test for non-existant LIB was incorrect (using cmtime cf. mtime). 2001-03-05 16:20:33 +00:00
christos a5854c63b6 .PHONY gnode's don't get a PREFIX, so don't try to set the parent's prefixes
on a parallel make.
2001-01-15 22:17:09 +00:00
sommerfeld 3274266e5f Delete forceSerial; just use compatMake for that.
Add -N flag to *really* not execute any commands (useful when using
the -d flags to debug usr/src/Makefile)
Document -N
Update documentation of -n to mention that it still executes commands
for targets marked .MAKE so that the -N/-n distinction is clear.
2001-01-01 15:47:37 +00:00
sommerfeld dd9c50102d Fix token accounting for .BEGIN/.END jobs 2000-12-30 15:58:34 +00:00
sommerfeld a804073cac Add a token-passing scheme to allow a recursive make to successfully
use -j; all make's in a recursive build cooperate to limit the total
number of jobs, using a token-passing scheme.

The current token passing algorithm is similar to the one implemented
by gmake; there is a single pipe which is inherited through the entire
process hierarchy; tokens are obtained by reading a byte from the
"read end" of the pipe, and are returned by writing them to the "write
end".  This exact algorithm is likely to change in the future.

Implementation details:
 - Use the new trace facility to allow measurement of the
effectiveness of different token-passing schemes
 - Get a token in MakeStartJobs(), return it in Make_Update()
 - Eliminate Job_Full() and the jobFull global since they are
redundant with token system.
 - Add an "internal" -J option (to pass the token pipe fd's down to
submakes) and a -T option for tracing.
 - Change how compatMake is forced so that -j means something when
inherited by submakes.
 - When waiting for a token, poll the token-passing pipe as well as
the output pipes of existing jobs.
2000-12-30 02:05:20 +00:00
mycroft 796fb2ec8c Readd optimization last night. Problems earlier were partially due to the
arguments names on one function being swapped (by a previous author).

Do not do any duplicate suppression when a source list is created.  Instead:
* OP_MADE protects against trying to make the source multiple times.
* A new OP_MARK flag is introduced to suppress duplicates while expanding
  the .ALLSRC variable and .USE targets.
This turns the O(n^2) insertion into O(n) in most cases.

This is tested with a `make build' and some special test cases.
2000-06-11 07:39:52 +00:00
mycroft 83660a50d9 Back out last night's optimization for now. 2000-06-10 22:28:33 +00:00
mycroft 04af209e45 Don't use OP_MARK when attaching suffix transformations. 2000-06-10 22:24:21 +00:00
mycroft edfd0106e2 Introduce an OP_MARK bit, and use it to suppress duplicates during .ALLSRC
and .USE expansion.  Also, remove some more Lst_Member() checks that are now
redundant.
2000-06-10 21:44:08 +00:00
sjg 90c80377e5 Fixed the oodate test to include the check of gn->cmtime == 0 without
breaking the original intent.

PR: 9503
2000-02-29 22:00:02 +00:00
sjg 14fcc9e86c Non-existent libs are always out of date.
This was not handled correctly on ELF where libs do not have T.O.C.

PR: 9393
Reviewed by: christos
2000-02-15 04:41:45 +00:00
sjg f618973b5f You cannot meaningfully test if a non-existent file has a correct
archive header, so don't try - just believe gn->type & OP_LIB.
2000-01-31 13:21:20 +00:00
mycroft 2500a4b975 Some minor cleanup of :: tests. 1999-09-16 00:54:14 +00:00
mycroft b12871c6cb Rework how :: dependencies are handled.
Build a list of `cohorts' as before, but do *not* link each one into all the
parent nodes; instead, copy the `cohort' lists into the stream of targets to
be built inside Make_ExpandUse().  Also do the attribute propagation as a
separate pass after parsing.
This eliminates several O(n^2) algorithms.
1999-09-15 10:47:37 +00:00
christos 4f3cc30bcc This patch fixes the problem introduced in the previous commit where
parents would be get remade, even if children were not really updated
by the commands executed for them. It also makes all the children have
the real modification time set if possible, so it should fix some other
timing weirdnesses...

- collapse childMade and make fields into flags and convert them to bits
  CHILDMADE and REMAKE
- introduce FORCE flag that gets set in all the parents of a child that
  has no sources and does not exist.
- set oodate if the FORCE flag is set, and not if CHILDMADE
- centralize the RECHECK into Make_Recheck() and use this in make.c and compat.c
- use Make_TimeStamp for all child -> parent timestamp propagations
1998-11-11 19:37:06 +00:00
christos 7e91b1976d PR/6426: Jim Bernard: make sometimes does not make directories on top of
a union mount.

	eg.
	src: FORCE

	FORCE is a fake target that does not have sources. When FORCE is
	considered made it gets updated with the current timestamp. If the
	directory happens to have the same timestamp too, then it will not
	be made because it is considered to be up-to-date with respect to
	the child. This can happen because the time resolution is only in
	seconds. It is more likely to happen on a union filesystem where
	the timestamps take longer to update.

	The fix is to consider the parent unmade when children have been
	updated.
1998-11-11 11:25:43 +00:00
christos f46f2d693e PR/5210: Hauke Fath: make core dumps with .SHELL
Unfortunately this revealed a deeper problem with the brk_string code.
To fix it:
	- remove sharing of the buffer between brk_string invocations
	- change the semantics of brk_string so that the argument array
	  starts with 0, and return the buffer where the strings are
	  stored
1998-03-26 19:20:36 +00:00
lukem 2ba9e97765 wrap #include <sys/cdefs.h>, __RCSID(...) stuff in #ifndef MAKE_BOOTSTRAP 1997-09-28 03:30:58 +00:00
christos 254d64f064 Add WARNS=1
RCSID police
1997-07-01 21:17:00 +00:00
christos 702a3f7097 Deal with archive.a(member.o) nodes when expanding .USE dependencies or
adding children to .OODATE.
1997-06-07 16:41:09 +00:00
mycroft 755bc65362 Make sure `-n' is actually disabled for targets with the .MAKE attribute. 1997-05-06 23:51:29 +00:00
christos 193e8d1b7d - Target searching addition:
Make used to only use the search path for nodes that were pure
	sources (not targets of other sources). This has been corrected
	and now gnu-autoconf generated Makefiles work in directories other
	than the source one.

- Suffix transformation rescanning:
	Suffix transformations (.c.o:; cc ...) were only recognized in
	the past when both suffixes were members of the suffix list.
	Thus a sequence like:
		.z.b:
			echo ${.TARGET}
		.SUFFIXES: .z
	would cause .z.b: to be inserted as a regular target (and the main
	target in this case). Other make programs always add rules that
	start with a period in the transformation list and never consider
	them as targets. We cannot do that (consider .depend files) so we
	resort to scanning the list of the current targets every time a
	suffix gets added, and we mutate existing targets that are now
	valid transformation rules into transformation rules. If the
	transformed target was also the main target, we set the main target
	to be the next target in the targets list.
1997-05-02 14:24:27 +00:00
christos bdae19cbd2 Make sure that the children of nodes that are marked .MADE, are marked
UPTODATE and their timestamps are consistent.
1997-03-28 22:31:21 +00:00
christos 69ad8a6988 Locate all the children of a node marked as MADE. 1997-03-23 01:25:28 +00:00
christos dd0a1d0814 Add a .MADE directive to indicated that the children of a target are
up-to-date, even when they are not. This is to simulate our current
make install behavior with proper dependencies.
1997-03-10 21:19:49 +00:00
christos 4417c4f61f Reported by cgd: fix .USE directive problems:
1. ${.*} variables did not get expanded in dependencies.
    2. expanded ${.*} variables in .USE dependencies can cause tree
       restructuring; handle it.
    3. in compat mode, expand .USE before evaluating the list of targets,
       instead of doing .USE expansions on demand, because they can cause
       tree restructuring.
1997-02-20 16:51:47 +00:00
christos aa49881371 - Merge in FreeBSD and Lite2 changes.
- Fix bug where a non-archive target with a .a suffix would always
  be considered to be out of date, since it does not have a TOC.
1996-11-06 17:58:58 +00:00
christos bb97544b1b Fix bug reported by Greg Hudson where leaf (source only) nodes were
referenced only by their basename and not by their full pathname. This
breaks when .PATH or MAKEOBJDIR are used. There might be Makefiles around
that try to work around this bug by prepending ${.CURDIR} to the sources,
and they should be found and fixed. Also a lot of the gunk in suff.c that
was attempting to work around the same problem could be removed.
1996-08-30 23:21:10 +00:00
christos 0acf990595 Add PHONY attribute and target. This is the first step to cleanup the
xinstall and xlint crud.
1996-03-15 21:52:32 +00:00
christos b5f782e810 - $NetBSD$ rcsids
- Fixed so that .[A-Z]* targets that do not match keywords are ignored as
  Posix mandates
- Added .PHONY target keyword
1995-06-14 15:18:37 +00:00
christos 95531c8e1f Fixes from Paul Borman (prb@bsdi.com)
1. Honor environment variable $MACHINE if set over uname.machine
2. archives with :: are always out of date, even when they have no children.
3. VAR= a b c     # comment, gets the trailing blanks trimmed, unless
   escaped by \. I'll have to read the posix manul to make sure that it
   is ok to handle escapes here.
1995-01-06 19:57:27 +00:00