OpenBSD CVS

CVS log for src/usr.bin/make/main.c


[BACK] Up to [local] / src / usr.bin / make

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.132 / (download) - annotate - [select for diffs], Mon Sep 4 11:35:11 2023 UTC (8 months, 2 weeks ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.131: +2 -3 lines
Diff to previous 1.131 (colored)

GC old code that was originally implemented to facilitate adoption by
other BSDs, which never happened, so make things simpler for further
development.

Ditches config.h entirely since it gets reduced to 2 defines.

okay tb@

Revision 1.131 / (download) - annotate - [select for diffs], Sat Jul 8 21:51:45 2023 UTC (10 months, 1 week ago) by jmc
Branch: MAIN
Changes since 1.130: +2 -2 lines
Diff to previous 1.130 (colored)

max_processes -> max_jobs in usage();

Revision 1.130 / (download) - annotate - [select for diffs], Tue May 30 04:42:21 2023 UTC (11 months, 2 weeks ago) by espie
Branch: MAIN
Changes since 1.129: +55 -4 lines
Diff to previous 1.129 (colored)

Due to the way make is designed, not being able to read a makefile
is basically silent.

Record errors due to missing permissions and other oddities, and display them
when we error out due to lack of targets, as a quality-of-life diagnostic.

Based on a remark from sthen@, with some feedback and tweaks from op@

okay op@, kn@

Revision 1.129 / (download) - annotate - [select for diffs], Tue Jan 17 13:03:22 2023 UTC (16 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.128: +2 -2 lines
Diff to previous 1.128 (colored)

Arguments may contain more than one variable assignment

`make FOO=1 BAR=2 ...' works as expected and lots of things wouldn't work
if make only accepted a single assignment, as currently documented.

Fix SYNOPSIS and usage to match reality and POSIX spec (thanks jmc).

OK jmc

Revision 1.128 / (download) - annotate - [select for diffs], Sun Dec 4 23:50:48 2022 UTC (17 months, 2 weeks ago) by cheloha
Branch: MAIN
Changes since 1.127: +1 -2 lines
Diff to previous 1.127 (colored)

userspace: remove vestigial '?' cases from top-level getopt(3) loops

getopt(3) returns '?' when it encounters a flag not present in the in
the optstring or if a flag is missing its option argument.  We can
handle this case with the "default" failure case with no loss of
legibility.  Hence, remove all the redundant "case '?':" lines.

Prompted by dlg@.  With help from dlg@ and millert@.

Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2

ok naddy@ millert@ dlg@

Revision 1.127 / (download) - annotate - [select for diffs], Mon Jan 13 15:41:53 2020 UTC (4 years, 4 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.126: +31 -34 lines
Diff to previous 1.126 (colored)

make the choice of engine explicit

simplify the running of .BEGIN/.END so that they pass through the engine
first (so they can now have dependencies). Error out properly if .BEGIN/.END
fails.

Revision 1.126 / (download) - annotate - [select for diffs], Mon Jan 13 15:19:04 2020 UTC (4 years, 4 months ago) by espie
Branch: MAIN
Changes since 1.125: +2 -2 lines
Diff to previous 1.125 (colored)

make things more complex so that they can become simpler:
in the compatMake case, we still get into handle_all_running_jobs in case
of a fatal signal and at the end. Pass compatMake around to job.c so that
it will *not* run parallel make code in the sequential make case, thus
actually making sure both engines are separate.

Revision 1.125 / (download) - annotate - [select for diffs], Mon Jan 13 14:51:50 2020 UTC (4 years, 4 months ago) by espie
Branch: MAIN
Changes since 1.124: +19 -10 lines
Diff to previous 1.124 (colored)

simplify the way we account for different jobs:
- have a simple variable "sequential" that counts  whether we are
running more than one job (for the expensive heuristics)
- don't expose various things globally, just have a set_noparallel() for
the parser
- preallocate exactly enough job structures and record them in availableJobs
- keep one job on the side for .INTERRUPT

Revision 1.124 / (download) - annotate - [select for diffs], Wed Jan 8 14:09:29 2020 UTC (4 years, 4 months ago) by espie
Branch: MAIN
Changes since 1.123: +2 -2 lines
Diff to previous 1.123 (colored)

fix -q: in compatMode, compute and return outofdate just like parallel mode.
Also, never run .END in querymode (we don't actually care about updating
problem in that case).

okay millert@

Revision 1.123 / (download) - annotate - [select for diffs], Mon Apr 22 18:32:09 2019 UTC (5 years ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.122: +3 -3 lines
Diff to previous 1.122 (colored)

fix thinko from tb@'s commit.

okay tb@

Revision 1.122 / (download) - annotate - [select for diffs], Thu Apr 20 03:04:11 2017 UTC (7 years, 1 month ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.121: +6 -6 lines
Diff to previous 1.121 (colored)

use strtonum instead of strtoll to parse the argument to -j

ok deraadt@ benno@

Revision 1.121 / (download) - annotate - [select for diffs], Fri Oct 21 16:12:38 2016 UTC (7 years, 6 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.120: +6 -6 lines
Diff to previous 1.120 (colored)

small obvious cleanups:
- remove a lot of unnecessary casts
- zap extra param that's no longer needed
- add proper prototype and make function static

okay natano@

Revision 1.120 / (download) - annotate - [select for diffs], Wed Oct 12 00:31:06 2016 UTC (7 years, 7 months ago) by tb
Branch: MAIN
Changes since 1.119: +2 -2 lines
Diff to previous 1.119 (colored)

make -t uses the "fattr" syscall utimes(2) for its touch(1) built-in.
Thus, add "fattr" to the list of pledge promises.

ok millert, deraadt

Revision 1.119 / (download) - annotate - [select for diffs], Mon Jan 4 10:59:23 2016 UTC (8 years, 4 months ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.118: +8 -14 lines
Diff to previous 1.118 (colored)

Use err(3) instead of various handrolled combinations of perror(3) and
fprintf(stderr, ...) with strerror(3) and exit(3).  Make sure the exit
status is 2 if an error occurred.  Prompted by gsoares@'s and jsg@'s
audit of exit statuses after failure of pledge(2).

ok gsoares@

Revision 1.118 / (download) - annotate - [select for diffs], Tue Dec 29 19:04:46 2015 UTC (8 years, 4 months ago) by gsoares
Branch: MAIN
Changes since 1.117: +2 -2 lines
Diff to previous 1.117 (colored)

fix exit status on pledge(2) failure.

OK tb@ jsg@

Revision 1.117 / (download) - annotate - [select for diffs], Sun Nov 29 09:17:12 2015 UTC (8 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.116: +2 -1 lines
Diff to previous 1.116 (colored)

fix duplicate targets in target list for good: split previous groupling fix
in two. Catch 22: we have to dedup targets very early so that commands get
attached correctly, but we can't figure out the grouplings heuristics until
we have all commands...

ok millert@

Revision 1.116 / (download) - annotate - [select for diffs], Sun Nov 15 06:19:22 2015 UTC (8 years, 6 months ago) by daniel
Branch: MAIN
Changes since 1.115: +1 -7 lines
Diff to previous 1.115 (colored)

unifdef MAKE_BOOTSTRAP now that Makefile.boot is gone.

ok espie@

Revision 1.115 / (download) - annotate - [select for diffs], Wed Oct 14 13:50:22 2015 UTC (8 years, 7 months ago) by espie
Branch: MAIN
Changes since 1.114: +2 -2 lines
Diff to previous 1.114 (colored)

make sure we use stdbool.h
Mostly diff by Daniel Dickman, who told me to commit in his stead,
as he's tied up at work.

Revision 1.114 / (download) - annotate - [select for diffs], Fri Oct 9 01:37:08 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.113: +3 -3 lines
Diff to previous 1.113 (colored)

Change all tame callers to namechange to pledge(2).

Revision 1.113 / (download) - annotate - [select for diffs], Thu Oct 8 14:49:27 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.112: +4 -1 lines
Diff to previous 1.112 (colored)

tame "stdio rpath wpath cpath proc exec".  make is a shell, and appears
to only need these operations.  Take note that "exec" is a 2-day old
tame request, so do get a new kernel before you update or risk getting
trapped.

Revision 1.112 / (download) - annotate - [select for diffs], Wed Oct 7 14:16:09 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.111: +0 -3 lines
Diff to previous 1.111 (colored)

Oops, not quite ready for tame() here.  People need time to update
their kernels, before it starts using the new "exec" primitive.
HINT: everyone, update your kernels, tame is coming to make really soon.

Revision 1.111 / (download) - annotate - [select for diffs], Wed Oct 7 14:14:30 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.110: +4 -1 lines
Diff to previous 1.110 (colored)

*** empty log message ***

Revision 1.110 / (download) - annotate - [select for diffs], Sat Feb 7 18:52:35 2015 UTC (9 years, 3 months ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.109: +3 -3 lines
Diff to previous 1.109 (colored)

sync usage(); ok espie

Revision 1.109 / (download) - annotate - [select for diffs], Sat Feb 7 13:32:12 2015 UTC (9 years, 3 months ago) by espie
Branch: MAIN
Changes since 1.108: +42 -3 lines
Diff to previous 1.108 (colored)

add support for the popular -C option, in the least intrusive way possible:
parse thru parameters for -C upfront, and then we can setup CURDIR/OBJDIR
so as not to disturb anything else.

okay millert@, "makes sense" guenther@

Revision 1.108 / (download) - annotate - [select for diffs], Fri Jan 23 22:35:57 2015 UTC (9 years, 3 months ago) by espie
Branch: MAIN
Changes since 1.107: +2 -2 lines
Diff to previous 1.107 (colored)

a wee little bit more cleanup (more const and remove noise from CDIAGFLAGS...
-pedantic kind of requires -std=c99 here to avoid LL warnings)
okay miod@, millert@

Revision 1.107 / (download) - annotate - [select for diffs], Fri Jan 23 13:18:40 2015 UTC (9 years, 3 months ago) by espie
Branch: MAIN
Changes since 1.106: +3 -3 lines
Diff to previous 1.106 (colored)

remove a bunch of dangerous casts (useless casts from void * to something
else, in some cases by adding extra temporary variables.
IMO, it's much better practice to do

void *a;
int *p = a;
*p = 42;

rather than
void *a;
*(int *)a = 42;

okay miod@... to be revisited for some possible const additions later.

Revision 1.106 / (download) - annotate - [select for diffs], Fri Jan 16 15:36:30 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.105: +2 -2 lines
Diff to previous 1.105 (colored)

switch to <limits.h>; ok millert

Revision 1.105 / (download) - annotate - [select for diffs], Fri Jan 16 15:17:34 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.104: +1 -10 lines
Diff to previous 1.104 (colored)

The make code has "bootstrap", to allow it to be brought up on other
systems.  Rarely used & tested -- perhaps once a decade. Perhaps not
even once this decade?  Anyways,
    #define PATH_MAX (MAXPATHLEN+1)
is quite wrong.  Delete the chunk, assuming any system this is ported
to has PATH_MAX.

Revision 1.104 / (download) - annotate - [select for diffs], Tue Jul 15 23:07:19 2014 UTC (9 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.103: +4 -6 lines
Diff to previous 1.103 (colored)

remove support for the non-standard BSDmakefile, which make tries to
open first.  a handful of strange ports will cope soon.
ok espie

Revision 1.103 / (download) - annotate - [select for diffs], Thu May 15 19:40:42 2014 UTC (10 years ago) by chl
Branch: MAIN
Changes since 1.102: +2 -2 lines
Diff to previous 1.102 (colored)

remove unused variable

ok espie@

Revision 1.102 / (download) - annotate - [select for diffs], Sun Nov 24 12:36:13 2013 UTC (10 years, 5 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.101: +10 -43 lines
Diff to previous 1.101 (colored)

simplify determination of OBJDIR to what we actually use.
(prevents some race conditions by just chdir()'ing into the right objdir)
problem noticed by theo
okay'd by general apathy...

Revision 1.101 / (download) - annotate - [select for diffs], Sun Jul 7 09:41:08 2013 UTC (10 years, 10 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.100: +3 -5 lines
Diff to previous 1.100 (colored)

old option -P bites the dust. It's not been doing anything for years.
It used to control pipes for parallel output, but the new model means
pipes are no longer used at all.
Its mere presence confuses some people.
tested thru a few builds and bulk to not impact anything.

Revision 1.100 / (download) - annotate - [select for diffs], Thu Oct 18 17:54:43 2012 UTC (11 years, 7 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.99: +8 -3 lines
Diff to previous 1.99 (colored)

numerous error message fixes:
- do ^C checking differently: don't record sent signals, but when jobs
die, recheck whether we received/have pending a INT/QUIT/TERM/HUP signal.
Then don't display our process group "normally", instead group together
everything dying by signal/shell dying by signal (just give the target
names).

- make certain we always handle signals before dying from "other conditions"
- have the parser messages look more like normal messages
- remove double error messages from some parser errors
- make sure unclosed variables ARE errors when some modifiers are present

- keep track of the base directory we're run from, so that submakes can
get shortened directories...
- make sure the whole error message including silent command fits into a
reasonable length.

okay millert@

Revision 1.99 / (download) - annotate - [select for diffs], Tue Oct 9 19:47:09 2012 UTC (11 years, 7 months ago) by espie
Branch: MAIN
Changes since 1.98: +10 -1 lines
Diff to previous 1.98 (colored)

recognize new debug options for double commands, heldjobs, target group
construction

Revision 1.98 / (download) - annotate - [select for diffs], Sat Oct 6 09:32:40 2012 UTC (11 years, 7 months ago) by espie
Branch: MAIN
Changes since 1.97: +5 -2 lines
Diff to previous 1.97 (colored)

- extra juice for debugging signal passing.  Note when we can't pass the
signal because the process already bought it (pgroups will do that to you)
(lots of discussion with Todd on that one)
- tweak error handling some more to make it less verbose when just one job
is running...
- show signal name in case of signal interrupts.
- zap OP_LIB, move that stuff to the location where we warn when we meet
that bug.

okay millert@

Revision 1.97 / (download) - annotate - [select for diffs], Tue Oct 2 10:29:31 2012 UTC (11 years, 7 months ago) by espie
Branch: MAIN
Changes since 1.96: +9 -34 lines
Diff to previous 1.96 (colored)

more changes, discussed and tested by various people.
- put back some job control, turns out it's necessary when we don't run a
shell.
- zap old #ifdef CLEANUP code... probably doesn't even compile.
- kill most of the OP_LIB code. Just keep a wee little bit for compatibility
(deprecated .LIBS and .INCLUDES, warns for weird dependencies instead of
erroring out).
- much improved debugging and -p output: sort variables, targets, rules,
output stuff in a nicer format mimicing input.
- better error message when no command is found, explain where the target comes from.
- sort final error list by file.
- show system files in errors as <bsd.prog.mk>
- reincorporate random delay, that was dropped
- optimize siginfo output by not regenerating the whole string each time.
- finish zapping old LocationInfo field that's no longer used.

Revision 1.96 / (download) - annotate - [select for diffs], Fri Sep 21 07:55:20 2012 UTC (11 years, 7 months ago) by espie
Branch: MAIN
Changes since 1.95: +26 -29 lines
Diff to previous 1.95 (colored)

major overhaul of the way make handle jobs, inspired by dpb:
instead of forking a "job" per target, and having that job further fork
separate commands, have make maintain a list of jobs, indexed by pid
of currently running commands, and handle process termination
continuation-style.  This has lots of benefits:
- make is responsible for most printing, so we no longer need pipes nor
job control: make -j jobs see the tty.
- no more special-casing for jobs that don't really execute anything.
- unify code for make -jn and make -B, including signal handlers and
job waiting.  So make -n, make -q, +cmd now run commands in the same
way in all cases.
- unified more accurate error-reporting, as make knows precisely which
command failed. Commands are tagged with their lines, and we display failing
commands in silent mode.
- fine-grained "expensive" command handling (recursion limiter). Do it
per-command instead of per-target.

Moreover, signal response is now simpler, as we just block the signals
in a small critical sections, test for events, and sigpause (thanks a lot
to guenther@ and millert@), so running make is now almost always paused
without any busy-waiting.

Thanks to everyone who tested and gave input.

Revision 1.95 / (download) - annotate - [select for diffs], Mon Jul 19 19:46:44 2010 UTC (13 years, 10 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.94: +1 -2 lines
Diff to previous 1.94 (colored)

Correct $OpenBSD$ stuff

Revision 1.94 / (download) - annotate - [select for diffs], Thu Jul 15 10:41:11 2010 UTC (13 years, 10 months ago) by espie
Branch: MAIN
Changes since 1.93: +2 -2 lines
Diff to previous 1.93 (colored)

whitespace

Revision 1.93 / (download) - annotate - [select for diffs], Wed Feb 3 20:45:44 2010 UTC (14 years, 3 months ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.92: +22 -2 lines
Diff to previous 1.92 (colored)

Add a new default variable in Makefile context, MACHINE_CPU. Its value is
decided at compile-time and is either MACHINE_CPU from <machine/param.h> if
it is defined, or the same value as MACHINE_ARCH otherwise.
This will be used to allow ports with suffixes to their canonical MACHINE_ARCH
to provide this canonical name as MACHINE_CPU, and in turn to let Makefiles
do TRT.
ok kettenis@

Revision 1.92 / (download) - annotate - [select for diffs], Tue Nov 4 07:22:35 2008 UTC (15 years, 6 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.91: +4 -1 lines
Diff to previous 1.91 (colored)

changes to get target equivalence to work better.
- add new file to create lists of equivalent targets (siblings)
- use that for sequential mode to have much better VPATH support
- separate checking commands from reporting error, for later.
- zap DieHorribly accordingly
- renumber existing flags
- signal_running_jobs() is simpler than pass_signal_to_jobs()
- new debug option -dn for name matching.

Similar code to handle parallel make is still missing.

thanks to Mark, Miod, Theo, Otto, Todd for tests and/or comments.

Revision 1.91 / (download) - annotate - [select for diffs], Thu Jan 10 20:34:03 2008 UTC (16 years, 4 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.90: +3 -2 lines
Diff to previous 1.90 (colored)

fix stupid typo in grouping, make PWD work correctly again.
Found out by Christian Ehrhardt.

Revision 1.90 / (download) - annotate - [select for diffs], Wed Nov 28 09:40:08 2007 UTC (16 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.89: +3 -0 lines
Diff to previous 1.89 (colored)

debug scaffolding: allows the insertion of a random delay before firing up
jobs in parallel mode.

Revision 1.89 / (download) - annotate - [select for diffs], Sat Nov 17 09:49:53 2007 UTC (16 years, 6 months ago) by espie
Branch: MAIN
Changes since 1.88: +12 -5 lines
Diff to previous 1.88 (colored)

read only .depend if !make(depend)

On the basis that:
- .depend is a bsd extension anyways, changing its semantics doesn't
affect posix compliance.
- it may allow regenerating broken .depend files without needing to
remove them.

approved by miod@, millert@, deraadt@.

Revision 1.88 / (download) - annotate - [select for diffs], Sat Nov 3 11:44:30 2007 UTC (16 years, 6 months ago) by espie
Branch: MAIN
Changes since 1.87: +1 -1 lines
Diff to previous 1.87 (colored)

token is a confusing name, rename to banner

Revision 1.87 / (download) - annotate - [select for diffs], Fri Nov 2 17:27:24 2007 UTC (16 years, 6 months ago) by espie
Branch: MAIN
Changes since 1.86: +4 -0 lines
Diff to previous 1.86 (colored)

Work done at p2k7.


This is a really big step towards getting parallel make to work.


Note that this is not yet complete. There are still a few `details' to
fix before this works 100%.  Specifically: sequential make (compat) and
parallel make don't use the same engine, and the parallel engine still
has a few limitations. For instance, some known issues:
- parallel make does not deal with .phony targets correctly all the time.
- some errors are deadly in parallel make mode.
- parallel make NEEDS way more sturdy correspondance of file system paths
and target names, since it often needs to match dependencies to targets
before the corresponding files exist.
- some local variables like $* get set in a bogus way in some cases.
- suffix handling has issues, especially related to the NULL suffix.
So, if you find stuff that does NOT yet work with parallel make, don't go
blindly try to fix the Makefile. It's very likely you might have stumbled
into a make bug. (unless you really, really, understand Makefiles, DON'T
GO CHANGING THEM YET).



Tested by lots of people, thanks go to miod@, and robert@ among other people.

Quick summary of what this does:

- remove `saving commands' extension (it's not really usable, nor used)
- move compat job runner and parallel interrupt handling into engine.c
- tweak the code so that both compat and parallel mode use the same job runner
and the same interrupt handling. Remove the other one.
- optimize job runner so that, in parallel mode, the last command does not
fork if we can avoid it (as it's already running in a sub shell).
- scrape all the code that dealt with creating shell scripts from commands.
- scrape all the code that dealt with recognizing special sequences in
command output to print/not print output.
- fix the parallel job pipe to not keep around file descriptors that are not
needed.
- replace the parallel job buffering with a nicer one, that deals with
non-blocking descriptors to try to agregate as much output from one job in
one go (greed) to unconfuse the users.
- create two pipes per job, so that stdout and stderr stay separate.
- make job token printing a debug option.
- always use the parallel job-runner to `execute' commands, even if we just
print them out.
- store list of errors encountered during parallel make running, and print them
on exit, so that we know what went wrong.
- add a dirty hack to targ.c to deal with paths produced by gccmakedep.

Revision 1.86 / (download) - annotate - [select for diffs], Wed Oct 24 13:19:24 2007 UTC (16 years, 6 months ago) by espie
Branch: MAIN
Changes since 1.85: +8 -7 lines
Diff to previous 1.85 (colored)

fix logic of command line/ MAKEFLAGS parsing.
Forces make to see the -j4 in MAKEFLAGS and to actually pass it to submakes

Revision 1.85 / (download) - annotate - [select for diffs], Sun Sep 23 09:44:39 2007 UTC (16 years, 7 months ago) by espie
Branch: MAIN
Changes since 1.84: +4 -13 lines
Diff to previous 1.84 (colored)

kill local/jobs distinction. Correctly this time...

Revision 1.84 / (download) - annotate - [select for diffs], Tue Sep 18 07:45:25 2007 UTC (16 years, 8 months ago) by espie
Branch: MAIN
Changes since 1.83: +12 -3 lines
Diff to previous 1.83 (colored)

revert maxLocal removal, there's something fishy going on.

Revision 1.83 / (download) - annotate - [select for diffs], Mon Sep 17 12:42:09 2007 UTC (16 years, 8 months ago) by espie
Branch: MAIN
Changes since 1.82: +4 -18 lines
Diff to previous 1.82 (colored)

rewrite of the basic suffix/target parsing: use hash for suffixes.

Store special targets in target hash, and use them for the parsing.

Use OP_DUMMY flag to mark targets that don't really exist yet, such
as interrupt and default nodes.

Also, .PATHxxx is special in suffixes.

Small tweaks to compat.c, so that run_commands does more stuff after
the fork() (and thus no need to free things).

Remove distinction between local and global jobs.

Revision 1.82 / (download) - annotate - [select for diffs], Mon Sep 17 12:01:17 2007 UTC (16 years, 8 months ago) by espie
Branch: MAIN
Changes since 1.81: +2 -5 lines
Diff to previous 1.81 (colored)

make usePipes the default, zap undocumented -P.

Revision 1.81 / (download) - annotate - [select for diffs], Mon Sep 17 11:11:30 2007 UTC (16 years, 8 months ago) by espie
Branch: MAIN
Changes since 1.80: +7 -7 lines
Diff to previous 1.80 (colored)

parseIncPath -> userIncludePath and assorted renames

Revision 1.80 / (download) - annotate - [select for diffs], Mon Sep 17 09:28:36 2007 UTC (16 years, 8 months ago) by espie
Branch: MAIN
Changes since 1.79: +12 -12 lines
Diff to previous 1.79 (colored)

kill extra spaces at end of line

Revision 1.79 / (download) - annotate - [select for diffs], Sun Sep 16 12:30:35 2007 UTC (16 years, 8 months ago) by espie
Branch: MAIN
Changes since 1.78: +3 -3 lines
Diff to previous 1.78 (colored)

rename dirSearchPath -> defaultPath, and openDirectories -> knownDirectories

Revision 1.78 / (download) - annotate - [select for diffs], Sun Sep 16 10:14:26 2007 UTC (16 years, 8 months ago) by espie
Branch: MAIN
Changes since 1.77: +2 -1 lines
Diff to previous 1.77 (colored)

cut up dir.c into dir.c/direxpand.c as there is very little interface between
two modules that do different things.

Revision 1.77 / (download) - annotate - [select for diffs], Sun Sep 16 09:46:14 2007 UTC (16 years, 8 months ago) by espie
Branch: MAIN
Changes since 1.76: +0 -0 lines
Diff to previous 1.76 (colored)

remove dead code: #define RECHECK is always on

Revision 1.76 / (download) - annotate - [select for diffs], Mon Jul 30 09:51:53 2007 UTC (16 years, 9 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.75: +16 -16 lines
Diff to previous 1.75 (colored)

everywhere except in Var_Parse, we always add/append variables to the
VAR_GLOBAL context, so make it the common case: rename the basic functions
to Var_Set_with_ctxt/Var_Append_with_ctxt, define Var_Set and Var_Append
as macros that specify VAR_GLOBAL, and use these.

okay miod@

Revision 1.75 / (download) - annotate - [select for diffs], Mon Jul 30 09:39:18 2007 UTC (16 years, 9 months ago) by espie
Branch: MAIN
Changes since 1.74: +310 -240 lines
Diff to previous 1.74 (colored)

clean-up. Basically:
- remove globals curdir and objdir, stuff them into a structure, and pass
it around to the relevant functions.
- cut up most of main code into functions:
figure_out_MACHINE/ARCH, figure_out_CURDIR, setup_CURDIR_OBJDIR, setup_VPATH,
no_fd_limits, read_makefile_list, read_all_make_rules...
- simplify the code used to figure out curdir/objdir.

No semantic changes.

okay miod@

Revision 1.74 / (download) - annotate - [select for diffs], Tue Jul 24 18:58:48 2007 UTC (16 years, 9 months ago) by espie
Branch: MAIN
Changes since 1.73: +0 -0 lines
Diff to previous 1.73 (colored)

simplify computations in the var module: instead of advancing a char *
and keeping track of a length, we just advance the char *, and ditch
the length. We can still get the length at the end of the top-level
functions to satisfy existing interfaces.

Much simpler code, less error-prone.

Okay millert@

Revision 1.73 / (download) - annotate - [select for diffs], Tue Jul 24 18:56:15 2007 UTC (16 years, 9 months ago) by espie
Branch: MAIN
Changes since 1.72: +0 -0 lines
Diff to previous 1.72 (colored)

move the code that grabs a value in Var_Parse in its own function,
get_expanded_value.

Extend the code a bit to be much more thorough in case of a recursive
expansion: shows exactly the cycle of variable names involved.

okay millert@

Revision 1.72 / (download) - annotate - [select for diffs], Tue Jul 24 18:52:47 2007 UTC (16 years, 9 months ago) by espie
Branch: MAIN
Changes since 1.71: +0 -0 lines
Diff to previous 1.71 (colored)

change Var_ParseSkip API to increment the position instead of returning a
length, simplifies code.

(warns a bit, symptom of some further issues to fix).

okay millert@

Revision 1.71 / (download) - annotate - [select for diffs], Sat Jul 21 14:41:07 2007 UTC (16 years, 10 months ago) by espie
Branch: MAIN
Changes since 1.70: +2 -2 lines
Diff to previous 1.70 (colored)

even though gcc doesn't reuse the utsname space, it could. Ensure MACHINE
stays defined.

Revision 1.70 / (download) - annotate - [select for diffs], Sun Jul 8 17:44:20 2007 UTC (16 years, 10 months ago) by espie
Branch: MAIN
Changes since 1.69: +3 -7 lines
Diff to previous 1.69 (colored)

A set of big related changes. okay millert@, tested further by kettenis@
and matthieu@

This all revolves around putting ALL global variables into one single big
hash, and using flags. This removes some impossible to understand stuff,
like old varfind, and allows for some nice stuff.
- each time we reference a global variable, we create it, possibly as a dummy
variable.
- each time we go to the environment, we remember it, thus we no longer go
back to it.

Lists of dependant changes:
- isolate changes to oldVars and checkEnvFirst.
- remove VAR_CMD and VAR_GLOBAL contexts. The only distinction is in parsevar.
Split Parse_DoVar into Parse_DoVar and Parse_CmdlineVar
- rework var modules around obtain_global_var, observe flags in various
functions like Var_Value and Var_Seti.
- Var_Seti/Var_Appendi are almost the same code, use that internally.
- add magic to handle the very special SHELL variable.
- introduce Var_Definedi for the cases where we don't want the actual
value, to simplify tests.
- add keyword .poison, parse it and set global flags accordingly.
- do poison_checks where needed.
- document poison.
- in for loops, set variable temporarily, so that Var_SubstVar will also
substitute it in varmodifiers expressions.

Revision 1.69 / (download) - annotate - [select for diffs], Tue Sep 26 18:20:50 2006 UTC (17 years, 7 months ago) by mk
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.68: +1 -2 lines
Diff to previous 1.68 (colored)

It seems pointless to assign a variable the atoi() return value after
the strtol() error checking block for the strtol() assignment for the
same variable.

ok brad mglocker

Revision 1.68 / (download) - annotate - [select for diffs], Sat May 6 10:52:34 2006 UTC (18 years ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.67: +2 -1 lines
Diff to previous 1.67 (colored)

do not bother defining End if !CLEANUP, reminded by lint.

Revision 1.67 / (download) - annotate - [select for diffs], Sun Feb 26 18:06:15 2006 UTC (18 years, 2 months ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.66: +2 -2 lines
Diff to previous 1.66 (colored)

consistent error message; from ray lai
ok deraadt

Revision 1.66 / (download) - annotate - [select for diffs], Thu Feb 17 02:37:21 2005 UTC (19 years, 3 months ago) by jolan
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.65: +2 -2 lines
Diff to previous 1.65 (colored)

alyte spelling-in-comment fixes

Revision 1.65 / (download) - annotate - [select for diffs], Wed Apr 21 13:17:49 2004 UTC (20 years, 1 month ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.64: +3 -3 lines
Diff to previous 1.64 (colored)

- correct SYNOPSIS
- add missing options to usage() and slight sync
- point people to psd doc

Revision 1.64 / (download) - annotate - [select for diffs], Wed Apr 7 13:11:36 2004 UTC (20 years, 1 month ago) by espie
Branch: MAIN
Changes since 1.63: +11 -24 lines
Diff to previous 1.63 (colored)

ISO function declarations, trim a few comments, rename a few variables to
more explicit/more consistent names.

okay otto@

Revision 1.63 / (download) - annotate - [select for diffs], Fri Jan 30 17:37:37 2004 UTC (20 years, 3 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.62: +2 -2 lines
Diff to previous 1.62 (colored)

a collection of flags is an int.
noticed by tedu.

Revision 1.62 / (download) - annotate - [select for diffs], Tue Jun 3 02:56:11 2003 UTC (20 years, 11 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.61: +2 -6 lines
Diff to previous 1.61 (colored)

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.

Revision 1.61 / (download) - annotate - [select for diffs], Mon Apr 21 23:14:06 2003 UTC (21 years, 1 month ago) by millert
Branch: MAIN
Changes since 1.60: +15 -7 lines
Diff to previous 1.60 (colored)

Stop parsing arguments when we hit "--".

Revision 1.60 / (download) - annotate - [select for diffs], Sun Apr 6 22:47:14 2003 UTC (21 years, 1 month ago) by espie
Branch: MAIN
Changes since 1.59: +5 -3 lines
Diff to previous 1.59 (colored)

get rid of some strcpy/sprintf.
ok krw@, matthieu@, deraadt@

Revision 1.59 / (download) - annotate - [select for diffs], Mon Dec 30 22:12:38 2002 UTC (21 years, 4 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.58: +4 -3 lines
Diff to previous 1.58 (colored)

Don't pass a NULL arg to Parse_DoVar which can happen if user specifies
"make --".

Check for "-", not "--" when deciding whether or not to pass something
to Lst_AtEnd() (I misunderstood what the old code was trying to do).
This fixes, e.g. ports/graphics/tiff

Revision 1.58 / (download) - annotate - [select for diffs], Mon Dec 30 02:29:24 2002 UTC (21 years, 4 months ago) by millert
Branch: MAIN
Changes since 1.57: +17 -24 lines
Diff to previous 1.57 (colored)

Avoid setting optind to 0 since in GNU getopt() that means the same
as optreset in BSD getopt.  This actually simplifies things a bit.
espie@ OK

Revision 1.57 / (download) - annotate - [select for diffs], Sat Mar 2 00:23:14 2002 UTC (22 years, 2 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_3_2_BASE, OPENBSD_3_2, OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.56: +1 -26 lines
Diff to previous 1.56 (colored)

kill #ifdef REMOTE stuff that only obfuscates issues.
ok millert@, miod@

Revision 1.56 / (download) - annotate - [select for diffs], Sun Nov 11 12:35:02 2001 UTC (22 years, 6 months ago) by espie
Branch: MAIN
Changes since 1.55: +6 -6 lines
Diff to previous 1.55 (colored)

Fixed version... don't see how this could work on i386, since it didn't
initialize create in main.c.

Revision 1.55 / (download) - annotate - [select for diffs], Sun Nov 11 06:02:06 2001 UTC (22 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.54: +4 -4 lines
Diff to previous 1.54 (colored)

undo changes that crash on (at least) the alpha

Revision 1.54 / (download) - annotate - [select for diffs], Sun Nov 11 01:19:23 2001 UTC (22 years, 6 months ago) by espie
Branch: MAIN
Changes since 1.53: +5 -5 lines
Diff to previous 1.53 (colored)

Redo LstInit as a macro: smaller and faster code in all cases, zeroing two
pointers is simpler than calling a function.
Recognize purely static lst headers, which don't really need any
initialization.
ok miod@

Revision 1.53 / (download) - annotate - [select for diffs], Tue Jun 5 11:59:11 2001 UTC (22 years, 11 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.52: +44 -32 lines
Diff to previous 1.52 (colored)

Use Str_concat instead of fixed buffers and snprintf in building paths.
Replace MAXPATHLEN with PATH_MAX (synch with op-make).
ok naddy@

Revision 1.52 / (download) - annotate - [select for diffs], Sun Jun 3 16:33:48 2001 UTC (22 years, 11 months ago) by espie
Branch: MAIN
Changes since 1.51: +5 -2 lines
Diff to previous 1.51 (colored)

Make sure targs get initialized.
Don't bother cleaning it up for speed

Revision 1.51 / (download) - annotate - [select for diffs], Thu May 31 13:38:48 2001 UTC (22 years, 11 months ago) by espie
Branch: MAIN
Changes since 1.50: +3 -2 lines
Diff to previous 1.50 (colored)

Simple guard against overflow. Better code to appear.

Revision 1.50 / (download) - annotate - [select for diffs], Tue May 29 17:00:54 2001 UTC (22 years, 11 months ago) by espie
Branch: MAIN
Changes since 1.49: +2 -2 lines
Diff to previous 1.49 (colored)

Protect against copying a too long PWD.
This is temporary, this code needs better fixes.

Revision 1.49 / (download) - annotate - [select for diffs], Tue May 29 12:53:41 2001 UTC (22 years, 11 months ago) by espie
Branch: MAIN
Changes since 1.48: +3 -1 lines
Diff to previous 1.48 (colored)

Take includes out of lst.h, re-add what's needed to separate files.
Removes remaining lint stuff from lst.lib.

Revision 1.48 / (download) - annotate - [select for diffs], Wed May 23 12:34:46 2001 UTC (23 years ago) by espie
Branch: MAIN
Changes since 1.47: +137 -490 lines
Diff to previous 1.47 (colored)

Mostly clean-up:
- cut up those huge include files into separate interfaces for all modules.
Put the interface documentation there, and not with the implementation.
- light-weight includes for needed concrete types (lst_t.h, timestamp_t.h).
- cut out some more logically separate parts: cmd_exec, varname, parsevar,
timestamp.
- put all error handling functions together, so that we will be able to
clean them up.
- more systematic naming: functioni  to handle interval, function to handle
string.
- put the init/end code apart to minimize coupling.
- kill weird types like ReturnStatus and Boolean. Use standard bool (with a
fallback for non-iso systems)
- better interface documentation for lots of subsystems.

As a result, make compilation goes somewhat faster (5%, even considering
the largish BSD copyrights to read). The corresponding preprocessed
source goes down from 1,5M to 1M.

A few minor code changes as well: Parse_DoVar is no longer destructive.
Parse_IsVar functionality is folded into Parse_DoVar (as it knows what an
assignment is), a few more interval handling functions. Avoid calling
XXX_End when they do nothing, just #define XXX_End   to nothing.

Parse_DoVar is slightly more general: it will handle compound assignments
as long as they make sense, e.g., VAR +!= cmd
will work.  As a side effect, VAR++=value now triggers an error
(two + in assignment).
- this stuff doesn't occur in portable Makefiles.
- writing VAR++ = value or VAR+ +=value  disambiguates it.
- this is a good thing, it uncovered a bug in bsd.port.mk.

Tested by naddy@. Okayed millert@. I'll handle the fallback if there is
any. This went through a full make build anyways, including isakmpd
(without mickey's custom binutils, as he didn't see fit to share it with me).

Revision 1.47 / (download) - annotate - [select for diffs], Mon May 7 22:57:19 2001 UTC (23 years ago) by espie
Branch: MAIN
Changes since 1.46: +2 -3 lines
Diff to previous 1.46 (colored)

avoid closing the same file twice. parse module assumes ownership of
file handles it's passed to.

(this is apparently harmless on BSDs, but is still a bug).

Revision 1.46 / (download) - annotate - [select for diffs], Thu May 3 13:41:07 2001 UTC (23 years ago) by espie
Branch: MAIN
Changes since 1.45: +140 -188 lines
Diff to previous 1.45 (colored)

Synch with my current work.
Numerous changes:
- generate can build several tables
- style cleanup
- statistics code
- use variable names throughout (struct Name)
- recursive variables everywhere
- faster parser (pass buffer along instead of allocating multiple copies)
- correct parser. Handles comments everywhere, and ; correctly
- more string intervals
- simplified dir.c, less recursion.
- extended for loops
- sinclude()
- finished removing extra junk from Lst_*
- handles ${@D} and friends in a simpler way
- cleaned up and modular VarModifiers handling.
- recognizes some gnu Makefile usages and errors out about them.

Additionally, some extra functionality is defined by FEATURES. The set of
functionalities is currently hardcoded to OpenBSD defaults, but this may
include support for some NetBSD extensions, like ODE modifiers.

Backed by miod@ and millert@, who finally got sick of my endless patches...

Revision 1.45 / (download) - annotate - [select for diffs], Fri Nov 24 14:36:34 2000 UTC (23 years, 5 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.44: +5 -4 lines
Diff to previous 1.44 (colored)

Change the time stamp interface to use an abstract datatype.
Define two possible interfaces: the classic one,
and the new one (used where available) that depends on timespec.

Better granularity, make is now able to distinguish between files that
were built during the same second.

Revision 1.44 / (download) - annotate - [select for diffs], Fri Oct 13 08:29:20 2000 UTC (23 years, 7 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8
Changes since 1.43: +5 -5 lines
Diff to previous 1.43 (colored)

esetenv: does a setenv and bails out if error.

Revision 1.43 / (download) - annotate - [select for diffs], Thu Sep 14 13:46:45 2000 UTC (23 years, 8 months ago) by espie
Branch: MAIN
Changes since 1.42: +4 -3 lines
Diff to previous 1.42 (colored)

Replace the old hash used to hold file names within a directory with
open hashing.

An interesting optimization is that the open hashing interface is more
fine-grained, hence we can compute the correct hash value at the start
of Dir_FindFile, and reuse it for each hash structure into which we look
(the effect is measurable on large directories along with objdir/VPATH).

Remove a few unnecessary Lst_Open/Lst_Close that serve no purpose except
obfuscating the code.

The interface to dir.h changes slightly, hence tedious includes changes...

Revision 1.42 / (download) - annotate - [select for diffs], Thu Sep 14 13:43:31 2000 UTC (23 years, 8 months ago) by espie
Branch: MAIN
Changes since 1.41: +30 -32 lines
Diff to previous 1.41 (colored)

- new DirReadDir internal function, that just reads a directory from
the disk or from a cache.
- use it in Dir_AddDir, and directly to set up dot.
- change Dir_AddDir to use string intervals, as this simplifies
dependend functions.
- set up an open-hashing cache for opened directory names.
- add_dirpath() function in main, to simplify code.
- simplify cleaning-up directories, as Dir_ClearPath is overkill.

Revision 1.41 / (download) - annotate - [select for diffs], Thu Sep 14 13:32:07 2000 UTC (23 years, 8 months ago) by espie
Branch: MAIN
Changes since 1.40: +18 -15 lines
Diff to previous 1.40 (colored)

Some systematic clean-up.
- UNUSED macro that expands to __attribute__((unused)) for gcc
- move rcsid around so that they can be tagged UNUSED.
- activate -Wunused.
- use UNUSED instead of kludgy junk for function arguments.
- add extern to all extern prototypes.
- update comments in lst.h.
- clean up var.c a little bit, constifying arguments, updating comments...

Revision 1.40 / (download) - annotate - [select for diffs], Mon Jul 31 21:01:40 2000 UTC (23 years, 9 months ago) by espie
Branch: MAIN
Changes since 1.39: +3 -3 lines
Diff to previous 1.39 (colored)

POSIX rules: pass variables set on the command line to submakes through
MAKEFLAGS

Revision 1.39 / (download) - annotate - [select for diffs], Tue Jul 18 20:17:20 2000 UTC (23 years, 10 months ago) by espie
Branch: MAIN
Changes since 1.38: +77 -49 lines
Diff to previous 1.38 (colored)

Handle MAKEFLAGS variation mandated by POSIX.

Code to pass variable definitions to submakes through make flags.
Not activated yet, need to fix src/ first.

Revision 1.38 / (download) - annotate - [select for diffs], Sat Jul 1 00:21:22 2000 UTC (23 years, 10 months ago) by espie
Branch: MAIN
Changes since 1.37: +3 -3 lines
Diff to previous 1.37 (colored)

Forgot to import one estrdup from my trunk.

Ensure make prints sane error messages when obj/ exists.

Revision 1.37 / (download) - annotate - [select for diffs], Fri Jun 23 16:39:45 2000 UTC (23 years, 11 months ago) by espie
Branch: MAIN
Changes since 1.36: +3 -3 lines
Diff to previous 1.36 (colored)

This patch is worth a lot, speed-wise.

This does introduce a proper stack of IFiles to handle included files:
instead of having the current file be a special case, it's also an IFile.

The corresponding code is slightly unobfuscated, removing the error-prone
ParseEOF function, freeing the filename systematically (thus, main.c needs
to strdup stdin), and merging both include functions lookup into one.

The speed gain comes from changing the IFile structure to merge with
fgetln seamlessly.

The low-level parse code is mostly moved to a new file, lowparse.c, to
make things easier to read (see next patch as well).

Accordingly, util.c gains a fgetln.

Note the interaction between Parse_File, Dir_FindFile, and ReadMakefile in
main.c. This patch closes a subtle memory hole (only the Makefile names,
so rather small).

Reviewed by miod@.

Revision 1.36 / (download) - annotate - [select for diffs], Fri Jun 23 16:23:26 2000 UTC (23 years, 11 months ago) by espie
Branch: MAIN
Changes since 1.35: +3 -3 lines
Diff to previous 1.35 (colored)

This patch separates local contexts from global contexts for good.
Apart from a few casts, VAR_GLOBAL and friends are separate
data structures, so we use a small array for local variables.

We also junk allVars, since TargFreeGN can release local nodes,
and var.c has explicit lists for its variables already.

Reviewed millert@ and miod@.

Revision 1.35 / (download) - annotate - [select for diffs], Fri Jun 23 16:15:49 2000 UTC (23 years, 11 months ago) by espie
Branch: MAIN
Changes since 1.34: +4 -6 lines
Diff to previous 1.34 (colored)

Trivial consequences of the previous list changes:

- audit code for Lst_Datum, it's never applied to an empty pointer,
so check can be removed -> turn into a macro,
- Lst_First, Lst_Last can become macro as well
- specialized version of Lst_Succ (Lst_Adv) to use in loops where it cannot
fail,
- Lst_Open can no longer fail. Trim down corresponding code.

Reviewed millert@, miod@

Revision 1.34 / (download) - annotate - [select for diffs], Sat Jun 17 14:40:29 2000 UTC (23 years, 11 months ago) by espie
Branch: MAIN
Changes since 1.33: +13 -9 lines
Diff to previous 1.33 (colored)

A few assorted changes, to remove more dynamic lists.
- in Dir_Expand, path is a misnomer. Use a temp variable instead...
Reformat code for readability.
- Change Parse_MainName/Targ_FindList so that they fill arguments instead
of allocating new lists.
- nuke Targ_FindList(TG_NOCREATE), as this is never used.

- close a small memory hole (forgot to free sysMkPath if CLEANUP).

Reviewed by millert@

Revision 1.33 / (download) - annotate - [select for diffs], Sat Jun 17 14:38:18 2000 UTC (23 years, 11 months ago) by espie
Branch: MAIN
Changes since 1.32: +36 -36 lines
Diff to previous 1.32 (colored)

This patch introduces a distinction between
Lst_Init (constructor) and Lst_New (allocation + construction)
Lst_Destroy (destructor) and Lst_Delete (deallocation + destruction),
and uses that to turn most dynamic allocation of lists (Lst pointers)
into static structures (LIST).

Most of this is mundane, except for allGNs in targ.c, where the code must
be checked to verify that Targ_Init is called soon enough.

Lst_New is a temporary addition. All lists will soon be static.

Reviewed by millert@, like the previous patch.

Revision 1.32 / (download) - annotate - [select for diffs], Sat Jun 10 01:41:05 2000 UTC (23 years, 11 months ago) by espie
Branch: MAIN
Changes since 1.31: +10 -9 lines
Diff to previous 1.31 (colored)

Clean-up patch: use `void *' instead of old-fashioned ClientData/Address.

Revision 1.31 / (download) - annotate - [select for diffs], Sat Jun 10 01:32:23 2000 UTC (23 years, 11 months ago) by espie
Branch: MAIN
Changes since 1.30: +5 -7 lines
Diff to previous 1.30 (colored)

Thus, Lst_ForEach no longer needs returning a status.
In fact, it can become a macro based on Lst_ForEachFrom.
This also introduces Lst_Every, as a shortcut for the very common case where
Lst_ForEach does not need any user data.

Finally,  make consistent use of a few function typedefs, instead of having
explicit void (*)(Lst)  arguments all over the place.

Revision 1.30 / (download) - annotate - [select for diffs], Mon Apr 3 02:58:46 2000 UTC (24 years, 1 month ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.29: +4 -2 lines
Diff to previous 1.29 (colored)

Junk CDPATH from the environment.

Revision 1.29 / (download) - annotate - [select for diffs], Sun Mar 26 16:21:32 2000 UTC (24 years, 1 month ago) by espie
Branch: MAIN
Changes since 1.28: +4 -4 lines
Diff to previous 1.28 (colored)

Remove idiotic, braindead casts T* -> void*
They serve no purpose, except hiding potential bugs.

In particular, remove (ClientData) cast from macro, showing potentially
troublesome use of Hashes to store time_t.

Revision 1.28 / (download) - annotate - [select for diffs], Wed Feb 2 13:47:47 2000 UTC (24 years, 3 months ago) by espie
Branch: MAIN
Changes since 1.27: +3 -3 lines
Diff to previous 1.27 (colored)

Bug-fix: make should behave sensibly when presented with negative times...

- let *_MTime return booleans, as that's what they're used for, the time_t
is set as a side effect.

- use OUT_OF_DATE for a date starting point, set it at the origin of time.

Revision 1.27 / (download) - annotate - [select for diffs], Sun Dec 19 00:04:25 1999 UTC (24 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.26: +4 -4 lines
Diff to previous 1.26 (colored)

Rearrange Lst_Find interface to conform better with other functions.

Revision 1.26 / (download) - annotate - [select for diffs], Sat Dec 18 21:58:07 1999 UTC (24 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.25: +5 -5 lines
Diff to previous 1.25 (colored)

Nothing ever checks ReturnStatus on Lst_Insert, Lst_Append, Lst_AtFront,
Lst_AtEnd, Lst_Concat, Lst_Remove, Lst_Replace.

Don't bother returning one.

Revision 1.25 / (download) - annotate - [select for diffs], Sat Dec 18 21:53:32 1999 UTC (24 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.24: +7 -7 lines
Diff to previous 1.24 (colored)

NIL, NILGNODE, etc, are only glorified NULL.
Get rid of them.

Get rid of list.h, nothing uses it anyway.

Revision 1.24 / (download) - annotate - [select for diffs], Sat Dec 18 02:11:27 1999 UTC (24 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.23: +6 -6 lines
Diff to previous 1.23 (colored)

make does not use circular lists, get rid of the extra weight.

Revision 1.23 / (download) - annotate - [select for diffs], Thu Dec 16 17:27:18 1999 UTC (24 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.22: +3 -3 lines
Diff to previous 1.22 (colored)

Var_Subst is actually two distinct functions folded into one:
split the function specific to for.c out, and give them more sensible
arguments at the same time.

This makes .for loop handling more efficient, as we have some heuristic
to evaluate the size of the buffer needed...

Revision 1.22 / (download) - annotate - [select for diffs], Thu Dec 16 17:02:45 1999 UTC (24 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.21: +7 -8 lines
Diff to previous 1.21 (colored)

Allocate buffers as static data structures.
This cuts down quite a lot of malloc, since in actual use,
buffer usage is mostly static.

Revision 1.21 / (download) - annotate - [select for diffs], Thu Dec 16 16:41:41 1999 UTC (24 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.20: +4 -3 lines
Diff to previous 1.20 (colored)

Split Buf_GetAll into Buf_Retrieve/Buf_Size.
(idiotic to retrieve size every time when it's used half the time)

Revision 1.20 / (download) - annotate - [select for diffs], Thu Dec 9 18:20:06 1999 UTC (24 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.19: +2 -77 lines
Diff to previous 1.19 (colored)

Split some allocation/error handling functions out of main.c

Revision 1.19 / (download) - annotate - [select for diffs], Mon Dec 6 22:28:44 1999 UTC (24 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.18: +8 -12 lines
Diff to previous 1.18 (colored)

Extra parameter no longer needed, ditch.

Revision 1.18 / (download) - annotate - [select for diffs], Mon Dec 6 22:24:31 1999 UTC (24 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.17: +7 -7 lines
Diff to previous 1.17 (colored)

Clean up buffers interface somewhat:

- buf.c deals exclusively with chars. Be explicit about it, and remove
extraneous dumb casts to char (can hide real type errors).
- buffer sizes are size_t. Note that bp->left can never become NULL.
- Buf_GetAll is happy with a NULL pointer for the size, remove unneeded
extra pointers.
- Propagate size_t to all places where buffer functions are used.

Revision 1.17 / (download) - annotate - [select for diffs], Mon Dec 6 22:20:34 1999 UTC (24 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.16: +8 -7 lines
Diff to previous 1.16 (colored)

Fix handling of
VAR!=

specifically, properly distinguish between bad commands and empty results.

Revision 1.16 / (download) - annotate - [select for diffs], Wed Nov 10 14:11:49 1999 UTC (24 years, 6 months ago) by espie
Branch: MAIN
Changes since 1.15: +3 -2 lines
Diff to previous 1.15 (colored)

Turn on strict-prototypes, add missing prototypes.
Move main prototype to main.c, as this is not used
from any other file.

Close open bug.

Revision 1.15 / (download) - annotate - [select for diffs], Sat Jan 9 16:45:02 1999 UTC (25 years, 4 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6, OPENBSD_2_5_BASE, OPENBSD_2_5
Changes since 1.14: +24 -5 lines
Diff to previous 1.14 (colored)

close PR 685.

Slightly trimmed down version of fix by assar@sics.se
(strtol failure is usually simpler to test, and error messages should
identify the program that produces them)

Revision 1.14 / (download) - annotate - [select for diffs], Sat Dec 5 00:06:28 1998 UTC (25 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.13: +18 -9 lines
Diff to previous 1.13 (colored)

Modifications from netbsd:
- don't interfere with MACHINE/MACHINE_ARCH defines for bootstrap
- type clean-up, time_t, and printing `unknown' ints
- fix TARGET/MEMBER bug in archive rules
- memmove...
- cleaner Error handler.
- reentrant brk_string
- .MAKE env variable
- preliminary scaffolding for .NOPATH

Other improvements:
- efree
- shellneed streamlined
- display Stop in .CURDIR after an error.
- document most features and misfeatures.
- add a few OpenBSD notes to the tutorial.

Revision 1.13 / (download) - annotate - [select for diffs], Wed Jan 28 12:41:50 1998 UTC (26 years, 3 months ago) by niklas
Branch: MAIN
CVS Tags: OPENBSD_2_4_BASE, OPENBSD_2_4, OPENBSD_2_3_BASE, OPENBSD_2_3
Changes since 1.12: +5 -4 lines
Diff to previous 1.12 (colored)

Use BSDmakefile in favour of [mM]akefile if existent.  Good for
cases where you want BSDmake specific facilities not messing up other
implementations of make

Revision 1.12 / (download) - annotate - [select for diffs], Tue Apr 1 07:28:13 1997 UTC (27 years, 1 month ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_2_BASE, OPENBSD_2_2, OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.11: +26 -21 lines
Diff to previous 1.11 (colored)

Sync with NetBSD (mostly by christos initial substitution/regexp from 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]
- BSD did not traditionally have <sys/cdefs.h>; use BSD4_4 instead and include
  <sys/param.h> to grab it.
- Don't compile the regex code if MAKE_BOOTSTRAP (from gwr)
- Use explicit .c.o rule in Makefile.boot so that the bootstrap process works.
- Use only integral types in procedure arguments. [buf.c buf.h]
- Include <stdlib.h> to get getenv() prototype on SVR4
- if __STDC__ -> ifdef __STDC__ to appease SVR4
- Define const and volatile for non __STDC__
- Implement snprintf() and vsnprintf() for non BSD4_4 systems.
- Make $MACHINE_ARCH settable from the environment.
- Fix .USE directive problems: (reported by cgd)
    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.
- 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.
- Fix problems in the RE substitution error handling.
- Locate all the children of a node marked as MADE.
- Do not compile-in ${MACHINE} (as per NetBSD PR#3386)
- 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.
- Make sure that the children of nodes that are marked .MADE, are marked
  UPTODATE and their timestamps are consistent.
- Don't disable wildcards completely; they are used by other Makefiles.

Revision 1.11 / (download) - annotate - [select for diffs], Mon Jan 27 05:24:09 1997 UTC (27 years, 3 months ago) by briggs
Branch: MAIN
Changes since 1.10: +8 -5 lines
Diff to previous 1.10 (colored)

Set MACHINE_ARCH only if it's not already in the environment.  Update
comment accordingly.  Patch from Dale Rahn.

Revision 1.10 / (download) - annotate - [select for diffs], Wed Jan 15 23:42:51 1997 UTC (27 years, 4 months ago) by millert
Branch: MAIN
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored)

getopt(3) returns -1 when out of args, not EOF, whee!

Revision 1.9 / (download) - annotate - [select for diffs], Sat Nov 30 21:08:59 1996 UTC (27 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.8: +127 -81 lines
Diff to previous 1.8 (colored)

Sync with NetBSD:
- 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.
- Fix NetBSD PR #2930: declare missing variable.

Revision 1.8 / (download) - annotate - [select for diffs], Mon Sep 2 16:04:13 1996 UTC (27 years, 8 months ago) by briggs
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.7: +156 -4 lines
Diff to previous 1.7 (colored)

Sync up with NetBSD:
(christos)
	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.
(christos)
	- 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'
(christos)
	Fix bug where make will always exit with 0, even when one or more
	parallel jobs failed. (Only affects parallel make code)
(christos)
	Protect __P from being multiply defined (for systems that already
	define it)
(christos) Add strdup() since ultrix is missing it.
	From Larry Schwimmer <rosebud@cyclone.Stanford.EDU>
(christos) Add estrdup(), a checked version of strdup and use it.
(christos) Recognize SVR4 style long filename entries in archives.
(thorpej) Tidy up some RCS ids a bit.

Revision 1.7 / (download) - annotate - [select for diffs], Sun Apr 21 23:43:21 1996 UTC (28 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.6: +20 -6 lines
Diff to previous 1.6 (colored)

sync to netbsd 960418

Revision 1.6 / (download) - annotate - [select for diffs], Wed Mar 27 19:32:36 1996 UTC (28 years, 1 month ago) by niklas
Branch: MAIN
Changes since 1.5: +8 -3 lines
Diff to previous 1.5 (colored)

From NetBSD: merge of 960317

Revision 1.5 / (download) - annotate - [select for diffs], Fri Feb 23 18:32:56 1996 UTC (28 years, 3 months ago) by niklas
Branch: MAIN
Changes since 1.4: +46 -9 lines
Diff to previous 1.4 (colored)

Implement an -m option used for replacing /usr/share/mk with a
custom search path, like $DESTDIR/usr/share/mk

Revision 1.4 / (download) - annotate - [select for diffs], Thu Feb 22 22:24:49 1996 UTC (28 years, 3 months ago) by niklas
Branch: MAIN
Changes since 1.3: +3 -3 lines
Diff to previous 1.3 (colored)

From NetBSD:
Support SVR4 style archives.
Fix pr/1421 (from Matthew Green) and pr/1997 (from Jeff Thieleke).
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.

Revision 1.3 / (download) - annotate - [select for diffs], Wed Jan 3 09:50:47 1996 UTC (28 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.2: +6 -3 lines
Diff to previous 1.2 (colored)

Parse_DoVar() trashes string, so pass it a strdup()'d copy of *argv...
then kvm_getargv will show a nice unhacked argument list

Revision 1.2 / (download) - annotate - [select for diffs], Thu Dec 14 03:23:33 1995 UTC (28 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +59 -17 lines
Diff to previous 1.1 (colored)

from christos@netbsd:
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.
- 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.
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.

from cgd@netbsd:
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.)

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:45:42 1995 UTC (28 years, 7 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:45:42 1995 UTC (28 years, 7 months ago) by deraadt
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.