Makefile 13 KB

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