History log of /src/usr.bin/make/Makefile
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
# 1.128 19-Jan-2025 rillig

make: fix code coverage counts

See tests/usr.bin/gcov/t_gcov.sh.


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base
# 1.127 19-Dec-2023 rillig

branches: 1.127.2;
make: clean up code coverage report files

Remove trailing whitespace.

Remove the first line, as it only repeats the filename.

Remove the line numbers, as they are mostly the same as in the original
source file.


# 1.126 17-Dec-2023 rillig

make: on cleandir, clean the unit-tests as well


# 1.125 19-Jun-2023 rillig

make: sort files in coverage report alphabetically


# 1.124 03-Jun-2023 lukem

bsd.own.mk: rename GCC_NO_* to CC_WNO_*

Rename compiler-warning-disable variables from
GCC_NO_warning
to
CC_WNO_warning
where warning is the full warning name as used by the compiler.

GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.


Revision tags: netbsd-10-1-RELEASE netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base
# 1.123 27-Sep-2022 rillig

make: set WARNS to 6, from the default 5

No binary change on x86_64.


# 1.122 03-May-2022 rillig

make: remove test scenarios for old GCC versions

These had been useful for NetBSD 8, which used GCC 5.


# 1.121 26-Jan-2022 rillig

make: generate coverage summary on 'make test-coverage'


# 1.120 09-Jan-2022 rillig

make: in Cmd_Exec, return error message instead of format string

This change leaves only literal format strings in parse.c. It allows
for more detailed error messages than the current "non-zero status" or
"exited on a signal".

No functional change.


# 1.119 12-Dec-2021 rillig

make: do not report '?' for fully covered header files


# 1.118 12-Dec-2021 rillig

make: only define target report-coverage if USE_COVERAGE is yes

Without USE_COVERAGE, GCOV was undefined, the '2>&1' passed all error
messages to GCOV_PERL, when then discarded them. If the error messages
had been left on stderr, the error message 'sh: arch.o.gcda: not found'
would have been a clear indicator of the actual cause of an empty
coverage report.


# 1.117 28-Nov-2021 rillig

make: replace bloated bit-set-to-string code with simple code

It was a nice idea to implement a bit-set using an enum type and have a
generic ToString function for them. In the end, the implementation
involved really heavy preprocessor magic and was probably difficult to
understand. Replace all the code with a few bits of straight-forward
preprocessor magic that can be readily understood by just looking 5
lines around, instead of digging through 130 lines of lengthy macro
definitions.

Curiously, this reduces the binary size even though the 3 ToString
functions now have a few lines of duplicate code and there are more
explicit function calls.

The ToString functions are only seldom used, so the additional memory
allocation is acceptable.

No functional change.


# 1.116 31-Jul-2021 rillig

make: fix lint warnings

The string functions from str.h are declared as 'static __unused' when
compiled with GCC, but lint explicitly undefines __GCC__ during
preprocessing. Therefore, make those functions inline, to prevent
warnings that they are unused.

The macro UNCONST is used in a few places, and (again) since lint
undefines __GCC__, that macro expanded to a simple type cast, which lint
warned about. To prevent this warning, implement UNCONST as a function
that works everywhere and hides the type cast.

In filemon_open, the code for closing F->in was obviously unreachable.

No functional change.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1
# 1.115 30-May-2021 rillig

make: fix reported code coverage for *.h

In 'make test-coverage', the number of uncovered lines for inline
functions in headers was reported too high. The cause for this is that
gcov reports the coverage for these functions multiple times, once per
translation unit. If some of the translation units don't use these
inline functions, summing the lines containing '#####' quickly leads to
numbers that are obviously too high.


Revision tags: cjep_staticlib_x-base
# 1.114 11-Apr-2021 rillig

branches: 1.114.2;
make: clean up Makefile

The dependencies on the header files are handled by 'make depend'. They
do not need to be spelled out.


# 1.113 22-Feb-2021 rillig

make: fix report-coverage

On NetBSD 8.0 it still worked. Maybe gcov doesn't support .c files as
arguments anymore. Using the .gcda files works and is more reliable
anyway since it covers the inline functions in the headers as well.


# 1.112 30-Jan-2021 rillig

make(1): run lint with strict bool mode

The make code is not supposed to use constructs such as "if (strcmp(s1,
s2))" or "if (p && *p)", instead all boolean expressions have a form
that would be accepted by a C#, Go or Java compiler as well. This also
ensures that pre-C99 compilers generate equivalent code as C99
compilers, at least regarding boolean expressions.


# 1.111 12-Dec-2020 rillig

make(1): add number of uncovered lines to coverage report


# 1.110 12-Dec-2020 rillig

make(1): add target test-coverage


# 1.109 06-Dec-2020 rillig

make(1): move .include lines as far down as possible


# 1.108 06-Dec-2020 rillig

make(1): move COPTS above <bsd.prog.mk>


# 1.107 03-Dec-2020 rillig

make(1): format coverage summary as a table

This is only used interactively, not in the official builds, therefore
the additional dependency on Perl doesn't matter. The same result could
have been achieved in any other programming language, but probably not
as concisely.


# 1.106 25-Oct-2020 rillig

make(1): remove unused strlist_t


# 1.105 23-Oct-2020 rillig

make(1): add target-specific COPTS when generating cpre or casm


# 1.104 18-Oct-2020 rillig

make(1): fix GCC warning about small buffer for cohort_num

Since unmade_cohorts is a signed number (the code contains an underflow
check), the result of the '%' operator could be negative and result in
"#-999999", which would overflow the buffer, truncating the last digit.


# 1.103 05-Oct-2020 rillig

make(1): enable format string truncation warnings for parse.c

No node is ever going to have a million or more cohorts. And even if
there were, this name is only used for printing informational messages.


# 1.102 05-Oct-2020 rillig

make(1): revert previous commit

It had accidentally reverted all the work from the past few days.


# 1.101 05-Oct-2020 rillig

make(1): fix double-free bug in -DCLEANUP mode (since 2020-10-02)

The bug had been introduced with dir.c 1.155 on 2020-10-02 22:20:25. In
that commit, openDirectories was replaced with a combination of a list
with a hash table, for more efficient lookup by name.

Upon cleanup, OpenDirs_Done is called, which in turn called
Dir_ClearPath. Dir_ClearPath takes full ownership of the given list and
empties it. This was no problem before since afterwards the list was
empty and calling Lst_Free just frees the remaining list pointer.

With OpenDirs, this list was combined with a hash table, and the hash
table contains the list nodes, assuming that the OpenDirs functions have
full ownership of both the list and the hash table. This assumption was
generally correct, except for the one moment during cleanup where full
ownership of the list was passed to Dir_ClearPath, while the hash table
still contained pointers to the (now freed) list nodes. This by itself
was not a problem since the hash table would be freed afterwards. But
as part of Dir_ClearPath, OpenDirs_Remove was called, which looked up
the freed directory by name and now found the freed list node, trying to
free it again. Boom.

Fixed by replacing the call to Dir_ClearPath with code that only frees
the directories, without giving up control over the list.


# 1.100 05-Oct-2020 rillig

make(1): allow easy creation of preprocessed source and assembler

To be used during development, to see how changes in the source code
affect the generated machine code.


# 1.99 01-Sep-2020 rillig

make(1): remove filemon object files on clean


# 1.98 31-Aug-2020 rillig

make(1): fix compilation with GCC 8


# 1.97 31-Aug-2020 rillig

make(1): fix copy-and-paste mistake for compiling with GCC10


# 1.96 28-Aug-2020 rillig

make(1): remove redundant MAKEFLAGS from subdir make

The make flags are passed via the environment, not via the command line.
This is not as obvious and visible, but it works.


# 1.95 27-Aug-2020 rillig

make(1): pass the command-line variables to the subdir make


# 1.94 26-Aug-2020 rillig

make(1): remove header sprite.h

Make is independent of the Sprite operating system.


# 1.93 25-Aug-2020 rillig

make(1): allow custom build options


# 1.92 23-Aug-2020 rillig

make(1): allow to run only selected tests via the command line


# 1.91 22-Aug-2020 sjg

Use TEST_MAKE to run unit-tests

This lets us take advantage of new features like ${.SHELL}


# 1.90 19-Aug-2020 rillig

make(1): don't optimize when measuring the code coverage

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96622


# 1.89 15-Aug-2020 rillig

make(1): fix archive test

Even though it is commented out in this Makefile, it is still run by
atf, on purpose. This test is broken on FreeBSD, but on NetBSD it
should still be run.

Without removing the archive first, it could be left over from a
previous test failure and thus be newer than all its members, leading to
${.OODATE} being empty.


# 1.88 12-Aug-2020 rillig

make(1): enable -Wcast-qual for var.c again

When it became disabled 9 years ago, there were 15 instances of UNCONST
in the code. These have been removed in the latest cleanup sessions.

Tested with GCC 5 from NetBSD 8 and GCC 10 from pkgsrc.


# 1.87 12-Aug-2020 rillig

make(1): allow optional compilation with GCC 10, use gcov from GCC


# 1.86 10-Aug-2020 rillig

make(1): make gcov command line configurable

Some useful options are -a or -f.


# 1.85 10-Aug-2020 rillig

make(1): clean up coverage files even if USE_COVERAGE is not set


# 1.84 09-Aug-2020 rillig

make(1): allow to build using GCC 9 during development


# 1.83 08-Aug-2020 rillig

make(1): add more detailed debug logging for variable modifiers

Before a modifier is applied to a variable, it is not yet parsed,
therefore it is only possible to log a rough estimate of the modifier.
But after applying it, the parsing position has advanced, and the full
modifier can be logged.

In addition, to fully understand how the modifiers work, it's not enough
to just know the variable names and values, there are also some flags
that influence how the modifiers behave. The most influential is
VARE_WANTRES.

Thanks to sjg for the extensive review and valuable feedback on the
first drafts.


# 1.82 07-Aug-2020 rillig

make(1): one file per line in the Makefile

Suggested by sjg.


# 1.81 06-Aug-2020 rillig

make(1): revert previous commit; "make retest" was already possible

What I really meant to allow was to run "make sync-mi" directly from the
main directory. But adding that to TARGETS didn't do anything.


# 1.80 06-Aug-2020 rillig

make(1): allow "make retest" directly from the main directory


# 1.79 03-Aug-2020 rillig

make(1): no declaration-after-statement anymore

NetBSD make is intended to be maximally portable, therefore it uses only
C89. This was not declared in the Makefile before.

There are still a few places in parse.c and metachar.c that use
end-of-line comments. These will be fixed in a follow-up commit.


# 1.78 01-Aug-2020 rillig

make(1): remove line numbers from generated code coverage files

The line numbers make it difficult to spot changes in the code and
coverage if a line is added or removed from the code.


# 1.77 31-Jul-2020 rillig

make(1): fix undefined behavior in malformed :S modifier

The unit tests failed on Ubuntu, and by looking closely at the code, it
was trivial to see the out-of-bounds memory read.

Other modifiers may have the same problem and will be inspected later.


# 1.76 29-Jul-2020 rillig

make(1): use specialized return type for ApplyModifier functions

This makes it immediately obvious what happens after a modifier has been
applied, instead of having to translate single-character mnemonics or
booleans to their actual intention.

This also reduces the size of the binary since there are fewer jumps.


# 1.75 26-Jul-2020 rillig

make(1): explicitly add dependencies on headers

This prevents partial builds after changing a header. The declared
dependencies are more than strictly necessary, but that's still better
than having inconsistent partial builds because too few dependencies are
declared.


# 1.74 26-Jul-2020 rillig

make(1): condense the list library into a single file

The list library is only used in make(1). Having it spread out over 28
files made it look more complex than it really is. In fact, it's just a
versatile generic data type like in hash.c.

Having all the list functions in a single file reduces the code size,
both by omitting the many RCS Ids and by inlining commonly used code.


# 1.73 25-Jul-2020 rillig

make(1): make it easy to run gcov on the code

There seems to be no gcov support in share/mk yes, but it's still good
to have, especially for a complex program like make(1).


# 1.72 25-Jul-2020 rillig

make(1): indent Makefile directives like in pkgsrc

This makes it easier to see the corresponding .if/.endif, even without
comments.


# 1.71 25-Jul-2020 rillig

make(1): format Makefile consistently


# 1.70 25-Jul-2020 rillig

make(1): regroup source files


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
# 1.69 06-Feb-2020 sjg

Fix meta_compat mode.

We need to call meta_job_output() from meta_compat_parent()
Also, the need for extra fds for meta mode only applies when
using filemon_ktrace.c.
Since we hope to see more interfaces like that, test for
USE_FILEMON_DEV being not defined.

Reviewed by: riastradh


# 1.68 19-Jan-2020 riastradh

Tweak makefile for USE_FILEMON=dev, from sjg.


# 1.67 19-Jan-2020 riastradh

Per sjg's suggestion, split filemon API into separate back ends.

By default we use the ktrace back end, but the /dev/filemon back end
is available as a compile-time option, by setting USE_FILEMON=dev in
make. sjg raised concerns about ktrace performance and would like to
continue using /dev/filemon on FreeBSD (which has seen more
maintenance kernel-side) without forking make.


# 1.66 19-Jan-2020 riastradh

Reimplement make(1) meta mode without filemon(4).


# 1.65 19-Dec-2019 maxv

Revert the filemon removal in bmake, as pointed out by maya we do care
about not introducing divergence with FreeBSD, and the cost of unused
is acceptable here.


# 1.64 18-Dec-2019 maxv

Retire filemon, discussed on tech-kern@.


Revision tags: phil-wifi-20191119
# 1.63 13-Oct-2019 mrg

introduce some common variables for use in GCC warning disables:

GCC_NO_FORMAT_TRUNCATION -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints. many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."


# 1.62 29-Sep-2019 mrg

convert HAVE_GCC == 7 to HAVE_GCC >= 7.


Revision tags: netbsd-9-4-RELEASE netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609
# 1.61 04-Feb-2019 mrg

- use -Wno-error=format-truncation


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.60 10-Jun-2018 christos

branches: 1.60.2;
use SUBDIR.roff suggested by uwe@


Revision tags: netbsd-8-3-RELEASE netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.59 18-Feb-2016 sjg

branches: 1.59.14;
Adapt to changed Var_Subst()


# 1.58 17-Jun-2015 christos

Centralize the "is a meta char" test, instead of using two different arrays.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.57 05-Jul-2014 dholland

Rework /usr/share/doc.

Update the <bsd.doc.mk> infrastructure, and update the docs to match
the new infrastructure.

- Build and install text, ps, pdf, and/or html, not roff sources.

- Don't wire the chapter numbers into the build system, or use them in
the installed pathnames. This didn't matter much when the docs were a
museum, but now that we're theoretically going to start maintaining
them again, we're going to add and remove documents periodically and
having the chapter numbers baked in creates a lot of thrashing for no
purpose.

- Specify the document name explicitly, rather than implicitly in a
path. Use this name (instead of other random strings) as the name
of the installed files.

- Specify the document section, which is the subdirectory of
/usr/share/doc to install into.

- Allow multiple subdocuments. (That is, multiple documents in one
output directory.)

- Enumerate the .png files groff emits along with html so they can be
installed.

- Remove assorted hand-rolled rules for running roff and roff widgetry
and add enough variable settings to make these unnecessary. This
includes support for
- explicit use of soelim
- refer
- tbl
- pic
- eqn

- Forcibly apply at least minimal amounts of sanity to certain
autogenerated roff files.

- Don't exclude USD.doc, SMM.doc, and PSD.doc directories from the
build, as they now actually do stuff.

Note: currently we can't generate pdf. This turns out to be a
nontrivial problem with no immediate solution forthcoming. So for now,
as a workaround, install compressed .ps as the printable form.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base dholland-make-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.56 30-May-2012 sjg

branches: 1.56.2; 1.56.8;
Don't pass debug flags etc. to unit-tests


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.55 14-Aug-2011 christos

branches: 1.55.2;
- remove gcc-4.5 warnings
- simplify job printing code
- document non-literal format strings


# 1.54 22-Jun-2011 mrg

apply some -Wno-error and/or -fno-strict-aliasing.


all of this should be looked at closer, but some of them are not
very trivial.


Revision tags: cherry-xenmp-base
# 1.53 18-May-2011 dsl

Back out a local change


# 1.52 17-May-2011 dsl

If a makefile if a multiple of the page size and doesn't end with a
newline, then it all goes horribly wrong when make tries to terminate
the last input line.
This was all ok before the mmap changes (rev 1.169) because the last
32 bytes of the input buffer were never read into.
The non-mmap case has a similar problem.
Bug found because my .depend files don't have a newline at the end of
the .OPTIO|NAL line (don't know if that is a local change).


Revision tags: bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.51 13-Sep-2010 sjg

Add meta.c which implements "meta" mode for make.
In this mode, a .meta file is created for each target, capturing
the expanded commands used, any command output, and if filemon(9)
is available, a record of system calls which are of interest.
Not enabled unless USE_META=yes is set when building make.
Also, if FILEMON_H exists, meta.c will be compiled to use filemon(9).


# 1.50 22-Apr-2010 sjg

PR: 42850
Reviewed by:

modmisc: since we apply an exists() test to $paths, be conservative
in what we expect.

Run the unit tests with -r -m / so that we do not fail if there
is no sys.mk present.


Revision tags: matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.49 14-Apr-2009 lukem

Enable WARNS=4 by default for usr.bin, except for:
awk bdes checknr compile_et error gss hxtool kgetcred kinit
klist ldd less lex locale login m4 man menuc mk_cmds
mklocale msgc openssl rpcgen rpcinfo sdiff spell ssh
string2key telnet tn3270 verify_krb5_conf xlint


# 1.48 24-Mar-2009 perry

remove unneeded special rule for main.o


# 1.47 20-Mar-2009 perry

The Makefile and main.c arranged to put "netbsd-${DATE}" into the
executable. Remove this so that different compiles can be binary
compared. rcsid's for all files are already embedded in the executable
so versions can be easily distinguished. (I didn't catch this on
previous passes because I did my builds on the same day.)

Note: there's a special rule for main.o in Makefile with a purpose I
can't actually discern -- I think it isn't needed, and I've flagged it
with a comment.


# 1.46 24-Jan-2009 dsl

branches: 1.46.2;
Move the bmake_malloc() functions into their own .c and .h files.
Include instead of make.h in a few places.


# 1.45 20-Dec-2008 dsl

Add functions for processing extendable arrays of pointers to strings.
Use for the .for variables and substution items - changing the latter from
make's all conquering lst.lib functions.
Being able to index everything makes the code simpler.
No functional changes intended.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2
# 1.44 06-Oct-2008 joerg

Don't use emalloc and friends directly, but call them consistently
bmake_malloc and friends. Implement them via macros for the native case
and provide fallback implementations otherwise. Avoid polluting the
namespace by not defining enomem globally. Don't bother to provide
strdup and strndup, they were only used for the estrdup and estrndup
comapt code.

This addresses the presence of emalloc in system libraries on A/UX and
resulted strange issues as reported by Timothy E. Larson.


Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base christos-broken matt-armv6-nbase hpcarm-cleanup-base
# 1.43 14-Feb-2008 christos

- use pid_t/size_t as appropriate instead of int.
- use %ld to print pids.
- fix a bit of lint.
- WARNS=4


Revision tags: cube-autoconf-base matt-armv6-base
# 1.42 25-Sep-2007 uwe

Revert 1.34 (CFLAGS+=-g) that have been commited by mistake (hi, xtos).


Revision tags: netbsd-4-0-RC1 matt-mips64-base netbsd-4-base
# 1.41 01-Nov-2006 sjg

branches: 1.41.2; 1.41.4; 1.41.8;
Use of libutil to provide emalloc et al, should be predicated on
a native NetBSD build using TOOLDIR etc.
Otherwise use the local versions.

Reviewed by: christos


# 1.40 25-Oct-2006 dsl

Fix previous - need to add a lstPrev()


# 1.39 08-Oct-2006 peter

WFORMAT is no more...


# 1.38 29-Aug-2006 christos

protect libutil with HOSTPROG


# 1.37 26-Aug-2006 christos

More programs using efun.


Revision tags: abandoned-netbsd-4-base chap-midi-nbase chap-midi-base
# 1.36 15-Jun-2006 skrll

Remove a hack that's no longer needed with gcc 3.3.6.


# 1.35 08-May-2006 he

branches: 1.35.2;
Our gcc 3.3.3 (nb3) for hppa gets an "unrecognized insn" internal
compiler error when building buf.c with -O2, so reduce optimization
level to -O1 for this single file.
To be documented in docs/HACKS, discussed with skrll.


# 1.34 22-Apr-2006 christos

Coverity CID 529: Call VarFreeEnv to prevent leak.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.33 07-May-2004 ross

Simplify build, no functional changes.

Instead of adding MAKE_BOOTSTRAP for hosted environments, i.e., when
you want things simple, instead add MAKE_NATIVE to get those hugely
important features like __RCSID().

It's now possible to build make on some hosts with: cc *.c */*.c


# 1.32 06-May-2004 ross

Instead of including from the wrong directory and then fixing it (-I)
in the Makefile, how about just doing the right include?


Revision tags: netbsd-2-0-base
# 1.31 15-Feb-2004 sjg

branches: 1.31.2;
Use ${.MAKE:S,^./,${.CURDIR}/,} so that when someone does
./make test
it works. Note use .CURDIR rather than .OBJDIR since the later
_may_ not always be correct (eg. symlink in .CURDIR for make).


# 1.30 01-Aug-2003 sjg

Fix for TEST_MAKE from Alan Barrett


# 1.29 28-Jul-2003 sjg

Fix parsing bug for :ts - patch from Alan Barrett <apb@cequrux.com>
Also add simple unit-test jig (regress/usr.bin/make will use it too)
but having it local here makes inclusion in bmake simpler.


# 1.28 26-Jul-2003 mrg

build var.c with -Wno-cast-qual - gcc3.3 complains about VarWordCompare()


# 1.27 14-Jul-2003 christos

Pass WARNS=3


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 fvdl_fs64_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.26 27-Jan-2002 reinoud

Fix major bug in make(1) ... due to shadowing of the dotLast path used for
the .DOTLAST primitive by a boolean variable with the same name, this whole
mechanism was broken ... it doesn't save much stat calls but it was wrong.

Thanks to Jason Thorpe for the other shadow-variable fixing patches he
made.


# 1.25 31-Oct-2001 tv

Overhaul the initialization and handling of .OBJDIR:

* Replace chdir_verify_path() with Main_SetObjdir(), which can be called
externally, and can take a "const char *". (There's a lot of non-const
"char *" passing around in var.c of what should be const strings....)

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

* Add a new special target, .OBJDIR:, which when parsed will cause make to
change to a new object directory and reset .OBJDIR, and PWD in the
environment. This will allow some makefiles (mainly, src/tools)
to override the default objdir semantics in order to add custom logic.


# 1.24 09-Jun-2001 sjg

Provide a useful? MAKE_VERSION.


# 1.23 30-Dec-2000 sommerfeld

Back out debug cruft.


# 1.22 30-Dec-2000 sommerfeld

Add a token-passing scheme to allow a recursive make to successfully
use -j; all make's in a recursive build cooperate to limit the total
number of jobs, using a token-passing scheme.

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

Implementation details:
- Use the new trace facility to allow measurement of the
effectiveness of different token-passing schemes
- Get a token in MakeStartJobs(), return it in Make_Update()
- Eliminate Job_Full() and the jobFull global since they are
redundant with token system.
- Add an "internal" -J option (to pass the token pipe fd's down to
submakes) and a -T option for tracing.
- Change how compatMake is forced so that -j means something when
inherited by submakes.
- When waiting for a token, poll the token-passing pipe as well as
the output pipes of existing jobs.


# 1.21 11-Oct-2000 is

More format string cleanup by sommerfeld.


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.20 04-Aug-1999 ross

branches: 1.20.8;
Back out part of previous, only the parse.c mod was intended.


# 1.19 04-Aug-1999 ross

Trivial speed hack.


Revision tags: netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.18 24-Oct-1997 lukem

branches: 1.18.2;
use CPPFLAGS instead of CFLAGS


Revision tags: netbsd-1-3-base
# 1.17 19-Oct-1997 lukem

branches: 1.17.2;
don't define WARNS=1 here


# 1.16 11-Oct-1997 mycroft

Use bsd.subdir.mk as appropriate.


# 1.15 01-Jul-1997 christos

Add WARNS=1
RCSID police


# 1.14 08-May-1997 gwr

Back out the .PATH.c changes. The .depend problem (and others)
will be fixed using the new .NOPATH make feature instead.


# 1.13 06-May-1997 gwr

Use .PATH.c: ...


# 1.12 06-Nov-1996 christos

- 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.


# 1.11 28-May-1996 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'


Revision tags: netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.10 11-Mar-1996 christos

branches: 1.10.4;
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.


# 1.9 04-Feb-1996 christos

fix pr/1421 and pr/1997


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.8 14-Jun-1995 christos

- $NetBSD$ rcsids
- Fixed so that .[A-Z]* targets that do not match keywords are ignored as
Posix mandates
- Added .PHONY target keyword


# 1.7 03-May-1995 jtc

None of the functions in util.c are needed by NetBSD, so don't
bother to compile it.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.6 30-Jun-1994 cgd

deal with new share/doc strategy


# 1.5 25-Jun-1994 cgd

update for new doc-make/install strategy


# 1.4 05-Mar-1994 cgd

fixes/improvements from Christos Zoulas <christos@deshaw.com>.


# 1.3 14-Dec-1993 jtc

Compile with -DPOSIX --- enables reasonable behavior for MAKE and
MAKEFLAGS variables.


# 1.2 31-Jul-1993 mycroft

Add RCS indentifiers.


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision