[AD] Patch for makefile issue when compiling MSVC with Cygwin |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: "Allegro Conductors [AD]" <Alleg-developers@xxxxxxxxxx>
- Subject: [AD] Patch for makefile issue when compiling MSVC with Cygwin
- From: Andrei Ellman <ae-a-alleg@xxxxxxxxxx>
- Date: Tue, 19 Dec 2006 08:48:02 +0100
- Organization: Wacko Software
When trying to compile Allegro 4.2.1 for MSVC using Cygwin, I got the
following error:
makefile.vc:282: *** target pattern contains no `%'. Stop.
After some research, I came to the conclusion that a ':' in the target
pattern was causing the problem. I had been able to compile it
previously, so came to the conclusion that when upgrading Cygwin (the
first time I had done so in a year), the ability for target-patterns to
contain ':' must have disappeared.
I had been able to build the MinGW build using Cygwin, so I looked at
how makefile.mgw handled it. I noticed the line "WINDIR_S = $(shell
cygpath -S)" which used Cygwin's 'cygpath' command to get a path in the
cygwin format which does not use a colon (ie. /cygdrive/c/foo/ instead
of C:/foo/). This was not present in makefile.vc
The attatched patch fixes the problem. It uses 'cygpath' to obtain the
Windows directory, and the MSVCDIR directory (I'm not sure how to pass a
makefile variable to a 'shell' call, so instead, I passed in the shell's
MSVCDIR or MSVCDir variable depending on which was available). For some
reason, the runner.exe utility cannot cope with tool-paths in the
cygpath format, so I also made a change to how the absolute pathnames
for the tools were calculated.
So far, this has only been tried with Cygwin. I'm not sure if the ':'
problem is a cygwin thing, or if a solution needs to be thought up for
MinGW as well.
Anyway, here's what I get witn make -v
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i686-pc-cygwin
--- makefile.vc.old 2006-11-26 12:13:58.000000000 +0100
+++ makefile.vc 2006-12-19 06:35:13.852212800 +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,13 +133,14 @@
@echo Your SYSTEMROOT or windir environment variable is not set!
endif
+endif # ALLEGRO_USE_CYGWIN
+
+
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
badmsvc:
@echo Your MSVCDIR environment variable is not set!
@@ -139,6 +148,26 @@
endif
endif
+ifdef ALLEGRO_USE_CYGWIN
+
+# Note: Using ':=' instead of '=' to improve performance of parsing makefile.
+# ?: Is there a more elegant way of setting MSVCDIR_S? MSVCDIR_S := $(shell cygpath $(MSVCDIR_MSVCDIR)) does not seem to work.
+ifdef MSVCDIR
+ MSVCDIR_S := $(shell cygpath $$MSVCDIR)
+else
+ifdef MSVCDir
+ MSVCDIR_S := $(shell cygpath $$MSVCDir)
+endif
+endif
+
+ 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 +189,21 @@
# -------- 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.
+ 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