[llvm-commits] Patch Proposal: tweak *.d on mingw-msys build environment

NAKAMURA Takumi geek4civic at gmail.com
Wed Jul 28 09:35:26 PDT 2010


This patch substitutes DOSish driveletter(c:/xxx/) scheme to
msys-compatible(/c/xxx/) one
when build host is MingW.

I am using the msysgit (msys+mingw+git) package as development environment.
C:/msysgit/mingw/bin/g++.exe (TDM-1 mingw32) 4.4.0
C:/msysgit/mingw/bin/make.exe GNU Make 3.81

msys-make igonores dependency rules emitted by mingw-g++ with -MMD,
... without any warnings.

And I have confirmed this might not have any side effects on
fedora12-ppc and cygwin.


...Takumi
-------------- next part --------------
diff --git a/Makefile.rules b/Makefile.rules
index 0b0f02c..d8f8236 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -1457,8 +1457,15 @@ DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
 
 # If the build succeeded, move the dependency file over, otherwise
 # remove it.
+ifeq ($(OS),MingW)
+DEPEND_MOVEFILE = then $(SED) 's/^\([ \t]*\)\([A-Za-z]\):/\1\/\2/g' \
+                        "$(ObjDir)/$*.d.tmp" > "$(ObjDir)/$*.d"; \
+                        $(RM) "$(ObjDir)/$*.d.tmp"; \
+                  else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
+else
 DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
                   else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
+endif
 
 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_SRC_DIR)/Makefile
 	$(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)


More information about the llvm-commits mailing list