summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/disser/src/nomake.cmd
blob: 113291765b5f064b212c013678ea52fca33e3498 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
@echo off

rem nomake script for disser package
rem Author: Stanislav Kruchinin <stanislav.kruchinin@gmail.com>

if "%CMDEXTVERSION%"=="" (
	echo This script requires command interpreter from Windows 2000 or above.
	goto :eof
)

setlocal enabledelayedexpansion

set target=disser
set subclass=gost732
set manual=manual

set clsfiles=*.cls *.rtx
set docfiles=%target%.pdf %subclass%.pdf %bst%.pdf %manual%.pdf
set textfiles=..\README ..\README.ru ..\ChangeLog
set srcfiles=*.dtx %target%.ins dtx.ist %manual%.tex Makefile nomake.cmd

if "!texmf!"==""   set texmf=%allusersprofile%\Application Data\MiKTeX\2.9
if "!destdir!"=="" set destdir=!texmf!
if "!clsdir!"==""  set clsdir=!destdir!\tex\latex\%target%
if "!docdir!"==""  set docdir=!destdir!\doc\latex\%target%
if "!srcdir!"==""  set srcdir=!destdir!\source\latex\%target%

if "!clext!"=="" set clext=*.aux *.toc *.idx *.ind *.ilg *.log *.out *.lof ^
*.lot *.lol *.bbl *.blg *.bak *.dvi *.ps *.pdf *.synctex *.synctex.gz
if "!clfiles!"=="" set clfiles=!clext! %clsfiles%

if "!latex!"==""    set latex=latex
if "!pdflatex!"=="" set pdflatex=pdflatex
if "!mi!"==""       set mi=makeindex

if "!latexflags!"==""    set latexflags=--src-specials
if "!pdflatexflags!"=="" set pdflatexflags=--shell-escape --synctex=1
if "!miflags!"==""       set miflags=-r -s dtx.ist


if "%1"=="" (
	call :all
) else (
	for %%f in (%*) do call :%%f
)

exit /b

:all
	call :package
	call :doc
goto :eof

:clean
	del !clfiles!
goto :eof

:doc
	call :pdf
goto :eof

:dvi
	!latex! !latexflags! %target%.dtx
	!mi! !miflags! %target%
	!latex! !latexflags! %target%.dtx
	!latex! !latexflags! %target%.dtx

	!latex! !latexflags! %subclass%.dtx
	!latex! !latexflags! %subclass%.dtx

	!latex! !latexflags! %bst%.dtx
	!mi! !miflags! %bst%
	!latex! !latexflags! %bst%.dtx
	!latex! !latexflags! %bst%.dtx

	!latex! !latexflags! %manual%.tex
	!latex! !latexflags! %manual%.tex
goto :eof

:help
	echo   all        ^(default^) build package and documentation
	echo   clean      remove output files
	echo   doc        alias for pdf target
	echo   dvi        build documentation in DVI format
	echo   help       show description of targets
	echo   install    install package and documentation
	echo   package    build package
	echo   pdf        build documentation in PDF format
	echo   reinstall  reinstall package and documentation
	echo   uninstall  uninstall package and documentation
goto :eof

:install
	if not exist %target%.cls call :all
	if not exist "!clsdir!" mkdir "!clsdir!"
	if not exist "!docdir!" mkdir "!docdir!"
	if not exist "!srcdir!" mkdir "!srcdir!"
	for %%f in (%clsfiles%)  do xcopy /y /i /f %%f "!clsdir!"
	for %%f in (%docfiles%)  do xcopy /y /i /f %%f "!docdir!"
	for %%f in (%textfiles%) do xcopy /y /i /f %%f "!docdir!"
	for %%f in (%srcfiles%)  do xcopy /y /i /f %%f "!srcdir!"
goto :eof

:package
    %latex% %target%.ins
goto :eof

:pdf
	!pdflatex! !pdflatexflags! %target%.dtx
	!mi! !miflags! %target%
	!pdflatex! !pdflatexflags! %target%.dtx
	!pdflatex! !pdflatexflags! %target%.dtx

	!pdflatex! !pdflatexflags! %subclass%.dtx
	!pdflatex! !pdflatexflags! %subclass%.dtx

	!pdflatex! !pdflatexflags! %manual%.tex
	!pdflatex! !pdflatexflags! %manual%.tex
goto :eof

:reinstall
	call :uninstall
	call :install
goto :eof

:uninstall
	rmdir /s /q "!clsdir!"
	rmdir /s /q "!docdir!"
	rmdir /s /q "!srcdir!"
goto :eof