History log of /netbsd-current/usr.bin/config/mkmakefile.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.73 05-Apr-2024 riastradh

config(1): Make sort order deterministic.

Ensure we break ties in every case. This way, even though we use the
unstable qsort(3) library routine, the output is reproducible, no
matter what algorithm is behind qsort(3).

It would be nice if we could just use a stable sort function here,
but mergesort(3) is nonstandard, so we'd have to add it to
tools/compat, which is a big pain.

Instead, put a tie-breaking rule in every comparison function we use
with qsort, and abort() in the event of ties -- that way, we noisily
refuse to rely on unstable sort order.

While here, dispense with any question of integer overflow, and
sprinkle comments.

PR bin/58115


# 1.72 18-Jan-2024 thorpej

With config(1) as it exists today, a kernel Makefile is able to implement
logic on kernel options so long as those options are not defflag'd or
defparam'd. This works because such options are automatally added to the
IDENT var in the kernel Makefile as a preprocessor define, and the Makefile
can then do an operation like:

.if !empty(IDENT:M-DSOMECOOLCPUOPTION)
CFLAGS+= -mcpu=somecoolcpu
.endif

Unfortunately, this precludes making it possible to generate a compile-time
dependency on SOMECOOLCPUOPTION, or having SOMECOOLCPUOPTION imply another
kernel config option using the normal config(1) option dependency function.

Fix this by introducing a new option description keyword: mkflagvar. This
keyword marks an already defflag'd option as wanting a kernel Makefile var
defined if that option is selected in the kernel config file. So:

defflag opt_coolcpu.h SOMECOOLCPUOPTION ANOTHERCOOLCPUOPTION
mkflagvar SOMECOOLCPUOPTION ANOTHERCOOLCPUOPTION

will cause:

KERNEL_OPT_SOMECOOLCPUOPTION="1"
KERNEL_OPT_ANOTHERCOOLCPUOPTION="1"

...to be emitted into the kernel Makefile if those options are, in fact,
selected with "options ..." in the kernel config file, thus allowing for
a compile-time dependency on the option to be generated in addition to
Makefile logic, which now looks like:

.if !empty(KERNEL_OPT_SOMECOOLCPUOPTION)
CFLAGS+= -mcpu=somecoolcpu
.endif


Revision tags: 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 netbsd-9-3-RELEASE cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.71 27-Aug-2018 riastradh

Tag each .c file with the options that might have brought it in.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base
# 1.70 16-Jun-2017 christos

branches: 1.70.4; 1.70.6;
un-c99


# 1.69 15-Jun-2017 christos

Allow multiline makeoptions to work by quoting the newline..


Revision tags: 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.68 04-Sep-2015 uebayasi

branches: 1.68.8;
Sort files in ${ALLFILES} in the order of parsing of `files.*'.

config(1) reads the first `files.${MACHINE}' when it encounters `machine'.
Then it includes common `files.${MACHINE_SUBARCH}', `files.${MACHINE_ARCH}',
and MI `sys/conf/files' at last. This change makes the first "file" in
`files.${MACHINE}' appear first in ${ALLFILES}.


# 1.67 04-Sep-2015 uebayasi

Make config(1) output only ${ALLFILES}, selected input files, and pass it to
Makefile.kern.inc, where files are filtered by suffix.


# 1.66 04-Sep-2015 uebayasi

Output ${ALLFILES}, the list of selected *.[csSo] files, sorted in the exact
order config(1) parses "file ..." commands in config(5) files. Define
${CFILES}, ${SFILES}, and ${OFILES} as subset of ${ALLFILES} selected by
suffix.


# 1.65 04-Sep-2015 uebayasi

Now Makefile.kern.inc handles swap<kernel>.c compiling/linking nicely,
config(1) can become less hackish.


# 1.64 04-Sep-2015 uebayasi

Share more code by making *.o handling less special.


# 1.63 03-Sep-2015 uebayasi

Pretty-print `Makefile' output.


# 1.62 03-Sep-2015 uebayasi

Move `all' target definition to Makefile.kern.inc.


# 1.61 03-Sep-2015 uebayasi

Define kernel dependency in Makefile.kern.inc.


# 1.60 02-Sep-2015 uebayasi

Fix build.


# 1.59 02-Sep-2015 uebayasi

Define ${OBJS} in `Makefile.kern.inc'. Relative paths are not truncated
(a/b/c/x.c -> x.c) in `-S' mode. Don't provide some explicit rules for `-S'
mode for safety.


# 1.58 02-Sep-2015 uebayasi

Output relative path for ${CFILES} and ${SFILES} in generated `Makefile'.
`Makefile.kern.inc' knows how to deal with $S prefix, so don't bother it in
config(1).


# 1.57 02-Sep-2015 uebayasi

Simplify generated `Makefile' by calculating ${OBJS} from merging ${CFILES},
${SFILES}, and ${OFILES} except swap<kernel>.o excluded.


# 1.56 01-Sep-2015 uebayasi

Fix build.


# 1.55 01-Sep-2015 uebayasi

Experimental ``suffix rules + subdirectories'' build support (-S).


# 1.54 01-Sep-2015 uebayasi

Use per-suffix lists where appropriate.


# 1.53 01-Sep-2015 uebayasi

Abstract struct filetype is no longer needed.


# 1.52 01-Sep-2015 uebayasi

Merge struct objects into struct files. Keep per-suffix file lists.


# 1.51 01-Sep-2015 uebayasi

Properly handle absolute prefix.


# 1.50 01-Sep-2015 uebayasi

Refactor emit file functions. No functional changes.


# 1.49 30-Aug-2015 uebayasi

Revert "Accept only relative paths ...". This will be redone in much better,
stricter way.


# 1.48 30-Aug-2015 uebayasi

Define compile rules in sys/conf/Makefile.kern.inc except those overriden by
"file ... compile-with ...". As rules are still explicit, be careful to not
override by checking .if !target(xxx.o).


# 1.47 29-Aug-2015 uebayasi

No need to define swap<kernel>.o build rule.


# 1.46 29-Aug-2015 uebayasi

Define ``normal'' .c/.S rules as .for loops. Still explicit and ugly, but
these will be eventually replaced with suffix rules. Tested x68k where .c/.S
rules are overriden with "compile-with".


# 1.45 29-Aug-2015 uebayasi

Convert MAXUSERS, take 2.

Define MAXUSERS in opt_param.h and include it from sys/param.h, for more
accurate dependency. Don't define -DMAXUSERS and add it to ${CPPFLAGS}.
config(5)'s "maxusers" syntax doesn't change.

(The version just before revert was OK, but I had something bad in my obj
dirs.)


# 1.44 29-Aug-2015 uebayasi

Revert MAXUSERS changes. Need fresh air.


# 1.43 29-Aug-2015 uebayasi

Define MAXUXERS in opt_param.h. Bump config(1) version.


# 1.42 29-Aug-2015 uebayasi

Revert "Retire optional `rule' argument of `file' command". It is still used
in m68k ports.


# 1.41 28-Aug-2015 uebayasi

Simplify.


# 1.40 28-Aug-2015 uebayasi

Retire optional `rule' argument of `file' command.

This has existed since Rev. 1.1 of Torek's config(8) [1], but probably has
never been used by anyone.

(I can not imagine how a `file' like look like if `rule' is specified.)

[1] http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.sbin/config.new/Attic/files.c?rev=1.1


# 1.39 28-Aug-2015 uebayasi

Accept only relative paths (from $S) for `file' and `object'. Simplify code.
config(1) does not need to be super-smart about path handling, because it is
usually used with make(1), that is much smarter.

Pre-compiled object files, specified using `object', are regarded as read-only
input, thus they should be put under $S (or $S/..), as part of a source tree.


# 1.38 28-Aug-2015 uebayasi

Global paths looked up at output stage (mk*()) are relative to `srcdir'.
Ignore "prefix" by not calling sourcepath().


# 1.37 15-Dec-2014 uebayasi

Revert debug code. Simplify.


# 1.36 15-Dec-2014 uebayasi

config(1): Fix build of old trees (bin/49389) (take 2)

Look into sys/conf/Makefile.kern.inc to check if "build_kernel" .USE target
is defined. If not (== old source trees), generate one on the fly.


# 1.35 15-Dec-2014 uebayasi

config(1): Fix build of old tree (bin/49389)

Define the default, empty "build_kernel" target, so that old source trees,
whose sys/conf/Makefile.kern.inc don't have "build_kernel" .USE target, can
be built.

(When "build_kernel" is defined, the target is overriden, as far as
sys/conf/Makefile.kern.inc is included later than the "netbsd: ..." definition
in sys/arch/*/conf/Makefile.*.)

This should address PR bin/49389.


# 1.34 21-Nov-2014 christos

Use proper index types, delete casts, use correct sizeof() in allocations.


# 1.33 17-Nov-2014 uebayasi

Pre-calc file path len/suffix. Misc. clean up.


# 1.32 16-Nov-2014 uebayasi

Fix oops in r1.30.


# 1.31 16-Nov-2014 uebayasi

Simpfily code by assuming suffix is a single character.


# 1.30 16-Nov-2014 uebayasi

Refactor.


# 1.29 16-Nov-2014 uebayasi

Consistently wrap long lines in ioconf.c.


# 1.28 15-Nov-2014 uebayasi

config(1): Avoid buffer overrun (modular build)


# 1.27 15-Nov-2014 uebayasi

config(1): Sort objects by weight in modular build

Sort per-module kernel objects (*.ko) by dependency weight. Important modules
are placed in lower addresses. The ``machdep'' module will be always placed
in the lowest.

(At this moment, the order is not exact because dependency information is
incomplete in config files (files.*). Thus ``sysmon_power.ko'' comes lower
than ``machdep.ko'' and/or ``uvm.ko''; but still much better than alphabetical
sort.)


# 1.26 06-Nov-2014 uebayasi

config(1): Rename internal flag to enable modular build


# 1.25 29-Oct-2014 christos

- add RCSID's
- fix -Wconversion (except scanner)


# 1.24 09-Oct-2014 uebayasi

Style.


# 1.23 09-Oct-2014 uebayasi

FIT_NOPROLOGUE is never set anywhere.


# 1.22 09-Oct-2014 uebayasi

Kill more unused indent code in emitfiles().


# 1.21 09-Oct-2014 uebayasi

Steal -M to enable "modular" build.


# 1.20 09-Oct-2014 uebayasi

Print one file per line. Simplify code.


# 1.19 09-Oct-2014 uebayasi

Correct inverted logic.


# 1.18 09-Oct-2014 uebayasi

Implement code to generate Makefile to build netbsd via intermediate relocatable
object files. Disabled for now. Commit this for further experiments.

Kernel (netbsd) has been built as:

netbsd: *.o
ld -o netbsd *.o

Change this to:

netbsd: *.ko
ld -o netbsd *.ko
acpica.ko: ${OBJS.acpica}
ld -r acpica.ko ${OBJS.acpica}
:

You can call *.ko as a module, but this is not only beneficial for loadable
module, but also localize related text/data. Various options/flags/params
will be able to be per-ko. Unnecessary symbols can be hidden. Many ideas
will follow.


# 1.17 18-Aug-2014 joerg

Restore explicit rule for swap*.o.


# 1.16 17-Aug-2014 joerg

Reorganize symbol table embedding. The existing option SYMTAB_SPACE is
replaced by the make option COPY_SYMTAB set to any value. The copy of
the symbol table is no longer put into a buffer in kern_ksyms.o, but a
small helper object. This object is build first with a dummy size, then
the kernel is linked to compute the real dimension of the symbol table
buffer. After that, the helper object is rebuild and the kernel linked
again.


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base 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 yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 tls-maxphys-base
# 1.15 08-Jun-2012 martin

branches: 1.15.10;
If we build several kernel (variants) within the same build directory, bad
things may happen in a parallel build - especially with rules like the
automatic size adjustment for SYMTAB_SPACE, see long standing failure of
evbarm on the build cluster.
Easy fix: .WAIT for each config to complete, before going on with the
next. Low impact, only minor loss of paralellism, and only in cases where
needed.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.14 11-Mar-2012 dholland

Create a struct condexpr type to hold condition expressions, instead
of abusing struct nvlist to make trees.

(These are the a|b and a&b constructs.)


Revision tags: netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.13 11-Apr-2009 lukem

branches: 1.13.6; 1.13.8;
Fix WARNS=4 issues (-Wcast-qual -Wsign-compare -Wshadow)


# 1.12 13-Mar-2009 cube

Now that condmkopttab isn't a hash table anymore, don't initialise it with
ht_new()... So actually rename it to condmkoptions to avoid confusion.

Reported build failure on amd64 (strange that I wouldn't get it on i386) on
current-users by Kurt Schreiner.


# 1.11 13-Mar-2009 cube

Actually allow a full expression for the condition for "makeoptions" in
files.*

Patch from Yorick Hardy.


# 1.10 20-Feb-2009 cube

Ignore line starting with # in Makefile.${arch}. It might be valid make(1)
syntax to have a line that starts with # that is not comment, but well,
let's just say it's not valid syntax for Makefile.${arch}.

Breakage on a couple archs reported by he@.


# 1.9 15-Feb-2009 enami

Fix compiler warning.


# 1.8 15-Feb-2009 cube

- Allow substition of options values in the generated Makefile using the
syntax %OPTION%.
- Make it possible to specify a syntax version information in the Makefile.
- Bump version to 20090214.


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 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.7 16-Jul-2008 kent

branches: 1.7.6;
* emitrules()
- code cleanup
- support for extensions of which length is not 1


Revision tags: 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 matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
# 1.6 13-Jan-2007 christos

branches: 1.6.12;
- rename {x,}error -> cfg{x,}error and {x,}warn -> cfg{x,}warn so that we
can use err(3) and warn(3) to display errors instead of using inconsistent
fprintf's.
- remove emalloc/estrdup etc. We have them in libutil.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base netbsd-4-base
# 1.5 04-Oct-2006 dsl

Instead of trying to check the return value of every fprintf() and fputs()
call - which makes the code completely impossibly to follow, call fflush()
and ferror() just prior to calling fclose().
This has the advantage of actually detecting the any write errors, since
the output is block bufferred and will typically not happen during fprintf()
but only during the fclose() - where it is difficult to report.
I also singlilarly refuse to add (void) casts to every printf call in the
system - since it almost never makes any sense to look at the return value
(unless you want to know how many bytes were actually writtem).


Revision tags: abandoned-netbsd-4-base chap-midi-nbase chap-midi-base
# 1.4 19-Mar-2006 cube

Proper resource handling in mkmakefile().
Coverity CIDs: 186, 187, 188 and 189.


# 1.3 07-Nov-2005 erh

The swap*.o files actually do need to be specified on the individual kernel
build lines instead of in ${OBJS}. Partially revert previous change.


# 1.2 07-Nov-2005 erh

Remove special hack for swapnetbsd.c when generating the makefile.
Instead, just add it to the list of files.
Make "prefix foo" lines actually work right when foo is an absolute path,
and make sure the length calculations correspond to the output.
Provide a way to specify a file that will always be included, and a way
to omit the prologue ("$S/") on that file.


# 1.1 05-Jun-2005 thorpej

config and genassym are not sysadmin tools, they are development tools.
As such, they don't belong in /usr/sbin, but rather /usr/bin. Move them
there.


# 1.72 18-Jan-2024 thorpej

With config(1) as it exists today, a kernel Makefile is able to implement
logic on kernel options so long as those options are not defflag'd or
defparam'd. This works because such options are automatally added to the
IDENT var in the kernel Makefile as a preprocessor define, and the Makefile
can then do an operation like:

.if !empty(IDENT:M-DSOMECOOLCPUOPTION)
CFLAGS+= -mcpu=somecoolcpu
.endif

Unfortunately, this precludes making it possible to generate a compile-time
dependency on SOMECOOLCPUOPTION, or having SOMECOOLCPUOPTION imply another
kernel config option using the normal config(1) option dependency function.

Fix this by introducing a new option description keyword: mkflagvar. This
keyword marks an already defflag'd option as wanting a kernel Makefile var
defined if that option is selected in the kernel config file. So:

defflag opt_coolcpu.h SOMECOOLCPUOPTION ANOTHERCOOLCPUOPTION
mkflagvar SOMECOOLCPUOPTION ANOTHERCOOLCPUOPTION

will cause:

KERNEL_OPT_SOMECOOLCPUOPTION="1"
KERNEL_OPT_ANOTHERCOOLCPUOPTION="1"

...to be emitted into the kernel Makefile if those options are, in fact,
selected with "options ..." in the kernel config file, thus allowing for
a compile-time dependency on the option to be generated in addition to
Makefile logic, which now looks like:

.if !empty(KERNEL_OPT_SOMECOOLCPUOPTION)
CFLAGS+= -mcpu=somecoolcpu
.endif


Revision tags: netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base netbsd-9-3-RELEASE cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.71 27-Aug-2018 riastradh

Tag each .c file with the options that might have brought it in.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base
# 1.70 16-Jun-2017 christos

branches: 1.70.4; 1.70.6;
un-c99


# 1.69 15-Jun-2017 christos

Allow multiline makeoptions to work by quoting the newline..


Revision tags: 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.68 04-Sep-2015 uebayasi

branches: 1.68.8;
Sort files in ${ALLFILES} in the order of parsing of `files.*'.

config(1) reads the first `files.${MACHINE}' when it encounters `machine'.
Then it includes common `files.${MACHINE_SUBARCH}', `files.${MACHINE_ARCH}',
and MI `sys/conf/files' at last. This change makes the first "file" in
`files.${MACHINE}' appear first in ${ALLFILES}.


# 1.67 04-Sep-2015 uebayasi

Make config(1) output only ${ALLFILES}, selected input files, and pass it to
Makefile.kern.inc, where files are filtered by suffix.


# 1.66 04-Sep-2015 uebayasi

Output ${ALLFILES}, the list of selected *.[csSo] files, sorted in the exact
order config(1) parses "file ..." commands in config(5) files. Define
${CFILES}, ${SFILES}, and ${OFILES} as subset of ${ALLFILES} selected by
suffix.


# 1.65 04-Sep-2015 uebayasi

Now Makefile.kern.inc handles swap<kernel>.c compiling/linking nicely,
config(1) can become less hackish.


# 1.64 04-Sep-2015 uebayasi

Share more code by making *.o handling less special.


# 1.63 03-Sep-2015 uebayasi

Pretty-print `Makefile' output.


# 1.62 03-Sep-2015 uebayasi

Move `all' target definition to Makefile.kern.inc.


# 1.61 03-Sep-2015 uebayasi

Define kernel dependency in Makefile.kern.inc.


# 1.60 02-Sep-2015 uebayasi

Fix build.


# 1.59 02-Sep-2015 uebayasi

Define ${OBJS} in `Makefile.kern.inc'. Relative paths are not truncated
(a/b/c/x.c -> x.c) in `-S' mode. Don't provide some explicit rules for `-S'
mode for safety.


# 1.58 02-Sep-2015 uebayasi

Output relative path for ${CFILES} and ${SFILES} in generated `Makefile'.
`Makefile.kern.inc' knows how to deal with $S prefix, so don't bother it in
config(1).


# 1.57 02-Sep-2015 uebayasi

Simplify generated `Makefile' by calculating ${OBJS} from merging ${CFILES},
${SFILES}, and ${OFILES} except swap<kernel>.o excluded.


# 1.56 01-Sep-2015 uebayasi

Fix build.


# 1.55 01-Sep-2015 uebayasi

Experimental ``suffix rules + subdirectories'' build support (-S).


# 1.54 01-Sep-2015 uebayasi

Use per-suffix lists where appropriate.


# 1.53 01-Sep-2015 uebayasi

Abstract struct filetype is no longer needed.


# 1.52 01-Sep-2015 uebayasi

Merge struct objects into struct files. Keep per-suffix file lists.


# 1.51 01-Sep-2015 uebayasi

Properly handle absolute prefix.


# 1.50 01-Sep-2015 uebayasi

Refactor emit file functions. No functional changes.


# 1.49 30-Aug-2015 uebayasi

Revert "Accept only relative paths ...". This will be redone in much better,
stricter way.


# 1.48 30-Aug-2015 uebayasi

Define compile rules in sys/conf/Makefile.kern.inc except those overriden by
"file ... compile-with ...". As rules are still explicit, be careful to not
override by checking .if !target(xxx.o).


# 1.47 29-Aug-2015 uebayasi

No need to define swap<kernel>.o build rule.


# 1.46 29-Aug-2015 uebayasi

Define ``normal'' .c/.S rules as .for loops. Still explicit and ugly, but
these will be eventually replaced with suffix rules. Tested x68k where .c/.S
rules are overriden with "compile-with".


# 1.45 29-Aug-2015 uebayasi

Convert MAXUSERS, take 2.

Define MAXUSERS in opt_param.h and include it from sys/param.h, for more
accurate dependency. Don't define -DMAXUSERS and add it to ${CPPFLAGS}.
config(5)'s "maxusers" syntax doesn't change.

(The version just before revert was OK, but I had something bad in my obj
dirs.)


# 1.44 29-Aug-2015 uebayasi

Revert MAXUSERS changes. Need fresh air.


# 1.43 29-Aug-2015 uebayasi

Define MAXUXERS in opt_param.h. Bump config(1) version.


# 1.42 29-Aug-2015 uebayasi

Revert "Retire optional `rule' argument of `file' command". It is still used
in m68k ports.


# 1.41 28-Aug-2015 uebayasi

Simplify.


# 1.40 28-Aug-2015 uebayasi

Retire optional `rule' argument of `file' command.

This has existed since Rev. 1.1 of Torek's config(8) [1], but probably has
never been used by anyone.

(I can not imagine how a `file' like look like if `rule' is specified.)

[1] http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.sbin/config.new/Attic/files.c?rev=1.1


# 1.39 28-Aug-2015 uebayasi

Accept only relative paths (from $S) for `file' and `object'. Simplify code.
config(1) does not need to be super-smart about path handling, because it is
usually used with make(1), that is much smarter.

Pre-compiled object files, specified using `object', are regarded as read-only
input, thus they should be put under $S (or $S/..), as part of a source tree.


# 1.38 28-Aug-2015 uebayasi

Global paths looked up at output stage (mk*()) are relative to `srcdir'.
Ignore "prefix" by not calling sourcepath().


# 1.37 15-Dec-2014 uebayasi

Revert debug code. Simplify.


# 1.36 15-Dec-2014 uebayasi

config(1): Fix build of old trees (bin/49389) (take 2)

Look into sys/conf/Makefile.kern.inc to check if "build_kernel" .USE target
is defined. If not (== old source trees), generate one on the fly.


# 1.35 15-Dec-2014 uebayasi

config(1): Fix build of old tree (bin/49389)

Define the default, empty "build_kernel" target, so that old source trees,
whose sys/conf/Makefile.kern.inc don't have "build_kernel" .USE target, can
be built.

(When "build_kernel" is defined, the target is overriden, as far as
sys/conf/Makefile.kern.inc is included later than the "netbsd: ..." definition
in sys/arch/*/conf/Makefile.*.)

This should address PR bin/49389.


# 1.34 21-Nov-2014 christos

Use proper index types, delete casts, use correct sizeof() in allocations.


# 1.33 17-Nov-2014 uebayasi

Pre-calc file path len/suffix. Misc. clean up.


# 1.32 16-Nov-2014 uebayasi

Fix oops in r1.30.


# 1.31 16-Nov-2014 uebayasi

Simpfily code by assuming suffix is a single character.


# 1.30 16-Nov-2014 uebayasi

Refactor.


# 1.29 16-Nov-2014 uebayasi

Consistently wrap long lines in ioconf.c.


# 1.28 15-Nov-2014 uebayasi

config(1): Avoid buffer overrun (modular build)


# 1.27 15-Nov-2014 uebayasi

config(1): Sort objects by weight in modular build

Sort per-module kernel objects (*.ko) by dependency weight. Important modules
are placed in lower addresses. The ``machdep'' module will be always placed
in the lowest.

(At this moment, the order is not exact because dependency information is
incomplete in config files (files.*). Thus ``sysmon_power.ko'' comes lower
than ``machdep.ko'' and/or ``uvm.ko''; but still much better than alphabetical
sort.)


# 1.26 06-Nov-2014 uebayasi

config(1): Rename internal flag to enable modular build


# 1.25 29-Oct-2014 christos

- add RCSID's
- fix -Wconversion (except scanner)


# 1.24 09-Oct-2014 uebayasi

Style.


# 1.23 09-Oct-2014 uebayasi

FIT_NOPROLOGUE is never set anywhere.


# 1.22 09-Oct-2014 uebayasi

Kill more unused indent code in emitfiles().


# 1.21 09-Oct-2014 uebayasi

Steal -M to enable "modular" build.


# 1.20 09-Oct-2014 uebayasi

Print one file per line. Simplify code.


# 1.19 09-Oct-2014 uebayasi

Correct inverted logic.


# 1.18 09-Oct-2014 uebayasi

Implement code to generate Makefile to build netbsd via intermediate relocatable
object files. Disabled for now. Commit this for further experiments.

Kernel (netbsd) has been built as:

netbsd: *.o
ld -o netbsd *.o

Change this to:

netbsd: *.ko
ld -o netbsd *.ko
acpica.ko: ${OBJS.acpica}
ld -r acpica.ko ${OBJS.acpica}
:

You can call *.ko as a module, but this is not only beneficial for loadable
module, but also localize related text/data. Various options/flags/params
will be able to be per-ko. Unnecessary symbols can be hidden. Many ideas
will follow.


# 1.17 18-Aug-2014 joerg

Restore explicit rule for swap*.o.


# 1.16 17-Aug-2014 joerg

Reorganize symbol table embedding. The existing option SYMTAB_SPACE is
replaced by the make option COPY_SYMTAB set to any value. The copy of
the symbol table is no longer put into a buffer in kern_ksyms.o, but a
small helper object. This object is build first with a dummy size, then
the kernel is linked to compute the real dimension of the symbol table
buffer. After that, the helper object is rebuild and the kernel linked
again.


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base 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 yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 tls-maxphys-base
# 1.15 08-Jun-2012 martin

branches: 1.15.10;
If we build several kernel (variants) within the same build directory, bad
things may happen in a parallel build - especially with rules like the
automatic size adjustment for SYMTAB_SPACE, see long standing failure of
evbarm on the build cluster.
Easy fix: .WAIT for each config to complete, before going on with the
next. Low impact, only minor loss of paralellism, and only in cases where
needed.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.14 11-Mar-2012 dholland

Create a struct condexpr type to hold condition expressions, instead
of abusing struct nvlist to make trees.

(These are the a|b and a&b constructs.)


Revision tags: netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.13 11-Apr-2009 lukem

branches: 1.13.6; 1.13.8;
Fix WARNS=4 issues (-Wcast-qual -Wsign-compare -Wshadow)


# 1.12 13-Mar-2009 cube

Now that condmkopttab isn't a hash table anymore, don't initialise it with
ht_new()... So actually rename it to condmkoptions to avoid confusion.

Reported build failure on amd64 (strange that I wouldn't get it on i386) on
current-users by Kurt Schreiner.


# 1.11 13-Mar-2009 cube

Actually allow a full expression for the condition for "makeoptions" in
files.*

Patch from Yorick Hardy.


# 1.10 20-Feb-2009 cube

Ignore line starting with # in Makefile.${arch}. It might be valid make(1)
syntax to have a line that starts with # that is not comment, but well,
let's just say it's not valid syntax for Makefile.${arch}.

Breakage on a couple archs reported by he@.


# 1.9 15-Feb-2009 enami

Fix compiler warning.


# 1.8 15-Feb-2009 cube

- Allow substition of options values in the generated Makefile using the
syntax %OPTION%.
- Make it possible to specify a syntax version information in the Makefile.
- Bump version to 20090214.


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 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.7 16-Jul-2008 kent

branches: 1.7.6;
* emitrules()
- code cleanup
- support for extensions of which length is not 1


Revision tags: 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 matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
# 1.6 13-Jan-2007 christos

branches: 1.6.12;
- rename {x,}error -> cfg{x,}error and {x,}warn -> cfg{x,}warn so that we
can use err(3) and warn(3) to display errors instead of using inconsistent
fprintf's.
- remove emalloc/estrdup etc. We have them in libutil.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base netbsd-4-base
# 1.5 04-Oct-2006 dsl

Instead of trying to check the return value of every fprintf() and fputs()
call - which makes the code completely impossibly to follow, call fflush()
and ferror() just prior to calling fclose().
This has the advantage of actually detecting the any write errors, since
the output is block bufferred and will typically not happen during fprintf()
but only during the fclose() - where it is difficult to report.
I also singlilarly refuse to add (void) casts to every printf call in the
system - since it almost never makes any sense to look at the return value
(unless you want to know how many bytes were actually writtem).


Revision tags: abandoned-netbsd-4-base chap-midi-nbase chap-midi-base
# 1.4 19-Mar-2006 cube

Proper resource handling in mkmakefile().
Coverity CIDs: 186, 187, 188 and 189.


# 1.3 07-Nov-2005 erh

The swap*.o files actually do need to be specified on the individual kernel
build lines instead of in ${OBJS}. Partially revert previous change.


# 1.2 07-Nov-2005 erh

Remove special hack for swapnetbsd.c when generating the makefile.
Instead, just add it to the list of files.
Make "prefix foo" lines actually work right when foo is an absolute path,
and make sure the length calculations correspond to the output.
Provide a way to specify a file that will always be included, and a way
to omit the prologue ("$S/") on that file.


# 1.1 05-Jun-2005 thorpej

config and genassym are not sysadmin tools, they are development tools.
As such, they don't belong in /usr/sbin, but rather /usr/bin. Move them
there.


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.71 27-Aug-2018 riastradh

Tag each .c file with the options that might have brought it in.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base
# 1.70 16-Jun-2017 christos

branches: 1.70.4;
un-c99


# 1.69 15-Jun-2017 christos

Allow multiline makeoptions to work by quoting the newline..


Revision tags: 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.68 04-Sep-2015 uebayasi

branches: 1.68.8;
Sort files in ${ALLFILES} in the order of parsing of `files.*'.

config(1) reads the first `files.${MACHINE}' when it encounters `machine'.
Then it includes common `files.${MACHINE_SUBARCH}', `files.${MACHINE_ARCH}',
and MI `sys/conf/files' at last. This change makes the first "file" in
`files.${MACHINE}' appear first in ${ALLFILES}.


# 1.67 04-Sep-2015 uebayasi

Make config(1) output only ${ALLFILES}, selected input files, and pass it to
Makefile.kern.inc, where files are filtered by suffix.


# 1.66 04-Sep-2015 uebayasi

Output ${ALLFILES}, the list of selected *.[csSo] files, sorted in the exact
order config(1) parses "file ..." commands in config(5) files. Define
${CFILES}, ${SFILES}, and ${OFILES} as subset of ${ALLFILES} selected by
suffix.


# 1.65 04-Sep-2015 uebayasi

Now Makefile.kern.inc handles swap<kernel>.c compiling/linking nicely,
config(1) can become less hackish.


# 1.64 04-Sep-2015 uebayasi

Share more code by making *.o handling less special.


# 1.63 03-Sep-2015 uebayasi

Pretty-print `Makefile' output.


# 1.62 03-Sep-2015 uebayasi

Move `all' target definition to Makefile.kern.inc.


# 1.61 03-Sep-2015 uebayasi

Define kernel dependency in Makefile.kern.inc.


# 1.60 02-Sep-2015 uebayasi

Fix build.


# 1.59 02-Sep-2015 uebayasi

Define ${OBJS} in `Makefile.kern.inc'. Relative paths are not truncated
(a/b/c/x.c -> x.c) in `-S' mode. Don't provide some explicit rules for `-S'
mode for safety.


# 1.58 02-Sep-2015 uebayasi

Output relative path for ${CFILES} and ${SFILES} in generated `Makefile'.
`Makefile.kern.inc' knows how to deal with $S prefix, so don't bother it in
config(1).


# 1.57 02-Sep-2015 uebayasi

Simplify generated `Makefile' by calculating ${OBJS} from merging ${CFILES},
${SFILES}, and ${OFILES} except swap<kernel>.o excluded.


# 1.56 01-Sep-2015 uebayasi

Fix build.


# 1.55 01-Sep-2015 uebayasi

Experimental ``suffix rules + subdirectories'' build support (-S).


# 1.54 01-Sep-2015 uebayasi

Use per-suffix lists where appropriate.


# 1.53 01-Sep-2015 uebayasi

Abstract struct filetype is no longer needed.


# 1.52 01-Sep-2015 uebayasi

Merge struct objects into struct files. Keep per-suffix file lists.


# 1.51 01-Sep-2015 uebayasi

Properly handle absolute prefix.


# 1.50 01-Sep-2015 uebayasi

Refactor emit file functions. No functional changes.


# 1.49 30-Aug-2015 uebayasi

Revert "Accept only relative paths ...". This will be redone in much better,
stricter way.


# 1.48 30-Aug-2015 uebayasi

Define compile rules in sys/conf/Makefile.kern.inc except those overriden by
"file ... compile-with ...". As rules are still explicit, be careful to not
override by checking .if !target(xxx.o).


# 1.47 29-Aug-2015 uebayasi

No need to define swap<kernel>.o build rule.


# 1.46 29-Aug-2015 uebayasi

Define ``normal'' .c/.S rules as .for loops. Still explicit and ugly, but
these will be eventually replaced with suffix rules. Tested x68k where .c/.S
rules are overriden with "compile-with".


# 1.45 29-Aug-2015 uebayasi

Convert MAXUSERS, take 2.

Define MAXUSERS in opt_param.h and include it from sys/param.h, for more
accurate dependency. Don't define -DMAXUSERS and add it to ${CPPFLAGS}.
config(5)'s "maxusers" syntax doesn't change.

(The version just before revert was OK, but I had something bad in my obj
dirs.)


# 1.44 29-Aug-2015 uebayasi

Revert MAXUSERS changes. Need fresh air.


# 1.43 29-Aug-2015 uebayasi

Define MAXUXERS in opt_param.h. Bump config(1) version.


# 1.42 29-Aug-2015 uebayasi

Revert "Retire optional `rule' argument of `file' command". It is still used
in m68k ports.


# 1.41 28-Aug-2015 uebayasi

Simplify.


# 1.40 28-Aug-2015 uebayasi

Retire optional `rule' argument of `file' command.

This has existed since Rev. 1.1 of Torek's config(8) [1], but probably has
never been used by anyone.

(I can not imagine how a `file' like look like if `rule' is specified.)

[1] http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.sbin/config.new/Attic/files.c?rev=1.1


# 1.39 28-Aug-2015 uebayasi

Accept only relative paths (from $S) for `file' and `object'. Simplify code.
config(1) does not need to be super-smart about path handling, because it is
usually used with make(1), that is much smarter.

Pre-compiled object files, specified using `object', are regarded as read-only
input, thus they should be put under $S (or $S/..), as part of a source tree.


# 1.38 28-Aug-2015 uebayasi

Global paths looked up at output stage (mk*()) are relative to `srcdir'.
Ignore "prefix" by not calling sourcepath().


# 1.37 15-Dec-2014 uebayasi

Revert debug code. Simplify.


# 1.36 15-Dec-2014 uebayasi

config(1): Fix build of old trees (bin/49389) (take 2)

Look into sys/conf/Makefile.kern.inc to check if "build_kernel" .USE target
is defined. If not (== old source trees), generate one on the fly.


# 1.35 15-Dec-2014 uebayasi

config(1): Fix build of old tree (bin/49389)

Define the default, empty "build_kernel" target, so that old source trees,
whose sys/conf/Makefile.kern.inc don't have "build_kernel" .USE target, can
be built.

(When "build_kernel" is defined, the target is overriden, as far as
sys/conf/Makefile.kern.inc is included later than the "netbsd: ..." definition
in sys/arch/*/conf/Makefile.*.)

This should address PR bin/49389.


# 1.34 21-Nov-2014 christos

Use proper index types, delete casts, use correct sizeof() in allocations.


# 1.33 17-Nov-2014 uebayasi

Pre-calc file path len/suffix. Misc. clean up.


# 1.32 16-Nov-2014 uebayasi

Fix oops in r1.30.


# 1.31 16-Nov-2014 uebayasi

Simpfily code by assuming suffix is a single character.


# 1.30 16-Nov-2014 uebayasi

Refactor.


# 1.29 16-Nov-2014 uebayasi

Consistently wrap long lines in ioconf.c.


# 1.28 15-Nov-2014 uebayasi

config(1): Avoid buffer overrun (modular build)


# 1.27 15-Nov-2014 uebayasi

config(1): Sort objects by weight in modular build

Sort per-module kernel objects (*.ko) by dependency weight. Important modules
are placed in lower addresses. The ``machdep'' module will be always placed
in the lowest.

(At this moment, the order is not exact because dependency information is
incomplete in config files (files.*). Thus ``sysmon_power.ko'' comes lower
than ``machdep.ko'' and/or ``uvm.ko''; but still much better than alphabetical
sort.)


# 1.26 06-Nov-2014 uebayasi

config(1): Rename internal flag to enable modular build


# 1.25 29-Oct-2014 christos

- add RCSID's
- fix -Wconversion (except scanner)


# 1.24 09-Oct-2014 uebayasi

Style.


# 1.23 09-Oct-2014 uebayasi

FIT_NOPROLOGUE is never set anywhere.


# 1.22 09-Oct-2014 uebayasi

Kill more unused indent code in emitfiles().


# 1.21 09-Oct-2014 uebayasi

Steal -M to enable "modular" build.


# 1.20 09-Oct-2014 uebayasi

Print one file per line. Simplify code.


# 1.19 09-Oct-2014 uebayasi

Correct inverted logic.


# 1.18 09-Oct-2014 uebayasi

Implement code to generate Makefile to build netbsd via intermediate relocatable
object files. Disabled for now. Commit this for further experiments.

Kernel (netbsd) has been built as:

netbsd: *.o
ld -o netbsd *.o

Change this to:

netbsd: *.ko
ld -o netbsd *.ko
acpica.ko: ${OBJS.acpica}
ld -r acpica.ko ${OBJS.acpica}
:

You can call *.ko as a module, but this is not only beneficial for loadable
module, but also localize related text/data. Various options/flags/params
will be able to be per-ko. Unnecessary symbols can be hidden. Many ideas
will follow.


# 1.17 18-Aug-2014 joerg

Restore explicit rule for swap*.o.


# 1.16 17-Aug-2014 joerg

Reorganize symbol table embedding. The existing option SYMTAB_SPACE is
replaced by the make option COPY_SYMTAB set to any value. The copy of
the symbol table is no longer put into a buffer in kern_ksyms.o, but a
small helper object. This object is build first with a dummy size, then
the kernel is linked to compute the real dimension of the symbol table
buffer. After that, the helper object is rebuild and the kernel linked
again.


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base 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 yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 tls-maxphys-base
# 1.15 08-Jun-2012 martin

branches: 1.15.10;
If we build several kernel (variants) within the same build directory, bad
things may happen in a parallel build - especially with rules like the
automatic size adjustment for SYMTAB_SPACE, see long standing failure of
evbarm on the build cluster.
Easy fix: .WAIT for each config to complete, before going on with the
next. Low impact, only minor loss of paralellism, and only in cases where
needed.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.14 11-Mar-2012 dholland

Create a struct condexpr type to hold condition expressions, instead
of abusing struct nvlist to make trees.

(These are the a|b and a&b constructs.)


Revision tags: netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.13 11-Apr-2009 lukem

branches: 1.13.6; 1.13.8;
Fix WARNS=4 issues (-Wcast-qual -Wsign-compare -Wshadow)


# 1.12 13-Mar-2009 cube

Now that condmkopttab isn't a hash table anymore, don't initialise it with
ht_new()... So actually rename it to condmkoptions to avoid confusion.

Reported build failure on amd64 (strange that I wouldn't get it on i386) on
current-users by Kurt Schreiner.


# 1.11 13-Mar-2009 cube

Actually allow a full expression for the condition for "makeoptions" in
files.*

Patch from Yorick Hardy.


# 1.10 20-Feb-2009 cube

Ignore line starting with # in Makefile.${arch}. It might be valid make(1)
syntax to have a line that starts with # that is not comment, but well,
let's just say it's not valid syntax for Makefile.${arch}.

Breakage on a couple archs reported by he@.


# 1.9 15-Feb-2009 enami

Fix compiler warning.


# 1.8 15-Feb-2009 cube

- Allow substition of options values in the generated Makefile using the
syntax %OPTION%.
- Make it possible to specify a syntax version information in the Makefile.
- Bump version to 20090214.


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 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.7 16-Jul-2008 kent

branches: 1.7.6;
* emitrules()
- code cleanup
- support for extensions of which length is not 1


Revision tags: 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 matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
# 1.6 13-Jan-2007 christos

branches: 1.6.12;
- rename {x,}error -> cfg{x,}error and {x,}warn -> cfg{x,}warn so that we
can use err(3) and warn(3) to display errors instead of using inconsistent
fprintf's.
- remove emalloc/estrdup etc. We have them in libutil.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base netbsd-4-base
# 1.5 04-Oct-2006 dsl

Instead of trying to check the return value of every fprintf() and fputs()
call - which makes the code completely impossibly to follow, call fflush()
and ferror() just prior to calling fclose().
This has the advantage of actually detecting the any write errors, since
the output is block bufferred and will typically not happen during fprintf()
but only during the fclose() - where it is difficult to report.
I also singlilarly refuse to add (void) casts to every printf call in the
system - since it almost never makes any sense to look at the return value
(unless you want to know how many bytes were actually writtem).


Revision tags: abandoned-netbsd-4-base chap-midi-nbase chap-midi-base
# 1.4 19-Mar-2006 cube

Proper resource handling in mkmakefile().
Coverity CIDs: 186, 187, 188 and 189.


# 1.3 07-Nov-2005 erh

The swap*.o files actually do need to be specified on the individual kernel
build lines instead of in ${OBJS}. Partially revert previous change.


# 1.2 07-Nov-2005 erh

Remove special hack for swapnetbsd.c when generating the makefile.
Instead, just add it to the list of files.
Make "prefix foo" lines actually work right when foo is an absolute path,
and make sure the length calculations correspond to the output.
Provide a way to specify a file that will always be included, and a way
to omit the prologue ("$S/") on that file.


# 1.1 05-Jun-2005 thorpej

config and genassym are not sysadmin tools, they are development tools.
As such, they don't belong in /usr/sbin, but rather /usr/bin. Move them
there.


# 1.70 16-Jun-2017 christos

un-c99


# 1.69 15-Jun-2017 christos

Allow multiline makeoptions to work by quoting the newline..


Revision tags: 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.68 04-Sep-2015 uebayasi

Sort files in ${ALLFILES} in the order of parsing of `files.*'.

config(1) reads the first `files.${MACHINE}' when it encounters `machine'.
Then it includes common `files.${MACHINE_SUBARCH}', `files.${MACHINE_ARCH}',
and MI `sys/conf/files' at last. This change makes the first "file" in
`files.${MACHINE}' appear first in ${ALLFILES}.


# 1.67 04-Sep-2015 uebayasi

Make config(1) output only ${ALLFILES}, selected input files, and pass it to
Makefile.kern.inc, where files are filtered by suffix.


# 1.66 04-Sep-2015 uebayasi

Output ${ALLFILES}, the list of selected *.[csSo] files, sorted in the exact
order config(1) parses "file ..." commands in config(5) files. Define
${CFILES}, ${SFILES}, and ${OFILES} as subset of ${ALLFILES} selected by
suffix.


# 1.65 04-Sep-2015 uebayasi

Now Makefile.kern.inc handles swap<kernel>.c compiling/linking nicely,
config(1) can become less hackish.


# 1.64 04-Sep-2015 uebayasi

Share more code by making *.o handling less special.


# 1.63 03-Sep-2015 uebayasi

Pretty-print `Makefile' output.


# 1.62 03-Sep-2015 uebayasi

Move `all' target definition to Makefile.kern.inc.


# 1.61 03-Sep-2015 uebayasi

Define kernel dependency in Makefile.kern.inc.


# 1.60 02-Sep-2015 uebayasi

Fix build.


# 1.59 02-Sep-2015 uebayasi

Define ${OBJS} in `Makefile.kern.inc'. Relative paths are not truncated
(a/b/c/x.c -> x.c) in `-S' mode. Don't provide some explicit rules for `-S'
mode for safety.


# 1.58 02-Sep-2015 uebayasi

Output relative path for ${CFILES} and ${SFILES} in generated `Makefile'.
`Makefile.kern.inc' knows how to deal with $S prefix, so don't bother it in
config(1).


# 1.57 02-Sep-2015 uebayasi

Simplify generated `Makefile' by calculating ${OBJS} from merging ${CFILES},
${SFILES}, and ${OFILES} except swap<kernel>.o excluded.


# 1.56 01-Sep-2015 uebayasi

Fix build.


# 1.55 01-Sep-2015 uebayasi

Experimental ``suffix rules + subdirectories'' build support (-S).


# 1.54 01-Sep-2015 uebayasi

Use per-suffix lists where appropriate.


# 1.53 01-Sep-2015 uebayasi

Abstract struct filetype is no longer needed.


# 1.52 01-Sep-2015 uebayasi

Merge struct objects into struct files. Keep per-suffix file lists.


# 1.51 01-Sep-2015 uebayasi

Properly handle absolute prefix.


# 1.50 01-Sep-2015 uebayasi

Refactor emit file functions. No functional changes.


# 1.49 30-Aug-2015 uebayasi

Revert "Accept only relative paths ...". This will be redone in much better,
stricter way.


# 1.48 30-Aug-2015 uebayasi

Define compile rules in sys/conf/Makefile.kern.inc except those overriden by
"file ... compile-with ...". As rules are still explicit, be careful to not
override by checking .if !target(xxx.o).


# 1.47 29-Aug-2015 uebayasi

No need to define swap<kernel>.o build rule.


# 1.46 29-Aug-2015 uebayasi

Define ``normal'' .c/.S rules as .for loops. Still explicit and ugly, but
these will be eventually replaced with suffix rules. Tested x68k where .c/.S
rules are overriden with "compile-with".


# 1.45 29-Aug-2015 uebayasi

Convert MAXUSERS, take 2.

Define MAXUSERS in opt_param.h and include it from sys/param.h, for more
accurate dependency. Don't define -DMAXUSERS and add it to ${CPPFLAGS}.
config(5)'s "maxusers" syntax doesn't change.

(The version just before revert was OK, but I had something bad in my obj
dirs.)


# 1.44 29-Aug-2015 uebayasi

Revert MAXUSERS changes. Need fresh air.


# 1.43 29-Aug-2015 uebayasi

Define MAXUXERS in opt_param.h. Bump config(1) version.


# 1.42 29-Aug-2015 uebayasi

Revert "Retire optional `rule' argument of `file' command". It is still used
in m68k ports.


# 1.41 28-Aug-2015 uebayasi

Simplify.


# 1.40 28-Aug-2015 uebayasi

Retire optional `rule' argument of `file' command.

This has existed since Rev. 1.1 of Torek's config(8) [1], but probably has
never been used by anyone.

(I can not imagine how a `file' like look like if `rule' is specified.)

[1] http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.sbin/config.new/Attic/files.c?rev=1.1


# 1.39 28-Aug-2015 uebayasi

Accept only relative paths (from $S) for `file' and `object'. Simplify code.
config(1) does not need to be super-smart about path handling, because it is
usually used with make(1), that is much smarter.

Pre-compiled object files, specified using `object', are regarded as read-only
input, thus they should be put under $S (or $S/..), as part of a source tree.


# 1.38 28-Aug-2015 uebayasi

Global paths looked up at output stage (mk*()) are relative to `srcdir'.
Ignore "prefix" by not calling sourcepath().


# 1.37 15-Dec-2014 uebayasi

Revert debug code. Simplify.


# 1.36 15-Dec-2014 uebayasi

config(1): Fix build of old trees (bin/49389) (take 2)

Look into sys/conf/Makefile.kern.inc to check if "build_kernel" .USE target
is defined. If not (== old source trees), generate one on the fly.


# 1.35 15-Dec-2014 uebayasi

config(1): Fix build of old tree (bin/49389)

Define the default, empty "build_kernel" target, so that old source trees,
whose sys/conf/Makefile.kern.inc don't have "build_kernel" .USE target, can
be built.

(When "build_kernel" is defined, the target is overriden, as far as
sys/conf/Makefile.kern.inc is included later than the "netbsd: ..." definition
in sys/arch/*/conf/Makefile.*.)

This should address PR bin/49389.


# 1.34 21-Nov-2014 christos

Use proper index types, delete casts, use correct sizeof() in allocations.


# 1.33 17-Nov-2014 uebayasi

Pre-calc file path len/suffix. Misc. clean up.


# 1.32 16-Nov-2014 uebayasi

Fix oops in r1.30.


# 1.31 16-Nov-2014 uebayasi

Simpfily code by assuming suffix is a single character.


# 1.30 16-Nov-2014 uebayasi

Refactor.


# 1.29 16-Nov-2014 uebayasi

Consistently wrap long lines in ioconf.c.


# 1.28 15-Nov-2014 uebayasi

config(1): Avoid buffer overrun (modular build)


# 1.27 15-Nov-2014 uebayasi

config(1): Sort objects by weight in modular build

Sort per-module kernel objects (*.ko) by dependency weight. Important modules
are placed in lower addresses. The ``machdep'' module will be always placed
in the lowest.

(At this moment, the order is not exact because dependency information is
incomplete in config files (files.*). Thus ``sysmon_power.ko'' comes lower
than ``machdep.ko'' and/or ``uvm.ko''; but still much better than alphabetical
sort.)


# 1.26 06-Nov-2014 uebayasi

config(1): Rename internal flag to enable modular build


# 1.25 29-Oct-2014 christos

- add RCSID's
- fix -Wconversion (except scanner)


# 1.24 09-Oct-2014 uebayasi

Style.


# 1.23 09-Oct-2014 uebayasi

FIT_NOPROLOGUE is never set anywhere.


# 1.22 09-Oct-2014 uebayasi

Kill more unused indent code in emitfiles().


# 1.21 09-Oct-2014 uebayasi

Steal -M to enable "modular" build.


# 1.20 09-Oct-2014 uebayasi

Print one file per line. Simplify code.


# 1.19 09-Oct-2014 uebayasi

Correct inverted logic.


# 1.18 09-Oct-2014 uebayasi

Implement code to generate Makefile to build netbsd via intermediate relocatable
object files. Disabled for now. Commit this for further experiments.

Kernel (netbsd) has been built as:

netbsd: *.o
ld -o netbsd *.o

Change this to:

netbsd: *.ko
ld -o netbsd *.ko
acpica.ko: ${OBJS.acpica}
ld -r acpica.ko ${OBJS.acpica}
:

You can call *.ko as a module, but this is not only beneficial for loadable
module, but also localize related text/data. Various options/flags/params
will be able to be per-ko. Unnecessary symbols can be hidden. Many ideas
will follow.


# 1.17 18-Aug-2014 joerg

Restore explicit rule for swap*.o.


# 1.16 17-Aug-2014 joerg

Reorganize symbol table embedding. The existing option SYMTAB_SPACE is
replaced by the make option COPY_SYMTAB set to any value. The copy of
the symbol table is no longer put into a buffer in kern_ksyms.o, but a
small helper object. This object is build first with a dummy size, then
the kernel is linked to compute the real dimension of the symbol table
buffer. After that, the helper object is rebuild and the kernel linked
again.


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base 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 yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 tls-maxphys-base
# 1.15 08-Jun-2012 martin

branches: 1.15.10;
If we build several kernel (variants) within the same build directory, bad
things may happen in a parallel build - especially with rules like the
automatic size adjustment for SYMTAB_SPACE, see long standing failure of
evbarm on the build cluster.
Easy fix: .WAIT for each config to complete, before going on with the
next. Low impact, only minor loss of paralellism, and only in cases where
needed.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.14 11-Mar-2012 dholland

Create a struct condexpr type to hold condition expressions, instead
of abusing struct nvlist to make trees.

(These are the a|b and a&b constructs.)


Revision tags: netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.13 11-Apr-2009 lukem

branches: 1.13.6; 1.13.8;
Fix WARNS=4 issues (-Wcast-qual -Wsign-compare -Wshadow)


# 1.12 13-Mar-2009 cube

Now that condmkopttab isn't a hash table anymore, don't initialise it with
ht_new()... So actually rename it to condmkoptions to avoid confusion.

Reported build failure on amd64 (strange that I wouldn't get it on i386) on
current-users by Kurt Schreiner.


# 1.11 13-Mar-2009 cube

Actually allow a full expression for the condition for "makeoptions" in
files.*

Patch from Yorick Hardy.


# 1.10 20-Feb-2009 cube

Ignore line starting with # in Makefile.${arch}. It might be valid make(1)
syntax to have a line that starts with # that is not comment, but well,
let's just say it's not valid syntax for Makefile.${arch}.

Breakage on a couple archs reported by he@.


# 1.9 15-Feb-2009 enami

Fix compiler warning.


# 1.8 15-Feb-2009 cube

- Allow substition of options values in the generated Makefile using the
syntax %OPTION%.
- Make it possible to specify a syntax version information in the Makefile.
- Bump version to 20090214.


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 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.7 16-Jul-2008 kent

branches: 1.7.6;
* emitrules()
- code cleanup
- support for extensions of which length is not 1


Revision tags: 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 matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
# 1.6 13-Jan-2007 christos

branches: 1.6.12;
- rename {x,}error -> cfg{x,}error and {x,}warn -> cfg{x,}warn so that we
can use err(3) and warn(3) to display errors instead of using inconsistent
fprintf's.
- remove emalloc/estrdup etc. We have them in libutil.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base netbsd-4-base
# 1.5 04-Oct-2006 dsl

Instead of trying to check the return value of every fprintf() and fputs()
call - which makes the code completely impossibly to follow, call fflush()
and ferror() just prior to calling fclose().
This has the advantage of actually detecting the any write errors, since
the output is block bufferred and will typically not happen during fprintf()
but only during the fclose() - where it is difficult to report.
I also singlilarly refuse to add (void) casts to every printf call in the
system - since it almost never makes any sense to look at the return value
(unless you want to know how many bytes were actually writtem).


Revision tags: abandoned-netbsd-4-base chap-midi-nbase chap-midi-base
# 1.4 19-Mar-2006 cube

Proper resource handling in mkmakefile().
Coverity CIDs: 186, 187, 188 and 189.


# 1.3 07-Nov-2005 erh

The swap*.o files actually do need to be specified on the individual kernel
build lines instead of in ${OBJS}. Partially revert previous change.


# 1.2 07-Nov-2005 erh

Remove special hack for swapnetbsd.c when generating the makefile.
Instead, just add it to the list of files.
Make "prefix foo" lines actually work right when foo is an absolute path,
and make sure the length calculations correspond to the output.
Provide a way to specify a file that will always be included, and a way
to omit the prologue ("$S/") on that file.


# 1.1 05-Jun-2005 thorpej

config and genassym are not sysadmin tools, they are development tools.
As such, they don't belong in /usr/sbin, but rather /usr/bin. Move them
there.