Commit Graph

319 Commits

Author SHA1 Message Date
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
mycroft 83f22c12ea Nuke an `optimization' that made source list creation O(n^2). This may cause
more memory to be used with stupid Makefiles, but it saves a fair amount of
time (~13% just for libc) with sane ones.
2000-06-10 13:48:48 +00:00
sjg 70fc6bfcaf no need for v->name-- on JUNK vars anymore 2000-06-10 05:54:29 +00:00
mycroft b0d51d4783 For VAR_JUNK variables, defer freeing of the name string until the bottom of
Var_Parse(), as it may be used (strdup()ed) by some modifiers.
2000-06-10 04:51:00 +00:00
sjg 5d93c6ecfd Don't free v until after the last use. 2000-06-10 04:17:58 +00:00
mycroft 6bf47769cb Do some evil with VAR_KEEP to make it happier. This seems... wrong. 2000-06-06 09:00:49 +00:00
mycroft 39bf056eb6 Allow further patterns after a :D or :U, as in ODE make. (Copied some code
from VarGetPattern.  It should become more flexible instead.)
2000-06-06 08:44:57 +00:00
mycroft 123757193a Roll back my for-expansion changes. Doing this right is just too hard to be
worth it.
2000-06-06 04:56:52 +00:00
sjg 3d93bb57a6 Check_Cwd_av: Ensure that word after a '(', '{' etc is considered a command,
so that we spot the cd/chdir and don't put one in.
2000-06-06 03:00:11 +00:00
sjg 2293fdd17b Make ::= work again with the VAR_FOR context changes. 2000-06-01 09:39:02 +00:00
mycroft ea218bb6e9 Create a `for' context, and substitute iteration variable from it using the
normal Var_Parse() path.  This allows :R, etc. to work on iteration variables.
2000-06-01 04:16:39 +00:00
sjg cd8908a299 Rats! ${FOO:=bar} is a common usage of the SysV = modifier.
To avoid that, we now do ::[+?!]*= but the SysV = modifier can
conflict with any new modifier.  At there are currently no Makefiles
in our tree that use ${FOO::=bar}
2000-06-01 02:29:21 +00:00
sjg 339f702f71 Implemented a set of assignment modifiers. These solve obscure
problems such as using modifiers on .for loop iterators derived from
local variables (eg .TARGET).
Unless the variable already exists in a global context, these assignments are
local to the current context (this is usually what is wanted).
2000-05-30 02:32:21 +00:00
sjg 489a59f8c6 Expand variables that appear in a [No]Match pattern. Allows
[ x${DONE:M${.TARGET}} != x ] || blah
2000-05-14 15:14:41 +00:00
sjg 214b560694 allow .POSIX to define %POSIX as in FreeBSD 2000-05-11 08:22:40 +00:00
sjg edfc5b4270 Expand variables in variable name passed to Var_Set and Var_Append.
This allows ${FOO}.bar=fubar etc to work.
This does not impact any Makefiles in the current tree but allows
some cool magic (which I need elsewhere).
2000-05-11 07:43:42 +00:00
sjg 0051977fda Pass ctxt along to VarLoopExpand so that local variables such as .TARGET
can be expanded.
2000-05-11 03:32:56 +00:00
sjg 82abb388a6 Revert to the original behaviour wrt sysIncPath, ie if sysIncPath
is an empty list, use DEFSYSPATH.
The current behaviour may have been useful when DEFSYSMK was an
absolute path (hasn't been the case since 1996), but right now
make -m /no/such/dir will fail to find sys.mk and die.
2000-05-10 07:49:35 +00:00
drochner df45d3b6cf support OSF/1 2000-05-04 18:29:53 +00:00
drochner 6d10baf050 conditionalize prototypes for REMOTE support
(seems that REMOTE support is incomplete anyway)
2000-05-04 18:29:12 +00:00
drochner e1710a32d6 make cleaner C for more picky compilers 2000-05-04 18:27:53 +00:00
sjg 5fe132c5cb Added the :U :D :L :P :! and :@ modifiers as used by ODE make.
These allow some very useful magic in the makefiles.
The comment in var.c describing their behaviour is mostly lifted
from ODE make, but the implementation of the modifiers themselves
is quite different (much simpler) due to divergence of our code base.
2000-04-29 12:18:52 +00:00
sjg 6f4163b60c Allow MAKESYSPATH in the environment to override the default syspath. 2000-04-29 12:15:16 +00:00
sjg 0828d668af Changes to make MAKEOBJDIRPREFIX useful.
Firstly, we ignore getenv("PWD") if MAKEOBJDIRPREFIX is set so that we always
get the same value for .CURDIR regardless of how make was invoked.

Second, when executing a command we check if it is ${.MAKE} or ${.MAKE:T}
without a preceeding chdir, if so we insert a chdir(${.CURDIR}) so that
the Makefile will be found by the child make.  Note that this behaviour is
dissabled if MAKEOBJDIRPREFIX is not set or if NOCHECKMAKECHDIR is set.
See the comments in main.c for more detail.

With these two changes, one can successfully build usr/src using MAKEOBJDIRPREFIX
allowing the src to be mounted from a CD-ROM.
2000-04-20 11:23:25 +00:00
simonb ae62335eb5 Buf_GetAll() takes an int *, not a size_t *.
Build failure on alpha reported by Tim Rightnour on current-users.
2000-04-18 03:46:41 +00:00
christos 94c2d86134 Don't type && when you mean || (pointed out by David Holland) 2000-04-17 14:59:02 +00:00
christos 13a6d6acf1 PR/9898: David Holland: small glitch in var substitution for single letter
variables.
2000-04-16 23:35:16 +00:00
christos a4760ab7d0 prefix errors with the program name. 2000-04-16 23:24:23 +00:00
christos c097e3c5c2 Don't core-dump when the current working directory is not readable 2000-04-16 23:24:04 +00:00
christos c407ec1982 PR/9899: David A. Holland: multi-variable .for constructs in make 2000-04-16 22:08:06 +00:00
simonb d88dfea295 Don't declare 'extern opt*' getopt variables. 2000-04-14 06:11:07 +00:00
soren 89c5a767f8 Fix doubled 'the's. 2000-03-13 22:55:05 +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 448f091254 Mention MAKEOBJDIRPREFIX and explain how it or MAKEOBJDIR are used.
Also fixed a typo in the .SUFFIXES bit.
2000-02-08 12:56:28 +00:00
sjg 49984c2f37 Make chdir_verify_path() do variable expansion on path in case
someone wants to do freaky stuff with $MAKEOBJDIR.
Initialize the Var system and set .CURDIR, MACHINE and MACHINE_ARCH
before chdir_verify_path() is called.
2000-02-08 12:43:25 +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 4e558e01fa Don't apply suffix rules for .PHONY targets. (gmake doesn't do this either.) 2000-01-22 19:28:11 +00:00
mycroft f5d7100e26 Nuke `extern int errno;' in code we compile with -Wstrict-prototypes. We get
the correct definition from errno.h.
2000-01-21 17:08:33 +00:00
christos 4cd25afac7 Create temporary files carefully, to avoid security problems. Idea borrowed
from the botched FreeBSD implementation...
2000-01-19 23:39:37 +00:00
wrstuden f21e998aad Add a few little changes needed to get this to compile on IRIX 6.4. 2000-01-06 22:23:20 +00:00
mrg f22d12ed49 back out rev 1.23 (don't stat PHONY targets). it broken the libcrypto
build by causing everything to be remade everytime.  this fixes PR#8419.
1999-11-25 22:34:16 +00:00
kristerw e71aea426d Typos (from OpenBSD) 1999-11-19 22:29:24 +00:00
msaitoh 0fcbe067c6 s/ the the / the / 1999-10-08 20:13:42 +00:00
kim 6c6c0c0d5c Make this compile on Solaris... 1999-09-16 19:57:54 +00:00
mycroft 2500a4b975 Some minor cleanup of :: tests. 1999-09-16 00:54:14 +00:00
mycroft ce14db1fcd Fix a bug in the previous. In the `compat' case, we don't actually use the
list of target nodes returned by Make_ExpandUse().  We have to search the
cohorts explicitly while iterating through the tree.  So, tweak CompatMake()
to do this.
1999-09-16 00:49:48 +00:00
sommerfeld bcb141e5d0 Reuse the Hash_Entry `name' field to store the variable name when we
can (i.e., everything except environment variables, which aren't
stored in hash tables).

While we're here, inline the body of VarDelete into Var_Delete since
it's the only caller and it's just simpler that way when v->name can
share storage with the hash entry and may not need to be freed
separately.

Speeds up the infamous libc build benchhmark maybe 1% on PIII, 4% on
alpha pc164

Suggested by Perry Metzger.
1999-09-15 22:51:05 +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
mycroft c29ad80902 More cleanup code bites it. 1999-09-15 08:48:17 +00:00
mycroft dd291116bc Don't bother iterating through all the data structures to free(3) everything
right before exiting.
(The code is still present, `#ifdef CLEANUP', in case someone needs it...)
1999-09-15 08:43:21 +00:00
mycroft 441a442e46 Fix another case where we stat(2)ed .PHONY targets. 1999-09-15 05:56:33 +00:00
mycroft ff6341a190 Nuke Buf_{G,Ung}etByte{,s}(), since they aren't used, and make BufExpand do
power-of-2 allocation.
1999-09-15 04:16:31 +00:00
mycroft c33b6eca55 Avoid using Lst_Member() in SuffExpandChildren(), by avoiding Lst_ForEach() and
passing in the LstNode of the child being inspected.  Shaves off another few %,
particularly when there are long child lists containing $ expansions (e.g. in
libc).
1999-09-15 03:59:44 +00:00
mycroft d2ec8b0e26 Replace the linear variable list in the GNode with a hash table. Gives a
small (~10% on my machine) speedup building libc.
Changes by: perry (+ bug fix and minor change by me)
Reviewed by: mycroft sommerfeld
1999-09-15 02:56:34 +00:00
christos ab01074993 Add :O var modifier, that sorts the words in a variable. 1999-09-12 00:17:50 +00:00
christos 7057287c54 PR/8259: Chris Demetriou: Fix stack overflow bugs exposed by the glibc-2.1.1
Makefile. Use snprintf everywhere.
1999-09-04 04:21:28 +00:00
simonb dcb4cadef7 Don't need strftime() on Ultrix either. 1999-08-27 00:47:25 +00:00
aidan 58f27ba58c Added .PARSEDIR and .PARSEFILE variables to make(1). 1999-08-09 21:06:28 +00:00
ross 7886a593e3 Back out part of previous, only the parse.c mod was intended. 1999-08-04 16:44:07 +00:00
ross 0728723c31 Trivial speed hack. 1999-08-04 02:54:56 +00:00
hubertf 5674691260 Save the walls, use fly swatters instead of machine guns!
(s/sscanf/strtol/, per Christos)
1999-08-02 17:23:58 +00:00
hubertf a38c426e1c Detect invalid arguments to -j and -L by using sscanf() instead of atoi().
Fixes PR 6743 by Assar Westerlund <assar@sics.se>
1999-08-02 15:23:11 +00:00
hubertf d5df2197fb sprite.h is private to make, so #include it with "sprite.h",
not <sprite.h>.

Problem reported in PR 4381 bye Soren S. Jorvang <soren@t.dk>
1999-07-29 19:45:32 +00:00
christos 10e7b7f04d Fix extreme brokeness with job control that appeared when we set USE_PGRP. 1999-07-16 05:38:20 +00:00
thorpej 70b6975a7e Fix a typo. 1999-07-12 18:22:49 +00:00
thorpej 484fe86089 Correct an inverse initialization of a variable, which caused all .PATHs
to be treated as .DOTLAST.
1999-07-12 17:29:32 +00:00
thorpej 5a0addc0ef Add a mechanism for specifying that ${.CURDIR} will be searched last
in the presence of .PATH directives by specifying:

.PATH: .DOTLAST

This will be used to fixup the build system to work with both crypto-us
and crypto-intl sub-trees.

Make(1) changes by Christos Zoulas, after much badgering by me :-)
1999-07-11 02:06:57 +00:00
christos 80d9d7d175 Regular bourne shells don't have the -q option (from Chuck Cranor) 1999-07-06 14:02:56 +00:00
christos 516292d398 apply solaris fixes 1999-06-29 07:44:21 +00:00
christos eee5bfa70d Revert previous change. I am a bonehead. 1999-06-06 21:16:23 +00:00
christos 9081585e9b remove accidentally left debugging code 1999-06-06 20:41:04 +00:00
christos 4d93254198 Allow junk variable to work in non dynamic contexts. Allows as to say things
like:
    .if defined(COPTS) && !empty(COPTS:M*-g*)
1999-06-06 20:24:02 +00:00
christos f15f83610f Fix awful bug where:
V := $V foo
	V := $V bar

would report that variable V is recursive...
1999-06-02 18:47:11 +00:00
christos 94df9ca047 Define USE_PGRP so that we send signals to our job's process group instead
of only pid.
1999-05-03 12:01:14 +00:00
christos 130a3bae01 killpg(pgrp, sig) == kill(-pgrp, sig) in the sysv case. 1999-05-03 09:49:55 +00:00
gwr 4761a8c13b Uh... should have been ${MACHINE} not hard coded... Duh! 1999-04-03 04:50:16 +00:00
gwr ae400a2e31 Define CC=gcc -O and add -DMACHINE=... 1999-04-03 04:39:10 +00:00
gwr 0a1b2f4b53 Make regex support conditional on NO_REGEX (was MAKE_BOOTSTRAP)
Solaris has a compatible regex, as do many others now...
1999-04-03 04:37:47 +00:00
sommerfe 1be2746ed5 report a sensible error if wait() fails. 1999-03-24 13:19:26 +00:00
christos 8001a619fc use emalloc() instead of malloc() 1999-03-19 16:11:02 +00:00
erh fa45851f9b Add missing .El line. 1999-03-10 05:14:51 +00:00
ross 7f8e818918 Missing .El. 1999-03-09 03:19:28 +00:00
mycroft a1c657fe56 Clean up SYNOPSIS formatting. 1999-03-07 11:29:58 +00:00
cjs d5ce180dc0 When giving the -v option to /bin/sh, also give the new -q option so that
the execution of $ENV isn't printed with every job that's started.
1999-02-04 00:40:55 +00:00
christos 24eea87b54 Allow system path to be overriden in the Makefile 1998-12-19 17:26:12 +00:00
ross 3eb0afd457 Fix a bug that apparently prevented, since day 1, the .-include / .sinclude
feature from ever working. Also, fix the man page that incorrectly described
the syntax of the feature that didn't work.
1998-11-17 23:56:23 +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 889ce7db6e - full prototypes
- more conservative printf
- char -> unsigned char
1998-11-06 23:31:09 +00:00
itohy 6aeb72f23f Reduced memory leaks.
I found some more leaks, but are not in inside of iterations.
1998-11-01 03:07:33 +00:00
itohy 841c52934a If the target name is shorter than the suffix,
the previous garbage bytes may be read.
Example: "make n" --- target = n, suffix = .ln

Changing interface of SuffSuffIsSuffix() is required to fix this bug.
1998-11-01 03:05:03 +00:00
itohy f748b52ef3 Avoid reading outside of allocated memory
on command execution if the output is empty.
1998-11-01 03:01:53 +00:00
christos ff08129ca5 strftime is not needed for svr4 machines; also fix the prototype footprint. 1998-10-18 14:24:16 +00:00
christos 3b7c5b4ed8 Only define const and volatile when __STDC__ is not defined (for BOOTSTRAP) 1998-10-18 14:23:48 +00:00
wsanchez 65b6624a6d Include sys/types.h 1998-10-13 17:09:16 +00:00
wsanchez 8a6084908f Use __ARCHITECTURE__, if defined, as MACHINE_ARCH 1998-10-13 17:08:34 +00:00
christos 82ee767393 Fix conditional variable expression parsing (reported by cgd) 1998-09-18 20:35:11 +00:00
christos 1b24c735a6 PR/6162: Greg A. Woods: pmake does not add suffix rules if gnodes have children.
This is traditional make behavior (Solaris make does the same), but
	 GNU does not. Lets see what breaks.
1998-09-18 20:20:52 +00:00