Generating sources during buildworld
Jilles Tjoelker
jilles at stack.nl
Thu Apr 27 19:26:43 UTC 2017
On Wed, Apr 26, 2017 at 03:51:53PM +0000, Brooks Davis wrote:
> On Wed, Apr 26, 2017 at 11:40:10AM -0400, Eric McCorkle wrote:
> > I'm looking for some help with the build system, specifically how to
> > generate sources for a library that will then be used to build the library.
> > Basically, I want to have a tool which collects public key certificates,
> > then converts them into .c files which are used to build both loader and
> > the kernel.
> > Knowing how LLVM works, it seems that this is possible; however, I've
> > been unable to find documentation on how to write a makefile that
> > accomplishes this. Can someone point me to documentation or examples on
> > how to do this?
> It the tool is a script then take a look at usr.bin/getaddrinfo/Makefile
> (make sure it's from the tip of head, the initial version had rather
> poor style.)
> If the tool is a compiled program, then things get more complicated. An
> example of this is usr.bin/fortune/strfile/ and
> usr.bin/fortune/datfiles/. For a new program, you'd need to make your
> tool a bootstrap tool in Makefile.inc1.
There are actually two kinds of these tools: bootstrap tools and build
tools.
Bootstrap tools such as strfile are also installed as normal programs;
often, they are not built as a bootstrap tool if the version in the host
system is sufficiently recent.
Build tools are specific to building a particular directory, and are not
installed. These work by adding the directory to a list in Makefile.inc1
and adding a build-tools target to the directory's Makefile. Examples
are bin/sh and usr.bin/awk.
In either case, the tool must be buildable on fairly old systems and
your life will be simpler if you can write your tool in shell or awk.
--
Jilles Tjoelker
More information about the freebsd-hackers
mailing list