Re: Automatic dependency checking problems

Bram Moolenaar <[email protected]> Mon, 10 May 2004 22:09:53 +0200
Newsgroups gmane.comp.tools.aap.user
Message-ID <[email protected]>
Thore Karlsen wrote:

> >"it depends".  If we have a standard format for $LINKFLAGS then all
> >tools can use it.  But if you have a project where some files are
> >compiled with MSVC and some files with MingW, you might have link flags
> >that differ.  Switching between the two tools should not result in the
> >variables becoming invalid.
> 
> Hmm.. I see what you're saying, but what I'm seeing in the tools files
> doesn't seem to match it. Currently, MSVC/BCC both use LINKFLAGS, while
> MingW/GCC use the standard variable LDFLAGS.
>
> Different compilers use the standard variable, so they obviously
> conflict. And if the reason to use LINKFLAGS is to allow several
> compilers to be used in a recipe, why use the non-standard variable
> LINKFLAGS for several compilers? Instead of e.g. MSVCLINKFLAGS and
> BCCLINKFLAGS.

True, this problem already exists.  Perhaps we should say that $LDFLAGS
can be used for arguments that the "standard Unix cc" understands, and a
compiler-specific variable should be used for compiler-specific
arguments.

> >The $CC and $CXX are generic: the C and C++ compiler.  Thus when
> >selecting a tool I think these variables should be set.  But variables
> >specific for one tool should have a name that's only used by that tool.
> >Does this make sense?
> 
> That does make sense, but then I wonder why variables like LDFLAGS even
> exist. I think it's a little confusing the way it is. It's hard to know
> which flags are used where, unless you go digging through the AAP code.

Yes, making something portable _is_ complicated.  But we can try to find
the simplest solution.

> Also, if the linker requires separate flags, why not also the compilers?
> Why does the MSVC compiler use the standard CPPFLAGS, but not the
> standard LDFLAGS? Different compilers use different compiler flags, so
> you couldn't use MingW along with MSVC even if they have different
> linker flags.

True.  It appears there is no good naming system yet.

> And to continue in the same vein: Why use MSVC and MSLINK instead of
> CC/CXX and LD? You indicated now that CC and CXX should be set to the MS
> compiler, so is there a need to use MSVC anymore? Was there ever really
> a need for that?

The idea is that you can set $MSVC to where your MS compiler is, while
you also use gcc.  Then ":usetool" can be used switch between the two.
But it appears this isn't consistent yet.  Again, perhaps a good
approach is to use $CC and $CXX for compilers that use "normal Unix cc"
arguments.  I think that's the only de facto standard for compilers that
exists.  Gcc also uses that, although it has many extensions.

Many compilers do have equivalents for the "standard cc" flags.  The
could could translate them.  This already is the intention for the
"$INCLUDE" and "$DEFINE variables.  We could add more variables like
that.

Now that you tested the changes to the tools I'll check in a new
version.  That is going to be version 1.065.  Please try it out when
it's ready.

-- 
hundred-and-one symptoms of being an internet addict:
228. You spend Saturday night making the counter on your home page
     pass that 2000 mark.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\  Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///


-------------------------------------------------------
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