[A-A-P-develop] Handling build attributes
Brought to you by:
vimboss
From: Adriaan de G. <ad...@cs...> - 2003-10-30 13:00:16
|
Suppose (this is a hypothetical recipe - I know objecttype doesn't make much sense in the places where I use it here): :program a : { add_INCLUDE=-Ithing } { objecttype = frobnicated } b.c c.c { objecttype = discombobulate } { add_INCLUDE = -Iboo } d.c { var_INCLUDE=-I/usr } I had an earlier patch that applied build attributes ( { add_INCLUDE=-Ithing } { objecttype = frobnicated } ) to sources, but it did it wrong and Bram told me to use spaces around = and to put the attributes in the build_attr, not in the nodes. So I have, and patch is attached. It's somewhat larger than before, because it takes the following into account: - If a source sets an attribute that is also a build attribute, then the source attribute takes precedence. So c.c is compiled to a discombobulated object file, and not a frobnicated one. - If a source has an var_* attribute and the build attributes have a corresponding var_* or add_*, the source takes precedence. - If a source has an add_ attribute and the build has a var_ attribute, compute var_ + add_ and set that as var_ - If a source has an add_ attribute and build has one too, prepend the build attribute to the source attribute. This recipe shows all the combinations: :program b : { var_INCLUDE = -I1 } { add_CFLAGS = -DD=2 } b.c c.c { add_INCLUDE = -I/usr/local/include } d.c { var_INCLUDE = -I/root } e.c { add_CFLAGS = -DDEBUG } f.c { var_CFLAGS = -DFROBNICATE } with AAP output: Aap: cc -I1 -DD=2 -MM b.c > build-FreeBSD4_9_RC/b.c.aap Aap: cc -I1 -O2 -DD=2 -DD=2 -c -o build-FreeBSD4_9_RC/b.o b.c Aap: cc -I1 -I/usr/local/include -DD=2 -MM c.c > build-FreeBSD4_9_RC/c.c.aap Aap: cc -I1 -I/usr/local/include -O2 -DD=2 -DD=2 -c -o build-FreeBSD4_9_RC/c.o c.c Aap: cc -I/root -DD=2 -MM d.c > build-FreeBSD4_9_RC/d.c.aap Aap: cc -I/root -O2 -DD=2 -DD=2 -c -o build-FreeBSD4_9_RC/d.o d.c Aap: cc -I1 -DD=2 -DDEBUG -MM e.c > build-FreeBSD4_9_RC/e.c.aap Aap: cc -I1 -O2 -DD=2 -DDEBUG -DD=2 -DDEBUG -c -o build-FreeBSD4_9_RC/e.o e.c Aap: cc -I1 -DFROBNICATE -MM f.c > build-FreeBSD4_9_RC/f.c.aap Aap: cc -I1 -O2 -DFROBNICATE -c -o build-FreeBSD4_9_RC/f.o f.c Heck, it makes sense to me. Docs are forthcoming, unless thinking about bdir() gets in the way. |