Re: Automatic dependency checking problems

Thore Karlsen <sid-m3MN3Z/L/[email protected]> Thu, 06 May 2004 16:25:21 -0500
Newsgroups gmane.comp.tools.aap.user
Organization I've resigned.
Message-ID <[email protected]>
On Thu, 06 May 2004 22:57:46 +0200, Bram Moolenaar
<[email protected]> wrote:

[...]

>> When I run AAP in cygwin, AAP defaults to using gcc. I have ":usetool
>> MSVC" in my recipe. However, the gcccheck action has cc for $CC and gcc
>> for $CXX. I assume this is because the value of these variables is
>> substituted when the action is parsed, and not when it is actually
>> invoked?

>No, they are expanded when the action is invoked.

Ah. I was getting confused, since this works as if the variable is
expanded when the action is parsed:

sourcefiles = Test1/main.cpp
:program Test1 : $sourcefiles

sourcefiles = Test2/main.cpp
:program Test2 : $sourcefiles

all : Test1 Test2

Considering that Test1 and Test2 aren't really invoked until we get down
to "all", which depends on them, why isn't Test1 built with
Test2/main.cpp? That is the last value sourcefiles was set to.

I guess what I'm asking is, when is the variable ultimately expanded?

>I think the problem simply is that the msvc tool doesn't set $CC or
>$CXX.  It only sets $MSVC.
>
>So, should a tool like msvc set $CC and $CXX, so that all places where
>they are used will use the selected tools?  I suppose so.

I would say yes. I see the other tools do the same thing, and I'm not
sure why. Perhaps there is a reason for it, but I don't see an
explanation.

The tools also use undocumented variables like LINKFLAGS to set flags.
It seems to me that there should be standard variables for flags to the
standard tools.

[...]

>> This does appear to have done the trick. I had to trick AAP into
>> believing that gcc wasn't present to get it to use aap_depend_c(),
>> though.

>Setting $CC and $CXX should help:
>
>	CC = cl
>	CXX = cl
>
>May need to use _top.CC and _top.CXX when not in the main recipe.

That worked, but it causes cl.exe to spit out an error message in
gcccheck:

cl : Command line warning D4002 : ignoring unknown option
'/cygdrive/c/DOCUME~1/THOREK~1/LOCALS~1/Temp/tmpe_xfIU.c'
cl : Command line error D2003 : missing source filename

Isn't there a better way to check if gcc is used than to actually invoke
it? Perhaps only run the test if $CC or $CXX is cc, gcc, or g++? Or even
let the user explicitly select a method in the recipe.

-- 
Be seeing you.



-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver
higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3