Even though envp is not the POSIX way of crawling through the environment,
this will hopefully save someone from having to scratch their head
really hard with a crunched program using envp.
from henric@aimnet.com, via OpenBSD
crunchgen-created makefile with a partiallly complete build
(a situation which is more common than you think...)
solving the "parallel build" problem for crunchgen-created makefiles
needs to be done a different way...
fixes [toolchain/17012] from me.
it's not set, default to -Os (so it's not hard coded into the binary.)
Generate a makefile by default that does all object file builds in local
subdirs by binary (i.e. bad144 gets built in $OBJDIR/bad144) via a reach over
make. (Sets .PATH and .CURDIR and does a make for the objects needed in that
dir).
Add a -o option that does the old behavior of searching for obj files by
querying the various object environment vars and searching. Without this
option none of the objdir special options, environment vars, etc will have
effect.
Document all the changes in the man page (and specificly note that without -o
none of the objdir functions take effect).
1) Always do a make clean before building objects in any directory. This
is wasteful, but there's really no other simple way to cope with the
fact that the compilation settings (e.g. CFLAGS) appropriate for the
non-crunched build of a program may not be appropriate for the crunched
build. If the objdir magic in make didn't rely upon the presence of an
"obj" or "obj.${MACHINE}" symlink, we could abuse it to handle this but
unfortunately, it does.
2) Override $DBG to cause object files to be built with -Os. We can't emit
"DBG?=" into the generated makefile because of order-of-inclusion issues
with the system Makefiles; the result would be that the default setting
(currently -O2) would always be used instead of -Os. If you're crunching,
you almost certainly are doing it to get a smaller executable (!) so -Os
is almost certainly appropriate for you.
- keep the case consistent between the actual name and what's referenced.
e.g, if it's `foo', don't use '.Nm Foo' at the start of a sentence.
- remove unnecessary `.Nm foo' after the first occurrence (except for
using `.Nm ""' if there's stuff following, or for the 2nd and so on
occurrences in a SYNOPSIS
- use Sx, Ic, Li, Em, Sq, and Xr as appropriate