> -----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: [EMAIL PROTECTED] /test> cat foo.c #include "temp\foo.h" int x = WHATEVER; [EMAIL PROTECTED] /test> cat temp/foo.h #define WHATEVER 6 [EMAIL PROTECTED] /test> gcc -c -MM foo.c foo.o: foo.c temp/foo.h [EMAIL PROTECTED] /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/