fpc/docs/Makefile
2000-10-12 10:41:58 +00:00

497 lines
12 KiB
Makefile

#
# $Id$
# 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.
#
#####################################################################
# Configurable section
#####################################################################
# 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 are made when 'html' is specified
HTML = user units ref prog
# Where do you want the html files to be put ?
ifndef PREFIXINSTALLDIR
PREFIXINSTALLDIR=/usr
endif
ifndef DOCINSTALLDIR
DOCINSTALLDIR:=$(PREFIXINSTALLDIR)/doc/fpc-$(shell ppc386 -iV)
endif
#
# Program definitions
#
# Latex
ifndef LATEX
LATEX = latex
endif
# Latex2html conversion.
ifndef LATEX2HTML
LATEX2HTML = /usr/bin/latex2html
endif
# Options for converter
ifndef LATEX2HTMLOPTS
LATEX2HTMLOPTS = -no_reuse -up_url "../fpctoc.html"\
-up_title "Free Pascal manuals" -contents_in_navigation\
-html_version 4.0 -split 3 -image_type gif
endif
# Icons for latex2html
ICONSERVER=../buttons
export ICONSERVER
# Ascii mode ? (i.e. no pics)
ifndef ASCIIMODE
ASCIIMODE=NO
#ASCIIMODE=YES
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
# tmpdir
export TMP=/tmp
#
#######################################################################
# End of configurable section. Do not edit after this line.
#######################################################################
PS = $(addsuffix .ps, $(HTML))
DVI = $(addsuffix .dvi, $(HTML))
TXT = $(addsuffix .txt, $(HTML))
PDF = $(addsuffix .pdf, $(HTML))
TOC = $(addsuffix .toc, $(HTML) onechap)
AUX = $(addsuffix .aux, $(HTML) onechap)
LOG = $(addsuffix .log, $(HTML) onechap)
LOT = $(addsuffix .lot, $(HTML) onechap)
OUT = $(addsuffix .out, $(HTML) onechap)
CHK = $(addsuffix .chk, $(HTML) progex unitex refex htex onechap)
CHAPTERS = $(addsuffix .tex, crt dos getopts go32 graph linux printer\
strings objects heaptrc sysutils ipc mouse gpm dxeload \
emu387 ports math)
# Check if ascii-mode requested
ifeq ($(ASCIIMODE),YES)
LATEX2HTMLOPTS:=$(LATEX2HTMLOPTS) -ascii_mode
endif
#####################################################################
# Conversion from types
#####################################################################
.PHONY: clean dvi help html ps psdist htmldist pdfdist txtdist \
htm txt pdf refex alldist messages onechap
.SUFFIXES: .dvi .tex .ps .txt .pdf
# default show help
.dvi.ps:
$(DVIPS) $<
.tex.dvi:
$(LATEX) $*
-$(MAKEINDEX) $*
$(LATEX) $*
-$(MAKEINDEX) $*
$(LATEX) $*
.dvi.txt:
$(DVITXT) -o $*.txt $*.dvi
.tex.pdf:
$(PDFLATEX) $*
-$(MAKEINDEX) $*
$(PDFLATEX) $*
-$(MAKEINDEX) $*
$(PDFLATEX) $*
#####################################################################
# Targets
#####################################################################
help:
@echo 'Possible targets :'
@echo ' dvi : Make documentation using latex.'
@echo ' ps : Make documentation using latex and dvips.'
@echo ' html : Make documentation using latex2html.'
@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 ' linuxexamples : Compile all examples for linux'
@echo ' dosexamples : Compile all examples for dos'
@echo ' htmldist : html, and rchive result.'
@echo ' psdist : ps, and archive result.'
@echo ' pdfdist : pdf, and archive result.'
clean:
-rm -f *.htex
-rm -rf $(HTML) onechap
-rm -f $(TOC) $(LOG) $(DVI) $(PDF) $(AUX) $(OUT) $(PS) *.i* $(LOT) $(TXT) $(CHK)
# Units
-$(MAKE) -C crtex clean
-$(MAKE) -C dosex clean
-$(MAKE) -C go32ex clean
-$(MAKE) -C heapex clean
-$(MAKE) -C ipcex clean
-$(MAKE) -C linuxex clean
-$(MAKE) -C mouseex clean
-$(MAKE) -C objectex clean
-$(MAKE) -C optex clean
-$(MAKE) -C printex clean
-$(MAKE) -C sockex clean
-$(MAKE) -C stringex clean
-$(MAKE) -C sysutex clean
-$(MAKE) -C mathex clean
-$(MAKE) -C graphex clean
-$(MAKE) -C gpmex clean
# Reference
-$(MAKE) -C refex clean
$(TXT) : %.txt: %.dvi
$(DVI) : %.dvi: %.tex
$(PDF) : %.pdf: %.tex
unitex.chk:
ifndef INSTALLDEBUG
$(MAKE) -C crtex tex
$(MAKE) -C dosex tex
$(MAKE) -C go32ex tex
$(MAKE) -C heapex tex
$(MAKE) -C ipcex tex
$(MAKE) -C linuxex tex
$(MAKE) -C mouseex tex
$(MAKE) -C objectex tex
$(MAKE) -C optex tex
$(MAKE) -C printex tex
$(MAKE) -C sockex tex
$(MAKE) -C stringex tex
$(MAKE) -C sysutex tex
$(MAKE) -C mathex tex
$(MAKE) -C graphex tex
$(MAKE) -C gpmex tex
endif
touch unitex.chk
refex.chk:
ifndef INSTALLDEBUG
$(MAKE) -C refex tex
endif
touch refex.chk
progex.chk:
ifndef INSTALLDEBUG
$(MAKE) -C progex tex
endif
touch progex.chk
messages:
msg2inc -TE ../compiler/errore.msg messages.tex
date.inc:
@echo \\date\{`date +'%B %Y'`\} > date.inc
onechap: onechap.dvi
units.dvi: units.tex date.inc $(CHAPTERS)
ref.dvi: ref.tex date.inc
prog.dvi: prog.tex date.inc
user.dvi: user.tex date.inc
units.pdf: units.tex date.inc $(CHAPTERS)
ref.pdf: ref.tex date.inc
user.pdf: user.tex date.inc
prog.pdf: prog.tex date.inc
dvi : $(DVI)
txt : dvi $(TXT)
ps : dvi $(PS)
pdf : $(PDF)
all : dvi ps pdf txt html
#####################################################################
# Html creation
#####################################################################
htex: htex.chk
htex.chk: $(wildcard *.tex)
./tex2htex
touch htex.chk
user: user.chk
user.chk: htex.chk date.inc
ifdef INSTALLDEBUG
mkdir user
cp user.tex user/index.html
else
$(LATEX2HTML) $(LATEX2HTMLOPTS) -split 2 -link 2\
-t "User's guide for Free Pascal" user.htex
-sed -f foot.sed <user/footnode.html >user/footnote.html
-mv user/footnote.html user/footnode.html
-rm -f user/labels.pl user/internals.pl user/.*.pag user/.*.dir
-rm -f user/images.* user/*.log user/WARNINGS
endif
touch user.chk
units: units.chk
units.chk: unitex.chk htex.chk date.inc
ifdef INSTALLDEBUG
mkdir units
cp units.tex units/index.html
else
$(LATEX2HTML) $(LATEX2HTMLOPTS) -split 3 -link 2\
-t "Unit reference for Free Pascal" units.htex
-sed -f foot.sed <units/footnode.html >units/footnote.html
-mv units/footnote.html units/footnode.html
ifndef LOG
-rm -f units/labels.pl units/internals.pl units/.*.pag units/.*.dir
-rm -f units/images.* units/*.log units/WARNINGS
endif
endif
touch units.chk
ref: ref.chk
ref.chk: refex.chk htex.chk date.inc
ifdef INSTALLDEBUG
mkdir ref
cp ref.tex ref/index.html
else
$(LATEX2HTML) $(LATEX2HTMLOPTS) -split 4 -link 2\
-t "Free Pascal reference guide" ref.htex
-sed -f foot.sed <ref/footnode.html >ref/footnote.html
-mv ref/footnote.html ref/footnode.html
ifndef LOG
-rm -f ref/labels.pl ref/internals.pl ref/.*.pag ref/.*.dir
-rm -f ref/images.* ref/*.log ref/WARNINGS
endif
endif
touch ref.chk
prog: prog.chk
prog.chk: progex.chk htex.chk date.inc
ifdef INSTALLDEBUG
mkdir prog
cp prog.tex prog/index.html
else
$(LATEX2HTML) $(LATEX2HTMLOPTS) -split 2 -link 2\
-t "Free Pascal programmers guide" prog.htex
-sed -f foot.sed <prog/footnode.html >prog/footnote.html
-mv prog/footnote.html prog/footnode.html
ifndef LOG
-rm -f prog/labels.pl prog/internals.pl prog/.*.pag prog/.*.dir
-rm -f prog/images.* prog/*.log prog/WARNINGS
endif
endif
touch prog.chk
internal: internal.chk
internal.chk: htex.chk date.inc
ifdef INSTALLDEBUG
mkdir internal
cp internal.tex internal/index.html
else
$(LATEX2HTML) $(LATEX2HTMLOPTS) -split 4 -link 2\
-t "Free Pascal Compiler Documentation" internal.htex
-sed -f foot.sed <internal/footnode.html >internal/footnote.html
-mv internal/footnote.html internal/footnode.html
ifndef LOG
-rm -f internal/labels.pl internal/internals.pl internal/.*.pag internal/.*.dir
-rm -f internal/images.* internal/*.log internal/WARNINGS
endif
endif
touch internal.chk
onechap: onechap.chk
onechap.chk: unitex.chk htex.chk date.inc
ifdef INSTALLDEBUG
mkdir onechap
cp onechap.tex onechap/index.html
else
$(LATEX2HTML) $(LATEX2HTMLOPTS) -split 4 -link 2\
-t "Free Pascal reference guide" onechap.htex
-sed -f foot.sed <onechap/footnode.html >onechap/footnote.html
-mv onechap/footnote.html onechap/footnode.html
ifndef LOG
-rm -f onechap/labels.pl onechap/internals.pl onechap/.*.pag onechap/.*.dir
-rm -f onechap/images.* onechap/*.log onechap/WARNINGS
endif
endif
touch onechap.chk
html: $(HTML)
#####################################################################
# Installation
#####################################################################
pdfinstall: pdf
install -d -m 755 $(DOCINSTALLDIR)
cp $(PDF) $(DOCINSTALLDIR)
htmlinstall: html
install -d -m 755 $(DOCINSTALLDIR)
cp fpctoc.html $(DOCINSTALLDIR)
cp -R buttons $(DOCINSTALLDIR)
cp -R search $(DOCINSTALLDIR)
sed s/DOCDIR/"$(subst /,\/,$(DOCINSTALLDIR))"/ $(DOCINSTALLDIR)/search/fpchelp.idksm.linux > $(DOCINSTALLDIR)/search/fpchelp.idksm
cp -f $(DOCINSTALLDIR)/search/filelist.txt.linux $(DOCINSTALLDIR)/search/filelist.txt
rm -f $(DOCINSTALLDIR)/search/*.linux
cp -R $(HTML) $(DOCINSTALLDIR)
find $(DOCINSTALLDIR) -name 'CVS' | xargs -n1 rm -rf
doshtmlinstall: html
install -d -m 755 $(DOCINSTALLDIR)
cp fpctoc.html $(DOCINSTALLDIR)
cp -R buttons $(DOCINSTALLDIR)
cp -R search $(DOCINSTALLDIR)
rm -f $(DOCINSTALLDIR)/search/*.linux
cp -R $(HTML) $(DOCINSTALLDIR)
find $(DOCINSTALLDIR) -name 'CVS' | xargs -n1 rm -rf
www-install: psdist htmlinstall
scp fpcdoc.zip fpcdocps.zip fpcdocps.tar.gz fpcdoc.tar.gz tfdec1:htdocs/fpk
ssh tfdec1 '(cd htdocs/fpk/docs ; /usr/local/bin/tar -xzf ../fpcdoc.tar.gz)'
install:
@echo Choose install from:
@echo pdfinstall,htmlinstall,htmldosinstall
@exit
#####################################################################
# Archives
#####################################################################
psdist: $(PS)
tar -cvzf fpcdocps.tar.gz $(PS)
zip docs-ps $(PS)
pdfdist: pdf
zip docs-pdf $(PDF)
dvidist: dvi
zip docs-dvi $(DVI)
txtdist: txt
zip docs-txt $(TXT)
#####################################################################
# Zips of htmls
#####################################################################
DOCPREFIX=doc
BASEDIR=$(shell pwd)
htmltar:
$(MAKE) htmlinstall DOCINSTALLDIR=$(DOCPREFIX)
cd $(DOCPREFIX) ; tar cz * > $(BASEDIR)/fpcdoc.tar.gz ; cd $(BASEDIR)
rm -rf $(DOCPREFIX)
htmlzip:
$(MAKE) doshtmlinstall DOCINSTALLDIR=$(DOCPREFIX)
zip -D9rq doc-html $(DOCPREFIX)/*
rm -rf $(DOCPREFIX)
htmzip:
$(MAKE) doshtmlinstall DOCINSTALLDIR=$(DOCPREFIX)
makehtm `find $(DOCPREFIX) -name '*.html'`
zip -D9rq doc-htm `find $(DOCPREFIX) -name '*.htm' -or -name '*.gif' -or -name '*.css'`
rm -rf $(DOCPREFIX)
htmldist: htmlzip htmltar
htmdist: htmzip
alldist: dvidist psdist txtdist pdfdist htmldist htmdist
distclean: clean
-rm -f *.tar.gz *.zip
#####################################################################
# Examples
#####################################################################
examples:
$(MAKE) -C crtex
$(MAKE) -C dosex
$(MAKE) -C optex
$(MAKE) -C printex
$(MAKE) -C refex
$(MAKE) -C stringex
$(MAKE) -C ipcex
$(MAKE) -C objectex
$(MAKE) -C sysutex
dosexamples: examples
$(MAKE) -C go32ex
$(MAKE) -C mouseex
linuxexamples: examples
$(MAKE) -C linuxex
$(MAKE) -C sockex
$(MAKE) -C ipcex
#
# $Log$
# Revision 1.4 2000-10-12 10:41:58 peter
# * more examples
#
# Revision 1.3 2000/09/02 21:51:36 peter
# * fixed pdf creating (merged)
#
# Revision 1.1 2000/07/13 09:10:03 michael
# + Initial import
#