r9732: Automated commit for Debian build of clsql upstream-version-2.11.12
[clsql.git] / doc / Makefile
1 ##############################################################################
2 # FILE IDENTIFICATION
3
4 #  Name:         Makefile
5 #  Purpose:      Makefile for the clsql documentation
6 #  Programer:    Kevin M. Rosenberg
7 #  Date Started: Mar 2002
8 #
9 #  CVS Id:   $Id$
10 #
11 # This file, part of CLSQL, is Copyright (c) 2002-2003 by Kevin M. Rosenberg
12 #
13 # CLSQL users are granted the rights to distribute and use this software
14 # as governed by the terms of the Lisp Lesser GNU Public License
15 # (http://opensource.franz.com/preamble.html), also known as the LLGPL.
16 ##############################################################################
17
18 DOCFILE_BASE_DEFAULT:=clsql
19 DOCFILE_EXT_DEFAULT:=xml
20
21
22 # Standard docfile processing
23
24 DEBIAN=$(shell expr "`cat /etc/issue`" : '.*Debian.*')
25 SUSE=$(shell expr "`cat /etc/issue`" : '.*SuSE.*')
26 SUSE91=$(shell expr "`cat /etc/issue`" : '.*SuSE Linux 9.1.*')
27 REDHAT=$(shell expr "`cat /etc/issue`" : '.*Red Hat.*')
28 MANDRAKE=$(shell expr "`cat /etc/issue`" : '.*Mandrake.*')
29
30 ifneq (${DEBIAN},0)
31 OS:=debian
32 else
33   ifneq (${SUSE91},0)
34     OS=suse91
35   else
36     ifneq (${SUSE},0)
37       OS=suse
38     else   
39       ifneq (${REDHAT},0)
40         OS=redhat
41       else   
42         ifneq (${MANDRAKE},0)
43           OS=mandrake
44         endif
45       endif
46     endif
47   endif
48 endif
49
50
51 ifndef DOCFILE_BASE
52 DOCFILE_BASE=${DOCFILE_BASE_DEFAULT}
53 endif
54
55 ifndef DOCFILE_EXT
56 DOCFILE_EXT=${DOCFILE_EXT_DEFAULT}
57 endif
58
59 DOCFILE:=${DOCFILE_BASE}.${DOCFILE_EXT}
60 FOFILE:=${DOCFILE_BASE}.fo
61 PDFFILE:=${DOCFILE_BASE}.pdf
62 PSFILE:=${DOCFILE_BASE}.ps
63 DVIFILE:=${DOCFILE_BASE}.dvi
64 TXTFILE:=${DOCFILE_BASE}.txt
65 HTMLFILE:=${DOCFILE_BASE}.html
66 TMPFILES:=${DOCFILE_BASE}.aux ${DOCFILE_BASE}.out ${DOCFILE_BASE}.log
67 DOCFILES:=$(shell echo *.xml *.xsl)
68
69 ifeq ($(XSLTPROC),)
70   XSLTPROC:=xsltproc
71 endif
72
73 CATALOG:=`pwd`/catalog-${OS}.xml
74 CHECK:=XML_CATALOG_FILES="$(CATALOG)" xmllint --noout --xinclude --postvalid $(DOCFILE) || exit 1
75
76 .PHONY: all
77 all: html pdf 
78
79 .PHONY: dist
80 dist: html pdf
81
82 .PHONY: doc
83 doc: html pdf
84
85 .PHONY: check
86 check:
87         @echo "Operating system detected: ${OS}"
88         @$(CHECK)
89
90 .PHONY: html
91 html: html.tar.gz
92
93 html.tar.gz: $(DOCFILES) Makefile 
94         @rm -rf html
95         @mkdir html
96         @XML_CATALOG_FILES="$(CATALOG)" $(XSLTPROC) --stringparam chunker.output.encoding ISO-8859-1 \
97                  --xinclude --output html/ html_chunk.xsl $(DOCFILE)
98         @GZIP='-9' tar czf html.tar.gz html 
99
100 .PHONY: fo
101 fo: ${FOFILE}
102
103 ${FOFILE}: $(DOCFILES) Makefile 
104         @XML_CATALOG_FILES="$(CATALOG)" xsltproc --xinclude --output $(FOFILE) fo.xsl $(DOCFILE)
105
106 .PHONY: pdf
107 pdf: ${PDFFILE}
108
109 ${PDFFILE}: ${DOCFILES} Makefile
110         @$(MAKE) fo
111         @fop $(FOFILE) -pdf $(PDFFILE) > /dev/null
112
113 .PHONY: dvi
114 dvi: ${DVIFILE}
115
116 .PHONY: ps
117 ps: ${PSFILE}
118
119 ${PSFILE}: ${DOCFILES} Makefile
120         @$(MAKE) fo
121         @fop $(FOFILE) -ps $(PSFILE) > /dev/null
122
123
124 .PHONY: txt
125 txt: ${TXTFILE}
126
127 ${TXTFILE}: ${FOFILE}
128         @XML_CATALOG_FILES="$(CATALOG)" xsltproc --xinclude --output ${HTMLFILE} html.xsl $(DOCFILE)
129         lynx -dump ${HTMLFILE} > ${TXTFILE}
130
131 .PHONY: clean
132 clean: 
133         @rm -f *~ *.bak *.orig \#*\# .\#* texput.log
134         @rm -rf html ${PSFILE} ${HTMLFILE}
135         @rm -f ${TMPFILES} ${FOFILE}
136         @rm -f  ${DVIFILE} ${TXTFILE}
137
138 .PHONY: distclean
139 distclean: clean