Re: Automatic dependency checking problems
Bram Moolenaar <[email protected]> Thu, 06 May 2004 20:37:00 +0200
| Newsgroups | gmane.comp.tools.aap.user |
|---|---|
| Message-ID | <[email protected]> |
Thore Karlsen wrote:
> I'm having some issues with this.
>
> First: I'm running AAP under cygwin, but I'm compiling with MSVC. This
> means that gcc can be found, so AAP will default to using that to
> generate the dependencies. This doesn't work, for a couple of reasons:
>
> 1. gcc doesn't understand the MSVC compiler flags.
> 2. The dependency files use .o for object files, not .obj which is the
> standard suffix for the windows platform.
>
> It would be good if I could tell AAP not to try to use gcc for
> dependency checking, regardless of whether it's found or not. There
> doesn't seem to be a good way to do this.
This is actually mentioned in the default.aap recipe as a todo item.
I would think that when $CC is set to use MSVC, the test that gcc exists
should fail and Aap will use aap_depend_c() instead. Why doesn't it
work that way? Is $CC still set to gcc perhaps?
> There is also a problem with the built-in dependency checking function,
> aap_depend_c. It doesn't automatically look in the directory of a source
> file for the header file. If the directory structure is like this:
>
> main.aap
> Project/main.cpp
> Project/main.h
>
> main.h will not be listed as a dependency, because main.h can't be found
> in the list of directories aap_depend_c searches. It should
> automatically search the Project directory, because that's what C/C++
> compilers do.
The order in which directories are searched for include files is often a
cause of trouble. I think when using a file in double quotes the search
always looks in the directory of the source file first. When using <>
that is skipped. My old K&R C book mentions this.
The code apparently uses the current directory instead of the directory
of the source file. I suppose that's wrong. Please try this patch:
*** RecPython.py~ Mon Mar 8 20:17:37 2004
--- RecPython.py Thu May 6 19:58:10 2004
***************
*** 864,870 ****
scanned = {os.path.abspath(source) : 0}
# Make the local pathlist from "-Idir" arguments.
! localpathlist = [ "." ]
if flags is None:
flags = get_var_val_int(recdict, "CFLAGS")
for n in [get_var_val_int(recdict, "CPPFLAGS"),
--- 864,872 ----
scanned = {os.path.abspath(source) : 0}
# Make the local pathlist from "-Idir" arguments.
! # Should we include the current directory? Probably not. We do look in
! # the directory of the source file when double quotes are used.
! localpathlist = [ ]
if flags is None:
flags = get_var_val_int(recdict, "CFLAGS")
for n in [get_var_val_int(recdict, "CPPFLAGS"),
***************
*** 951,956 ****
--- 953,962 ----
msg_extra(recdict, _('Cannot find included file "%s"' % fname))
return
+ mypath = os.path.dirname(fname)
+ if mypath == '':
+ mypath = '.'
+
f = open(fname)
msg_extra(recdict, _('Scanning "%s" for dependencies') % fname)
***************
*** 987,993 ****
# Search for the file in the specified path for
# include files.
if quote == '"':
! pathlist = localpathlist + globalpathlist
else:
pathlist = globalpathlist + localpathlist
fn = search_path(pathlist, line[s:i])
--- 993,999 ----
# Search for the file in the specified path for
# include files.
if quote == '"':
! pathlist = [ mypath ] + localpathlist + globalpathlist
else:
pathlist = globalpathlist + localpathlist
fn = search_path(pathlist, line[s:i])
--
hundred-and-one symptoms of being an internet addict:
140. You'd rather catch a score on the web than watch the game as
it is being played on tv.
/// 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