Re: [AD] Patch for makefile issue when compiling MSVC with Cygwin |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: Coordination of admins/developers of the game programming library Allegro <alleg-developers@xxxxxxxxxx>
- Subject: Re: [AD] Patch for makefile issue when compiling MSVC with Cygwin
- From: Andrei Ellman <ae-a-alleg@xxxxxxxxxx>
- Date: Sun, 24 Dec 2006 12:49:46 +0100
- Organization: Wacko Software
Milan Mimica wrote:
On 23/12/06, Milan Mimica <milan.mimica@xxxxxxxxxx> wrote:
Hey, passing makefile variables to shell command works! Try the patch.
It's just a stripped version of yours.
Actually stripping it even more. Using only the variable defined in
makefile.helper.
The second version using makefile.helper does not work if using MSVC6,
as msvchelp.c does not get called. Either use the version of the patch
that I've attatched (a modified version of the first version of your
patch), or update fix.bat so that msvchelp.c is called regardless of
which MSVC version is being used (and update the docs to reflect this).
My patch also changes
WINDIR_S = $(shell cygpath -S)
to
WINDIR_S := $(shell cygpath -S)
in order to speed up makefile parsing. I have attatched a similar patch
for makefile.mgw that does the same.
Also worth mentioning is that the runner.exe utility does not seem to
like paths in /cygdrive/c/ format. Am I right in guessing that apps
compiled with -mno-cygwin cannot recognise cygdrive paths? If so, is it
worth compiling runner.exe as a native cygwin app so that the following:
ifdef ALLEGRO_USE_CYGWIN
MSVCDIR_TOOLSDIR_U = $(subst \,/,$(MSVCDIR_MSVCDIR))
else
MSVCDIR_TOOLSDIR_U = $(MSVCDIR_U)
endif
can be reduced to:
MSVCDIR_TOOLSDIR_U = $(MSVCDIR_U)
AE.
--- makefile.vc.old 2006-11-26 12:13:58.000000000 +0100
+++ makefile.vc 2006-12-24 12:17:20.668656000 +0100
@@ -103,6 +103,14 @@
.PHONY: badwin badmsvc badspaces
+ifdef ALLEGRO_USE_CYGWIN
+
+WINDIR_S := $(shell cygpath -S)
+WINDIR_U = $(subst \,/,$(WINDIR_S))
+WINDIR_D = $(subst /,\,$(WINDIR_S))
+
+else
+
ifeq ($(OS),Windows_NT)
WINSYSDIR = $(SYSTEMROOT)
ifeq ($(WINSYSDIR),)
@@ -125,19 +133,39 @@
@echo Your SYSTEMROOT or windir environment variable is not set!
endif
+endif # ALLEGRO_USE_CYGWIN
+
+
+# Different MSVC versions use different variables for storing the MSVC dir.
+# Make sure that MSVCDIR_MSVCDIR contains the MSVC dir.
ifdef MSVCDIR
- MSVCDIR_U = $(subst \,/,$(MSVCDIR))
- MSVCDIR_D = $(subst /,\,$(MSVCDIR))
+ MSVCDIR_MSVCDIR = $(MSVCDIR)
else
ifdef MSVCDir
- MSVCDIR_U = $(subst \,/,$(MSVCDir))
- MSVCDIR_D = $(subst /,\,$(MSVCDir))
+ MSVCDIR_MSVCDIR = $(MSVCDir)
+else
+ifdef VCINSTALLDIR
+ MSVCDIR_MSVCDIR = $(VCINSTALLDIR)
else
badmsvc:
- @echo Your MSVCDIR environment variable is not set!
+ @echo Your MSVCDIR or MSVCDir or VCINSTALLDIR environment variable is not set!
@echo See the docs/build/msvc.txt file!
endif
endif
+endif
+
+ifdef ALLEGRO_USE_CYGWIN
+# Note: In order to get the Cygwin-style path without spaces,
+# we must first convert the path to DOS 8.3 format using 'cygpath -d',
+# and then convert the result to Cygwin format.
+ MSVCDIR_S := $(shell cygpath `cygpath -d "$(MSVCDIR_MSVCDIR)"`)
+ MSVCDIR_U = $(subst \,/,$(MSVCDIR_S))
+ MSVCDIR_D = $(subst /,\,$(MSVCDIR_S))
+else
+ MSVCDIR_U = $(subst \,/,$(MSVCDIR_MSVCDIR))
+ MSVCDIR_D = $(subst /,\,$(MSVCDIR_MSVCDIR))
+endif # ALLEGRO_USE_CYGWIN
+
NULLSTRING :=
SPACE := $(NULLSTRING) # special magic to get an isolated space character
@@ -160,13 +188,22 @@
# -------- Work out the absolute pathnames for some MSVC tools to avoid confusion --------
+ifdef ALLEGRO_USE_CYGWIN
+ # The runner.exe tool does not like paths in the /cygdrive/ format.
+ # ?: Is this because if an app was compiled with -mno-cygwin, it means that paths in the /cygdrive format do not make sense?
+ MSVCDIR_TOOLSDIR_U = $(subst \,/,$(MSVCDIR_MSVCDIR))
+else
+ MSVCDIR_TOOLSDIR_U = $(MSVCDIR_U)
+endif
+
+
ifdef COMPILER_ICL
MSVC_CL = icl
else
- MSVC_CL = $(MSVCDIR_U)/bin/cl
+ MSVC_CL = $(MSVCDIR_TOOLSDIR_U)/bin/cl
endif
-MSVC_LINK = $(MSVCDIR_U)/bin/link
-MSVC_LIB = $(MSVCDIR_U)/bin/link -lib
+MSVC_LINK = $(MSVCDIR_TOOLSDIR_U)/bin/link
+MSVC_LIB = $(MSVCDIR_TOOLSDIR_U)/bin/link -lib
MSVC_RC = rc
--- makefile.mgw.old 2006-12-24 12:18:14.826531200 +0100
+++ makefile.mgw 2006-12-24 12:18:34.084222400 +0100
@@ -68,7 +68,7 @@
ifdef ALLEGRO_USE_CYGWIN
-WINDIR_S = $(shell cygpath -S)
+WINDIR_S := $(shell cygpath -S)
WINDIR_U = $(subst \,/,$(WINDIR_S))
WINDIR_D = $(subst /,\,$(WINDIR_S))