typos ...
[latex2e.git] / make.bat
blob9885e27de75d9fa4032b0fc08c98ab87db103ee2
1 @echo off
3 rem TODO
4 rem change babel to same system?
6 rem Makefile for LaTeX2e files
8   if not [%1] == [] goto :init
10 :help
12   echo.
13   echo  make check         - runs the automated test suite
14   echo  make doc           - runs all documentation files
15   echo  make clean         - clean out directory tree
16   echo  make ctan          - create CTAN-ready archives
17   echo  make ctan ^<name^> - create CTAN-ready archive for required\name
18   echo  make localinstall  - install files in local texmf tree
19   echo  make unpack        - extract packages
21   goto :EOF
23 :init
25   rem Avoid clobbering anyone else's variables
27   setlocal
29   rem Safety precaution against awkward paths
31   cd /d "%~dp0"
33   rem Clean up settings
35   set CLEAN=zip
37   rem Bundles that are part of the overall LaTeX2e structure
39   set BUNDLES=base doc required\tools required\graphics required\cyrillic
40 rem  set BUNDLES=required\cyrillic
42   set MAINDIR=.
43   set DISTRIBDIR=%MAINDIR%\distrib
44   set UNPACKDIR=%MAINDIR%\unpacked
45   set BUILDDIR=%MAINDIR%\build
46   set TESTDIR=%MAINDIR%\test
49 :main
51   rem Cross-compatibility with *nix
52   
53   if /i [%1] == [-s] shift
55   if /i [%1] == [check]        goto check
56   if /i [%1] == [doc]          goto doc
57   if /i [%1] == [clean]        goto clean
58   if /i [%1] == [cleanall]     goto clean
59   if /i [%1] == [ctan]         goto ctan
60   if /i [%1] == [localinstall] goto localinstall
61   if /i [%1] == [unpack]       goto unpack
63   goto help
65 :check
67   for %%I in (%BUNDLES%) do (
68     echo ======================================
69     echo == [%%I] check
70     echo ======================================
71     pushd %%I
72     call make check
73     popd
74   )
76   goto end
78 :doc
80   for %%I in (%BUNDLES%) do (
81     echo ======================================
82     echo == [%%I] doc
83     echo ======================================
84     pushd %%I
85     call make doc
86     popd
87   )
89   goto end
91 :clean
93   for %%I in (%BUNDLES%) do (
94     echo ======================================
95     echo == [%%I] clean
96     echo ======================================
97     pushd %%I
98     call make clean
99     popd
100   )
102     echo ======================================
103     echo == [main] clean
104     echo ======================================
105   for %%I in (%CLEAN%) do (
106     if exist *.%%I del /q *.%%I
107   )
109   goto end
111 :ctan
113   if [%2] == [] goto ctanall
115   if not exist required\%2 (
116     echo.
117     echo Module required\%2 not found!
118     shift
119     goto end
120   )
122   pushd required\%2
124     call make clean
125     call make localinstall
126     call make check
127 rem    call make doc         -- done in ctan
128     call make ctan
130   popd
132   pushd distrib\required
134   zip -v -r -ll latex2e-distrib-%2.zip %2 -x "*~" "*.pdf" 
135   zip -v -r -g  latex2e-distrib-%2.zip %2\*.pdf -x "*~"
137   popd
139   mv distrib\required\*.zip .
141   if "%GLOBALPROBLEM%" == "true" (
142      echo.
143      echo ==================================
144      echo There have been some problems!!!!!
145      echo ==================================
146   )
148   shift
150   endlocal & set GLOBALPROBLEM=
152   goto end
154 :ctanall
156   call :clean
157   call :localinstall
158   call :check
159 rem  call :doc               --- done in :ctan
161   for %%I in (%BUNDLES%) do (
162     echo ======================================
163     echo == [%%I] ctan
164     echo ======================================
165     pushd %%I
166     call make ctan
167     popd
168   )
170     echo ======================================
171     echo == [main] ctan
172     echo ======================================
174   zip -v -r -ll latex2e-distrib.zip distrib\base distrib\doc\ distrib\unpacked -x "*~" "*.pdf"
175   zip -v -r -g  latex2e-distrib.zip distrib\base distrib\doc\*.pdf distrib\unpacked\*.pdf -x "*~" 
177   pushd distrib\required
179   for %%I in (tools graphics cyrillic) do (
180     zip -v -r -ll latex2e-distrib-%%I.zip %%I -x "*~" "*.pdf"
181     zip -v -r -g  latex2e-distrib-%%I.zip %%I\*.pdf -x "*~"
182   )
184   popd
186   mv distrib\required\*.zip .
188   if "%GLOBALPROBLEM%" == "true" (
189      echo.
190      echo ==================================
191      echo There have been some problems!!!!!
192      echo ==================================
193   )
195   endlocal & set GLOBALPROBLEM=
197   goto end
199 :localinstall
201   for %%I in (%BUNDLES%) do (
202     echo ======================================
203     echo == [%%I] localinstall
204     echo ======================================
205     pushd %%I
206     call make localinstall
207     popd
208   )
210   goto end
212 :unpack
214   for %%I in (%BUNDLES%) do (
215     echo ======================================
216     echo == [%%I] unpack
217     echo ======================================
218     pushd %%I
219     call make unpack
220     popd
221   )
223   goto end
225 :end
227   shift
228   if not [%1] == [] goto main