[AD] Re: updated fix.bat to simplify MSVC target |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: alleg-developers@xxxxxxxxxx
- Subject: [AD] Re: updated fix.bat to simplify MSVC target
- From: Matthew Leverton <meffer@xxxxxxxxxx>
- Date: Fri, 1 Apr 2005 13:52:06 -0600
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:references; b=Z1R80CJOOWa4hRNKv3bsCZ5EjOBgl+hs6xHSrFsdF3cARWLUAJG1grdtR9c1VX/fhsPI7kgaInWy+gkarjhh1mL/edpIDml8RcltA7f4YMS9Sgge8SvVBY8tZDucUekEqkDmP/dOkmKEZ0/m5GXbfYSw8V1FhKNmypMxwwMAx48=
A minor correction. The first file didn't check to see if MSVC was the target.
Which leads me to a question I have been meaning to propose... Would
it make sense to convert the paths for every build? I know normally
that a variable like MINGDIR doesn't have spaces, but it could. Is
there any reason (beside that) why we limit the conversion to MSVCDir?
--
Matthew Leverton
http://www.allegro.cc
@echo off
rem Sets up the Allegro package for building with the specified compiler,
rem and if possible converting text files from LF to CR/LF format.
rem Test if there are too many args.
if [%4] == [] goto arg3
goto help
:arg3
rem Test if third arg is ok.
if [%3] == [--crlf] goto arg2
if [%3] == [--disable-8.3] goto arg2
if [%3] == [] goto arg2
goto help
:arg2
rem Test if second arg is ok.
if [%2] == [--crlf] goto arg1
if [%2] == [--disable-8.3] goto arg1
if [%2] == [] goto arg1
goto help
:arg1
rem Test if first arg is ok.
if [%1] == [bcc32] goto head
if [%1] == [djgpp] goto head
if [%1] == [mingw32] goto head
if [%1] == [msvc] goto head
if [%1] == [msvc7] goto head
if [%1] == [icl] goto head
if [%1] == [watcom] goto head
goto help
:head
rem Generate header of makefile and alplatf.h,
rem then go to platform specific function.
echo # generated by fix.bat > makefile
echo /* generated by fix.bat */ > include\allegro\platform\alplatf.h
if [%1] == [bcc32] goto bcc32
if [%1] == [djgpp] goto djgpp
if [%1] == [mingw32] goto mingw32
if [%1] == [msvc] goto msvc6
if [%1] == [msvc7] goto msvc7
if [%1] == [icl] goto icl
if [%1] == [watcom] goto watcom
echo fix.bat internal error: not reached
goto help
:bcc32
echo Configuring Allegro for Windows/BCC32...
echo MAKEFILE_INC = makefile.bcc >> makefile
echo #define ALLEGRO_BCC32 >> include\allegro\platform\alplatf.h
goto tail
:djgpp
echo Configuring Allegro for DOS/djgpp...
echo MAKEFILE_INC = makefile.dj >> makefile
echo #define ALLEGRO_DJGPP >> include\allegro\platform\alplatf.h
goto tail
:mingw32
echo Configuring Allegro for Windows/Mingw32...
echo MAKEFILE_INC = makefile.mgw >> makefile
echo #define ALLEGRO_MINGW32 >> include\allegro\platform\alplatf.h
goto tail
:icl
echo Configuring Allegro for Windows/ICL...
echo COMPILER_ICL = 1 >> makefile
goto msvccommon
:msvc7
echo Configuring Allegro for Windows/MSVC7...
echo COMPILER_MSVC7 = 1 >> makefile
goto msvccommon
:msvc6
echo Configuring Allegro for Windows/MSVC6...
goto msvccommon
:msvccommon
echo MAKEFILE_INC = makefile.vc >> makefile
echo #define ALLEGRO_MSVC >> include\allegro\platform\alplatf.h
if [%3] == [--disable-8.3] goto tail
if [%2] == [--disable-8.3] goto tail
goto convertmsvcdir
:watcom
echo Configuring Allegro for DOS/Watcom...
echo MAKEFILE_INC = makefile.wat >> makefile
echo #define ALLEGRO_WATCOM >> include\allegro\platform\alplatf.h
goto tail
:help
echo.
echo Usage: fix platform [--crlf] [--disable-8.3]
echo.
echo Where platform is one of: bcc32, djgpp, mingw32, msvc, msvc7, icl or watcom.
echo.
echo The --crlf parameter is used to turn on LF to CR/LF conversion.
echo.
echo By default, fix.bat will shorten your MSVCDir variable into
echo the DOS 8.3 format. This is done to prevent any problems a long
echo path with spaces might cause.
echo.
echo Use the --disable-8.3 parameter if you do not want fix.bat to
echo shorten your MSVCDir variable.
echo.
goto end
:convertmsvcdir
echo Shortening MSVCDir path...
gcc -s -o msvchelp.exe misc/msvchelp.c
if not "%ERRORLEVEL%" == "0" goto nogcc
msvchelp MSVCDir
if not "%ERRORLEVEL%" == "0" goto helper_error
del msvchelp.exe
echo include makefile.helper >> makefile
goto tail
:nogcc
echo.
echo *** ERROR ***
echo GCC was not found in your path. To compile Allegro for MSVC, you need to
echo have gcc (MinGW or DJGPP) installed. See the documentation for more info.
echo If you have GCC installed already, you can add it to the path by the following:
echo.
echo SET PATH=%%PATH%%;c:\path-to-gcc\bin
echo.
echo After correcting this problem, you will need to run "fix.bat %1" again.
goto end
:helper_error
echo.
echo *** ERROR ***
echo There was a problem convering the MSVCDir variable to the 8.3 short format.
echo Make sure that MSVCDir is set and that you are on a drive that is writeable.
echo.
echo After correcting this problem, you will need to run "fix.bat %1" again.
echo.
goto end
:tail
rem Generate last line of makefile and optionally convert CR/LF.
echo include makefile.all >> makefile
if [%2] == [--crlf] goto crlf_convert
if [%3] == [--crlf] goto crlf_convert
goto done
:crlf_convert
echo Converting Allegro files to DOS CR/LF format...
utod .../*.bat .../*.sh .../*.c *.cfg .../*.h .../*.inc .../*.rc
utod .../*.rh .../*.inl .../*.s .../*.txt .../*._tx makefile.*
:done
echo Done!
:end