Hello,

Sorry for not replying before. I was not subscribed to llvm-commits and did not see your email.

A couple of comments: You really need to add some comments in Makefile.config.in over the stuff that sets SYSPATH to indicate what it is used for, and probably over the TableGen = ... line in Makefile.rules. If you don't do this, someone may break this in the future.

Ok, done.

Another thing: does it work to add something like this to makefile.rules?

ifeq ($(OS),Cygwin)
USE_CYGPATH := true # Actually, it would be better to do the syspath stuff here and remove USE_CYGPATH
endif

cygpath should only be used when compiling for Mingw under Cygwin (ie, the gcc -mno-cygwin). I've done that instead:

ifneq (,$(findstring -mno-cygwin, $(CXX)))
  SYSPATH = $(shell echo $(1) | cygpath -m -f -)
else
  SYSPATH = $(1)
endif


The new patch is attached.


-- Alain
Index: Makefile.config.in
===================================================================
--- Makefile.config.in  (revision 45958)
+++ Makefile.config.in  (working copy)
@@ -265,3 +265,11 @@
 ALL_BINDINGS      := @ALL_BINDINGS@
 OCAML_LIBDIR      := @OCAML_LIBDIR@
 
+# When compiling under Mingw/Cygwin, executables such as tblgen
+# expect Windows paths, whereas the build system uses Unix paths.
+# The function SYSPATH transforms Unix paths into Windows paths.
+ifneq (,$(findstring -mno-cygwin, $(CXX)))
+  SYSPATH = $(shell echo $(1) | cygpath -m -f -)
+else
+  SYSPATH = $(1)
+endif
Index: lib/VMCore/Makefile
===================================================================
--- lib/VMCore/Makefile (revision 45958)
+++ lib/VMCore/Makefile (working copy)
@@ -21,7 +21,7 @@
 
 $(ObjDir)/Intrinsics.gen.tmp: $(ObjDir)/.dir $(INTRINSICTDS) $(TBLGEN)
        $(Echo) Building Intrinsics.gen.tmp from Intrinsics.td
-       $(Verb) $(TableGen) $(INTRINSICTD) -o $@ -gen-intrinsic
+       $(Verb) $(TableGen) $(call SYSPATH, $(INTRINSICTD)) -o $(call SYSPATH, 
$@) -gen-intrinsic
 
 $(GENFILE): $(ObjDir)/Intrinsics.gen.tmp
        $(Verb) $(CMP) -s $@ $< || ( $(CP) $< $@ && \
Index: Makefile.rules
===================================================================
--- Makefile.rules      (revision 45958)
+++ Makefile.rules      (working copy)
@@ -483,8 +483,14 @@
 ProgInstall   = $(INSTALL) $(Install.StripFlag) -m 0755 
 ScriptInstall = $(INSTALL) -m 0755 
 DataInstall   = $(INSTALL) -m 0644
-TableGen      = $(TBLGEN) -I $(PROJ_SRC_DIR) -I$(PROJ_SRC_ROOT)/include \
-                -I $(PROJ_SRC_ROOT)/lib/Target      
+
+# When compiling under Mingw/Cygwin, the tblgen tool expects Windows
+# paths. In this case, the SYSPATH function (defined in
+# Makefile.config) transforms Unix paths into Windows paths.
+TableGen      = $(TBLGEN) -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
+                -I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
+                -I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
+
 Archive       = $(AR) $(AR.Flags)
 LArchive      = $(LLVMToolDir)/llvm-ar rcsf
 ifdef RANLIB
@@ -1248,57 +1254,57 @@
 $(TARGET:%=$(ObjDir)/%GenRegisterNames.inc.tmp): \
 $(ObjDir)/%GenRegisterNames.inc.tmp : %.td $(ObjDir)/.dir
        $(Echo) "Building $(<F) register names with tblgen"
-       $(Verb) $(TableGen) -gen-register-enums -o $@ $<
+       $(Verb) $(TableGen) -gen-register-enums -o $(call SYSPATH, $@) $<
 
 $(TARGET:%=$(ObjDir)/%GenRegisterInfo.h.inc.tmp): \
 $(ObjDir)/%GenRegisterInfo.h.inc.tmp : %.td $(ObjDir)/.dir
        $(Echo) "Building $(<F) register information header with tblgen"
-       $(Verb) $(TableGen) -gen-register-desc-header -o $@ $<
+       $(Verb) $(TableGen) -gen-register-desc-header -o $(call SYSPATH, $@) $<
 
 $(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
 $(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir
        $(Echo) "Building $(<F) register info implementation with tblgen"
-       $(Verb) $(TableGen) -gen-register-desc -o $@ $<
+       $(Verb) $(TableGen) -gen-register-desc -o $(call SYSPATH, $@) $<
 
 $(TARGET:%=$(ObjDir)/%GenInstrNames.inc.tmp): \
 $(ObjDir)/%GenInstrNames.inc.tmp : %.td $(ObjDir)/.dir
        $(Echo) "Building $(<F) instruction names with tblgen"
-       $(Verb) $(TableGen) -gen-instr-enums -o $@ $<
+       $(Verb) $(TableGen) -gen-instr-enums -o $(call SYSPATH, $@) $<
 
 $(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
 $(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir
        $(Echo) "Building $(<F) instruction information with tblgen"
-       $(Verb) $(TableGen) -gen-instr-desc -o $@ $<
+       $(Verb) $(TableGen) -gen-instr-desc -o $(call SYSPATH, $@) $<
 
 $(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
 $(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir
        $(Echo) "Building $(<F) assembly writer with tblgen"
-       $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
+       $(Verb) $(TableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
 
 $(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
 $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir
        $(Echo) "Building $(<F) assembly writer #1 with tblgen"
-       $(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $< 
+       $(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, 
$@) $< 
 
 $(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
 $(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir
        $(Echo) "Building $(<F) code emitter with tblgen"
-       $(Verb) $(TableGen) -gen-emitter -o $@ $<
+       $(Verb) $(TableGen) -gen-emitter -o $(call SYSPATH, $@) $<
 
 $(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
 $(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir
        $(Echo) "Building $(<F) instruction selector implementation with tblgen"
-       $(Verb) $(TableGen) -gen-dag-isel -o $@ $<
+       $(Verb) $(TableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
 
 $(TARGET:%=$(ObjDir)/%GenSubtarget.inc.tmp): \
 $(ObjDir)/%GenSubtarget.inc.tmp : %.td $(ObjDir)/.dir
        $(Echo) "Building $(<F) subtarget information with tblgen"
-       $(Verb) $(TableGen) -gen-subtarget -o $@ $<
+       $(Verb) $(TableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
 
 $(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
 $(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir
        $(Echo) "Building $(<F) calling convention information with tblgen"
-       $(Verb) $(TableGen) -gen-callingconv -o $@ $<
+       $(Verb) $(TableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
 
 clean-local::
        -$(Verb) $(RM) -f $(INCFiles)
_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to