Makefile 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. #
  2. # $Id$
  3. # This file is part of the Free Pascal run time library.
  4. # Copyright (c) 1996-98 by Michael van Canneyt
  5. #
  6. # Makefile for the Free Pascal Documentation
  7. #
  8. # See the file COPYING.FPC, included in this distribution,
  9. # for details about the copyright.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. #
  15. #####################################################################
  16. # Configurable section
  17. #####################################################################
  18. # Debugging the install, that will only copy the .tex to index.html
  19. # so a make html and make install goes quickly
  20. #INSTALLDEBUG=1
  21. # Which docs are made when 'html' is specified
  22. HTML = user units ref prog
  23. # Can be 'report','book' or 'html'
  24. PREAMBLETYPE = report
  25. # Where do you want the html files to be put ?
  26. ifndef PREFIXINSTALLDIR
  27. PREFIXINSTALLDIR=/usr
  28. endif
  29. ifndef DOCINSTALLDIR
  30. DOCINSTALLDIR:=$(PREFIXINSTALLDIR)/doc/fpc-$(shell ppc386 -iV)
  31. endif
  32. #
  33. # Program definitions
  34. #
  35. # Latex
  36. ifndef LATEX
  37. LATEX = latex
  38. endif
  39. # Latex2html conversion.
  40. ifndef LATEX2HTML
  41. LATEX2HTML = /usr/bin/latex2html
  42. endif
  43. # Options for converter
  44. ifndef LATEX2HTMLOPTS
  45. LATEX2HTMLOPTS = -no_reuse -up_url "../fpctoc.html"\
  46. -up_title "Free Pascal manuals" -contents_in_navigation\
  47. -html_version 4.0 -split 3
  48. endif
  49. # Icons for latex2html
  50. ICONSERVER=../buttons
  51. export ICONSERVER
  52. # Ascii mode ? (i.e. no pics)
  53. ifndef ASCIIMODE
  54. ASCIIMODE=NO
  55. #ASCIIMODE=YES
  56. endif
  57. # DVI to PS converter
  58. ifndef DVIPS
  59. DVIPS=dvips
  60. endif
  61. # DVI to TXT converter
  62. ifndef DVITXT
  63. DVITXT=dvi2tty -w132
  64. endif
  65. # PDF converter
  66. ifndef PDFLATEX
  67. PDFLATEX=pdflatex
  68. endif
  69. # Makeindex programma
  70. ifndef MAKEINDEX
  71. MAKEINDEX=makeindex
  72. endif
  73. # tmpdir
  74. export TMP=/tmp
  75. #
  76. #######################################################################
  77. # End of configurable section. Do not edit after this line.
  78. #######################################################################
  79. PS = $(addsuffix .ps, $(HTML))
  80. DVI = $(addsuffix .dvi, $(HTML))
  81. TXT = $(addsuffix .txt, $(HTML))
  82. PDF = $(addsuffix .pdf, $(HTML))
  83. TOC = $(addsuffix .toc, $(HTML) onechap)
  84. AUX = $(addsuffix .aux, $(HTML) onechap)
  85. LOG = $(addsuffix .log, $(HTML) onechap)
  86. LOT = $(addsuffix .lot, $(HTML) onechap)
  87. OUT = $(addsuffix .out, $(HTML) onechap)
  88. CHK = $(addsuffix .chk, $(HTML) progex unitex refex htex onechap)
  89. CHAPTERS = $(addsuffix .tex, crt dos getopts go32 graph linux printer\
  90. strings objects heaptrc sysutils ipc mouse gpm dxeload \
  91. emu387 ports math)
  92. GTKPDF=$(addsuffix .pdf,$(addprefix gtk, 1 2 3 4 5))
  93. # Check if ascii-mode requested
  94. ifeq ($(ASCIIMODE),YES)
  95. LATEX2HTMLOPTS:=$(LATEX2HTMLOPTS) -ascii_mode
  96. endif
  97. #####################################################################
  98. # Conversion from types
  99. #####################################################################
  100. .PHONY: clean dvi help html ps psdist htmldist pdfdist txtdist \
  101. htm txt pdf refex alldist messages onechap gtk
  102. .SUFFIXES: .dvi .tex .ps .txt .pdf
  103. # default show help
  104. .dvi.ps:
  105. $(DVIPS) $<
  106. .tex.dvi:
  107. $(LATEX) $*
  108. -$(MAKEINDEX) $*
  109. $(LATEX) $*
  110. -$(MAKEINDEX) $*
  111. $(LATEX) $*
  112. .dvi.txt:
  113. $(DVITXT) -o $*.txt $*.dvi
  114. .tex.pdf:
  115. $(PDFLATEX) $*
  116. -$(MAKEINDEX) $*
  117. $(PDFLATEX) $*
  118. -$(MAKEINDEX) $*
  119. $(PDFLATEX) $*
  120. #####################################################################
  121. # Targets
  122. #####################################################################
  123. help:
  124. @echo 'Possible targets :'
  125. @echo ' dvi : Make documentation using latex.'
  126. @echo ' ps : Make documentation using latex and dvips.'
  127. @echo ' html : Make documentation using latex2html.'
  128. @echo ' pdf : Make documentation using pdflatex'
  129. @echo ' txt : dvi, convert to text using dvi2tty'
  130. @echo ' htm : Convert .html to .htm files, zip result'
  131. @echo ' clean : Clean up the mess.'
  132. @echo ' linuxexamples : Compile all examples for linux'
  133. @echo ' dosexamples : Compile all examples for dos'
  134. @echo ' htmldist : html, and rchive result.'
  135. @echo ' psdist : ps, and archive result.'
  136. @echo ' pdfdist : pdf, and archive result.'
  137. clean:
  138. -rm -f preamble.inc date.inc
  139. -rm -f *.htex
  140. -rm -rf $(HTML) onechap
  141. -rm -f $(TOC) $(LOG) $(DVI) $(PDF) $(AUX) $(OUT) $(PS) *.i* $(LOT) $(TXT) $(CHK)
  142. # Units
  143. -$(MAKE) -C crtex clean
  144. -$(MAKE) -C dosex clean
  145. -$(MAKE) -C go32ex clean
  146. -$(MAKE) -C heapex clean
  147. -$(MAKE) -C ipcex clean
  148. -$(MAKE) -C linuxex clean
  149. -$(MAKE) -C mouseex clean
  150. -$(MAKE) -C objectex clean
  151. -$(MAKE) -C optex clean
  152. -$(MAKE) -C printex clean
  153. -$(MAKE) -C sockex clean
  154. -$(MAKE) -C stringex clean
  155. -$(MAKE) -C sysutex clean
  156. -$(MAKE) -C mathex clean
  157. -$(MAKE) -C graphex clean
  158. -$(MAKE) -C gpmex clean
  159. # Reference
  160. -$(MAKE) -C refex clean
  161. $(TXT) : %.txt: %.dvi
  162. $(DVI) : %.dvi: %.tex
  163. $(PDF) : %.pdf: %.tex
  164. unitex.chk:
  165. ifndef INSTALLDEBUG
  166. $(MAKE) -C crtex tex
  167. $(MAKE) -C dosex tex
  168. $(MAKE) -C go32ex tex
  169. $(MAKE) -C heapex tex
  170. $(MAKE) -C ipcex tex
  171. $(MAKE) -C linuxex tex
  172. $(MAKE) -C mouseex tex
  173. $(MAKE) -C objectex tex
  174. $(MAKE) -C optex tex
  175. $(MAKE) -C printex tex
  176. $(MAKE) -C sockex tex
  177. $(MAKE) -C stringex tex
  178. $(MAKE) -C sysutex tex
  179. $(MAKE) -C mathex tex
  180. $(MAKE) -C graphex tex
  181. $(MAKE) -C gpmex tex
  182. endif
  183. touch unitex.chk
  184. refex.chk:
  185. ifndef INSTALLDEBUG
  186. $(MAKE) -C refex tex
  187. endif
  188. touch refex.chk
  189. progex.chk:
  190. ifndef INSTALLDEBUG
  191. $(MAKE) -C progex tex
  192. endif
  193. touch progex.chk
  194. messages:
  195. msg2inc -TE ../compiler/errore.msg messages.tex
  196. #
  197. # Include files
  198. #
  199. date.inc:
  200. @echo \\date\{`date +'%B %Y'`\} > date.inc
  201. preamble.inc:
  202. cp -f preamble.$(PREAMBLETYPE) preamble.inc
  203. includes: date.inc preamble.inc
  204. #
  205. # DVI files
  206. #
  207. onechap: onechap.dvi
  208. units.dvi: units.tex includes $(CHAPTERS)
  209. ref.dvi: ref.tex includes
  210. prog.dvi: prog.tex includes
  211. user.dvi: user.tex includes
  212. units.pdf: units.tex includes $(CHAPTERS)
  213. ref.pdf: ref.tex includes
  214. user.pdf: user.tex includes
  215. prog.pdf: prog.tex includes
  216. dvi : $(DVI)
  217. txt : dvi $(TXT)
  218. ps : dvi $(PS)
  219. pdf : $(PDF)
  220. all : dvi ps pdf txt html
  221. #####################################################################
  222. # Html creation
  223. #####################################################################
  224. htex: htex.chk
  225. htex.chk: $(wildcard *.tex)
  226. ./tex2htex
  227. touch htex.chk
  228. user: user.chk
  229. user.chk: htex.chk includes
  230. ifdef INSTALLDEBUG
  231. mkdir user
  232. cp user.tex user/index.html
  233. else
  234. cp -f preamble.html preamble.inc
  235. $(LATEX2HTML) $(LATEX2HTMLOPTS) -split 2 -link 2\
  236. -t "User's guide for Free Pascal" user.htex
  237. -sed -f foot.sed <user/footnode.html >user/footnote.html
  238. -mv user/footnote.html user/footnode.html
  239. -rm -f user/labels.pl user/internals.pl user/.*.pag user/.*.dir
  240. -rm -f user/images.* user/*.log user/WARNINGS
  241. endif
  242. touch user.chk
  243. units: units.chk
  244. units.chk: unitex.chk htex.chk includes
  245. ifdef INSTALLDEBUG
  246. mkdir units
  247. cp units.tex units/index.html
  248. else
  249. cp -f preamble.html preamble.inc
  250. $(LATEX2HTML) $(LATEX2HTMLOPTS) -split 3 -link 2\
  251. -t "Unit reference for Free Pascal" units.htex
  252. -sed -f foot.sed <units/footnode.html >units/footnote.html
  253. -mv units/footnote.html units/footnode.html
  254. ifndef LOG
  255. -rm -f units/labels.pl units/internals.pl units/.*.pag units/.*.dir
  256. -rm -f units/images.* units/*.log units/WARNINGS
  257. endif
  258. endif
  259. touch units.chk
  260. ref: ref.chk
  261. ref.chk: refex.chk htex.chk includes
  262. ifdef INSTALLDEBUG
  263. mkdir ref
  264. cp ref.tex ref/index.html
  265. else
  266. cp -f preamble.html preamble.inc
  267. $(LATEX2HTML) $(LATEX2HTMLOPTS) -split 4 -link 2\
  268. -t "Free Pascal reference guide" ref.htex
  269. -sed -f foot.sed <ref/footnode.html >ref/footnote.html
  270. -mv ref/footnote.html ref/footnode.html
  271. ifndef LOG
  272. -rm -f ref/labels.pl ref/internals.pl ref/.*.pag ref/.*.dir
  273. -rm -f ref/images.* ref/*.log ref/WARNINGS
  274. endif
  275. endif
  276. touch ref.chk
  277. prog: prog.chk
  278. prog.chk: progex.chk htex.chk includes
  279. ifdef INSTALLDEBUG
  280. mkdir prog
  281. cp prog.tex prog/index.html
  282. else
  283. cp -f preamble.html preamble.inc
  284. $(LATEX2HTML) $(LATEX2HTMLOPTS) -split 2 -link 2\
  285. -t "Free Pascal programmers guide" prog.htex
  286. -sed -f foot.sed <prog/footnode.html >prog/footnote.html
  287. -mv prog/footnote.html prog/footnode.html
  288. ifndef LOG
  289. -rm -f prog/labels.pl prog/internals.pl prog/.*.pag prog/.*.dir
  290. -rm -f prog/images.* prog/*.log prog/WARNINGS
  291. endif
  292. endif
  293. touch prog.chk
  294. internal: internal.chk
  295. internal.chk: htex.chk
  296. ifdef INSTALLDEBUG
  297. mkdir internal
  298. cp internal.tex internal/index.html
  299. else
  300. cp -f preamble.html preamble.inc
  301. $(LATEX2HTML) $(LATEX2HTMLOPTS) -split 4 -link 2\
  302. -t "Free Pascal Compiler Documentation" internal.htex
  303. -sed -f foot.sed <internal/footnode.html >internal/footnote.html
  304. -mv internal/footnote.html internal/footnode.html
  305. ifndef LOG
  306. -rm -f internal/labels.pl internal/internals.pl internal/.*.pag internal/.*.dir
  307. -rm -f internal/images.* internal/*.log internal/WARNINGS
  308. endif
  309. endif
  310. touch internal.chk
  311. onechap: onechap.chk
  312. onechap.chk: unitex.chk htex.chk includes
  313. ifdef INSTALLDEBUG
  314. mkdir onechap
  315. cp onechap.tex onechap/index.html
  316. else
  317. cp -f preamble.html preamble.inc
  318. $(LATEX2HTML) $(LATEX2HTMLOPTS) -split 4 -link 2\
  319. -t "Free Pascal reference guide" onechap.htex
  320. -sed -f foot.sed <onechap/footnode.html >onechap/footnote.html
  321. -mv onechap/footnote.html onechap/footnode.html
  322. ifndef LOG
  323. -rm -f onechap/labels.pl onechap/internals.pl onechap/.*.pag onechap/.*.dir
  324. -rm -f onechap/images.* onechap/*.log onechap/WARNINGS
  325. endif
  326. endif
  327. touch onechap.chk
  328. html: $(HTML)
  329. #####################################################################
  330. # GTK Articles
  331. #####################################################################
  332. gtk: $(GTKPDF)
  333. gtk1.pdf: gtk1.tex
  334. gtk2.pdf: gtk2.tex
  335. gtk3.pdf: gtk3.tex
  336. gtk4.pdf: gtk4.tex
  337. gtk5.pdf: gtk5.tex
  338. #####################################################################
  339. # Installation
  340. #####################################################################
  341. pdfinstall: pdf
  342. install -d -m 755 $(DOCINSTALLDIR)
  343. cp $(PDF) $(DOCINSTALLDIR)
  344. htmlinstall: html
  345. install -d -m 755 $(DOCINSTALLDIR)
  346. cp fpctoc.html $(DOCINSTALLDIR)
  347. cp -R buttons $(DOCINSTALLDIR)
  348. cp -R search $(DOCINSTALLDIR)
  349. sed s/DOCDIR/"$(subst /,\/,$(DOCINSTALLDIR))"/ $(DOCINSTALLDIR)/search/fpchelp.idksm.linux > $(DOCINSTALLDIR)/search/fpchelp.idksm
  350. cp -f $(DOCINSTALLDIR)/search/filelist.txt.linux $(DOCINSTALLDIR)/search/filelist.txt
  351. rm -f $(DOCINSTALLDIR)/search/*.linux
  352. cp -R $(HTML) $(DOCINSTALLDIR)
  353. find $(DOCINSTALLDIR) -name 'CVS' | xargs -n1 rm -rf
  354. doshtmlinstall: html
  355. install -d -m 755 $(DOCINSTALLDIR)
  356. cp fpctoc.html $(DOCINSTALLDIR)
  357. cp -R buttons $(DOCINSTALLDIR)
  358. cp -R search $(DOCINSTALLDIR)
  359. rm -f $(DOCINSTALLDIR)/search/*.linux
  360. cp -R $(HTML) $(DOCINSTALLDIR)
  361. find $(DOCINSTALLDIR) -name 'CVS' | xargs -n1 rm -rf
  362. www-install: psdist htmlinstall
  363. scp fpcdoc.zip fpcdocps.zip fpcdocps.tar.gz fpcdoc.tar.gz tfdec1:htdocs/fpk
  364. ssh tfdec1 '(cd htdocs/fpk/docs ; /usr/local/bin/tar -xzf ../fpcdoc.tar.gz)'
  365. install:
  366. @echo Choose install from:
  367. @echo pdfinstall,htmlinstall,htmldosinstall
  368. @exit
  369. #####################################################################
  370. # Archives
  371. #####################################################################
  372. psdist: $(PS)
  373. tar -cvzf fpcdocps.tar.gz $(PS)
  374. zip docs-ps $(PS)
  375. pdfdist: pdf
  376. zip docs-pdf $(PDF)
  377. dvidist: dvi
  378. zip docs-dvi $(DVI)
  379. txtdist: txt
  380. zip docs-txt $(TXT)
  381. #####################################################################
  382. # Zips of htmls
  383. #####################################################################
  384. DOCPREFIX=doc
  385. BASEDIR=$(shell pwd)
  386. htmltar:
  387. $(MAKE) htmlinstall DOCINSTALLDIR=$(DOCPREFIX)
  388. cd $(DOCPREFIX) ; tar cz * > $(BASEDIR)/fpcdoc.tar.gz ; cd $(BASEDIR)
  389. rm -rf $(DOCPREFIX)
  390. htmlzip:
  391. $(MAKE) doshtmlinstall DOCINSTALLDIR=$(DOCPREFIX)
  392. zip -D9rq doc-html $(DOCPREFIX)/*
  393. rm -rf $(DOCPREFIX)
  394. htmzip:
  395. $(MAKE) doshtmlinstall DOCINSTALLDIR=$(DOCPREFIX)
  396. makehtm `find $(DOCPREFIX) -name '*.html'`
  397. zip -D9rq doc-htm `find $(DOCPREFIX) -name '*.htm' -or -name '*.gif' -or -name '*.css'`
  398. rm -rf $(DOCPREFIX)
  399. htmldist: htmlzip htmltar
  400. htmdist: htmzip
  401. alldist: dvidist psdist txtdist pdfdist htmldist htmdist
  402. distclean: clean
  403. -rm -f *.tar.gz *.zip
  404. #####################################################################
  405. # Examples
  406. #####################################################################
  407. examples:
  408. $(MAKE) -C crtex
  409. $(MAKE) -C dosex
  410. $(MAKE) -C optex
  411. $(MAKE) -C printex
  412. $(MAKE) -C refex
  413. $(MAKE) -C stringex
  414. $(MAKE) -C ipcex
  415. $(MAKE) -C objectex
  416. $(MAKE) -C sysutex
  417. dosexamples: examples
  418. $(MAKE) -C go32ex
  419. $(MAKE) -C mouseex
  420. linuxexamples: examples
  421. $(MAKE) -C linuxex
  422. $(MAKE) -C sockex
  423. $(MAKE) -C ipcex
  424. #
  425. # $Log$
  426. # Revision 1.6 2001-07-29 20:28:00 peter
  427. # * move preamble to separate include file so changes only need to
  428. # be done to this file.
  429. #
  430. # Revision 1.5 2001/07/10 22:01:15 michael
  431. # + Some cleaning up
  432. #
  433. # Revision 1.4 2000/10/12 10:41:58 peter
  434. # * more examples
  435. #
  436. # Revision 1.3 2000/09/02 21:51:36 peter
  437. # * fixed pdf creating (merged)
  438. #
  439. # Revision 1.1 2000/07/13 09:10:03 michael
  440. # + Initial import
  441. #