Makefile 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  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. ifndef FPC
  22. ifdef PP
  23. FPC=$(PP)
  24. endif
  25. endif
  26. ifndef FPC
  27. FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
  28. ifneq ($(FPCPROG),)
  29. FPCPROG:=$(firstword $(FPCPROG))
  30. FPC:=$(shell $(FPCPROG) -PB)
  31. ifneq ($(findstring Error,$(FPC)),)
  32. override FPC=ppc386
  33. endif
  34. else
  35. override FPC=ppc386
  36. endif
  37. endif
  38. override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
  39. override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
  40. HOSTOS=$(shell $(FPC) -iSO)
  41. # Which docs are made when 'html' is specified
  42. HTML = user units ref prog fpdoc fcl chart
  43. # Can be 'report','book', 'html', 'hevea', 'ts3' 'ts4'
  44. ifdef USEHEVEA
  45. PREAMBLETYPE = hevea
  46. else
  47. ifdef USEL2H
  48. PREAMBLETYPE = html
  49. else
  50. PREAMBLETYPE = report
  51. endif
  52. endif
  53. # Where do you want the html files to be put ?
  54. ifndef PREFIXINSTALLDIR
  55. PREFIXINSTALLDIR=/usr
  56. endif
  57. ifndef DOCINSTALLDIR
  58. DOCINSTALLDIR:=$(PREFIXINSTALLDIR)/doc/fpc-$(shell $(FPC) -iV)
  59. endif
  60. ifndef FPDOC
  61. ifneq ($(wildcard ../utils/fpdoc/fpdoc),)
  62. FPDOC=../utils/fpdoc/fpdoc
  63. else
  64. FPDOC=fpdoc
  65. endif
  66. endif
  67. ifndef FPCSRCDIR
  68. FPCSRCDIR=..
  69. endif
  70. # Use Ascii mode ? (i.e. no pics in produced HTML ?)
  71. ifndef ASCIIMODE
  72. ASCIIMODE=NO
  73. endif
  74. #######################################################################
  75. # LaTeX Program definitions
  76. #######################################################################
  77. # Latex itself
  78. ifndef LATEX
  79. LATEX = latex
  80. endif
  81. # DVI to PS converter
  82. ifndef DVIPS
  83. DVIPS=dvips
  84. endif
  85. # DVI to TXT converter
  86. ifndef DVITXT
  87. DVITXT=dvi2tty -w132
  88. endif
  89. # PDF converter
  90. ifndef PDFLATEX
  91. PDFLATEX=pdflatex
  92. endif
  93. # Makeindex programma
  94. ifndef MAKEINDEX
  95. MAKEINDEX=makeindex
  96. endif
  97. #######################################################################
  98. # Latex2html conversion.
  99. #######################################################################
  100. ifdef USEL2H
  101. # Command to use.
  102. ifndef LATEX2HTML
  103. LATEX2HTML = /usr/bin/latex2html
  104. endif
  105. # Default options for converter
  106. ifndef LATEX2HTMLOPTS
  107. LATEX2HTMLOPTS = -no_reuse -up_url "../fpctoc.html"\
  108. -up_title "Free Pascal manuals"\
  109. -html_version 4.0 -split 3
  110. endif
  111. endif # USEL2H
  112. #######################################################################
  113. # HEVEA conversion.
  114. #######################################################################
  115. ifdef USEHEVEA
  116. # Hevea conversion.
  117. ifndef HEVEA
  118. HEVEA = /usr/bin/hevea
  119. endif
  120. endif # USEHEVEA
  121. # tmpdir
  122. export TMP=/tmp
  123. #
  124. #######################################################################
  125. # End of configurable section. Do not edit after this line.
  126. #######################################################################
  127. PS = $(addsuffix .ps, $(HTML))
  128. DVI = $(addsuffix .dvi, $(HTML))
  129. TXT = $(addsuffix .txt, $(HTML))
  130. PDF = $(addsuffix .pdf, $(HTML))
  131. TOC = $(addsuffix .toc, $(HTML) onechap)
  132. AUX = $(addsuffix .aux, $(HTML) onechap)
  133. LOG = $(addsuffix .log, $(HTML) onechap)
  134. LOT = $(addsuffix .lot, $(HTML) onechap)
  135. OUT = $(addsuffix .out, $(HTML) onechap)
  136. CHK = $(addsuffix .chk, $(HTML) progex unitex refex htex onechap scripts)
  137. CHAPTERS = $(addsuffix .tex, crt dos getopts go32 graph linux printer\
  138. strings objects heaptrc sysutils ipc mouse gpm dxeload \
  139. emu387 ports math keyboard typinfo video)
  140. GTKPDF=$(addsuffix .pdf,$(addprefix gtk, 1 2 3 4 5))
  141. # Check if ascii-mode requested
  142. ifeq ($(ASCIIMODE),YES)
  143. ifdef USEL2H
  144. LATEX2HTMLOPTS+=-ascii_mode
  145. endif
  146. ifdef USEHEVEA
  147. HEVEAOPTS+=-text
  148. endif
  149. endif
  150. #####################################################################
  151. # Conversion from types
  152. #####################################################################
  153. .PHONY: clean dvi help html ps psdist htmldist pdfdist txtdist \
  154. htm txt pdf refex alldist messages onechap gtk \
  155. user ref prog units
  156. .SUFFIXES: .dvi .tex .ps .txt .pdf
  157. # default show help
  158. .dvi.ps:
  159. $(DVIPS) $<
  160. .tex.dvi:
  161. $(LATEX) $*
  162. -$(MAKEINDEX) $*
  163. $(LATEX) $*
  164. -$(MAKEINDEX) $*
  165. $(LATEX) $*
  166. .dvi.txt:
  167. $(DVITXT) -o $*.txt $*.dvi
  168. .tex.pdf:
  169. $(PDFLATEX) $*
  170. -$(MAKEINDEX) $*
  171. $(PDFLATEX) $*
  172. -$(MAKEINDEX) $*
  173. $(PDFLATEX) $*
  174. #####################################################################
  175. # Targets
  176. #####################################################################
  177. help:
  178. @echo 'Possible targets :'
  179. @echo ' dvi : Make documentation using latex.'
  180. @echo ' ps : Make documentation using latex and dvips.'
  181. @echo ' html : Make HTML documentation using default converter.'
  182. @echo ' hevea : Make HTML documentation using hevea'
  183. @echo ' l2h : Make HTML documentation using latex2html'
  184. @echo ' 4ht : Make HTML documentation using tex4ht'
  185. @echo ' pdf : Make documentation using pdflatex'
  186. @echo ' txt : dvi, convert to text using dvi2tty'
  187. @echo ' htm : Convert .html to .htm files, zip result'
  188. @echo ' clean : Clean up the mess.'
  189. @echo ' examples : Comple all generic examples'
  190. @echo ' linuxexamples : Compile all examples for linux'
  191. @echo ' dosexamples : Compile all examples for dos'
  192. @echo ' execute : Execute examples (DOS/Windows/OS/2 only)'
  193. @echo ' htmldist : html, and rchive result.'
  194. @echo ' psdist : ps, and archive result.'
  195. @echo ' pdfdist : pdf, and archive result.'
  196. clean:
  197. -rm -f preamble.inc date.inc htex.sed
  198. -rm -f *.htex *.hind *.haux *.htoc $(addsuffix *.html,$(HTML))
  199. -rm -f *.4tc *.4ct *.css *.lg *.tmp *.xref
  200. -rm -rf $(HTML) onechap
  201. -rm -f $(TOC) $(LOG) $(DVI) $(PDF) $(AUX) $(OUT) $(PS) *.i* $(LOT) $(TXT) $(CHK)
  202. -rm -f onechap.dvi onechap.pdf onechap.ps onechap.out onechap.log onechap.aux
  203. # Styles
  204. -rm -f $(notdir $(wildcard styles/*))
  205. # Units
  206. -$(MAKE) -C crtex clean
  207. -$(MAKE) -C dosex clean
  208. -$(MAKE) -C go32ex clean
  209. -$(MAKE) -C heapex clean
  210. -$(MAKE) -C ipcex clean
  211. -$(MAKE) -C linuxex clean
  212. -$(MAKE) -C mmouseex clean
  213. -$(MAKE) -C mouseex clean
  214. -$(MAKE) -C objectex clean
  215. -$(MAKE) -C optex clean
  216. -$(MAKE) -C printex clean
  217. -$(MAKE) -C sockex clean
  218. -$(MAKE) -C stringex clean
  219. -$(MAKE) -C sysutex clean
  220. -$(MAKE) -C mathex clean
  221. -$(MAKE) -C graphex clean
  222. -$(MAKE) -C gpmex clean
  223. -$(MAKE) -C typinfex clean
  224. -$(MAKE) -C kbdex clean
  225. -$(MAKE) -C videoex clean
  226. # Reference
  227. -$(MAKE) -C refex clean
  228. # Programmers manual
  229. -$(MAKE) -C progex clean
  230. $(TXT) : %.txt: %.dvi
  231. $(DVI) : %.dvi: %.tex
  232. $(PDF) : %.pdf: %.tex
  233. unitex.chk:
  234. ifndef INSTALLDEBUG
  235. $(MAKE) -C crtex tex
  236. $(MAKE) -C dosex tex
  237. $(MAKE) -C go32ex tex
  238. $(MAKE) -C heapex tex
  239. $(MAKE) -C ipcex tex
  240. $(MAKE) -C linuxex tex
  241. $(MAKE) -C mouseex tex
  242. $(MAKE) -C mmouseex tex
  243. $(MAKE) -C objectex tex
  244. $(MAKE) -C optex tex
  245. $(MAKE) -C printex tex
  246. $(MAKE) -C sockex tex
  247. $(MAKE) -C stringex tex
  248. $(MAKE) -C sysutex tex
  249. $(MAKE) -C mathex tex
  250. $(MAKE) -C graphex tex
  251. $(MAKE) -C gpmex tex
  252. $(MAKE) -C kbdex tex
  253. $(MAKE) -C typinfex tex
  254. $(MAKE) -C videoex tex
  255. endif
  256. touch unitex.chk
  257. refex.chk:
  258. ifndef INSTALLDEBUG
  259. $(MAKE) -C refex tex
  260. endif
  261. touch refex.chk
  262. progex.chk:
  263. ifndef INSTALLDEBUG
  264. $(MAKE) -C progex tex
  265. endif
  266. touch progex.chk
  267. messages:
  268. msg2inc -TE ../compiler/errore.msg messages.tex
  269. #
  270. # Include files
  271. #
  272. date.inc:
  273. @echo \\date\{`date +'%B %Y'`\} > date.inc
  274. preamble.inc:
  275. cp -f preamble.$(PREAMBLETYPE) preamble.inc
  276. ifeq ($(OS),Windows_NT)
  277. inWinNT=1
  278. endif
  279. ifndef inWinNT
  280. scripts.chk:
  281. chmod +x tex2htex
  282. chmod +x pp2tex
  283. chmod +x progex/c2tex
  284. touch scripts.chk
  285. endif
  286. # Local copy of the required styles
  287. syntax.sty: styles/syntax.sty
  288. cp $(wildcard styles/*.*) .
  289. ifndef inWinNT
  290. includes: date.inc preamble.inc syntax.sty scripts.chk
  291. else
  292. includes: date.inc preamble.inc syntax.sty
  293. endif
  294. #####################################################################
  295. # Tex from XML
  296. #####################################################################
  297. FCLOPTS=--package=fcl --descr=classes.xml --input='$(FPCSRCDIR)/rtl/$(HOSTOS)/classes.pp -Fi$(FPCSRCDIR)/rtl/objpas/classes'
  298. fcl.inc: classes.xml
  299. $(FPDOC) --output=fcl.inc $(FCLOPTS) --format=latex
  300. #####################################################################
  301. # DVI files
  302. #####################################################################
  303. onechap: onechap.dvi
  304. units.dvi: units.tex includes $(CHAPTERS)
  305. ref.dvi: ref.tex includes
  306. prog.dvi: prog.tex includes
  307. user.dvi: user.tex includes
  308. fpdoc.dvi: fpdoc.tex includes
  309. fcl.dvi: fcl.tex fcl.inc includes
  310. chart.dvi: chart.tex
  311. units.pdf: units.tex includes $(CHAPTERS)
  312. ref.pdf: ref.tex includes
  313. user.pdf: user.tex includes
  314. prog.pdf: prog.tex includes
  315. onechap.pdf: onechap.tex includes
  316. onechap.dvi: onechap.tex includes
  317. fpdoc.pdf: fpdoc.tex includes
  318. fcl.pdf: fcl.tex fcl.inc includes
  319. chart.pdf: chart.tex
  320. dvi : $(DVI)
  321. txt : dvi $(TXT)
  322. ps : dvi $(PS)
  323. pdf : $(PDF)
  324. all : dvi ps pdf txt html
  325. #######################################################################
  326. # HTML creation
  327. #######################################################################
  328. .PHONY: htex user prog units onechap ref internal html hevea
  329. ifdef INSTALLDEBUG
  330. #######################################################################
  331. # Installation debugging
  332. $(HTML):
  333. mkdir $@
  334. cp [email protected] $@/index.html
  335. html: $(HTML)
  336. else
  337. #######################################################################
  338. # Automatic selection. Default tex4ht
  339. ifdef USEHEVEA
  340. include Makefile.hev
  341. else
  342. ifdef USEL2H
  343. include Makefile.l2h
  344. else
  345. include Makefile.4ht
  346. endif # USEL2H
  347. endif # USEHEVEA
  348. endif # INSTALLDEBUG
  349. #######################################################################
  350. # Targets to force using a specific tool.
  351. hevea:
  352. $(MAKE) html USEHEVEA=1
  353. l2h:
  354. $(MAKE) html USEL2H=1
  355. 4ht:
  356. $(MAKE) html USETEX4HT=1
  357. fcl: fcl/index.html
  358. fcl/index.html: classes.xml
  359. $(FPDOC) $(FCLOPTS) --format=html --output=fcl
  360. #####################################################################
  361. # GTK Articles
  362. #####################################################################
  363. gtk: $(GTKPDF)
  364. gtk1.pdf: gtk1.tex
  365. gtk2.pdf: gtk2.tex
  366. gtk3.pdf: gtk3.tex
  367. gtk4.pdf: gtk4.tex
  368. gtk5.pdf: gtk5.tex
  369. #####################################################################
  370. # Installation
  371. #####################################################################
  372. pdfinstall: pdf
  373. install -d -m 755 $(DOCINSTALLDIR)
  374. cp $(PDF) $(DOCINSTALLDIR)
  375. htmlinstall: html
  376. install -d -m 755 $(DOCINSTALLDIR)
  377. cp fpctoc.html $(DOCINSTALLDIR)
  378. cp -R buttons $(DOCINSTALLDIR)
  379. cp -R pics $(DOCINSTALLDIR)
  380. cp -R $(HTML) $(DOCINSTALLDIR)
  381. find $(DOCINSTALLDIR) -name 'CVS' -or -name '*.eps' | xargs -n1 rm -rf
  382. install:
  383. @echo Choose install from:
  384. @echo pdfinstall,htmlinstall,htmldosinstall
  385. @exit
  386. #####################################################################
  387. # Archives
  388. #####################################################################
  389. psdist: $(PS)
  390. tar -cvzf fpcdocps.tar.gz $(PS)
  391. zip docs-ps $(PS)
  392. pdfdist: pdf
  393. zip docs-pdf $(PDF)
  394. dvidist: dvi
  395. zip docs-dvi $(DVI)
  396. txtdist: txt
  397. zip docs-txt $(TXT)
  398. #####################################################################
  399. # Zips of htmls
  400. #####################################################################
  401. DOCPREFIX=doc
  402. BASEDIR=$(shell pwd)
  403. htmltar:
  404. ifndef SKIPINSTALL
  405. $(MAKE) htmlinstall DOCINSTALLDIR=$(DOCPREFIX)
  406. endif
  407. cd $(DOCPREFIX) ; tar cz * > $(BASEDIR)/fpcdoc.tar.gz ; cd $(BASEDIR)
  408. rm -rf $(DOCPREFIX)
  409. htmlzip:
  410. ifndef SKIPINSTALL
  411. $(MAKE) htmlinstall DOCINSTALLDIR=$(DOCPREFIX)
  412. endif
  413. zip -D9rq doc-html $(DOCPREFIX)/*
  414. rm -rf $(DOCPREFIX)
  415. htmzip:
  416. ifndef SKIPINSTALL
  417. $(MAKE) htmlinstall DOCINSTALLDIR=$(DOCPREFIX)
  418. endif
  419. makehtm `find $(DOCPREFIX) -name '*.html'`
  420. zip -D9rq doc-htm `find $(DOCPREFIX) -name '*.htm' -or -name '*.gif' -or -name '*.png' -or -name '*.css'`
  421. rm -rf $(DOCPREFIX)
  422. htmldist: htmlzip htmltar
  423. htmdist: htmzip
  424. alldist: dvidist psdist txtdist pdfdist
  425. $(MAKE) htmltar
  426. $(MAKE) htmlzip SKIPINSTALL=Y
  427. $(MAKE) htmzip SKIPINSTALL=Y
  428. distclean: clean
  429. -rm -f *.tar.gz *.zip
  430. #####################################################################
  431. # Examples
  432. #####################################################################
  433. examples:
  434. $(MAKE) -C crtex
  435. $(MAKE) -C dosex
  436. $(MAKE) -C optex
  437. $(MAKE) -C mathex
  438. $(MAKE) -C printex
  439. $(MAKE) -C refex
  440. $(MAKE) -C stringex
  441. $(MAKE) -C objectex
  442. $(MAKE) -C sysutex
  443. $(MAKE) -C typinfex
  444. $(MAKE) -C kbdex
  445. dosexamples: examples
  446. $(MAKE) -C go32ex
  447. $(MAKE) -C mouseex
  448. linuxexamples: examples
  449. $(MAKE) -C linuxex
  450. $(MAKE) -C sockex
  451. $(MAKE) -C ipcex
  452. execute:
  453. $(MAKE) -C dosex all
  454. $(MAKE) -C dosex execute
  455. $(MAKE) -C refex all
  456. $(MAKE) -C refex execute
  457. $(MAKE) -C mathex all
  458. $(MAKE) -C mathex execute
  459. $(MAKE) -C stringex all
  460. $(MAKE) -C stringex execute
  461. $(MAKE) -C objectex all
  462. $(MAKE) -C objectex execute
  463. $(MAKE) -C sysutex all
  464. $(MAKE) -C sysutex execute
  465. $(MAKE) -C typinfex all
  466. $(MAKE) -C typinfex execute
  467. #
  468. # $Log$
  469. # Revision 1.27 2004-07-17 21:02:28 marco
  470. # * x86 dependancy fixed, reported by Claviola
  471. #
  472. # Revision 1.26 2004/05/18 22:10:56 michael
  473. # + Updates for 1.9.4. Mostly MACPas related
  474. #
  475. # Revision 1.25 2004/03/19 17:39:03 peter
  476. # * use fpdoc from utils tree if found
  477. #
  478. # Revision 1.24 2003/11/16 00:03:03 michael
  479. # + Many changes for 2.0 beta
  480. #
  481. # Revision 1.23 2003/11/02 00:14:23 marco
  482. # * fixed classes moving to rtl, and the OS dependancy of the classes unit
  483. # generation.
  484. #
  485. # Revision 1.22 2003/05/29 10:25:51 peter
  486. # * allow to specify FPCSRCDIR and FPDOC
  487. #
  488. # Revision 1.21 2003/03/18 21:25:23 michael
  489. # + Added fcl docs and fpdoc
  490. #
  491. # Revision 1.20 2003/03/18 00:14:51 michael
  492. # + Added fpdoc
  493. #
  494. # Revision 1.19 2003/03/17 08:27:27 michael
  495. # + Split out html generation
  496. #
  497. # Revision 1.18 2003/03/16 15:24:58 peter
  498. # * also remove htex.sed
  499. #
  500. # Revision 1.17 2003/03/16 15:22:18 peter
  501. # * support for hevea
  502. # * provided local copies or required styles since debian does not
  503. # supply the listings.sty anymore
  504. #
  505. # Revision 1.16 2003/02/24 23:37:52 michael
  506. # + Preparations for version 1.0.8
  507. #
  508. # Revision 1.15 2002/11/10 12:22:10 carl
  509. # * update makefiles for testing
  510. # * update example which did not compile
  511. #
  512. # Revision 1.14 2002/04/23 18:03:50 michael
  513. # + removed fcl target in HTML
  514. #
  515. # Revision 1.13 2002/03/19 14:33:18 pierre
  516. # * remove ipcex directory target from examples
  517. #
  518. # Revision 1.12 2002/03/12 22:13:42 michael
  519. # + Now pics directory is included in HTML
  520. #
  521. # Revision 1.11 2001/11/05 20:10:05 michael
  522. # + Added onechap target
  523. #
  524. # Revision 1.10 2001/10/18 21:41:26 peter
  525. # * fixed latex2html settings
  526. #
  527. # Revision 1.9 2001/10/11 23:36:54 carl
  528. # + reinstated Windows NT support
  529. #
  530. # Revision 1.8 2001/10/04 21:03:13 michael
  531. # + Added video and keyboard units
  532. #
  533. # Revision 1.7 2001/09/22 11:15:04 peter
  534. # * chmod the scripts
  535. # * fixed html installation
  536. #
  537. # Revision 1.6 2001/07/29 20:28:00 peter
  538. # * move preamble to separate include file so changes only need to
  539. # be done to this file.
  540. #
  541. # Revision 1.5 2001/07/10 22:01:15 michael
  542. # + Some cleaning up
  543. #
  544. # Revision 1.4 2000/10/12 10:41:58 peter
  545. # * more examples
  546. #
  547. # Revision 1.3 2000/09/02 21:51:36 peter
  548. # * fixed pdf creating (merged)
  549. #
  550. # Revision 1.1 2000/07/13 09:10:03 michael
  551. # + Initial import
  552. #