From: montanaro AT crd DOT ge DOT com (Skip Montanaro) Subject: A bit different path conversion problem (and solution) 20 Feb 1998 20:38:42 -0800 Message-ID: <199802202228.RAA28934.cygnus.gnu-win32@esopus.crd.ge.com> Reply-To: skip AT calendar DOT com To: gnu-win32 AT cygnus DOT com I just joined the list because I was having trouble with Unix v. Windows paths. I dug through the archives a bit and a few threads over the past several months. (Seems to be a frequently recurring topic...) None seemed to quite match the problem I had. It turned out to have a relatively easy fix. I figured others might find it useful. We are using gnu-win32 to port some Unix code to Windows. We already relied on GNU make, gcc and g++, so the logical choice was to use gnu-win32 as a build environment. The problem is that not all of the GNU tools treat paths consistently. GNU cpp wants DOS-ish filenames (e.g., h:/some/path), while GNU make wants Unix-ish filenames (.e.g., //h/some/path). This posed a problem because we use gcc/g++ -MM to build dependencies. We'd give it DOS-ish paths and it would obligingly spit out DOS-ish paths, causing GNU make to barf. One person I saw fixed the problem by modifying GNU make to accept DOS-ish filenames. I didn't want to fiddle with compiling any more tools than absolutely necessary, however. The solution was to post-process the gcc -MM output: export PLATFORM = $(shell uname) export PCPLATFORM = CYGWIN32/NT ... ifeq ($(PLATFORM),$(PCPLATFORM)) DOSIFY = -e "s@\([a-z]\):/@//\1/@g" endif %.d: %.c $(SHELL) -ec 'gcc -MM $(CPPFLAGS) $< | sed -e "s/$*.o/& $@/g" $(DOSIFY) > $@' Just another itty-bitty tool for your toolbox... Have a nice weekend, -- Skip Montanaro (skip AT calendar DOT com) 518-372-5583 - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".