mpir/win/make.bat

407 lines
12 KiB
Batchfile
Raw Normal View History

2011-03-19 09:49:07 -04:00
@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.
::
2011-03-31 20:59:41 -04:00
if not exist config.params.bat (
echo run configure first
exit /b 1
)
call config.params.bat
2011-03-31 22:27:32 -04:00
if "%1" == "" goto :make
if "%1" == "check" goto :check
if "%1" == "clean" goto :clean
if "%1" == "tune" goto :tune
if "%1" == "speed" goto :speed
echo Usage: make [clean^|check^|tune^|speed]
exit /b 1
:make
2011-03-20 09:45:08 -04:00
md mpn mpz mpq mpf printf scanf cxx > nul 2>&1
2011-03-19 09:49:07 -04:00
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 .
2011-03-31 21:36:08 -04:00
if %ABI% == 64 (set LOCALABI=x64)
if %ABI% == 32 (set LOCALABI=win32)
set YASMFLAG=
if %LIBTYPE% == dll (set YASMFLAG=-D DLL)
2011-05-08 15:44:26 -04:00
if %LIBTYPE% == dll (set FLAGS1=%FLAGS1% /D "__GMP_WITHIN_GMP" /D "__GMP_WITHIN_GMPXX")
2011-03-31 21:36:08 -04:00
call gen_mpir_h %LOCALABI%
2011-03-31 22:27:32 -04:00
copy ..\mpn\generic\gmp-mparam.h .. > nul 2>&1
2011-05-08 09:26:30 -04:00
copy ..\longlong_pre.h+..\mpn\generic\longlong_inc.h+..\longlong_post.h ..\longlong.h > nul 2>&1
2011-03-31 20:59:41 -04:00
for %%X in ( %MPNPATH% ) do (
copy ..\mpn\%%X\gmp-mparam.h .. > nul 2>&1
2011-05-09 12:48:50 -04:00
copy ..\longlong_pre.h+..\mpn\%%X\longlong_inc.h+..\longlong_post.h ..\longlong.h > nul 2>&1
2011-04-02 06:39:58 -04:00
call gen_config_h ..\mpn\%%X\ > nul 2>&1
2011-03-20 08:04:53 -04:00
)
2011-03-19 09:49:07 -04:00
2011-05-08 20:03:42 -04:00
set HAVE_STDINT=yes
2011-03-19 09:49:07 -04:00
echo #include ^<stdint.h^> > comptest.c
echo int main(void){return 0;} >> comptest.c
cl /nologo comptest.c > nul 2>&1
2011-03-20 08:04:53 -04:00
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
2011-05-08 20:03:42 -04:00
set HAVE_STDINT=no
2011-03-20 08:04:53 -04:00
)
2011-03-19 09:49:07 -04:00
del comptest.*
if %ABI% == 64 (set OPT=/D "_WIN64" %FLAGS% %FLAGS1% /c)
if %ABI% == 32 (set OPT=%FLAGS% %FLAGS1% /c)
2011-03-31 21:36:08 -04:00
if %ABI% == 64 (set LOCALDIR=x86_64w)
if %ABI% == 32 (set LOCALDIR=x86w)
2011-03-31 22:27:32 -04:00
:: just compile all generic and just overwrite with asm
2011-03-19 09:49:07 -04:00
cd mpn
for %%X in ( ..\..\mpn\generic\*.c) do (
2011-05-09 03:01:54 -04:00
:: exclude udiv_w_sdiv.c from all builds
2011-04-02 06:39:58 -04:00
if not "%%X" == "..\..\mpn\generic\udiv_w_sdiv.c" (
2011-03-19 09:49:07 -04:00
cl %OPT% -I..\.. %%X
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-04-02 06:39:58 -04:00
)
2011-03-19 09:49:07 -04:00
)
2011-03-31 20:59:41 -04:00
for %%X in ( %MPNPATH% ) do (
for %%i in ( ..\..\mpn\%%X\*.asm ) do (
%YASMEXE% %YASMFLAG% -I ..\..\mpn\%LOCALDIR% -f %LOCALABI% %%i
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
echo assemblin %%i
2011-03-31 20:59:41 -04:00
)
2011-03-19 09:49:07 -04:00
)
2011-05-27 14:07:54 -04:00
:: dont know what the asm version have so delete them
2011-05-09 03:01:54 -04:00
del preinv_divrem_1.obj preinv_mod_1.obj divrem_1.obj mod_1.obj divrem_euclidean_qr_1.obj > nul 2>&1
cl %OPT% -I..\.. ..\..\mpn\generic\divrem_1.c
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-05-09 03:01:54 -04:00
cl %OPT% -I..\.. ..\..\mpn\generic\mod_1.c
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-05-09 03:01:54 -04:00
cl %OPT% -I..\.. ..\..\mpn\generic\divrem_euclidean_qr_1.c
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-05-09 03:01:54 -04:00
cl /D "USE_PREINV_DIVREM_1" %OPT% -I..\.. ..\..\mpn\generic\preinv_divrem_1.c
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-05-09 03:01:54 -04:00
cl %OPT% -I..\.. ..\..\mpn\generic\preinv_mod_1.c
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-19 09:49:07 -04:00
cd ..
cd mpz
for %%X in ( ..\..\mpz\*.c) do (
cl %OPT% -I..\.. %%X
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-19 09:49:07 -04:00
)
2011-05-08 20:03:42 -04:00
if %HAVE_STDINT% == no (
del *_sx.obj *_ux.obj > nul 2>&1
)
2011-03-19 09:49:07 -04:00
cd ..
cd mpf
for %%X in ( ..\..\mpf\*.c) do (
cl %OPT% -I..\.. %%X
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-19 09:49:07 -04:00
)
cd ..
cd mpq
for %%X in ( ..\..\mpq\*.c) do (
cl %OPT% -I..\.. %%X
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-19 09:49:07 -04:00
)
cd ..
cd printf
for %%X in ( ..\..\printf\*.c) do (
cl %OPT% -I..\.. %%X
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-19 09:49:07 -04:00
)
cd ..
cd scanf
for %%X in ( ..\..\scanf\*.c) do (
cl %OPT% -I..\.. %%X
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-19 09:49:07 -04:00
)
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
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-19 09:49:07 -04:00
)
2011-03-20 09:45:08 -04:00
cd cxx
for %%X in ( ..\..\cxx\*.cc) do (
cl /EHsc %OPT% -I..\.. %%X
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-20 09:45:08 -04:00
)
cd ..
2011-04-02 05:27:06 -04:00
if %LIBTYPE% == dll (
2011-04-02 06:39:58 -04:00
link /DLL /NODEFAULTLIB:LIBCMT.lib /nologo scanf\*.obj printf\*.obj mpz\*.obj mpq\*.obj mpf\*.obj mpn\*.obj *.obj /out:mpir.%LIBTYPE%
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-04-02 06:39:58 -04:00
link /DLL /NODEFAULTLIB:LIBCMT.lib /nologo scanf\*.obj printf\*.obj mpz\*.obj mpq\*.obj mpf\*.obj mpn\*.obj *.obj /out:mpirxx.%LIBTYPE%
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-04-02 05:27:06 -04:00
)
if %LIBTYPE% == lib (
2011-04-02 06:39:58 -04:00
lib /nologo scanf\*.obj printf\*.obj mpz\*.obj mpq\*.obj mpf\*.obj mpn\*.obj *.obj /out:mpir.%LIBTYPE%
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-04-02 06:39:58 -04:00
lib /nologo cxx/*.obj /out:mpirxx.%LIBTYPE%
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-04-02 05:27:06 -04:00
)
2011-03-31 22:27:32 -04:00
exit /b 0
:check
md tests
cd tests
md mpn mpz mpq mpf rand misc cxx devel > nul 2>&1
2011-05-08 16:33:58 -04:00
if %LIBTYPE% == dll (
for %%X in ( mpn mpz mpq mpf rand misc cxx devel .) do (
copy ..\mpir.dll %%X
)
copy ..\mpirxx.dll cxx
)
2011-03-31 22:27:32 -04:00
cd ..
set OPT=%FLAGS% %FLAGS1%
2011-05-08 16:33:58 -04:00
set MPIRLIB=/link ..\..\mpir.lib
2011-04-02 05:27:06 -04:00
if %LIBTYPE% == lib (set MPIRLIB=..\..\mpir.lib)
2011-04-02 06:39:58 -04:00
if %LIBTYPE% == lib (set MPIRXXLIB=..\..\mpirxx.lib)
2011-04-02 05:27:06 -04:00
set MPIRLIB1=/link ..\mpir.lib
if %LIBTYPE% == lib (set MPIRLIB1=..\mpir.lib)
2011-03-31 22:27:32 -04:00
cd tests
cl %OPT% /c ..\..\tests\memory.c /I..\..
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
cl %OPT% /c ..\..\tests\misc.c /I..\..
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
cl %OPT% /c ..\..\tests\trace.c /I..\..
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
cl %OPT% /c ..\..\tests\refmpn.c /I..\..
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
cl %OPT% /c ..\..\tests\refmpz.c /I..\..
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
cl %OPT% /c ..\..\tests\refmpq.c /I..\..
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
cl %OPT% /c ..\..\tests\refmpf.c /I..\..
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
:: these only needed for try.exe
cl %OPT% /c ..\..\tests\spinner.c /I..\..
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
cl %OPT% /c ..\..\build.vc10\getopt.c /I..\..
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
for %%X in ( ..\..\tests\t-*.c) do (
2011-05-08 15:44:26 -04:00
cl %OPT% /I..\.. /I..\..\tests %%X misc.obj memory.obj trace.obj refmpn.obj %MPIRLIB1%
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
)
for %%X in ( *.exe) do (
echo testing %%X
%%X
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
)
cd mpn
for %%X in ( ..\..\..\tests\mpn\t-*.c) do (
2012-01-07 10:42:44 -05:00
if not %%X == ..\..\..\tests\mpn\t-fat.c (
cl %OPT% /I..\..\.. /I..\..\..\tests %%X ..\misc.obj ..\memory.obj ..\trace.obj ..\refmpn.obj %MPIRLIB%
if errorlevel 1 goto :err
)
2011-03-31 22:27:32 -04:00
)
for %%X in ( *.exe) do (
echo testing mpn_%%X
%%X
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
)
cd ..
cd mpz
for %%X in ( ..\..\..\tests\mpz\*.c) do (
2011-04-02 05:27:06 -04:00
cl %OPT% /I..\..\.. /I..\..\..\tests %%X ..\misc.obj ..\memory.obj ..\trace.obj ..\refmpn.obj ..\refmpz.obj %MPIRLIB%
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
)
for %%X in ( *.exe) do (
echo testing mpz_%%X
%%X
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
)
cd ..
cd mpq
for %%X in ( ..\..\..\tests\mpq\t-*.c) do (
2011-04-02 05:27:06 -04:00
cl %OPT% /I..\..\.. /I..\..\..\tests %%X ..\misc.obj ..\memory.obj ..\trace.obj ..\refmpn.obj ..\refmpz.obj ..\refmpq.obj %MPIRLIB%
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
)
for %%X in ( *.exe) do (
echo testing mpq_%%X
%%X
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
)
cd ..
cd mpf
for %%X in ( ..\..\..\tests\mpf\*.c) do (
2011-04-02 05:27:06 -04:00
cl %OPT% /I..\..\.. /I..\..\..\tests %%X ..\misc.obj ..\memory.obj ..\trace.obj ..\refmpn.obj ..\refmpf.obj %MPIRLIB%
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
)
for %%X in ( *.exe) do (
echo testing mpf_%%X
%%X
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
)
cd ..
cd rand
for %%X in ( ..\..\..\tests\rand\t-*.c) do (
2011-04-02 05:27:06 -04:00
cl %OPT% /I..\..\.. /I..\..\..\tests %%X ..\misc.obj ..\memory.obj ..\trace.obj ..\refmpn.obj %MPIRLIB%
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
)
for %%X in ( *.exe) do (
echo testing rand_%%X
%%X
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
)
cd ..
cd misc
for %%X in ( ..\..\..\tests\misc\t-*.c) do (
2011-04-02 05:27:06 -04:00
cl %OPT% /I..\..\.. /I..\..\..\tests %%X ..\misc.obj ..\memory.obj ..\trace.obj ..\refmpn.obj %MPIRLIB%
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
)
for %%X in ( *.exe) do (
echo testing misc_%%X
%%X
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
)
cd ..
cd cxx
for %%X in ( ..\..\..\tests\cxx\t-*.cc) do (
2011-04-02 06:39:58 -04:00
cl /EHsc %OPT% /I..\..\.. /I..\..\..\tests %%X ..\misc.obj ..\memory.obj ..\trace.obj ..\refmpn.obj %MPIRLIB% %MPIRXXLIB%
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
)
for %%X in ( *.exe) do (
echo testing cxx_%%X
%%X
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
)
cd ..
cd devel
2011-04-02 05:27:06 -04:00
cl %OPT% ..\..\..\tests\devel\try.c /I..\..\..\ /I..\..\..\tests ..\refmpn.obj ..\refmpz.obj ..\trace.obj ..\spinner.obj ..\misc.obj ..\memory.obj ..\getopt.obj %MPIRLIB%
2011-05-27 14:07:54 -04:00
if errorlevel 1 goto :err
2011-03-31 22:27:32 -04:00
cd ..
cd ..
exit /b 0
2011-05-27 14:07:54 -04:00
:err
echo ERROR
exit /b 1
2011-03-31 22:27:32 -04:00
:clean
del *.obj ..\mpir.h ..\config.h ..\gmp-mparam.h mpir.lib *.idb *.pdb > nul 2>&1
rmdir /S/Q mpn mpz mpq mpf scanf printf tests cxx tune speed > nul 2>&1
del gen_mpir_h.bat out_copy_rename.bat gen_config_h.bat cfg.h > nul 2>&1
del getopt.h getrusage.h gettimeofday.h unistd.h win_timing.h > nul 2>&1
2011-04-02 05:45:22 -04:00
del config.guess.* config.params.bat mpir.dll mpir.dll.manifest mpir.exp > nul 2>&1
2011-04-02 06:39:58 -04:00
del mpirxx.lib mpirxx.dll mpirxx.exp mpirxx.dll.manifest > nul 2>&1
2011-03-31 22:27:32 -04:00
exit /b 0
:speed
md speed
set OPT=%FLAGS% %FLAGS1%
2011-04-02 05:27:06 -04:00
set MPIRLIB=
if %LIBTYPE% == lib (set MPIRLIB=mpir.lib)
2011-03-31 22:27:32 -04:00
copy ..\build.vc10\unistd.h .
copy ..\build.vc10\getopt.h .
copy ..\build.vc10\win_timing.h .
copy ..\build.vc10\getrusage.h .
copy ..\build.vc10\gettimeofday.h .
cd speed
cl %OPT% /c ..\..\tests\misc.c /I..\..
cl %OPT% /c ..\..\tests\memory.c /I..\..
cl %OPT% /c ..\..\tests\refmpn.c /I..\..
cl %OPT% /c ..\..\build.vc10\win_timing.c
cl %OPT% /c ..\..\build.vc10\getopt.c /I..\..
for %%X in ( ..\..\tune\common.c ..\..\tune\mod_1_div.c ..\..\tune\set_strb.c ..\..\tune\divrem1div.c ..\..\tune\gcd_bin.c ..\..\tune\mod_1_inv.c ..\..\tune\divrem1inv.c ..\..\tune\gcdextod.c ..\..\tune\modlinv.c ..\..\tune\set_strs.c ..\..\tune\divrem2div.c ..\..\tune\gcdextos.c ..\..\tune\noop.c ..\..\tune\divrem2inv.c ..\..\tune\jacbase1.c ..\..\tune\powm_mod.c ..\..\tune\fac_ui_large.c ..\..\tune\jacbase2.c ..\..\tune\powm_redc.c ..\..\tune\fac_ui_small.c ..\..\tune\jacbase3.c ..\..\tune\preinv_divrem_1.c ) do (
cl -c %OPT% /I..\.. /I..\..\tests /I.. %%X
)
2011-04-02 05:27:06 -04:00
cl %OPT% /I..\.. /I.. /I..\..\tests ..\..\tune\speed.c *.obj ..\%MPIRLIB% advapi32.lib psapi.lib
2011-03-31 22:27:32 -04:00
cd ..
exit /b 0
:tune
md tune
set OPT=%FLAGS% %FLAGS1%
2011-04-02 05:27:06 -04:00
set MPIRLIB=
if %LIBTYPE% == lib (set MPIRLIB=mpir.lib)
2011-03-31 22:27:32 -04:00
copy ..\build.vc10\unistd.h .
copy ..\build.vc10\getopt.h .
copy ..\build.vc10\win_timing.h .
cd tune
cl %OPT% /c ..\..\tests\misc.c /I..\..
cl %OPT% /c ..\..\tests\memory.c /I..\..
cl %OPT% /c ..\..\tests\refmpn.c /I..\..
cl %OPT% /c ..\..\build.vc10\win_timing.c
cl %OPT% /c ..\..\build.vc10\getopt.c /I..\..
for %%X in ( ..\..\tune\set_strp.c ..\..\tune\common.c ..\..\tune\mod_1_div.c ..\..\tune\set_strb.c ..\..\tune\divrem1div.c ..\..\tune\gcd_bin.c ..\..\tune\mod_1_inv.c ..\..\tune\divrem1inv.c ..\..\tune\gcdextod.c ..\..\tune\modlinv.c ..\..\tune\set_strs.c ..\..\tune\divrem2div.c ..\..\tune\gcdextos.c ..\..\tune\noop.c ..\..\tune\divrem2inv.c ..\..\tune\jacbase1.c ..\..\tune\powm_mod.c ..\..\tune\fac_ui_large.c ..\..\tune\jacbase2.c ..\..\tune\powm_redc.c ..\..\tune\fac_ui_small.c ..\..\tune\jacbase3.c ..\..\tune\preinv_divrem_1.c ..\..\build.vc10\tune\*.c) do (
cl -c %OPT% /I..\.. /I..\..\tests /I.. %%X
)
2011-04-02 05:27:06 -04:00
cl %OPT% /I..\.. /I.. /I..\..\tests ..\..\tune\tuneup.c *.obj ..\%MPIRLIB% advapi32.lib psapi.lib
2011-03-31 22:27:32 -04:00
cd ..
exit /b 0