Commit Graph

442 Commits

Author SHA1 Message Date
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
christos aed39ca72c PR/6174: ITOH Yasufumi: Purify bug and a compile error in utility code. 1998-09-18 20:15:36 +00:00
christos 8bd03e9aab - Add {.,}[s-]include for silent include file failures
- Make traditional include statement include more than one file if present
  on the line.

Keeping up with the other's :-)
1998-08-06 13:42:22 +00:00
christos ea21627e65 Fix access to freed memory; pointed out by Todd Miller. 1998-07-04 21:53:11 +00:00
christos 076a184bb0 PR/5690: Wolfgang Rupprecht: deleting a suffix that has 0 source references
causes core-dump. Fix: when an unused suffix gets removed, delete
	 it from the suffix list.
1998-07-02 23:30:18 +00:00
tv f0dcde8323 Make a MAKE_BOOTSTRAP case work on NetBSD, too, for cross-compile cases 1998-05-21 17:19:46 +00:00
cgd b374e69f29 in Var_Parse(), set delim in a couple of other paths into cleanup 1998-04-03 04:07:15 +00:00
kleink fb7502608a Need <time.h> for time() prototype. 1998-04-02 10:33:17 +00:00
christos 84e525a801 Add conditional variable evaluation from Alistair Crooks. 1998-04-01 14:18:10 +00:00
christos d611392726 PR/5225: Jason Thorpe: make with -j 4 and subdirs core-dumps.
This revealed another long standing problem with pmake's port to bsd.
.MAKE was not set as the manual page states. Set it and remove another
typo in my last commit.
1998-03-28 22:29:04 +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
fair 78f41cb540 patch from PR#3573 to rename a variable "main" to "mainList" 1998-03-23 08:52:48 +00:00
hubertf 51dc9a9405 Fix typos from PR 5055 by NAKAJIMA Yoshihiro <nakayosh@kcn.or.jp>. 1998-02-24 18:34:31 +00:00
christos 79400c03dd Y2K fixes: use strftime(), and add a fake strftime() for systems that do
not have it.
1998-02-04 14:47:39 +00:00
thorpej f04b8efed3 Change an exit() to _exit(), so that it's safe for vfork(). 1997-12-31 06:06:12 +00:00
lukem 8640f5d0af getopt returns -1 not EOF, use memmove instead of bcopy 1997-11-08 09:33:15 +00:00
lukem 8ba07ab0b3 use CPPFLAGS instead of CFLAGS 1997-10-24 09:00:17 +00:00
lukem 6d1c625f54 fix up .Nm usage 1997-10-19 05:05:24 +00:00
lukem 00c29d5afe don't define WARNS=1 here 1997-10-19 04:23:02 +00:00
mikel d9c915fd1a add missing .Nm argument 1997-10-12 05:51:47 +00:00
mycroft e96e918e60 Use bsd.subdir.mk as appropriate. 1997-10-11 09:34:07 +00:00
thorpej 75b410b331 If printing a u_long, use the %lu format. 1997-10-03 17:58:00 +00:00
enami 5a3584034e Make this compile on NetBSD/alpha; use %ld and cast to u_long to print
a variable of type size_t.
1997-10-03 16:06:26 +00:00
lukem 2ba9e97765 wrap #include <sys/cdefs.h>, __RCSID(...) stuff in #ifndef MAKE_BOOTSTRAP 1997-09-28 03:30:58 +00:00
christos a004ae7f41 PR/4140: David A. Holland: use svr4 style archives for ELF environments 1997-09-26 13:29:05 +00:00
fair 7eaeaff5f2 fix some ints that should be "time_t" per PR#4139 1997-09-23 21:15:07 +00:00
christos 7b8cd5e6e3 Expand variables within variables correctly; eg.
foo.123=abc
bar=123
all:
	echo ${foo.${bar}}
1997-09-22 17:11:12 +00:00
kleink 66105c37fc Lseek(2) usage cleanup: the use of L_SET/L_INCR/L_XTND is deprecated,
use SEEK_SET/SEEK_CUR/SEEK_END instead.
1997-08-25 19:31:43 +00:00
christos 87d111ebee #if __STDC__ -> #ifdef __STDC__ 1997-07-11 20:17:37 +00:00
christos 4507c82bcc sprintf -> vsprintf 1997-07-11 20:16:01 +00:00
christos 487628a792 Fix memory corruption that was caused by debugging code leftovers. 1997-07-10 00:54:44 +00:00
christos e2d4e7ccc8 PR/3825: David A. Holland: global regexp handling gets stuck in infinite loop.
Actually there were two bugs:
	- Add REG_NOTBOL after the first substitution.
	- Handle the rm_so == rm_eo == 0 case, where in a substitution such
	  as 's/bzzzt/z*/g' the first time z* matches nothing.
1997-07-07 19:06:17 +00:00
christos 254d64f064 Add WARNS=1
RCSID police
1997-07-01 21:17:00 +00:00
christos 9981dd99c2 Apparently, using _doprnt(_IOREAD) to emulate vsnprintf() on SVR4 *sometimes*
core-dumps; use sprintf()+strlen() for now.
1997-06-07 16:42:31 +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
christos fab62ec0e9 Don't confuse `member' with `target' 1997-06-07 16:39:45 +00:00
pk 3552d54978 Erase spurious character. 1997-05-26 23:07:31 +00:00
pk 7abb0d066d Minor formatting glitch. 1997-05-26 21:04:28 +00:00
mycroft c19bda7d4c Check the .PHONY attribute... 1997-05-20 22:53:30 +00:00
christos 041c0c5158 Change the way curdir is handled [this started at the previous version]...
Instead of adding it in .PATH, handle it specially the same way as "." is
handled.
1997-05-09 17:05:59 +00:00
mycroft f88245a571 Make sure to propagate OP_PHONY to all cohorts that already existed. 1997-05-09 04:08:26 +00:00
mycroft 8aed472136 Fix description of .NOPATH. 1997-05-08 22:34:34 +00:00
gwr bf6930a26c Add the new .NOPATH feature which can be used to disable .PATH search
for particular targets, i.e. .depend, objects, etc.  (from Christos).
1997-05-08 21:24:41 +00:00
gwr 10e180cc49 Back out the .PATH.c changes. The .depend problem (and others)
will be fixed using the new .NOPATH make feature instead.
1997-05-08 21:11:01 +00:00
cjs 90423c173a If the -m option is used, make will check for the existence of the
directory specified, and add it to sysIncPath only if it exists.
However, afterwards make tested for the presence of a -m option by
checking to see if sysIncPath was an empty list, and assumed that
the -m option was not used if it was empty. This obviously breaks
if -m specified a non-existent directory. So I have added a flag
that is set if the -m option is used, and I test that instead.
1997-05-08 05:19:46 +00:00
mycroft 01925a4fb0 Copy the .PHONY attribute to the cohorts of a double dependency. 1997-05-07 13:12:33 +00:00
mycroft a66a01875e Ignore `-t' when the .MAKE attribute is set. 1997-05-07 07:31:37 +00:00
mycroft 755bc65362 Make sure `-n' is actually disabled for targets with the .MAKE attribute. 1997-05-06 23:51:29 +00:00
mycroft b160845c38 Document .PHONY better. 1997-05-06 22:29:43 +00:00
mycroft 5be8dcf32a Don't do a suffix search for a .PHONY target. 1997-05-06 22:06:58 +00:00
mycroft bcc725c5e3 Don't do a VPATH or .PATH search for .PHONY targets. (From Christos.) 1997-05-06 20:59:42 +00:00
mycroft 0997556292 Don't touch .PHONY targets. 1997-05-06 20:57:47 +00:00
gwr 012e528f2e Use .PATH.c: ... 1997-05-06 20:44:56 +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 6cfa2388a9 Make used to add every directory where it found files in the search path.
I.e. if you had a line in your Makefile:
	../foo.o: foo.c
`..' would be added in the search path. The addition of such paths has
been now disabled. If a pathname contains a slash, then the directory
where such a file is found is not added to the search path. Of course
this eliminates most (all?) use of this function.
1997-05-02 14:23:51 +00:00
mellon 64b4faf663 Don't look at archive information on platforms that run ELF binaries 1997-04-26 07:11:14 +00:00
christos e5c746f479 Don't disable wildcards completely; they are used by other Makefiles. 1997-03-29 16:51:26 +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 b4fe701a22 - Disable globbing for targets/dependencies when POSIX is defined.
- Fix globbing so that patterns that don't have a matching number of [] or {}
  don't get expanded. (before the [ case got expanded to nothing!) This is
  disabled.
1997-03-27 17:20:18 +00:00
gwr f17ca2c65c Do not compile-in ${MACHINE} (as per PR#3386, OK'ed by christos) 1997-03-24 20:56:36 +00:00
christos 69ad8a6988 Locate all the children of a node marked as MADE. 1997-03-23 01:25:28 +00:00
christos 161ba8eea5 Fix problems in the RE substitution error handling. 1997-03-18 19:24:46 +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 b210ac559b make $MACHINE_ARCH settable from the environment. 1997-01-28 23:58:00 +00:00
christos f73f9b0103 Don't compile the regex code if MAKE_BOOTSTRAP (from gwr) 1996-12-31 18:03:30 +00:00
christos 4442744d56 BSD did not traditionally have <sys/cdefs.h>; use BSD4_4 instead and include
<sys/param.h> to grab it.
1996-12-31 18:02:22 +00:00
christos 59a3352108 implement snprintf() and vsnprintf() for non BSD4_4 systems. 1996-12-31 17:56:04 +00:00
christos e43039b92f add a missing 'static' decl. 1996-12-31 17:55:28 +00:00
christos 9a2fab368e define const and volatile for non __STDC__ 1996-12-31 17:55:02 +00:00
christos 87961728d3 - include <stdlib.h> to get getenv() prototype on SVR4
- if __STDC__ -> ifdef __STDC__ to appease SVR4
1996-12-31 17:54:16 +00:00
christos 9749ddca0f Use only integral types in procedure arguments. 1996-12-31 17:53:21 +00:00
christos 36d9e80aff Use explicit .c.o rule so that the bootstrap process works. 1996-12-31 17:52:23 +00:00
christos 8819044d2a [initial version of the substitution/regexp changes were courtesy of Der Mouse]
- fix the variable substitution code in make [PR/2748]
      1. change s/a/b/ so that it substitutes the first occurance of the
	 pattern on each word, not only the first word.
      2. add flag '1' to the variable substitution so that the substitutions
	 get performed only once.

  ***THIS IS AN INCOMPATIBLE CHANGE!***

  Unfortunately there was no way to make things consistent without
  modifying the current behavior. Fortunately none of our Makefiles
  depended on this.

	    OLD:

		VAR      = aa1 aa2 aa3 aa4

		S/a/b/   = ba1 aa2 aa3 aa4
		S/a/b/g  = bb1 bb2 bb3 bb4

	    NEW:

		VAR      = aa1 aa2 aa3 aa4

		S/a/b/   = ba1 ba2 ba3 ba4
		S/a/b/1  = ba1 aa2 aa3 aa4
		S/a/b/g  = bb1 bb2 bb3 bb4
		S/a/b/1g = bb1 aa2 aa3 aa4

- add regexp variable substitution via 'C/foo/bar/' [PR/2752]

- add variable quoting via the ${VAR:Q} modifier. This is useful when running
  recursive invocations of make(1):

	make VAR=${VAR:Q}

  will always work... (This may prove useful in the kernel builds...) [PR/2981]
1996-12-24 17:36:27 +00:00
christos 2f197a9f4d Fir PR/2930: declare missing variable. 1996-11-11 15:16:10 +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
thorpej dff3ccad44 Fix extra "make:" and newline in error message.
From enami tsugutomo <enami@ba2.so-net.or.jp>, PR #2651.
1996-09-27 02:36:58 +00:00
christos 453e90716c - Fix bug where the first line after a conditionally skipped was not ready
in its entirety if it contained a continuation.
- Print the whole error line, not just the first 20 characters of it.
1996-09-13 04:22:09 +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
thorpej bbb4184355 Tidy up some RCS ids a bit. 1996-08-30 17:59:37 +00:00
christos 091b5c0118 Add estrdup(), a checked version of strdup and use it. 1996-08-13 16:42:00 +00:00
christos 22770fe8ea Add strdup() since ultrix is missing it.
From Larry Schwimmer <rosebud@cyclone.Stanford.EDU>
1996-08-13 16:41:15 +00:00
christos ba78477e9d Various cleanups from: Larry Schwimmer <rosebud@cyclone.Stanford.EDU> 1996-08-13 16:40:31 +00:00
christos 1bc899a1ff Protect __P from being multiply defined (for systems that already define it) 1996-08-13 16:39:30 +00:00
christos 15d37e3539 Recognize SVR4 style long filename entries in archives. 1996-06-02 21:09:33 +00:00
christos 62be8b7e25 Fix bug where make will always exit with 0, even when one or more parallel
jobs failed. (Only affects parallel make code)
1996-05-29 15:28:05 +00:00
christos 5c1983c016 - Move -D flags from Makefile to config.h and explain what they do. Add
-Wall -Wno-unused to CFLAGS. Add new define SYSVVARSUB to enable SysV
  style variable substitutions and enable them.
- Add SunOS style command substitutions via SUNSHCMD
- Fix core dump with '{variable = value'
1996-05-28 23:34:35 +00:00
jtc cf957d3a75 Changed to use 1900 + tm_year instead of hardcoding "19" as the century.
From PR #2308 by Stephen J. Roznowski <sjr@zombie.ncsc.mil>.
1996-04-08 18:57:49 +00:00
christos c7f6ddc626 make emalloc and erealloc return void *; closes PR/2276 1996-03-31 21:30:05 +00:00
jtc fea2f4c4ca Added erealloc() function that calls enomem() if the allocation fails
(this is like the existing emalloc() function).  Changed all realloc()
calls to erealloc().
1996-03-29 02:17:13 +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 6750270dc6 data and date aren't the same... 1996-03-12 18:04:27 +00:00
christos 57cad0d107 Jonathan Stone's fixes:
main.c:	Remove double include of <sys/resource.h>; if MACHINE is defined, use
	that instead of uname.
Makefile: Add util.c.
1996-03-11 13:45:31 +00:00
christos 9779dee0b1 Fix PR/2118; apply sysincludes patch. 1996-03-06 00:15:17 +00:00
christos 1b11cdf58d if PR/2090, sysvinclude too optimistic, did not check for space after the
include keyword
1996-02-17 13:28:09 +00:00
thorpej fb02474c1f In ParseDoInclude(), make a temporary copy of the current file name
while searching for ""-type include files, since the current file name
might not be a writeable string.
1996-02-07 23:04:04 +00:00
christos 8862d696fa fix pr/1421 and pr/1997 1996-02-04 22:20:27 +00:00
christos b941a324f5 Support SVR4 style archives. 1996-02-04 20:34:41 +00:00
christos f0874be2f5 - Added .WAIT to synchronize between sources like other pmake variants.
- Updated documentation to include .ORDER .PARALLEL .NO_PARALLEL .NONPARALLEL
1995-12-16 05:03:09 +00:00
christos 6611cb1d0d Updates for POSIX/SVR4 compiling:
arch.c:		 Don't require ranlib stuff. Not everybody has it.
dir.c:		 SunOS-4 != Solaris; change #ifdef sun to #if sun && !__svr4__
job.c, compat.c: Don't use 'union wait', use int and the W*() macros.
main.c: 	 Check for uname() == -1; some unames return > 0...
util.c, job.c:	 Add signal() with BSD semantics for svr4, don't use bsd
		 sigmask and friends.
1995-11-22 17:39:53 +00:00
cgd e3c5125de9 pull in make.h. (PAlloc() now uses emalloc(), which is prototyped in
make.h.  If the prototype is not in scope on the Alpha, I see lots
of "cast to pointer from integer of different size" warnings.)
1995-11-10 21:27:27 +00:00
christos 027abce852 - Turn compat mode on by default. It gets turned off when the -j without
the -B flag is specified. [Thus you can use -j 1 to turn it off].
- Fix malloc -> emalloc as Gordon noted.
1995-11-08 02:30:53 +00:00
christos 61067003d8 Minor:
- ${.PREFIX} should never contain a full pathname
    - Fixed gcc -Wall warnings
Major:
    - compatMake is now FALSE. This means that we are now running in
      full pmake mode:
	  * rules on dependency lines can be executed in parallel and or
	    out of sequence:

	    foo: bar baz

	    can fire the rule for baz before the rule for bar is fired.
	    To enforce bar to be fired before baz, another rule needs to be
	    added. [bar: baz]
	  * adjacent shell commands in a target are now executed by a single
	    invocation of the shell, not one invocation of the shell per line
      (compatMake can be turned off using the -B flag)
    - The -j flag now works... I.e. make -j 4 will fork up to four jobs in
      parallel when it can. The target name is printed before each burst
      of output caused by the target execution as '--- target ---', when j > 1
    - I have changed all the Makefiles so that they work with make -j N, and
      I have tested the whole netbsd by:
	  'make -j 4 cleandir; make -j 4 depend; make -j 4; make -j 4 install'
    - I have not compiled or tested this version of make with -DREMOTE.
1995-11-02 23:54:35 +00:00
ws 337d0ee3b1 Always ensure space for trailing NULL in argv 1995-10-30 17:36:27 +00:00
jtc 95c465e08b Update lseek() constants:
L_SET	-> SEEK_SET
And add off_t cast to offset argument.
1995-09-27 18:44:38 +00:00
jtc 6a70570191 include <signal.h> instead of <sys/signal.h> 1995-09-27 18:42:21 +00:00
christos f4699a7dd3 Revert previous suffix fix. If the .a suffix is present and a .c.a rule is
there, then the rule should be applied. This is the correct behavior.
1995-09-25 02:46:30 +00:00
christos ae8c2b9dd3 Don't apply the default suffix rules for nodes that are not in our
current directory because we could be building things outside our
directory that were not meant to be build... Fixes PR/1488
1995-09-22 00:42:10 +00:00
christos 17c2255148 Fix PR/1443:
Dependency rules with `=' in the lhs are parsed as variable assignments.
E.g., the following Makefile fails:

A=a b c d
all: $(A:%=%b)
$(A:%=%b):
	@echo $@
1995-09-10 03:58:16 +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
ws de7fa9654c Sort keyword table correctly, so binary search really works 1995-05-15 13:10:10 +00:00
jtc d08e2815ca None of the functions in util.c are needed by NetBSD, so don't
bother to compile it.
1995-05-03 05:09:14 +00:00
christos 67c2aabd6c Fix small typo; from Chris Torek 1995-04-29 17:05:08 +00:00
christos f222a602cf Fixed so that orphan tabs are ignored. Should close PR760. 1995-02-08 04:36:41 +00:00
christos 85ac32e8d2 str.c: Don't free NULL; does not work with non posix frees.
var.c: Minor memory leak plugged.
suff.c: Don't add extra sources on the null suffix if it has dependency
	lines or commands attached to it [POSIX says so]
1995-02-04 23:44:41 +00:00
mycroft b36edbb4da Fix 4 typos pointed out by Jordan, and 1 by me. 1995-01-23 20:34:59 +00:00
christos 0036b358ae Fixed to parse correctly SysV variable substitutions ${VAR:P1=P2} when
P1 or P2 contain }'s or )'s. From mikeb@snow.datametrics.com
1995-01-20 04:35:10 +00:00
christos 77759e5c6d Fixed PR/724, 'make' runs commands when $? is empty
This is not the perfect fix. I think that the whole __SYMDEF
checking code should be removed. [I should also teach myself
how to deal with the PR stuff to mark this closed :-)]
1995-01-11 17:42:26 +00:00
christos 42d1db77e3 Save the name of the environment variables. Remove the comment that
says that we don't. from Paul Borman (prb@bsdi.com)
1995-01-09 18:31:41 +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
cgd 7d82c5ab5d a few casts, for peace and quiet. 1994-12-24 16:54:24 +00:00
christos 218fbce657 Don't remove targets when the -n flag is given and make is interrupted.
(From Keith Bostic)
1994-11-25 19:16:45 +00:00
mycroft 126cf80fd0 Deal with lines that contain only spaces, per PR 515, but implemented
differently.
1994-10-18 20:36:26 +00:00
mycroft dfab95c9fe Remove an outdated comment that is very confusing. 1994-10-18 20:16:13 +00:00
gwr 4ca862ca1d Get the name of this type of MACHINE from utsname
so we can share an executable for similar machines.
(i.e. m68k: amiga hp300, mac68k, sun3, ...)
1994-09-30 03:14:21 +00:00
mycroft e046f69de1 Use getcwd(3), not getwd(3), and remove some old, unused compatibility code. 1994-09-23 09:33:21 +00:00
cgd 138fcd8327 deal with new share/doc strategy 1994-06-30 05:33:30 +00:00
mycroft ded5f042c3 Clean up deleted files. 1994-06-28 04:36:07 +00:00
cgd 5b029eb9a8 update for new doc-make/install strategy 1994-06-25 05:57:47 +00:00
cgd f10235118d from Lite 1994-06-19 02:33:16 +00:00
jtc ac414e10cd Christos' fix for quoting variable extraction properly. 1994-06-16 18:50:18 +00:00
jtc b28f89c931 Christos' fix for quoting variable extraction properly. 1994-06-16 18:50:16 +00:00
jtc 9f7dde6ba0 Christos' fix for quoting variable extraction properly. 1994-06-16 18:50:04 +00:00
jtc 26a8972fd7 Fixes from Christos Zoulas, who used purify, objectcenter and testcenter
to find memory leaks and illegal memory accesses.
1994-06-06 22:45:17 +00:00
jtc 63ad15ccc1 Fix from Thorsten Lockert: don't ignore \ before # characters
in strings (Fixes bug 255).
1994-05-21 16:36:01 +00:00
jtc abd412aa8d Properly parse null command line arguments in makefile rules.
Fix from Christos Zoulas.
1994-05-17 15:55:42 +00:00
glass 0b84fdb5c1 bootstrap improvements 1994-05-09 06:36:20 +00:00
glass 5760062851 bootstrap changes 1994-04-17 03:09:49 +00:00
briggs 506dde3090 Need for.o in list of objects when bootstrapping. 1994-04-09 23:35:25 +00:00
jtc aa67092685 Fixes from Christos Zoulas:
The following two patches fix a couple of problems with make(1)

1. Null Suffixes were not being copied, but they were being free'd
   This caused rules of the form:

   .c:
	${CC} ...

   to access invalid memory and potentially core dump..
   [That was always broken; I did not break that one :-)]

2. My recent fixes to parse ${VAR:%.foo=%.bar} handled the null string
   case incorrectly (${VAR:=.c} was broken).
1994-03-23 00:52:13 +00:00
pk 15b943d427 Do extended-name archives. 1994-03-18 11:32:09 +00:00
cgd 3cb7f8e872 kill some warnings, from Christos. 1994-03-07 22:22:01 +00:00
jtc 6b1913fcc9 Apply fix that was lost when Christos Zoulas' changes were integrated:
Shell commands start with tabs, not whitespace.  Pmake's
  POSIX behavior must have been derrived from an early draft.
1994-03-05 01:58:23 +00:00
mycroft f4d252cff0 Clean up deleted files. 1994-03-05 00:35:58 +00:00
cgd 298fa8e587 fixes/improvements from Christos Zoulas <christos@deshaw.com>. 1994-03-05 00:35:26 +00:00
mycroft ea40a9138d Clean up deleted files. 1994-03-05 00:35:19 +00:00
cgd 3db59563ee fixes/improvements from Christos Zoulas <christos@deshaw.com>. 1994-03-05 00:34:29 +00:00
jtc f4db87c6e4 Fix typos & spelling errors 1994-02-10 18:24:46 +00:00
jtc e890eb6415 Include appropriate header files to bring prototypes into scope. 1994-01-13 21:01:40 +00:00
cgd e11feae6b8 add missing arg to setenv(). reported by downsj@csos.orst.edu 1994-01-13 17:18:30 +00:00
pk f0e170dc10 Introduced ${.OBJDIR}. The variable is similar to .CURDIR but points at
the directory where make builds the targets. It can be used to clean up
those cumbersome Makefiles that have to guess at the "obj" directory.
1993-12-22 00:25:57 +00:00
jtc 5a178ffc9b POSIX.2 added the -S flag (opposite of -k). It was allready there,
just #ifdef'ed out.
1993-12-17 23:55:57 +00:00
jtc d253881943 Fix bug #47. Shell commands start with tabs, not whitespace. Pmake's
POSIX behavior must have been derrived from an early draft.
1993-12-17 23:52:04 +00:00
jtc 77e8bced10 Fix bug (PR #42) with -j flag. Doesn't seem to do anything, but at
least it doesn't dump core anymore.
1993-12-15 18:26:40 +00:00
jtc ae2b6ea2c2 Compile with -DPOSIX --- enables reasonable behavior for MAKE and
MAKEFLAGS variables.
1993-12-14 18:27:15 +00:00
jtc f39d0cfe88 Update to use <dirent.h>. 1993-12-08 00:37:37 +00:00
cgd edcba29bc8 add MACHINE_ARCH 1993-12-04 02:12:34 +00:00
cgd 670f052fd7 add support for an obj.${MACHINE} dir, which will be used rather than obj,
if both exist.  basically, precedence is now:
	MAKEOBJDIR or (obj.${MACHINE} then obj)
	.
1993-10-23 02:32:03 +00:00
cgd e57d888eed fix from chmr@edvz.tu-graz.ac.at (Christoph Robitschko)
to get things right if obj is a symlink and points to nowhere.
1993-08-23 05:29:31 +00:00
mycroft aee4b07b8a Add RCS identifiers, remove some completely useless RCS logs and patchkit
headers, and a few other insignificant changes.
1993-08-02 17:48:44 +00:00
mycroft e9d867ef50 Add RCS identifiers. 1993-08-01 17:54:45 +00:00
mycroft c3e42d1c64 Add RCS indentifiers. 1993-08-01 07:22:47 +00:00
mycroft 690cae8181 Add RCS indentifiers. 1993-07-31 15:17:49 +00:00
cgd 2b3bd9befd remember curdir as something other than ".", so that makes
of things which include files in directories won't get hosed...
1993-07-08 03:41:58 +00:00
glass 248f75d9b8 some compatibility fixes to ease bootstrapping:
Makefile.dist is now a decent Makefile and not one of these cc *.c disasters
1993-05-27 16:54:21 +00:00
glass 6cbb2d4ece some compatibility fixes to ease bootstrapping:
Makefile.dist is now a decent Makefile and not one of these cc *.c disasters
RANLIBMAG now defaults if not otherwise defined
1993-05-27 16:53:49 +00:00
mycroft 1b67cec37d Fix various bugs in man pages (from 386BSD patch 130). 1993-04-22 03:27:28 +00:00
cgd 883c20ae5a made .CURDIR be absolute, not relative, thereby eliminating
the need for some of the makefile trickery when making objects,
and fixing a few .PATH bugs
1993-03-23 07:26:38 +00:00
cgd e541169ce2 after 0.2.2 "stable" patches applied 1993-03-21 18:04:42 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00