summaryrefslogtreecommitdiff
path: root/fpcdocs/Makefile.fpc
blob: 2ac16c3e638322a0824d648e9c63683d3e468e45 (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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
#
#   $Id: Makefile.fpc,v 1.13 2005/05/07 09:41:09 michael Exp $
#   This file is part of the Free Pascal run time library.
#   Copyright (c) 1996-98 by Michael van Canneyt
#
#   Makefile for the Free Pascal Documentation
#
#   See the file COPYING.FPC, included in this distribution,
#   for details about the copyright.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#

[package]
name=fpdocs
version=2.6.4

[require]
nortl=y

[install]
#fpcpackage=y

[default]
rule=help

[target]
units=relinkhtml
programs=cleanxml relinkdocs

[prerules]
SEARCHFPCSRCPATH=../fpcsrc ../fpc ..
FPCSRCDIR:=$(patsubst %/compiler,%,$(firstword $(strip $(wildcard $(addsuffix /compiler,$(SEARCHFPCSRCPATH))))))

[rules]
# Debugging the install, that will only copy the .tex to index.html
# so a make html and make install goes quickly
#INSTALLDEBUG=1

# Which docs to build by default
ifndef DOCS
DOCS = user rtl ref prog fpdoc chart fcl
endif

# Which RTF docs
ifndef RTFS
RTFS = fcl rtl
endif

# Can be 'report','book' for pdf/ps, html use their own preamble file
PREAMBLETYPE = report

# Locate FPDoc
ifndef CROSSCOMPILE
ifndef FPDOC
ifneq ($(wildcard $(FPCSRCDIR)/utils/fpdoc/fpdoc),)
FPDOC=$(FPCSRCDIR)/utils/fpdoc/fpdoc
else
FPDOC=fpdoc
endif
endif
endif

# Locate Makeskel
ifndef CROSSCOMPILE
ifndef MAKESKEL
ifneq ($(wildcard $(FPCSRCDIR)/utils/fpdoc/makeskel),)
MAKESKEL=$(FPCSRCDIR)/utils/fpdoc/makeskel
else
MAKESKEL=makeskel
endif
endif
endif

ifndef FPCSRCDIR
FPCSRCDIR=..
endif

# Use Ascii mode ? (i.e. no pics in produced HTML ?)
ifndef ASCIIMODE
ASCIIMODE=NO
endif

ifndef HTMLFMT
  HTMLFMT=html
endif

ifndef RTLLINKPREFIX
  ifeq (chm, $(HTMLFMT))
    RTLLINKPREFIX:=ms-its:rtl.chm::/    
  else
    RTLLINKPREFIX:=../rtl/    
  endif
endif

ifndef HIDEPROTECTED
HIDEPROTECTED=YES
endif

FCLOPTS=$(FPDOCOPTS) --package=fcl --warn-no-node --descr=fcl.xml --content=fcl.xct --import=rtl.xct,$(RTLLINKPREFIX) $(FCLUNITOPTS)
ifeq ($(HIDEPROTECTED),YES)
FCLOPTS+= --hide-protected
endif

FPDOCHTMLOPTS=--footer-date="mmm dd yyyy"

ifeq (chm,$(HTMLFMT))
  HTMLSUFFIX:=.chm
  FPDOCHTMLOPTS+=--auto-toc --auto-index --make-searchable
  RTLCHMOPTS="--chm-title=(RTL) Runtime Library"
  FCLCHMOPTS="--chm-title=(FCL) Free Component Library"
endif

ifeq (ipf,$(HTMLFMT))
  HTMLSUFFIX:=.ipf
  FPDOCHTMLOPTS=
  CSSFILE=
endif

ifdef CSSFILE
ifndef (ipf,$(HTMLFMT)
 FPDOCHTMLOPTS+=--css-file=$(CSSFILE)
endif
endif


#######################################################################
# LaTeX Program definitions
#######################################################################

# Latex itself
ifndef LATEX
LATEX = latex
endif
# DVI to PS converter
ifndef DVIPS
DVIPS=dvips
endif
# DVI to TXT converter
ifndef DVITXT
DVITXT=dvi2tty -w132
endif
# PDF converter
ifndef PDFLATEX
PDFLATEX=pdflatex
endif
# Makeindex programma
ifndef MAKEINDEX
MAKEINDEX=makeindex
endif

# Required Latex settings
save_size=10000
export save_size

#######################################################################
# Latex2html conversion.
#######################################################################
ifdef USEL2H
# Command to use.
ifndef LATEX2HTML
LATEX2HTML = /usr/bin/latex2html
endif
# Default options for converter
ifndef LATEX2HTMLOPTS
LATEX2HTMLOPTS = -no_reuse -up_url "$(FPCSRCDIR)/fpctoc.html"\
                 -up_title "Free Pascal manuals"\
                 -html_version 4.0 -split 3
endif
ifeq ($(ASCIIMODE),YES)
LATEX2HTMLOPTS+=-ascii_mode
endif
endif # USEL2H

#######################################################################
# HEVEA conversion.
#######################################################################
ifdef USEHEVEA
# Hevea conversion.
ifndef HEVEA
HEVEA = /usr/bin/hevea
endif
ifeq ($(ASCIIMODE),YES)
HEVEAOPTS+=-text
endif
endif # USEHEVEA

#######################################################################
# PlasTeX conversion.
#######################################################################
ifdef USEPLASTEX
# PLASTEX conversion.
ifndef PLASTEX
PLASTEX = /usr/bin/plastex
endif
#ifeq ($(ASCIIMODE),YES)
#PLASTEXOPTS+=-text
#endif
endif # USEPLASTEX

#######################################################################
# Txt output via elinks
#######################################################################
#USEELINKS=1

# tmpdir
export TMP=/tmp
#


PS = $(addsuffix .ps, $(DOCS))
DVI = $(addsuffix .dvi, $(DOCS))
TXT = $(addsuffix .txt, $(DOCS))
PDF = $(addsuffix .pdf, $(DOCS))
TOC = $(addsuffix .toc, $(DOCS))
AUX = $(addsuffix .aux, $(DOCS))
LOG = $(addsuffix .log, $(DOCS))
LOT = $(addsuffix .lot, $(DOCS))
OUT = $(addsuffix .out, $(DOCS))
# Html files are build in a directory
HTML = $(DOCS)
CHM = $(addsuffix .chm, $(DOCS))
CHK = $(addsuffix .chk, $(DOCS))
IPF = $(addsuffix .ipf, $(DOCS))


#####################################################################
# Conversion from types
#####################################################################

.PHONY: clean dvi help html ps psdist htmldist htmdist htdist pdfdist \
        txtdist htm txt pdf refex alldist messages onechap gtk \
        user ref prog rtl updatexml updatefclxml updatertlxml

.SUFFIXES: .dvi .tex .ps .txt .pdf

# default show help

.dvi.ps:
        $(DVIPS) $<

.tex.dvi:
        -rm $*.aux $*.idx  $*.ilg  $*.ind  $*.log  $*.out  $*.toc $*.tmp $*.xref $*.4ht
        cp -f preamble.$(PREAMBLETYPE) preamble.inc
        $(LATEX) $*
        -$(MAKEINDEX) $*.idx
        $(LATEX) $*
        -$(MAKEINDEX) $*.idx
        $(LATEX) $*

ifndef USEELINKS
.dvi.txt:
        $(DVITXT) -o $*.txt  $*.dvi
else
include Makefile.txt
endif

.tex.pdf:
        -rm $*.aux $*.idx  $*.ilg  $*.ind  $*.log  $*.out  $*.toc $*.tmp $*.xref $*.4ht
        cp -f preamble.$(PREAMBLETYPE) preamble.inc
        $(PDFLATEX) $*
        -$(MAKEINDEX) $*.idx
        $(PDFLATEX) $*
        -$(MAKEINDEX) $*.idx
        $(PDFLATEX) $*

ifndef USEELINKS
$(TXT) : %.txt: %.dvi
else
$(TXT) : %.txt: %.tex
endif

$(DVI) : %.dvi: %.tex

$(PDF) : %.pdf: %.tex


#####################################################################
# Targets
#####################################################################

help:
        @echo 'Possible targets :'
        @echo ' dvi           : Make documentation using latex.'
        @echo ' ps            : Make documentation using latex and dvips.'
        @echo ' html          : Make HTML documentation using default converter.'
        @echo ' chm           : Make Compressed HTML documentation. (only the FCL and RTL)'
        @echo ' ipf           : Make fpGUI or OS/2 IPF documentation. (only the FCL and RTL)'
        @echo ' hevea         : Make HTML documentation using hevea'
        @echo ' l2h           : Make HTML documentation using latex2html'
        @echo ' 4ht           : Make HTML documentation using tex4ht'
        @echo ' plastex       : Make HTML documentation using plastex'
        @echo ' pdf           : Make documentation using pdflatex'
        @echo ' txt           : dvi, convert to text using dvi2tty'
        @echo ' htm           : Convert .html to .htm files, zip result'
        @echo ' clean         : Clean up the mess.'
        @echo ' examples      : Comple all generic examples'
        @echo ' linuxexamples : Compile all examples for linux'
        @echo ' dosexamples   : Compile all examples for dos'
        @echo ' execute       : Execute examples (DOS/Windows/OS/2 only)'
        @echo ' htmldist      : html, and rchive result.'
        @echo ' psdist        : ps, and archive result.'
        @echo ' pdfdist       : pdf, and archive result.'

clean: fpc_clean
        -rm -f preamble.inc date.inc messages.inc rtl.inc
        -rm -f *.4tc *.4ct *.css *.lg *.tmp *.xref *.kwd *.xct *.chm *.ipf
        -rm -rf $(DOCS)
        -rm -f $(CHK) $(TOC) $(LOG) $(DVI) $(PDF) $(AUX) $(OUT) $(PS) $(HTML) *.i* $(LOT) $(TXT)
# Styles
        -rm -f $(notdir $(wildcard styles/*.sty))

distclean: fpc_distclean clean cleanexamples
        -rm -f *.tar.gz *.zip

#####################################################################
# Include files
#####################################################################

# the following assumes "gdate" in the path on windwows

date.inc:
        @$(ECHO) \\date\{`date +'%B %Y'`\} > date.inc

$(FPCSRCDIR)/compiler/utils/msg2inc$(EXEEXT):
        $(MAKE) -C $(FPCSRCDIR)/compiler/utils msg2inc$(EXEEXT)
#        $(MAKE) -C $(FPCSRCDIR)/compiler msg2inc

messages.inc: $(FPCSRCDIR)/compiler/utils/msg2inc$(EXEEXT) $(FPCSRCDIR)/compiler/msg/errore.msg
        $(FPCSRCDIR)/compiler/utils/msg2inc -TE $(FPCSRCDIR)/compiler/msg/errore.msg messages.inc

comphelp.inc:
ifneq (,$(findstring win,$(OS_SOURCE)))
	$(ECHO) % Automatically generated. Do not edit > comphelp.inc
	$(ECHO) -n \\begin{verbatim} >> comphelp.inc
	$(FPC) -h >>comphelp.inc
	$(ECHO) \end{verbatim} >> comphelp.inc
else
	$(ECHO) "% Automatically generated. Do not edit" > comphelp.inc
	$(ECHO) -n '\' >> comphelp.inc
	$(ECHO) 'begin{verbatim}' >> comphelp.inc
	$(FPC) -h >>comphelp.inc
	$(ECHO) '\end{verbatim}' >> comphelp.inc
endif
# Local copy of the required styles
syntax.sty: styles/syntax.sty
        cp $(wildcard styles/*.sty) .

# Default includes needed for all docs, don't include preamble.inc
# because that is overwritten everytime with a new value and therefor
# always more recent
INCLUDES=date.inc syntax.sty


#####################################################################
# Tex from XML
#####################################################################

# Where is System.pp located
SYSTEMUNITDIR=$(OS_SOURCE)
ifneq ($(findstring bsd,$(OS_SOURCE)),)
override SYSTEMUNITDIR=bsd
endif
ifneq ($(findstring darwin,$(OS_SOURCE)),)
override SYSTEMUNITDIR=bsd
endif
HOSTOS=$(OS_SOURCE)

# Classes.pp is in rtl/unix/ for several targets
ifneq ($(findstring $(OS_SOURCE),linux freebsd darwin netbsd openbsd),)
CLASSESUNITDIR=unix
else
CLASSESUNITDIR=$(OS_SOURCE)
endif

ifneq ($(findstring $(OS_SOURCE),freebsd),)
OSDIRINCLUDES+=-Fi${FPCSRCDIR}/rtl/bsd
endif

ifneq ($(findstring $(OS_SOURCE),win32),)
OSDIRINCLUDES+=-Fi${FPCSRCDIR}/rtl/win -Fi${FPCSRCDIR}/rtl/$(OS_SOURCE) -Fi${FPCSRCDIR}/rtl/unix -Fi${FPCSRCDIR}/rtl/linux
endif 

ifneq ($(findstring $(OS_SOURCE),win64),)
OSDIRINCLUDES+=-Fi${FPCSRCDIR}/rtl/win -Fi${FPCSRCDIR}/rtl/$(OS_SOURCE) -Fi${FPCSRCDIR}/rtl/unix -Fi${FPCSRCDIR}/rtl/linux
endif 

FCLBASEDIR=$(FPCSRCDIR)/packages/fcl-base/src

FCLPROCESSDIR=$(FPCSRCDIR)/packages/fcl-process/src

FCLWEBDIR=$(FPCSRCDIR)/packages/fcl-web/src

FCLDBDIR=$(FPCSRCDIR)/packages/fcl-db/src

FCLZLIBDIR=$(FPCSRCDIR)/packages/paszlib/src

FCLJSONDIR=$(FPCSRCDIR)/packages/fcl-json/src

ifndef OLDGRAPH
GRAPHDIR=$(FPCSRCDIR)/packages/graph/src
else
# fpc 2.2.0
GRAPHDIR=$(FPCSRCDIR)/packages/extra/graph
endif

ifdef OLDDAEMON
# fpc 2.4.0
DAEMONDIR=$(FPCSRCDIR)/packages/fcl-base/src
else
# fpc 2.4.1 and later
DAEMONDIR=$(FPCSRCDIR)/packages/fcl-extra/src
endif
#
# Standard Makeskel update options.
#
MAKESKELOPTS=--update --disable-protected --disable-private --emit-class-separator
#
# Standard command
#
MAKESKEL+= $(MAKESKELOPTS)
#
# Command in use for FCL
#
FCLMAKESKEL=$(MAKESKEL) --package=fcl
#
# Command in use for RTL.
#
RTLMAKESKEL=$(MAKESKEL) --package=rtl --disable-arguments --disable-function-results

FCLUNITS=iostream pipes streamio process dbugintf contnrs zstream idea bufstream \
         base64 gettext pooledmm dbugmsg streamex inicol streamcoll cachecls \
         eventlog syncobjs custapp blowfish simpleipc inifiles rttiutils uriparser \
         daemonapp libtar ascii85 fptimer db avl_tree ibconnection mssqlconn zipper sqldb

FCLUNITS+= ezcgi
FCLXML=$(addsuffix .xml,$(FCLUNITS))
FCLNEWXML=$(addsuffix .new.xml,$(FCLUNITS))
# Separate arguments for all FCL units.
FCLIOSTREAM= --descr=iostream.xml --input="-S2 $(FCLBASEDIR)/iostream.pp"
FCLSTREAMIO= --descr=streamio.xml --input="$(FCLBASEDIR)/streamio.pp"
FCLCONTNRS= --descr=contnrs.xml --input="$(FCLBASEDIR)/contnrs.pp"
FCLIDEA= --descr=idea.xml --input="$(FCLBASEDIR)/idea.pp"
FCLBUFSTREAM= --descr=bufstream.xml --input="$(FCLBASEDIR)/bufstream.pp"
FCLBASE64= --descr=base64.xml --input="$(FCLBASEDIR)/base64.pp"
FCLGETTEXT= --descr=gettext.xml --input="$(FCLBASEDIR)/gettext.pp"
FCLPOOLEDMM= --descr=pooledmm.xml --input="$(FCLBASEDIR)/pooledmm.pp"
FCLSTREAMEX= --descr=streamex.xml --input="$(FCLBASEDIR)/streamex.pp"
FCLINICOL= --descr=inicol.xml --input="$(FCLBASEDIR)/inicol.pp"
FCLSTREAMCOL= --descr=streamcoll.xml --input="$(FCLBASEDIR)/streamcoll.pp"
FCLCACHECLS= --descr=cachecls.xml --input="$(FCLBASEDIR)/cachecls.pp"
FCLEVENTLOG= --descr=eventlog.xml --input="$(FCLBASEDIR)/eventlog.pp"
FCLSYNCOBJS= --descr=syncobjs.xml --input="$(FCLBASEDIR)/syncobjs.pp"
FCLCUSTAPP= --descr=custapp.xml --input="$(FCLBASEDIR)/custapp.pp"
FCLBLOWFISH= --descr=blowfish.xml --input="$(FCLBASEDIR)/blowfish.pp"
FCLINIFILES= --descr=inifiles.xml --input="$(FCLBASEDIR)/inifiles.pp"
FCLRTTIUTILS= --descr=rttiutils.xml --input="$(FCLBASEDIR)/rttiutils.pp"
FCLAVLTREE= --descr=avl_tree.xml --input="$(FCLBASEDIR)/avl_tree.pp"
FCLPROCESS= --descr=process.xml --input="$(FCLPROCESSDIR)/process.pp"
FCLPIPES= --descr=pipes.xml --input="$(FCLPROCESSDIR)/pipes.pp"
FCLDBUGINTF= --descr=dbugintf.xml --input="$(FCLPROCESSDIR)/dbugintf.pp" 
FCLDBUGMSG= --descr=dbugmsg.xml --input="$(FCLPROCESSDIR)/dbugmsg.pp"
FCLSIMPLEIPC= --descr=simpleipc.xml --input="$(FCLPROCESSDIR)/simpleipc.pp"
FCLEZCGI= --descr=ezcgi.xml --input="$(FCLWEBDIR)/base/ezcgi.pp"
FCLURIPARSER= --descr=uriparser.xml --input="$(FCLBASEDIR)/uriparser.pp"
FCLZSTREAM= --descr=zstream.xml --input="$(FCLZLIBDIR)/zstream.pp"
FCLDAEMONAPP= --descr=daemonapp.xml --input="$(DAEMONDIR)/daemonapp.pp"
FCLLIBTAR= --descr=libtar.xml --input="$(FCLBASEDIR)/libtar.pp"
FCLASCII85= --descr=ascii85.xml --input="$(FCLBASEDIR)/ascii85.pp"
FCLFPTIMER= --descr=fptimer.xml --input="$(FCLBASEDIR)/fptimer.pp"
FCLDB= --descr=db.xml --input="$(FCLDBDIR)/base/db.pas"
FCLSQLDB= --descr=sqldb.xml --input="$(FCLDBDIR)/sqldb/sqldb.pp"
FCLIBCONNECTION=  --descr=ibconnection.xml --input="$(FCLDBDIR)/sqldb/interbase/ibconnection.pp"
FCLMSSQLCONN=  --descr=mssqlconn.xml --input="$(FCLDBDIR)/sqldb/mssql/mssqlconn.pp"
FCLZIPPER=  --descr=zipper.xml --input="$(FCLZLIBDIR)/zipper.pp"
FCLJSON= --descr=fpjson.xml --input="$(FCLJSONDIR)/fpjson.pp"

# Now add to the FCL fpdoc opts.
FCLUNITOPTS+= $(FCLIOSTREAM) $(FCLPIPES) $(FCLSTREAMIO) $(FCLPROCESS) $(FCLDBUGINTF)
FCLUNITOPTS+= $(FCLCONTNRS) $(FCLZSTREAM) $(FCLIDEA) $(FCLBUFSTREAM) $(FCLBASE64) 
FCLUNITOPTS+= $(FCLGETTEXT) 
FCLUNITOPTS+= $(FCLEZCGI) 
FCLUNITOPTS+= $(FCLPOOLEDMM) $(FCLDBUGMSG) $(FCLSTREAMEX)
FCLUNITOPTS+= $(FCLINICOL) $(FCLSTREAMCOL) $(FCLCACHECLS) $(FCLEVENTLOG) $(FCLSYNCOBJS)
FCLUNITOPTS+= $(FCLCUSTAPP) $(FCLBLOWFISH) $(FCLSIMPLEIPC) $(FCLINIFILES) $(FCLRTTIUTILS)
FCLUNITOPTS+= $(FCLAVLTREE) $(FCLURIPARSER) $(FCLDAEMONAPP) $(FCLLIBTAR) $(FCLASCII85)
FCLUNITOPTS+= $(FCLFPTIMER) $(FCLDB) $(FCLZIPPER)
#FCLUNITOPTS+= $(FCLFPVECTORIAL) 
FCLUNITOPTS+= $(FCLSQLDB) $(FCLIBCONNECTION) $(FCLMSSQLCONN) $(FCLJSON)


RTLOPTS=$(FPDOCOPTS) --warn-no-node --package=rtl --descr=rtl.xml --content=rtl.xct
ifeq ($(HIDEPROTECTED),YES)
RTLOPTS+= --hide-protected
endif

ifdef CURRENTXMLONLY
RTLXML=crt.xml
RTLOPTS+=--descr=dateutils.xml --input="$(FPCSRCDIR)/rtl/unix/crt.pp -Fi$(FPCSRCDIR)/rtl/inc ${OSDIRINCLUDES}"
else
RTLUNITS=system objpas types sysutils strutils dateutils strings mouse keyboard \
         crt video dos sockets objects heaptrc mmx ipc printer typinfo \
         ports getopts emu387 dxeload go32 gpm oldlinux baseunix \
         unixtype unix classes unixutil x86 dynlibs linux math matrix \
         dateutils rtl wincrt clocale cthreads cmem cwstring \
         exeinfo lineinfo lnfodwrf ctypes
RTLXML=$(addsuffix .xml,$(RTLUNITS))
RTLNEWXML=$(addsuffix .new.xml,$(RTLUNITS))
RTLTYPES= --descr=types.xml --input="$(FPCSRCDIR)/rtl/objpas/types.pp ${OSDIRINCLUDES}"
RTLSTRUTILS= --descr=strutils.xml --input="$(FPCSRCDIR)/rtl/objpas/strutils.pp ${OSDIRINCLUDES}"
RTLSYSUTILS= --descr=sysutils.xml --input="$(FPCSRCDIR)/rtl/unix/sysutils.pp -Fi$(FPCSRCDIR)/rtl/objpas/sysutils -Fi$(FPCSRCDIR)/rtl/inc ${OSDIRINCLUDES}"
RTLSTRINGS= --descr=strings.xml --input="$(FPCSRCDIR)/rtl/inc/strings.pp -Fi$(FPCSRCDIR)/rtl/i386 -Fi$(FPCSRCDIR)/rtl/inc ${OSDIRINCLUDES}"
RTLMOUSE= --descr=mouse.xml --input="$(FPCSRCDIR)/rtl/unix/mouse.pp -Fi$(FPCSRCDIR)/rtl/inc ${OSDIRINCLUDES}"
RTLKEYBOARD= --descr=keyboard.xml --input="$(FPCSRCDIR)/rtl/unix/keyboard.pp -Fi$(FPCSRCDIR)/rtl/inc ${OSDIRINCLUDES}"
RTLCRT= --descr=crt.xml --input="$(FPCSRCDIR)/rtl/unix/crt.pp -Fi$(FPCSRCDIR)/rtl/inc ${OSDIRINCLUDES}"
RTLVIDEO= --descr=video.xml --input="$(FPCSRCDIR)/rtl/unix/video.pp -Fi$(FPCSRCDIR)/rtl/inc ${OSDIRINCLUDES}"
RTLDOS= --descr=dos.xml --input="$(FPCSRCDIR)/rtl/unix/dos.pp -Fi$(FPCSRCDIR)/rtl/inc -dcpui386 ${OSDIRINCLUDES}"
RTLSOCKETS= --descr=sockets.xml --input="-dver1_0 $(FPCSRCDIR)/rtl/unix/sockets.pp -Fi$(FPCSRCDIR)/rtl/inc -Fi$(FPCSRCDIR)/rtl/$(OS_SOURCE) ${OSDIRINCLUDES}"
RTLOBJECTS= --descr=objects.xml --input="$(FPCSRCDIR)/rtl/inc/objects.pp -Fi$(FPCSRCDIR)/rtl/i386 -Fi$(FPCSRCDIR)/rtl/$(OS_SOURCE) ${OSDIRINCLUDES}"
RTLHEAPTRC= --descr=heaptrc.xml --input="$(FPCSRCDIR)/rtl/inc/heaptrc.pp -Fi$(FPCSRCDIR)/rtl/i386 -Fi$(FPCSRCDIR)/rtl/$(OS_SOURCE) ${OSDIRINCLUDES}"
RTLMMX= --descr=mmx.xml --input="$(FPCSRCDIR)/rtl/i386/mmx.pp -Fi$(FPCSRCDIR)/rtl/$(OS_SOURCE) ${OSDIRINCLUDES}"
RTLIPC= --descr=ipc.xml --input="$(FPCSRCDIR)/rtl/unix/ipc.pp -Fi$(FPCSRCDIR)/rtl/$(OS_SOURCE) ${OSDIRINCLUDES}"
RTLPRINTER= --descr=printer.xml --input="$(FPCSRCDIR)/rtl/unix/printer.pp -Fi$(FPCSRCDIR)/rtl/$(OS_SOURCE) -Fi$(FPCSRCDIR)/rtl/inc ${OSDIRINCLUDES}"
RTLTYPINFO= --descr=typinfo.xml --input="$(FPCSRCDIR)/rtl/objpas/typinfo.pp -Fi$(FPCSRCDIR)/rtl/$(OS_SOURCE) ${OSDIRINCLUDES}"
RTLPORTS= --descr=ports.xml --input="$(FPCSRCDIR)/rtl/unix/ports.pp -Fi$(FPCSRCDIR)/rtl/$(OS_SOURCE) ${OSDIRINCLUDES}"
RTLGETOPTS= --descr=getopts.xml --input="$(FPCSRCDIR)/rtl/inc/getopts.pp -Fi$(FPCSRCDIR)/rtl/$(OS_SOURCE) ${OSDIRINCLUDES}"
RTLEMU387= --descr=emu387.xml --input="$(FPCSRCDIR)/rtl/go32v2/emu387.pp -Fi$(FPCSRCDIR)/rtl/i386 ${OSDIRINCLUDES}"
RTLDXELOAD= --descr=dxeload.xml --input="$(FPCSRCDIR)/rtl/go32v2/dxeload.pp -Fi$(FPCSRCDIR)/rtl/i386 ${OSDIRINCLUDES}"
RTLGO32= --descr=go32.xml --input="$(FPCSRCDIR)/rtl/go32v2/go32.pp -Fi$(FPCSRCDIR)/rtl/i386 ${OSDIRINCLUDES}"
RTLGPM= --descr=gpm.xml --input="-dVER1_0 $(FPCSRCDIR)/rtl/linux/gpm.pp -Fi$(FPCSRCDIR)/rtl/i386 ${OSDIRINCLUDES}"
RTLGRAPH= --descr=graph.xml --input="$(GRAPHDIR)/unix/graph.pp -Fi$(GRAPHDIR)/inc ${OSDIRINCLUDES}"
RTLWINCRT= --descr=wincrt.xml --input="$(GRAPHDIR)/win32/wincrt.pp"
RTLOLDLINUX= --descr=oldlinux.xml --input="$(FPCSRCDIR)/rtl/linux/oldlinux.pp -Fi$(FPCSRCDIR)/rtl/linux -Fi$(FPCSRCDIR)/rtl/unix ${OSDIRINCLUDES}"
RTLUNIXTYPE= --descr=unixtype.xml --input="$(FPCSRCDIR)/rtl/unix/unixtype.pp -Fi$(FPCSRCDIR)/rtl/unix -Fi$(FPCSRCDIR)/rtl/linux -Fi$(FPCSRCDIR)/rtl/linux/i386 ${OSDIRINCLUDES}"
RTLBASEUNIX= --descr=baseunix.xml --input="$(FPCSRCDIR)/rtl/unix/baseunix.pp -Fi$(FPCSRCDIR)/rtl/unix -Fi$(FPCSRCDIR)/rtl/linux -Fi$(FPCSRCDIR)/rtl/linux/i386 ${OSDIRINCLUDES}"
RTLUNIX= --descr=unix.xml  --input="$(FPCSRCDIR)/rtl/unix/unix.pp -Fi$(FPCSRCDIR)/rtl/unix -Fi$(FPCSRCDIR)/rtl/linux -Fi$(FPCSRCDIR)/rtl/linux/i386 ${OSDIRINCLUDES}"
RTLCLASSES= --descr=classes.xml --input="$(FPCSRCDIR)/rtl/$(CLASSESUNITDIR)/classes.pp -Fi$(FPCSRCDIR)/rtl/objpas/classes ${OSDIRINCLUDES} -dfpdocsystem"
RTLUNIXUTIL= --descr=unixutil.xml --input="$(FPCSRCDIR)/rtl/unix/unixutil.pp ${OSDIRINCLUDES}"
RTLX86= --descr=x86.xml --input="$(FPCSRCDIR)/rtl/unix/x86.pp ${OSDIRINCLUDES}"
RTLDYNLIBS= --descr=dynlibs.xml --input="$(FPCSRCDIR)/rtl/inc/dynlibs.pas -Fi$(FPCSRCDIR)/rtl/unix ${OSDIRINCLUDES}"
RTLLINUX= --descr=linux.xml --input="$(FPCSRCDIR)/rtl/linux/linux.pp -Fi$(FPCSRCDIR)/rtl/linux -Fi$(FPCSRCDIR)/rtl/unix ${OSDIRINCLUDES}"
RTLMATH= --descr=math.xml --input="$(FPCSRCDIR)/rtl/objpas/math.pp -Fi$(FPCSRCDIR)/rtl/i386 -dFPC_HAS_TYPE_EXTENDED ${OSDIRINCLUDES}"
RTLMATRIX= --descr=matrix.xml --input="$(FPCSRCDIR)/rtl/inc/matrix.pp -Fi$(FPCSRCDIR)/rtl/inc ${OSDIRINCLUDES}"
RTLSYSTEM= --descr=system.xml --input="-dfpdocsystem -dHASGETHEAPSTATUS -dSUPPORT_DOUBLE $(FPCSRCDIR)/rtl/$(SYSTEMUNITDIR)/system.pp -Fi$(FPCSRCDIR)/rtl/$(OS_SOURCE) -Fi$(FPCSRCDIR)/rtl/unix -Fi$(FPCSRCDIR)/rtl/inc -Fi$(FPCSRCDIR)/rtl/i386 -dCPU32 -dHASVARIANT -dFPC_HAS_TYPE_EXTENDED -dHASWIDECHAR ${OSDIRINCLUDES}"
RTLOBJPAS= --descr=objpas.xml --input="-dHASINTF $(FPCSRCDIR)/rtl/objpas/objpas.pp ${OSDIRINCLUDES}"
RTLDATEUTILS= --descr=dateutils.xml --input="$(FPCSRCDIR)/rtl/objpas/dateutils.pp -Fi$(FPCSRCDIR)/rtl/objpas ${OSDIRINCLUDES}"
RTLCLOCALE= --descr=clocale.xml --input="$(FPCSRCDIR)/rtl/unix/clocale.pp ${OSDIRINCLUDES}"
RTLCTHREADS= --descr=cthreads.xml --input="$(FPCSRCDIR)/rtl/unix/cthreads.pp ${OSDIRINCLUDES}"
RTLCMEM= --descr=cmem.xml --input="$(FPCSRCDIR)/rtl/inc/cmem.pp ${OSDIRINCLUDES}"
RTLCWSTRING= --descr=cwstring.xml --input="$(FPCSRCDIR)/rtl/unix/cwstring.pp ${OSDIRINCLUDES}"
RTLEXEINFO= --descr=exeinfo.xml --input="$(FPCSRCDIR)/rtl/inc/exeinfo.pp ${OSDIRINCLUDES}"
RTLLINEINFO= --descr=lineinfo.xml --input="$(FPCSRCDIR)/rtl/inc/lineinfo.pp ${OSDIRINCLUDES}"
RTLLNFODWRF= --descr=lnfodwrf.xml --input="$(FPCSRCDIR)/rtl/inc/lnfodwrf.pp ${OSDIRINCLUDES}"
RTLCTYPES= --descr=ctypes.xml --input="$(FPCSRCDIR)/rtl/inc/ctypes.pp -Fi$(FPCSRCDIR)/rtl/unix ${OSDIRINCLUDES}"
#
# Put all together.
#
RTLOPTS+= $(RTLSYSTEM) $(RTLOBJPAS) $(RTLTYPES) 
RTLOPTS+= $(RTLSTRUTILS) $(RTLSYSUTILS) $(RTLSTRINGS) $(RTLMOUSE) $(RTLKEYBOARD)
RTLOPTS+= $(RTLCRT) $(RTLVIDEO) $(RTLDOS) $(RTLSOCKETS) $(RTLOBJECTS)
RTLOPTS+= $(RTLHEAPTRC) $(RTLMMX) $(RTLIPC) $(RTLPRINTER) $(RTLTYPINFO) 
RTLOPTS+= $(RTLPORTS) $(RTLGETOPTS) $(RTLEMU387) $(RTLDXELOAD) $(RTLGO32)
RTLOPTS+= $(RTLGPM) $(RTLGRAPH) $(RTLOLDLINUX) $(RTLUNIXTYPE) $(RTLBASEUNIX)
RTLOPTS+= $(RTLUNIX) $(RTLCLASSES) $(RTLUNIXUTIL) $(RTLX86) $(RTLDYNLIBS)
RTLOPTS+= $(RTLLINUX) $(RTLMATH) $(RTLMATRIX) 
RTLOPTS+= $(RTLDATEUTILS) $(RTLWINCRT) $(RTLCLOCALE) $(RTLCTHREADS) $(RTLCMEM)
RTLOPTS+= $(RTLCWSTRING) $(RTLEXEINFO) $(RTLLINEINFO) $(RTLLNFODWRF) $(RTLCTYPES)
endif 

updatexml: updatefclxml updatertlxml

updatertlxml: fpc_all
	$(RTLMAKESKEL) $(RTLTYPES) --output=types.new.xml
	$(RTLMAKESKEL) $(RTLSTRUTILS) --output=strutils.new.xml
	$(RTLMAKESKEL) $(RTLSYSUTILS) --output=sysutils.new.xml
	$(RTLMAKESKEL) $(RTLSTRINGS) --output=strings.new.xml
	$(RTLMAKESKEL) $(RTLMOUSE) --output=mouse.new.xml
	$(RTLMAKESKEL) $(RTLKEYBOARD) --output=keyboard.new.xml
	$(RTLMAKESKEL) $(RTLCRT) --output=crt.new.xml
	$(RTLMAKESKEL) $(RTLVIDEO) --output=video.new.xml
	$(RTLMAKESKEL) $(RTLDOS) --output=dos.new.xml
	$(RTLMAKESKEL) $(RTLSOCKETS) --output=sockets.new.xml
	$(RTLMAKESKEL) $(RTLOBJECTS) --output=objects.new.xml
	$(RTLMAKESKEL) $(RTLHEAPTRC) --output=heaptrc.new.xml
	$(RTLMAKESKEL) $(RTLMMX) --output=mmx.new.xml
	$(RTLMAKESKEL) $(RTLIPC) --output=ipc.new.xml
	$(RTLMAKESKEL) $(RTLPRINTER) --output=printer.new.xml
	$(RTLMAKESKEL) $(RTLTYPINFO) --output=typinfo.new.xml
	$(RTLMAKESKEL) $(RTLPORTS) --output=ports.new.xml
	$(RTLMAKESKEL) $(RTLGETOPTS) --output=getopts.new.xml
	$(RTLMAKESKEL) $(RTLEMU387) --output=emu387.new.xml
	$(RTLMAKESKEL) $(RTLDXELOAD) --output=dxeload.new.xml
	$(RTLMAKESKEL) $(RTLGO32) --output=go32.new.xml
	$(RTLMAKESKEL) $(RTLGPM) --output=gpm.new.xml
	$(RTLMAKESKEL) $(RTLGRAPH) --output=graph.new.xml
	$(RTLMAKESKEL) $(RTLOLDLINUX) --output=oldlinux.new.xml
	$(RTLMAKESKEL) $(RTLUNIXTYPE) --output=unixtype.new.xml
	$(RTLMAKESKEL) $(RTLBASEUNIX) --output=baseunix.new.xml
	$(RTLMAKESKEL) $(RTLUNIX) --output=unix.new.xml
	$(RTLMAKESKEL) $(RTLCLASSES) --output=classes.new.xml
	$(RTLMAKESKEL) $(RTLUNIXUTIL) --output=unixutil.new.xml
	$(RTLMAKESKEL) $(RTLX86) --output=x86.new.xml
	$(RTLMAKESKEL) $(RTLDYNLIBS) --output=dynlibs.new.xml
	$(RTLMAKESKEL) $(RTLLINUX) --output=linux.new.xml
	$(RTLMAKESKEL) $(RTLMATH) --output=math.new.xml
	$(RTLMAKESKEL) $(RTLMATRIX) --output=matrix.new.xml
	$(RTLMAKESKEL) $(RTLSYSTEM) --output=system.new.xml
	$(RTLMAKESKEL) $(RTLOBJPAS) --output=objpas.new.xml
	$(RTLMAKESKEL) $(RTLDATEUTILS) --output=dateutils.new.xml
	$(RTLMAKESKEL) $(RTLCMEM) --output=cmem.new.xml
	$(RTLMAKESKEL) $(RTLCLOCALE) --output=clocale.new.xml
	$(RTLMAKESKEL) $(RTLCWSTRING) --output=cwstring.new.xml
	$(RTLMAKESKEL) $(RTLEXEINFO) --output=exeinfo.new.xml
	$(RTLMAKESKEL) $(RTLLINEINFO) --output=lineinfo.new.xml
	$(RTLMAKESKEL) $(RTLLNFODWRF) --output=lnfodwrf.new.xml
	$(RTLMAKESKEL) $(RTLCTYPES) --output=ctypes.new.xml
	./cleanxml $(RTLNEWXML)

updatefclxml: fpc_all
	$(FCLMAKESKEL) $(FCLIOSTREAM) --output=iostream.new.xml
	$(FCLMAKESKEL) $(FCLPIPES) --output=pipes.new.xml
	$(FCLMAKESKEL) $(FCLSTREAMIO) --output=streamio.new.xml
	$(FCLMAKESKEL) $(FCLPROCESS) --output=process.new.xml
	$(FCLMAKESKEL) $(FCLDBUGINTF) --output=dbugintf.new.xml
	$(FCLMAKESKEL) $(FCLCONTNRS) --output=contnrs.new.xml
	$(FCLMAKESKEL) $(FCLZSTREAM) --output=zstream.new.xml
	$(FCLMAKESKEL) $(FCLIDEA) --output=idea.new.xml
	$(FCLMAKESKEL) $(FCLBUFSTREAM) --output=bufstream.new.xml
	$(FCLMAKESKEL) $(FCLBASE64) --output=base64.new.xml
	$(FCLMAKESKEL) $(FCLGETTEXT) --output=gettext.new.xml
	$(FCLMAKESKEL) $(FCLEZCGI) --output=ezcgi.new.xml
	$(FCLMAKESKEL) $(FCLPOOLEDMM) --output=pooledmm.new.xml
	$(FCLMAKESKEL) $(FCLDBUGMSG) --output=dbugmsg.new.xml
	$(FCLMAKESKEL) $(FCLSTREAMEX) --output=streamex.new.xml
	$(FCLMAKESKEL) $(FCLINICOL) --output=inicol.new.xml
	$(FCLMAKESKEL) $(FCLSTREAMCOL) --output=streamcoll.new.xml
	$(FCLMAKESKEL) $(FCLCACHECLS) --output=cachecls.new.xml
	$(FCLMAKESKEL) $(FCLEVENTLOG) --output=eventlog.new.xml
	$(FCLMAKESKEL) $(FCLSYNCOBJS) --output=syncobjs.new.xml
	$(FCLMAKESKEL) $(FCLCUSTAPP) --output=custapp.new.xml
	$(FCLMAKESKEL) $(FCLBLOWFISH) --output=blowfish.new.xml
	$(FCLMAKESKEL) $(FCLSIMPLEIPC) --output=simpleipc.new.xml
	$(FCLMAKESKEL) $(FCLINIFILES) --output=inifiles.new.xml
	$(FCLMAKESKEL) $(FCLRTTIUTILS) --output=rttiutils.new.xml
        $(FCLMAKESKEL) $(FCLAVLTREE) --output=avl_tree.new.xml
        $(FCLMAKESKEL) $(FCLDB) --output=db.new.xml
        $(FCLMAKESKEL) $(FCLSQLDB) --output=sqldb.new.xml
	$(FCLMAKESKEL) $(FCLZIPPER) --output=zipper.new.xml
	$(FCLMAKESKEL) $(FCLJSON) --output=fpjson.new.xml
	./cleanxml $(FCLNEWXML)

rtl.inc: $(RTLXML)
        $(FPDOC) --output=rtl.inc $(RTLOPTS) --format=latex

fcl.inc: $(FCLXML)
        $(FPDOC) --output=fcl.inc $(FCLOPTS) --format=latex

#####################################################################
# DVI files
#####################################################################
RTFFILES = $(addsuffix .rtf,$(RTFS))

rtf: $(RTFFILES)

rtl.rtf: $(RTLXML)
        $(FPDOC) --output=rtl.rtf $(RTLOPTS) --format=rtf

fcl.rtf: $(FCLXML)
        $(FPDOC) --output=fcl.rtf $(FCLOPTS) --format=rtf


#####################################################################
# DVI files
#####################################################################

ref.dvi: ref.tex $(INCLUDES)

prog.dvi: prog.tex $(INCLUDES)

user.dvi: user.tex $(INCLUDES) messages.inc comphelp.inc

fpdoc.dvi: fpdoc.tex $(INCLUDES)

fcl.dvi: fcl.tex fcl.inc $(INCLUDES)

chart.dvi: chart.tex


ref.pdf: ref.tex $(INCLUDES)

user.pdf: user.tex $(INCLUDES) messages.inc comphelp.inc

prog.pdf: prog.tex $(INCLUDES)

onechap.pdf: onechap.tex $(INCLUDES)

onechap.dvi: onechap.tex $(INCLUDES)

fpdoc.pdf: fpdoc.tex $(INCLUDES)

fcl.pdf: fcl.tex fcl.inc $(INCLUDES)

chart.pdf: chart.tex

rtl.dvi: rtl.tex rtl.inc $(INCLUDES)

rtl.pdf: rtl.tex rtl.inc $(INCLUDES)

dvi : $(DVI)

ifndef USEELINKS
txt : dvi $(TXT)
else
#######################################################################
# TXT creation
#######################################################################
fcl.txt: $(FCLXML)
        $(FPDOC) $(FCLOPTS) --format=txt --output=fcl.txt
	unix2dos fcl.txt

rtl.txt: $(RTLXML)
        $(FPDOC) $(RTLOPTS) --format=txt --output=rtl.txt
	unix2dos rtl.txt

user.txt: messages.inc

txt : fpc_all comphelp.inc $(INCLUDES) $(TXT)
endif

ps : dvi $(PS)

pdf : $(PDF)

all : dvi ps pdf txt html


#######################################################################
# HTML creation
#######################################################################

.PHONY: htex user prog onechap ref internal html hevea

ifdef INSTALLDEBUG
#######################################################################
# Installation debugging
$(HTML):
        mkdir $@
        cp $@.tex $@/index.html
html: $(HTML)
else
#######################################################################
# Automatic selection. Default tex4ht
ifdef USEHEVEA
include Makefile.hev
else
ifdef USEPLASTEX
include Makefile.ptx
else
ifdef USEL2H
include Makefile.l2h
else
include Makefile.4ht
endif  # USEL2H
endif  # USEPLASTEX
endif  # USEHEVEA

fcl.chk: $(FCLXML)
        $(FPDOC) $(FCLOPTS) --format=$(HTMLFMT) --output=fcl$(HTMLSUFFIX) $(FPDOCHTMLOPTS) $(FCLCHMOPTS)
ifndef CSSFILE
        cp fpdoc.cst fcl/fpdoc.css
endif
        touch fcl.chk

rtl.chk: $(RTLXML)
        $(FPDOC) $(RTLOPTS) --format=$(HTMLFMT) --output=rtl$(HTMLSUFFIX) $(FPDOCHTMLOPTS) $(RTLCHMOPTS)
ifndef CSSFILE
        cp fpdoc.cst rtl/fpdoc.css
endif
        touch rtl.chk

user.chk: $(INCLUDES) user.tex messages.inc
prog.chk: $(INCLUDES) prog.tex
onechap.chk: $(INCLUDES) onechap.tex
ref.chk: $(INCLUDES) ref.tex
fpdoc.chk: $(INCLUDES) fpdoc.tex
chart.chk: $(INCLUDES) chart.tex

html: fpc_all comphelp.inc $(INCLUDES) $(CHK)

chm: 
	$(MAKE) html HTMLFMT=chm
   
ipf:
	$(MAKE) html HTMLFMT=ipf

endif  # INSTALLDEBUG
#######################################################################
# Targets to force using a specific tool.
hevea:
        $(MAKE) html USEHEVEA=1
l2h:
        $(MAKE) html USEL2H=1
4ht:
        $(MAKE) html USETEX4HT=1
plastex:
        $(MAKE) html USEPLASTEX=1


#####################################################################
# GTK Articles
#####################################################################

GTKPDF=$(addsuffix .pdf,$(addprefix gtk, 1 2 3 4 5))

gtk: $(GTKPDF)

gtk1.pdf: gtk1.tex

gtk2.pdf: gtk2.tex

gtk3.pdf: gtk3.tex

gtk4.pdf: gtk4.tex

gtk5.pdf: gtk5.tex


#####################################################################
# Installation
#####################################################################

.PHONY: pdfinstall psinstall dviinstall txtinstall

pdfinstall: pdf
        $(GINSTALL) -d -m 755 $(INSTALL_DOCDIR)
        cp $(PDF) $(INSTALL_DOCDIR)

psinstall: ps
        $(GINSTALL) -d -m 755 $(INSTALL_DOCDIR)
        cp $(PS) $(INSTALL_DOCDIR)

dviinstall: dvi
        $(GINSTALL) -d -m 755 $(INSTALL_DOCDIR)
        cp $(DVI) $(INSTALL_DOCDIR)

txtinstall: txt
        $(GINSTALL) -d -m 755 $(INSTALL_DOCDIR)
        cp $(TXT) $(INSTALL_DOCDIR)

htmlinstall: html
        $(GINSTALL) -d -m 755 $(INSTALL_DOCDIR)
        cp fpctoc.html $(INSTALL_DOCDIR)
        $(GINSTALL) -d -m 755 $(INSTALL_DOCDIR)/buttons
        cp buttons/*.* $(INSTALL_DOCDIR)/buttons
        $(GINSTALL) -d -m 755 $(INSTALL_DOCDIR)/pics
        cp pics/*.* $(INSTALL_DOCDIR)/pics
        cp -R $(HTML) $(INSTALL_DOCDIR)
        find $(INSTALL_DOCDIR) -name 'CVS' -or -name '*.eps' | xargs -n1 rm -rf

install:
        @echo Choose install from:
        @echo pdfinstall,htmlinstall,htmldosinstall
        @exit


#####################################################################
# Distribution archives/packages
#####################################################################

pstar:
        $(MAKE) zipinstall ZIPTARGET=psinstall UNIXHier= USETAR=y FULLZIPNAME=doc-ps

pszip:
        $(MAKE) zipinstall ZIPTARGET=psinstall UNIXHier= USEZIP=y FULLZIPNAME=doc-ps

pdftar:
        $(MAKE) zipinstall ZIPTARGET=pdfinstall UNIXHier= USETAR=y FULLZIPNAME=doc-pdf

pdfzip:
        $(MAKE) zipinstall ZIPTARGET=pdfinstall UNIXHier= USEZIP=y FULLZIPNAME=doc-pdf

dvizip:
        $(MAKE) zipinstall ZIPTARGET=dviinstall UNIXHier= USEZIP=y FULLZIPNAME=doc-dvi

txtzip:
        $(MAKE) zipinstall ZIPTARGET=txtinstall UNIXHier= USEZIP=y FULLZIPNAME=doc-txt

htmltar:
        $(MAKE) zipinstall ZIPTARGET=htmlinstall UNIXHier= USETAR=y FULLZIPNAME=doc-html

htmlzip:
        $(MAKE) zipinstall ZIPTARGET=htmlinstall UNIXHier= USEZIP=y FULLZIPNAME=doc-html

psdist: pszip pstar

pdfdist: pdfzip pdftar

txtdist: txtzip

dvidist: dvizip

htmldist: htmlzip htmltar

alldist: dvidist psdist txtdist pdfdist htmldist


#####################################################################
# Examples
#####################################################################

examples:
        $(MAKE) -C crtex
        $(MAKE) -C dosex
        $(MAKE) -C optex
        $(MAKE) -C mathex
        $(MAKE) -C printex
        $(MAKE) -C progex
        $(MAKE) -C refex
        $(MAKE) -C stringex
        $(MAKE) -C objectex
        $(MAKE) -C sysutex
        $(MAKE) -C typinfex
        $(MAKE) -C kbdex

cleanexamples:
        $(MAKE) -C crtex clean
        $(MAKE) -C dosex clean
        $(MAKE) -C optex clean
        $(MAKE) -C mathex clean
        $(MAKE) -C printex clean
        $(MAKE) -C progex clean
        $(MAKE) -C refex clean
        $(MAKE) -C stringex clean
        $(MAKE) -C objectex clean
        $(MAKE) -C sysutex clean
        $(MAKE) -C typinfex clean
        $(MAKE) -C kbdex clean

dosexamples: examples
        $(MAKE) -C go32ex
        $(MAKE) -C mouseex

linuxexamples: examples
        $(MAKE) -C linuxex
        $(MAKE) -C sockex
        $(MAKE) -C ipcex

execute:
        $(MAKE) -C dosex all
        $(MAKE) -C dosex execute
        $(MAKE) -C refex all
        $(MAKE) -C refex execute
        $(MAKE) -C mathex all
        $(MAKE) -C mathex execute
        $(MAKE) -C stringex all
        $(MAKE) -C stringex execute
        $(MAKE) -C objectex all
        $(MAKE) -C objectex execute
        $(MAKE) -C sysutex all
        $(MAKE) -C sysutex execute
        $(MAKE) -C typinfex all
        $(MAKE) -C typinfex execute