crunchgen reads specifications from the
conf-file that describe the components of the crunched binary. In its simplest use, the component program names are merely listed along with the top-level source directories in which their sources can be found.
crunchgen then calculates (via the source makefiles) and caches the list of object files and their locations. For more specialized situations, the user can specify by hand all the parameters that
crunchgen needs.
The
conf-file commands are as follows:
srcdirs dirname ...
A list of source trees in which the source directories of the component programs can be found. These dirs are searched using the BSD “<source-dir>/<progname>/” convention. Multiple srcdirs lines can be specified. The directories are searched in the order they are given.
progs progname ...
A list of programs that make up the crunched binary. Multiple progs lines can be specified.
libs libspec ...
A list of library specifications to be included in the crunched binary link. Multiple libs lines can be specified.
ln progname linkname
Causes the crunched binary to invoke progname whenever linkname appears in argv[0]. This allows programs that change their behavior when run under different names to operate correctly.
To handle specialized situations, such as when the source is not available or not built via a conventional Makefile, the following
special commands can be used to set
crunchgen parameters for a component program.
special progname keepsymbols symbols ...
Don't hide the specified symbols for progname. Normally all externally visible symbols for a program is hidden to avoid interference. Multiple keepsymbols lines can be specified for given progname.
special progname srcdir pathname
Set the source directory for progname. This is normally calculated by searching the specified srcdirs for a directory named progname.
special progname objdir pathname
Set the obj directory for
progname. This is normally calculated by looking for a directory named “
obj” under the
srcdir, and if that is not found, the
srcdir itself becomes the
objdir.
Note: This option only takes effect if the -o option to use existing object files is also specified.
special progname objs object-file-name ...
Set the list of object files for program progname. This is normally calculated by constructing a temporary makefile that includes “srcdir / Makefile” and outputs the value of $(OBJS). Multiple objs lines can be specified for given progname.
special progname objpaths full-pathname-to-object-file ...
Sets the pathnames of the object files for program progname. This is normally calculated by prepending the objdir pathname to each file in the objs list. Multiple objpaths lines can be specified for given progname.
Only the
objpaths parameter is actually needed by
crunchgen but it is calculated from
objdir and
objs, which are in turn calculated from
srcdir, so is sometimes convenient to specify the earlier parameters and let
crunchgen calculate forward from there if it can.
The makefile produced by
crunchgen contains an optional
objs target that will build the object files for each component program by running make inside that program's source directory. For this to work the
srcdir and
objs parameters must also be valid. If they are not valid for a particular program, that program is skipped in the
objs target.