Hello,

The attached patch makes it possible to compile LLVM under Mingw/Cygwin (that is, with "gcc -mno-cygwin" under Cygwin). The only problem which I could not address with configure flags is that the tblgen tool expect Windows paths, whereas the build system uses Cygwin paths. The patch introduce a Gnu Make function SYSPATH which performs the translation if needed.

Ideally, the SYSPATH variable in Makefile.config should be set by the configure script when given a special option (the same option could also set the other needed options -- see below). As I didn't want to play with autoconf, the current solution requires an explicit argument to be passed to make for the compilation.

With the patch, I was able to compile with the following commands:

./configure --build=i686-pc-mingw32 CC="gcc -mno-cygwin" CXX="g++ -mno-cygwin" ac_cv_search_dlopen=no ac_cv_lib_dl_dlopen=no

make USE_CYGPATH=1


Alain
Index: Makefile.config.in
===================================================================
--- Makefile.config.in  (revision 45701)
+++ Makefile.config.in  (working copy)
@@ -265,3 +265,10 @@
 ALL_BINDINGS      := @ALL_BINDINGS@
 OCAML_LIBDIR      := @OCAML_LIBDIR@
 
+USE_CYGPATH := false
+
+ifeq ($(USE_CYGPATH), true)
+  SYSPATH := $(shell echo $(1) | cygpath -m -f -)
+else
+  SYSPATH := $(1)
+endif
Index: lib/VMCore/Makefile
===================================================================
--- lib/VMCore/Makefile (revision 45701)
+++ 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 45701)
+++ Makefile.rules      (working copy)
@@ -483,8 +483,9 @@
 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      
+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 +1249,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