Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: "Dave Korn" To: Subject: RE: problems using gcc -MM on source with Windows-style #include paths Date: Wed, 15 Dec 2004 13:12:18 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit In-Reply-To: <20041214183915.61626.qmail@web53003.mail.yahoo.com> Message-ID: X-OriginalArrivalTime: 15 Dec 2004 13:12:19.0406 (UTC) FILETIME=[B4CE6EE0:01C4E2A7] > -----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 > #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 AT mace /test> cat foo.c #include "temp\foo.h" int x = WHATEVER; dk AT mace /test> cat temp/foo.h #define WHATEVER 6 dk AT mace /test> gcc -c -MM foo.c foo.o: foo.c temp/foo.h dk AT 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/