6 rem Makefile for LaTeX2 "base" files
8 if not [%1] == [] goto init
13 echo make check [show] - run automated check system
14 echo make clean - clean out directory
15 echo make doc [show] - typeset all dtx files
16 echo make localinstall - locally install package
17 echo make savetlg ^<name^> - save test log for ^<name^>
18 echo make checktlg ^<name^> - check one test file ^<name^>
19 echo make unpack [show] - extract modules
20 echo make ctan [show] - build CTAN distribution
22 echo The "show" option enables display of the output
23 echo of the TeX runs in the terminal.
29 rem Avoid clobbering anyone else's variables
33 rem Safety precaution against awkward paths
37 rem The name of the module and the bundle it is part of
42 rem Unpacking information
44 rem set UNPACK=%MODULE%.ins
48 set AUXFILES=aux cmds fpl glo hd idx ilg ind log lvt tlg toc out lof lot bbl tlg-clean
49 set CLEAN=fc gz pdf sty dvi def drv ldf ist fd ps xyc cfg
52 rem Check system set up
54 set CHECKDIR=testfiles
55 set CHECKEXE=etex -interaction=nonstopmode -translate-file ./ascii.tcx -efmt=..\build\latex.fmt -output-format=dvi
58 rem Local installation settings
60 set INSTALLDIR=latex\%BUNDLE%\%MODULE%
61 set INSTALLFILES= *.cfg *.clo *.cls *.def *.dfu *.fd *.ist *.ltx *.sty *.tex *.err
63 rem Documentation typesetting set up (not using internal format for now, perhaps it should)
65 set TYPESETEXE=pdflatex -interaction=nonstopmode
67 rem pdfs that will get distributed fro the base directory (most aren't)
69 set BASEPDFDISTRIBUTED=lppl source2e utf8ienc syntonly nfssfont makeindx ltxdoc letter latexsym inputenc ifthen graphpap fixltx2e exscale docstrip doc classes alltt proc slides cmfonts slifonts
71 rem Locations for the various support items required
74 set SCRIPTDIR=%MAINDIR%\scripts
75 set VALIDATE=%MAINDIR%\validate
77 set UNPACKDIR=%MAINDIR%\unpacked
78 set BUILDDIR=%MAINDIR%\build
79 set TESTDIR=%MAINDIR%\test
80 set SUPPORTDIR=%MAINDIR%\support
82 set DISTRIBDIR=%MAINDIR%\distrib
85 rem Set up redirection of output
89 if /i [%2] == [show] (
96 if /i [%1] == [check] goto check
97 if /i [%1] == [checktlg] goto checktlg
98 if /i [%1] == [clean] goto clean
99 if /i [%1] == [cleanall] goto clean
100 if /i [%1] == [doc] goto doc
101 if /i [%1] == [localinstall] goto localinstall
102 if /i [%1] == [savetlg] goto savetlg
103 if /i [%1] == [unpack] goto unpack
104 if /i [%1] == [ctan] goto ctan
110 if not exist %CHECKDIR%\nul goto end
112 rem Check for Perl, and give up if it is not found
115 if ERRORLEVEL 1 goto :EOF
117 rem Remove any old files, and then copy the test system into place
121 rem Unpack, allowing for using a 'trace' version or similar
125 rem next unpacks are needed if we want to process all test files
126 rem i.e. also those from the required portion, but I guess we really
127 rem better keep this separate
129 rem call ..\required\tools\make.bat unpack show
130 rem call ..\required\graphics\make.bat unpack show
131 rem call ..\required\cyrillic\make.bat unpack show
133 copy /y %SCRIPTDIR%\log2tlg %TESTDIR% > nul
134 copy /y %VALIDATE%\test2e.tex %TESTDIR% > nul
135 copy /y %VALIDATE%\test209.tex %TESTDIR% > nul
136 copy /y %VALIDATE%\ascii.tcx %TESTDIR% > nul
138 if exist %CHECKDIR%\helpers\nul (
139 copy /y %CHECKDIR%\helpers\* %TESTDIR% > nul
149 rem Copy all test files for which there is a matching reference log
151 for %%I in (%CHECKDIR%\*.lvt) do (
152 if exist %CHECKDIR%\%%~nI.tlg (
153 copy /y %CHECKDIR%\%%~nI.lvt %TESTDIR% > nul
154 copy /y %CHECKDIR%\%%~nI.tlg %TESTDIR% > nul
156 echo %CHECKDIR%\%%~nI.tlg missing
164 if [%2] == [] goto help
165 if not exist %CHECKDIR%\%2.lvt (
167 echo Check file %2.lvt not found!
174 rem Copy all test files for which there is a matching reference log
176 for %%I in (%CHECKDIR%\%2.lvt) do (
177 if exist %CHECKDIR%\%%~nI.tlg (
178 copy /y %CHECKDIR%\%%~nI.lvt %TESTDIR% > nul
179 copy /y %CHECKDIR%\%%~nI.tlg %TESTDIR% > nul
181 echo %CHECKDIR%\%%~nI.tlg missing
191 echo Running checks on
193 SET TEXINPUTS=.;%UNPACKDIR%;%BUILDDIR%
197 for %%I in (*.tlg) do (
199 for /l %%J in (1,1,%CHECKRUNS%) do (
200 %CHECKEXE% %%~nI.lvt <%SCRIPTDIR%\enter.txt %REDIRECT%
202 %PERLEXE% log2tlg %%~nI < %%~nI.log > %%~nI.new.log
204 rem del /q %%~nI.log > nul
205 ren %%~nI.log %%~nI.logfull > nul
206 ren %%~nI.new.log %%~nI.log > nul
208 rem remove empty lines from .tlg file
209 %PERLEXE% -n -e "/^\s*$/ || print" < %%~nI.tlg >%%~nI.clean.tlg
211 fc /n %%~nI.log %%~nI.clean.tlg > %%~nI.fc
214 for %%I in (*.fc) do (
215 for /f "skip=1 tokens=1" %%J in (%%~nI.fc) do (
226 echo Checks fails for
227 for %%I in (*.fc) do (
231 echo All checks passed
234 for %%I in (*.tlg) do (
235 if exist %%~nI.pdf del /q %%~nI.pdf
236 if exist %%~nI.dvi del /q %%~nI.dvi
246 del /q %DISTRIBDIR%\base\*
247 del /q %DISTRIBDIR%\unpacked\*
254 for %%I in (%NOCLEAN%) do (
255 copy /y %%I %%I.bak > nul
258 for %%I in (%CLEAN%) do (
259 if exist *.%%I del /q *.%%I
262 for %%I in (%NOCLEAN%) do (
263 copy /y %%I.bak %%I > nul
269 for %%I in (%AUXFILES%) do (
270 if exist *.%%I del /q *.%%I
273 if exist log2tlg del /q log2tlg
274 if exist test2e.tex del /q test2e.tex
275 if exist ascii.tcx del /q ascii.tcx
282 echo Typesetting (using normal TeX system on machine)
284 for %%I in (*.dtx) do (
287 %TYPESETEXE% -draftmode %%I %REDIRECT%
289 echo ! Compilation failed
293 makeindex -q -s gind.ist -o %%~nI.ind %%~nI.idx > nul
295 %TYPESETEXE% %%I %REDIRECT%
296 %TYPESETEXE% %%I %REDIRECT%
298 ) else echo %%I skipped
301 for %%I in (*.fdd) do (
304 %TYPESETEXE% -draftmode %%I %REDIRECT%
306 echo ! Compilation failed
310 makeindex -q -s l3doc.ist -o %%~nI.ind %%~nI.idx > nul
312 %TYPESETEXE% %%I %REDIRECT%
313 %TYPESETEXE% %%I %REDIRECT%
315 ) else echo %%I skipped
318 for %%I in (source2e.tex sample2e.tex lppl.tex small2e.tex) do (
321 %TYPESETEXE% -draftmode %%I %REDIRECT%
323 echo ! Compilation failed
327 makeindex -q -s l3doc.ist -o %%~nI.ind %%~nI.idx > nul
329 %TYPESETEXE% %%I %REDIRECT%
330 %TYPESETEXE% %%I %REDIRECT%
332 ) else echo %%I skipped
335 if "%PROBLEM%" == "true" (
337 echo There have been some problems!
347 echo Installing files
349 rem Find local root if possible
351 if not defined TEXMFHOME (
352 for /f "delims=" %%I in ('kpsewhich --var-value=TEXMFHOME') do @set TEXMFHOME=%%I
353 if "%TEXMFHOME%" == "" (
354 set TEXMFHOME=%USERPROFILE%\texmf
358 set INSTALLROOT=%TEXMFHOME%\tex\%INSTALLDIR%
360 if exist "%INSTALLROOT%\*.*" rmdir /q /s "%INSTALLROOT%"
361 mkdir "%INSTALLROOT%"
366 for %%I in (%INSTALLFILES%) do (
367 copy /y %%I "%INSTALLROOT%" > nul
380 if defined PERLEXE goto :EOF
382 rem This code is used to find out if Perl is available in the path
384 for /f "delims=; tokens=1,2*" %%I in ("%PATHCOPY%") do (
385 if exist %%I\perl.exe set PERLEXE=perl
389 if defined PERLEXE goto :EOF
391 rem No Perl found in the path, so try some standard locations
393 if not "%PATHCOPY%" == ";" goto perl-loop
395 if exist %SYSTEMROOT%\Perl\bin\perl.exe set PERLEXE=%SYSTEMROOT%\Perl\bin\perl
396 if exist %ProgramFiles%\Perl\bin\perl.exe set PERLEXE=%ProgramFiles%\Perl\bin\perl
397 if exist %SYSTEMROOT%\strawberry\Perl\bin\perl.exe set PERLEXE=%SYSTEMROOT%\strawberry\Perl\bin\perl
399 if defined PERLEXE goto :EOF
401 rem Failed to find Perl, give up and kill the entire batch process
404 echo This procedure requires Perl, but it could not be found.
412 if not exist %CHECKDIR%\%2.lvt (
414 echo Check file %2.lvt not found!
421 rem Copy the test file
423 copy /y %CHECKDIR%\%2.lvt %TESTDIR% > nul
426 echo Creating and copying %2.tlg
428 SET TEXINPUTS=.;%UNPACKDIR%;%BUILDDIR%
432 for /l %%I in (1,1,%CHECKRUNS%) do (
433 %CHECKEXE% %2.lvt %REDIRECT%
435 %PERLEXE% log2tlg %2 < %2.log > %2.tlg
439 copy /y %TESTDIR%\%2.tlg %CHECKDIR%\%2.tlg > nul
449 del /q %DISTRIBDIR%\base\*
450 del /q %DISTRIBDIR%\unpacked\*
452 for %%I in (*.cls *.dtx latexbug.el *.err *.fdd *.ins ltpatch.ltx README *.tex *.txt) do (
453 copy /y %%I %DISTRIBDIR%\base\%%I >nul
456 for %%I in (*.cls~ *.dtx~ *atexbug.el~ *.err~ *.fdd~ *.ins~ *tpatch.ltx~ *EADME~ *.tex~ *.txt~) do (
458 if exist %DISTRIBDIR%\base\%%I del /q %DISTRIBDIR%\base\%%I >nul
463 copy /y %UNPACKDIR%\* %DISTRIBDIR%\unpacked >nul
467 for %%I in (%BASEPDFDISTRIBUTED%) do (
468 copy /y %%I.pdf %DISTRIBDIR%\base\%%I.pdf >nul
473 for %%I in (*.pdf) do (
474 copy /y %%I %DISTRIBDIR%\base\%%I >nul
489 echo ***************************************************
490 echo *** Copying kernel bootstrap sources ...
491 echo ***************************************************
494 for %%I in (*.dtx *.ins *.fdd ltpatch.ltx *.tex *.cls) do (
495 copy /y %%I %UNPACKDIR%\%%I >nul
498 rem getting rid of emacs ~ files
500 for %%I in (*.dtx *.ins *.fdd ltpatch.ltx *.tex *.cls) do (
501 if exist %UNPACKDIR%\%%I~ rm %UNPACKDIR%\%%I~
504 rem remove other files
505 for %%I in (ttcterrata.cls) do (
506 if exist %UNPACKDIR%\%%I del %UNPACKDIR%\%%I
510 rem unpack the distribution
511 rem Make sure that no external input files are read by setting TEXINPUTS
514 echo ***************************************************
515 echo *** Generating LaTeX2e kernel bootstrap files...
516 echo ***************************************************
521 etex -ini unpack.ins <%SCRIPTDIR%\yes.txt
524 for %%I in (*.dtx *.ins *.fdd *.log *.aux) do (
525 if exist %%I del %%I >nul
534 echo ***************************************************
535 echo *** Copying format support files...
536 echo ***************************************************
538 copy /y %SUPPORTDIR%\*.*
541 echo ***************************************************
542 echo *** Generating LaTeX2e kernel formats...
543 echo ***************************************************
546 SET TEXINPUTS=.;%UNPACKDIR%
548 etex -ini -etex latex.ltx <%SCRIPTDIR%\yes.txt
549 pdfetex -ini -etex -jobname=pdflatex "*pdflatex.ini" latex.ltx <%SCRIPTDIR%\yes.txt
558 rem echo base: PROBLEM="%PROBLEM%" and GLOBALPROBLEM="%GLOBALPROBLEM%"
560 endlocal & if "%PROBLEM%" == "true" set GLOBALPROBLEM=%PROBLEM%
562 rem If something like "make check show" was used, remove the "show"
564 if /i [%2] == [show] shift
567 if not [%1] == [] goto main