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: Milan Mimica <milan.mimica@xxxxxxxxxx>
- Date: Fri, 29 Dec 2006 13:24:56 +0100
Michal Molhanec wrote:
in that case, can you test the attached patch ?
The patch works but doesn't do much in sense of makefile.vc simplification.
Mine patch (attached) upgrades your changes in fix.bat so that MSVCDir
is always set in "makefile" file. This way makefile.vc can rely on
MSVCDir being declared and no need to test for MSVCDIR and VCINSTALLDIR.
It simplifies makefile.vc.
Docs still need to be updated.
--
Milan Mimica
http://sparklet.sf.net
Index: fix.bat
===================================================================
--- fix.bat (revision 7679)
+++ fix.bat (working copy)
@@ -9,18 +9,20 @@
:arg3
rem Test if third arg is ok.
-if [%3] == [--crlf] goto arg2
-if [%3] == [--quick] goto arg2
-if [%3] == [--msvcpaths] goto arg2
-if [%3] == [] goto arg2
+if [%3] == [--crlf] goto arg2
+if [%3] == [--quick] goto arg2
+if [%3] == [--msvcpaths] goto arg2
+if [%3] == [--nomsvcpaths] goto arg2
+if [%3] == [] goto arg2
goto help
:arg2
rem Test if second arg is ok.
-if [%2] == [--crlf] goto arg1
-if [%2] == [--quick] goto arg1
-if [%2] == [--msvcpaths] goto arg1
-if [%2] == [] goto arg1
+if [%2] == [--crlf] goto arg1
+if [%2] == [--quick] goto arg1
+if [%2] == [--msvcpaths] goto arg1
+if [%2] == [--nomsvcpaths] goto arg1
+if [%2] == [] goto arg1
goto help
:arg1
@@ -108,6 +110,7 @@
echo MAKEFILE_INC = makefile.vc >> makefile
echo #define ALLEGRO_MSVC >> include\allegro\platform\alplatf.h
if "%MSVCDir%" == "" set MSVCDir=%VCINSTALLDIR%
+if "%MSVCDir%" == "" echo Your MSVCDir environment variable is not set!
goto tail
:watcom
@@ -118,35 +121,39 @@
:help
echo.
-echo Usage: fix platform [--crlf] [--msvcpaths]
+echo Usage: fix platform [--crlf] [--nomsvcpaths]
echo.
echo Where platform is one of:
echo bcc32, djgpp, mingw, msvc6, msvc7, msvc8, icl, or watcom.
echo.
echo The --crlf parameter is used to turn on LF to CR/LF conversion.
+echo The --nomsvcpaths parameter is used to turn off special MS Visual C++
+echo path handling.
echo.
-echo Use the --msvcpaths parameter if your MSVCDir variable contains
-echo spaces (you can view content of that variable by typing
-echo echo %%MSVCDir%%
-echo on the command line). Remember that this will only work if you
-echo have MinGW gcc in your PATH.
-echo With MSVC 8 and higher the variable name is VCINSTALLDIR instead
-echo of MSVCDir.
-echo.
goto end
-:convertmsvcdir
+:includemsvcdir
+if [%2] == [--nomsvcpaths] goto skipconvert
+if [%3] == [--nomsvcpaths] goto skipconvert
echo Converting MSVCDir path...
-gcc -mno-cygwin -s -o msvchelp.exe misc/msvchelp.c
+cl /nologo /w misc/msvchelp.c >NUL
msvchelp MSVCDir
del msvchelp.exe
+del msvchelp.obj
echo include makefile.helper >> makefile
goto realtail
+:skipconvert
+echo MSVCDir = %MSVCDir% >> makefile
+goto realtail
+
:tail
-if [%3] == [--msvcpaths] goto convertmsvcdir
-if [%2] == [--msvcpaths] goto convertmsvcdir
+REM msvc6 does not need this, msvc is fallback so we should do it anyway
+if [%1] == [msvc] goto includemsvcdir
+if [%1] == [msvc6] goto skipmsvcdir
+if [%1] == [msvc7] goto includemsvcdir
+if [%1] == [msvc8] goto includemsvcdir
:realtail
rem Generate last line of makefile and optionally convert CR/LF.
Index: makefile.vc
===================================================================
--- makefile.vc (revision 7679)
+++ makefile.vc (working copy)
@@ -136,47 +136,28 @@
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_MSVCDIR = $(MSVCDIR)
-else
-ifdef MSVCDir
- MSVCDIR_MSVCDIR = $(MSVCDir)
-else
-ifdef VCINSTALLDIR
- MSVCDIR_MSVCDIR = $(VCINSTALLDIR)
-else
+ifndef MSVCDir
badmsvc:
- @echo Your MSVCDIR or MSVCDir or VCINSTALLDIR environment variable is not set!
+ @echo Your MSVCDir 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_S := $(shell cygpath `cygpath -d "$(MSVCDir)"`)
MSVCDIR_U = $(subst \,/,$(MSVCDIR_S))
MSVCDIR_D = $(subst /,\,$(MSVCDIR_S))
else
- MSVCDIR_U = $(subst \,/,$(MSVCDIR_MSVCDIR))
- MSVCDIR_D = $(subst /,\,$(MSVCDIR_MSVCDIR))
+ MSVCDIR_U = $(subst \,/,$(MSVCDir))
+ MSVCDIR_D = $(subst /,\,$(MSVCDir))
endif # ALLEGRO_USE_CYGWIN
NULLSTRING :=
SPACE := $(NULLSTRING) # special magic to get an isolated space character
-ifneq ($(findstring $(SPACE),$(MSVCDIR)),)
-badspaces:
- @echo There are spaces in your MSVCDIR environment variable:
- @echo please change it to the 8.3 short filename version,
- @echo or move your compiler to a different directory.
-endif
-
ifneq ($(findstring $(SPACE),$(MSVCDir)),)
badspaces:
@echo There are spaces in your MSVCDir environment variable:
@@ -191,7 +172,7 @@
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))
+ MSVCDIR_TOOLSDIR_U = $(subst \,/,$(MSVCDir))
else
MSVCDIR_TOOLSDIR_U = $(MSVCDIR_U)
endif