On Monday 15 March 2010 04:43:56 Ralf Friedl wrote:
> Rob Landley wrote:
> > The globals handling is _almost_ right.  I need to make the #define TT
> > toybox currently has go away, probably some kind of:
> >
> >   #define THIS wc
> >   #include "busybox.h"
> >
> > And use that #define internally to do behind the scenes magic.  (This
> > might also be able to make the autogenerated FLAG stuff work.  I need to
> > study the c99 preprocessor spec to see what I've got to work with, but
> > that can come later...)
>
> Instead of this, it is better to do:
>     #include "generated/wc.h"

Yeah, I thought about that, but that's an awful lot of clutter and it's also 
harder to automate concisely at the makefile level.  (Generating 8 gazillion 
small files means the dependencies get brittle, and when you try to look at 
them you have a dozen windows/tabs open to follow a single thread.  I prefer a 
few big ones.)

> Then the generated wc.h can contain whatever is necessary for flags,
> globals, and so on, and include busybox.h for the common stuff.

Globals have to be in collected into a single table to make the union out of 
them, and I already got that part working fine.

Flags are fairly easy too do with a FLAG(o) syntax, but I prefer a FLAG_o 
syntax.  I'm playing with enums to see if I can get it without generating any 
actual code.

The point is, this is like step 6 in the coversion, and several of the early 
ones can be done orthogonally, so I'd worry about it later.

> If you place everything in one big include file, with preprocessor
> conditions on the definition of THIS, you will trigger a recompile of
> all files whenever you change a single file.

That's a whole separate rant.

Only if your dependencies are on the intermediate generated files instead of on 
the source they're generated from.  So you can work around that if you care 
to.

And in some cases, you _have_ to do that such as if the size of the largest 
global you make the union out of changes, so that's the right_ thing to do.  
And then there's ccache, which depends on the contents of files not the 
timestamps to determine what needs rebuilding.  And of course if you're using 
build at once mode (which is how you get the smallest binaries) then you never 
do anything except a build all (although during development you get to switch 
all apps but the one you're developing off at the config level.  In fact, does 
anybody except applet developers ever do anything _except_ build all from a 
clean start?)

I'm aware of that objection, and would happily argue about its relevance at 
great length, but not right now.

> Ralf

Rob
-- 
Latency is more important than throughput. It's that simple. - Linus Torvalds
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to