mpir/win/make.bat
2011-04-01 01:36:08 +00:00

124 lines
3.8 KiB
Batchfile

@echo off
:: Copyright 2011 Jason Moxham
::
:: This file is part of the MPIR Library.
::
:: The MPIR Library is free software; you can redistribute it and/or modify
:: it under the terms of the GNU Lesser General Public License as published
:: by the Free Software Foundation; either version 2.1 of the License, or (at
:: your option) any later version.
::
:: The MPIR Library is distributed in the hope that it will be useful, but
:: WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
:: or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
:: License for more details.
::
:: You should have received a copy of the GNU Lesser General Public License
:: along with the MPIR Library; see the file COPYING.LIB. If not, write
:: to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
:: Boston, MA 02110-1301, USA.
::
if not exist config.params.bat (
echo run configure first
exit /b 1
)
call config.params.bat
md mpn mpz mpq mpf printf scanf cxx > nul 2>&1
copy ..\build.vc10\gen_mpir_h.bat .
copy ..\build.vc10\out_copy_rename.bat .
copy ..\build.vc10\gen_config_h.bat .
copy ..\build.vc10\cfg.h .
::del ..\mpir.h > nul 2>&1
if %ABI% == 64 (set LOCALABI=x64)
if %ABI% == 32 (set LOCALABI=win32)
call gen_mpir_h %LOCALABI%
::del ..\config.h > nul 2>&1
for %%X in ( %MPNPATH% ) do (
copy ..\mpn\%%X\gmp-mparam.h .. > nul 2>&1
call gen_config_h ..\mpn\%%X > nul 2>&1
)
echo #include ^<stdint.h^> > comptest.c
echo int main(void){return 0;} >> comptest.c
cl /nologo comptest.c > nul 2>&1
if errorlevel 1 (
echo #undef HAVE_STDINT_H >> ..\config.h
echo #undef HAVE_INTMAX_T >> ..\config.h
echo #undef HAVE_UINTMAX_T >> ..\config.h
echo #undef HAVE_PTRDIFF_T >> ..\config.h
echo #undef HAVE_UINT_LEAST32_T >> ..\config.h
echo #undef SIZEOF_UINTMAX_T >> ..\config.h
)
del comptest.*
::static
::set OPT=/Ox /Oi /Ot /D "NDEBUG" /D "_LIB" /D "HAVE_CONFIG_H" /D "PIC" /D "_MBCS" /MT /GS- /FD /nologo /c /Zi /favor:INTEL64
::dll
::set OPT=/Ox /D "NDEBUG" /D "HAVE_CONFIG_H" /D "__GMP_LIBGMP_DLL" /D "__GMP_WITHIN_GMP" /D "__GMP_WITHIN_GMPXX" /D "_WINDLL" /D "_MBCS" /GF /FD /EHsc /MD /GS- /nologo /c /Zi /Gd
::set OPT=/Oi /D "_LIB" /D "PIC" /D "_MBCS" /MT /GS- /FD /favor:INTEL64
::set OPT= /D "__GMP_LIBGMP_DLL" /D "__GMP_WITHIN_GMP" /D "__GMP_WITHIN_GMPXX" /D "_WINDLL" /D "_MBCS" /GF /FD /EHsc /MD /GS- /Gd
set OPT=%FLAGS% %FLAGS1%
if %ABI% == 64 (set LOCALDIR=x86_64w)
if %ABI% == 32 (set LOCALDIR=x86w)
:: or just compile all generic and just overwrite with asm
cd mpn
for %%X in ( ..\..\mpn\generic\*.c) do (
cl %OPT% -I..\.. %%X
)
for %%X in ( %MPNPATH% ) do (
for %%i in ( ..\..\mpn\%%X\*.asm ) do (
%YASMEXE% -I ..\..\mpn\%LOCALDIR% -f %LOCALABI% %%i
echo assemblin %%i
)
)
cd ..
cd mpz
for %%X in ( ..\..\mpz\*.c) do (
cl %OPT% -I..\.. %%X
)
cd ..
cd mpf
for %%X in ( ..\..\mpf\*.c) do (
cl %OPT% -I..\.. %%X
)
cd ..
cd mpq
for %%X in ( ..\..\mpq\*.c) do (
cl %OPT% -I..\.. %%X
)
cd ..
cd printf
for %%X in ( ..\..\printf\*.c) do (
cl %OPT% -I..\.. %%X
)
cd ..
cd scanf
for %%X in ( ..\..\scanf\*.c) do (
cl %OPT% -I..\.. %%X
)
cd ..
for %%X in ( ..\assert.c ..\compat.c ..\errno.c ..\extract-dbl.c ..\invalid.c ..\memory.c ..\mp_bpl.c ..\mp_clz_tab.c ..\mp_dv_tab.c ..\mp_get_fns.c ..\mp_minv_tab.c ..\mp_set_fns.c ..\randbui.c ..\randclr.c ..\randdef.c ..\randiset.c ..\randlc2s.c ..\randlc2x.c ..\randmt.c ..\randmts.c ..\randmui.c ..\rands.c ..\randsd.c ..\randsdui.c ..\tal-reent.c ..\version.c ) do (
cl %OPT% -I.. %%X
)
cd cxx
for %%X in ( ..\..\cxx\*.cc) do (
cl /EHsc %OPT% -I..\.. %%X
)
cd ..
lib /nologo scanf\*.obj printf\*.obj mpz\*.obj mpq\*.obj mpf\*.obj mpn\*.obj cxx\*.obj *.obj /out:mpir.%LIBTYPE%
:fin