Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Apr 2017 21:26:33 +0200
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Brooks Davis <brooks@freebsd.org>
Cc:        Eric McCorkle <eric@metricspace.net>, "freebsd-hackers@freebsd.org" <freebsd-hackers@FreeBSD.org>
Subject:   Re: Generating sources during buildworld
Message-ID:  <20170427192633.GB88843@stack.nl>
In-Reply-To: <20170426155153.GA24831@spindle.one-eyed-alien.net>
References:  <3f63e99c-9241-380d-2e3a-12ef6a5a2758@metricspace.net> <20170426155153.GA24831@spindle.one-eyed-alien.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170427192633.GB88843>