NASM 0.98.09
[nasm.git] / doc / makedocs.bat
blob70db8110cac25a2a8611953e191a5b31a0a21e8a
1 @echo off
2 if "%1"=="clean" goto makeclean
3 if "%1"=="CLEAN" goto makeclean
4 if "%1"=="spotless" goto spotless
5 if "%1"=="SPOTLESS" goto spotless
6 if "%1"=="install" goto install
7 if "%1"=="INSTALL" goto install
9 cls
10 echo.
11 echo.
12 echo.
13 echo    Usage:
14 echo.
15 echo        makedocs - no parameters - makes all Docs
16 echo        makedocs install - installs already made docs in subdirectories
17 echo        makedocs clean - removes docs from current directory
18 echo        makedocs spotless - removes all - including default install dirs
19 echo.
20 echo.
21 echo.
22 echo.
23 echo        Makedocs(.bat), with no parameters will create Nasm Documentation
24 echo        in several formats: plain ascii text, ps, html, rtf, Windows help
25 echo        format, and if you've got an "info" system installed, info format.
26 echo.
27 echo.
28 echo                This requires Perl, and almost 4MB disk space.
29 echo.
30 echo.
31 choice "                     Proceed with making docs? "
32 if errorlevel 2 goto exit
34 :makeall
36 echo.
37 echo.
38 echo                        This takes a while. Stretch!
39 echo.
40 echo.
42 perl rdsrc.pl<nasmdoc.src
43 echo.
44 echo.
45 choice "                       Make *info* files? "
46 if errorlevel 2 goto noinfo
47 :makeinfo
48 echo.
49 echo.
50 makeinfo nasmdoc.tex
52 :noinfo
54 :install
56 if not exist nasmdoc.txt goto nofiles
57 if not exist nasmdoc0.htm goto nofiles
58 if not exist nasmdo10.htm goto nofiles
59 if not exist nasmdoc.hpj goto nofiles
60 if not exist nasmdoc.rtf goto nofiles
61 if not exist nasmdoc.ps goto nofiles
62 if not exist nasmdoc.tex goto nofiles
63 goto gotfiles
64 :nofiles
65 echo.
66 echo.
67 echo.
68 echo.
69 echo                       Alert!      Files missing!
70 echo.
71 echo.
72 choice "               Would you like to make them now? "
73 if errorlevel 2 goto exit
74 goto makeall
76 :gotfiles
78 :: get current path
80 set oldprompt=%prompt%
81 echo @prompt set nasdoc=$p>temp1.bat
82 command /c temp1.bat>temp2.bat
83 call temp2
84 del temp1.bat
85 del temp2.bat
86 set prompt=%oldprompt%
87 set oldprompt=
89 echo.
90 echo.
91 echo.
92 echo.
93 echo        Current Directory is %nasdoc%
94 echo        Nasm Documentation will be installed under this
95 echo        as %nasdoc%\text\nasmdoc.txt, etc.
96 echo.
97 echo.
98 choice "                   Change this directory? "
99 if errorlevel 2 goto dirok
101 echo.
102 echo.
103 echo.
104 echo.
105 echo      Directory *above* the directory you name (at least) should exist.
106 echo      Nasm documentation will be installed *under* the directory you
107 echo      name. E.G. \docs\nasm\html, etc. No trailing backslash!
108 echo.
109 echo.
111 echo                Enter new name for base directory:
112 set input=
113 fc con nul /lb1 /n|date|find "1:">magic.bat
114 echo set input=%%5>enter.bat
115 call magic
116 set nasdoc=%input%
117 del magic.bat
118 del enter.bat
119 set input=
121 echo.
122 echo.
123 md %nasdoc%
124 echo.
125 echo.
127 choice "  Install Text docs in %nasdoc%\text ? "
128 if errorlevel 2 goto notext
129 md %nasdoc%\text
130 copy nasmdoc.txt %nasdoc%\text
131 :notext
133 choice "  Install Html docs in %nasdoc%\html ? "
134 if errorlevel 2 goto nohtml
135 md %nasdoc%\html
136 copy *.htm %nasdoc%\html
137 :nohtml
139 choice "  Install Info docs in %nasdoc%\info ? "
140 if errorlevel 2 goto noinfodocs
141 if not exist nasm.inf goto inofiles
142 if not exist nasm.i9 goto inofiles
143 goto gotifiles
144 :inofiles
145 echo.
146 echo.
147 echo                       Alert!      Files missing!
148 echo.
149 echo.
150 choice "               Would you like to make them now? "
151 if errorlevel 2 goto noinfodocs
152 if not exist nasmdoc.tex goto makeall
153 goto makeinfo
155 :gotifiles
157 md %nasdoc%\info
158 copy nasm.i* %nasdoc%\info
159 :noinfodocs
161 choice "  Install Winhelp docs in %nasdoc%\winhelp ? "
162 if errorlevel 2 goto nowinhelp
163 md %nasdoc%\winhelp
164 copy nasmdoc.rtf %nasdoc%\winhelp
165 copy nasmdoc.hpj %nasdoc%\winhelp
166 :nowinhelp
168 choice "  Install Postscript docs in %nasdoc%\ps ? "
169 if errorlevel 2 goto nops
170 md %nasdoc%\ps
171 copy nasmdoc.ps %nasdoc%\ps
172 :nops
173 goto cleanup
175 :dirok
177 choice "  Install Text docs in .\text ? "
178 if errorlevel 2 goto notext2
179 md text
180 copy nasmdoc.txt text
181 :notext2
183 choice "  Install Html docs in .\html ? "
184 if errorlevel 2 goto nohtml2
185 md html
186 copy *.htm html
187 :nohtml2
189 choice "  Install Info docs in .\info ? "
190 if errorlevel 2 goto nid2
192 if not exist nasm.inf goto inof2
193 if not exist nasm.i9 goto inof2
194 goto gifiles2
195 :inof2
196 echo.
197 echo.
198 echo                       Alert!      Files missing!
199 echo.
200 echo.
201 choice "               Would you like to make them now? "
202 if errorlevel 2 goto nid2
203 if not exist nasmdoc.tex goto makeall
204 goto makeinfo
206 :gifiles2
208 md info
209 copy nasm.i* info
210 :nid2
212 choice "  Install Winhelp docs in .\winhelp ? "
213 if errorlevel 2 goto nwhelp2
214 md winhelp
215 copy nasmdoc.rtf winhelp
216 copy nasmdoc.hpj winhelp
217 :nwhelp2
219 choice "  Install Postscript docs in .\ps ? "
220 if errorlevel 2 goto nops2
221 md ps
222 copy nasmdoc.ps ps
223 :nops2
226 :cleanup
227 set nasdoc=
229 echo.
230 echo.
231 echo.
232 echo.
233 choice "        Remove all files created, but not installed?"
234 if not errorlevel 2 goto makeclean
236 goto exit
238 :spotless
239 deltree /y text
240 deltree /y html
241 deltree /y info
242 deltree /y winhelp
243 deltree /y ps
245 :makeclean
246 del *.htm
247 del *.rtf
248 del *.hpj
249 del *.txt
250 del *.tex
251 del *.ps
252 del nasm.i*
254 :exit