Scopes for rules
Richard Boulton <[email protected]> Mon, 05 Jan 2004 14:50:56 +0000
| Newsgroups | gmane.comp.tools.aap.devel |
|---|---|
| Message-ID | <[email protected]> |
Happy new year everyone! The attached minimal example does not behave as I would expect. The example consists of a main.aap, which includes (using :child) sub.aap. In sub.aap, the "INCLUDE" variable is set to a new value, local to the child, and the default rule for compiling a C file into an object is used. In main.aap, INCLUDE is set to an invalid value. I would expect this to be overridden by the value used in the child. The following is the output obtained when running AAP: Aap: Creating directory "/data/home/richard/stuff/aap_example/build-Linux2_4_20_k7" Aap: cc -Iinc1 -MM foo.c > build-Linux2_4_20_k7/foo.c.aap Aap: cc invalid include -O2 -c -o build-Linux2_4_20_k7/foo.o foo.c gcc-3.2: cannot specify -o with -c or -S and multiple compilations Aap: Error in recipe "/data/home/richard/Working/aap/Exec/default.aap" line 229: Error executing commands for compile c: Error in recipe "/data/home/richard/Working/aap/Exec/default.aap" line 233: Shell command returned 1 As you can see, the top level definition of INCLUDE is used for the compilation of foo.o from foo.c, rather than the definition in the recipe which causes the rule to fire. Interestingly, I note that the dependency calculation uses the value of INCLUDE from the sub.aap recipe scope. I believe this difference occurs because the dependency calculation is not invoked by a rule. I'm not familiar enough with the scope searching code to work out exactly what is going on here. I'd be grateful if anyone can suggest where the problem lies. -- Richard
aap_example.tgz
(application/x-gtar, 350 B) - not displayed