public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* problems using gcc -MM on source with Windows-style #include paths
@ 2004-12-14 18:39 Benjamin Drucker
  2004-12-15 13:14 ` Dave Korn
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Drucker @ 2004-12-14 18:39 UTC (permalink / raw)
  To: cygwin

I want to generate dependencies for my adopted C code
with "Windows-style" #include paths like this:

#include <stdio.h>
#include "Common\Misc\Boot.c"

I am building from a cygwin [CYGWIN_NT-5.1] window.  I
thought to use gcc -MM, but my version ["3.3.3 (cygwin
special)"] croaks on the #include paths with
backslashes.

I don't want to create an in-house tool to make
dependencies.

I am leaning against changing the C code because the
compiler we're using for actual compilation is a
Windows-only tool that needs Windows-style #include
paths.

I am looking for these kinds of solutions:
1. A version of gcc that can handle backslash include
paths.  Or a switch like "--use-dos-paths".
2. A different gnu-type tool that has been around and
is quite stable.
3. Some makefile wizardry involving sed and whatever
to do this cleanly.  This is the route I've been
pursuing and it's getting to be a mess.

cheers,
ben


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less. 
http://info.mail.yahoo.com/mail_250

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: problems using gcc -MM on source with Windows-style #include paths
  2004-12-14 18:39 problems using gcc -MM on source with Windows-style #include paths Benjamin Drucker
@ 2004-12-15 13:14 ` Dave Korn
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Korn @ 2004-12-15 13:14 UTC (permalink / raw)
  To: cygwin

> -----Original Message-----
> From: cygwin-owner On Behalf Of Benjamin Drucker
> Sent: 14 December 2004 18:39

> I want to generate dependencies for my adopted C code
> with "Windows-style" #include paths like this:
> 
> #include <stdio.h>
> #include "Common\Misc\Boot.c"
> 
> I am building from a cygwin [CYGWIN_NT-5.1] window.  I
> thought to use gcc -MM, but my version ["3.3.3 (cygwin
> special)"] croaks on the #include paths with
> backslashes.


  WFM.  In fact it nicely turns the backslashes into forward slashes in the
dependency output for me:

dk@mace /test> cat foo.c

#include "temp\foo.h"

int x = WHATEVER;

dk@mace /test> cat temp/foo.h

#define WHATEVER 6

dk@mace /test> gcc -c -MM foo.c
foo.o: foo.c temp/foo.h
dk@mace /test>


  What do you actually mean by 'croak'?  This is not a clearly-worded error
report!

> 3. Some makefile wizardry involving sed and whatever
> to do this cleanly.  This is the route I've been
> pursuing and it's getting to be a mess.

  It needn't be, you should be able to use the standard dependency generation
techniques, and all you need to do is add one level of dependency: instead of
having the .d files depend on the .c files and built using a rule with gcc -MM,
you have the .d files depend on an intermediate (e.g a .x file) still using the
gcc -MM rule, and the .x file depends on the .c and is built from it using a
rule which greps out just the lines with #include and seds the backslashes into
forward ones, i.e.

%.x : %.c
	grep ^[ \t]*#[ \t]*include[ \t] | sed -e 's,\\,/,g'

[not 100% sure if that backslash has the right amount of escaping for the level
of quoting but you get the idea.]

    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-12-15 13:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-14 18:39 problems using gcc -MM on source with Windows-style #include paths Benjamin Drucker
2004-12-15 13:14 ` Dave Korn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).