[Toybox] [PATCH] Generate all build files with single program.
Georgi Chorbadzhiyski
gf at unixsol.org
Sun Mar 18 09:14:19 PDT 2012
On 3/17/12 4:57 AM, Rob Landley wrote:
> On 03/16/2012 05:05 PM, Georgi Chorbadzhiyski wrote:
>> This patch removes all external tools from the build system. Now
>> everything in generated/ directory is build with single program.
>> The effect is that the build no longer requires sed, tr, sort and
>> python (for rebuilding the help texts). There is no need to ship
>> generated/help.h since it can be rebuild on the host without python.
>
> Cool!
>
> Generating help.h in C (and eliminating the need for python) is
> something I've been meaning to do for a while. But building the list of
> C files to compile... in C... seems unnecessarily brittle somehow.
No more than the sed usage (which I was unable to simplify and this is
was drove me to make the C version).
>> +__attribute__ ((format(printf, 2, 3)))
>> +void strbuf_printf(struct strbuf *s, const char *fmt, ...) {
>
> This is a purely local function, the __attribute__ tag is overkill.
It is just a habit I've picked when adding new printf style varargs
functions.
>> +void generate_headers(int argc, char **argv) {
>> + // Parse toys
>> + strbuf_add(&newtoys_h, "NEWTOY(toybox, NULL, 0)\n");
>> + strbuf_add(&globals_union, "extern union global_union {\n");
>
> It matters that these be in alphabetical order (for the binary search),
> and we can't depend on the filesystem doing it for us. Where are you
> sorting this?
I didn't sort them. I depend on the shell doing the right thing. The program
is called like this generated/genconf toys/*.c so it should be OK. Of course
the parameters can be sorted but it seemed unnecessary since the shell is
doing that for us.
--
Georgi Chorbadzhiyski
http://georgi.unixsol.org/
1332087259.0
More information about the Toybox
mailing list