r9541: new suse91 catalog
[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`" : '.*RedHat.*')
28
29 ifneq (${DEBIAN},0)
30 OS:=debian
31 else
32   ifneq (${SUSE91},0)
33     OS=suse91
34   else
35     ifneq (${SUSE},0)
36       OS=suse
37     else   
38       ifneq (${REDHAT},0)
39         OS=redhat
40       endif
41     endif
42   endif
43 endif
44
45
46 ifndef DOCFILE_BASE
47 DOCFILE_BASE=${DOCFILE_BASE_DEFAULT}
48 endif
49
50 ifndef DOCFILE_EXT
51 DOCFILE_EXT=${DOCFILE_EXT_DEFAULT}
52 endif
53
54 DOCFILE:=${DOCFILE_BASE}.${DOCFILE_EXT}
55 FOFILE:=${DOCFILE_BASE}.fo
56 PDFFILE:=${DOCFILE_BASE}.pdf
57 PSFILE:=${DOCFILE_BASE}.ps
58 DVIFILE:=${DOCFILE_BASE}.dvi
59 TXTFILE:=${DOCFILE_BASE}.txt
60 HTMLFILE:=${DOCFILE_BASE}.html
61 TMPFILES:=${DOCFILE_BASE}.aux ${DOCFILE_BASE}.out ${DOCFILE_BASE}.log
62 DOCFILES:=$(shell echo *.xml *.xsl)
63
64 ifeq ($(XSLTPROC),)
65   XSLTPROC:=xsltproc
66 endif
67
68 CATALOG:=`pwd`/catalog-${OS}.xml
69 CHECK:=XML_CATALOG_FILES="$(CATALOG)" xmllint --noout --xinclude --postvalid $(DOCFILE) || exit 1
70
71 .PHONY: all
72 all: html pdf 
73
74 .PHONY: dist
75 dist: html pdf
76
77 .PHONY: doc
78 doc: html pdf
79
80 .PHONY: check
81 check:
82         @echo "Operating system detected: ${OS}"
83         @$(CHECK)
84
85 .PHONY: html
86 html: html.tar.gz
87
88 html.tar.gz: $(DOCFILES) Makefile 
89         @rm -rf html
90         @mkdir html
91         @XML_CATALOG_FILES="$(CATALOG)" $(XSLTPROC) --stringparam chunker.output.encoding ISO-8859-1 \
92                  --xinclude --output html/ html_chunk.xsl $(DOCFILE)
93         @GZIP='-9' tar czf html.tar.gz html 
94
95 .PHONY: fo
96 fo: ${FOFILE}
97
98 ${FOFILE}: $(DOCFILES) Makefile 
99         @XML_CATALOG_FILES="$(CATALOG)" xsltproc --xinclude --output $(FOFILE) fo.xsl $(DOCFILE)
100
101 .PHONY: pdf
102 pdf: ${PDFFILE}
103
104 ${PDFFILE}: ${DOCFILES} Makefile
105         @$(MAKE) fo
106         @fop $(FOFILE) -pdf $(PDFFILE) > /dev/null
107
108 .PHONY: dvi
109 dvi: ${DVIFILE}
110
111 .PHONY: ps
112 ps: ${PSFILE}
113
114 ${PSFILE}: ${DOCFILES} Makefile
115         @$(MAKE) fo
116         @fop $(FOFILE) -ps $(PSFILE) > /dev/null
117
118
119 .PHONY: txt
120 txt: ${TXTFILE}
121
122 ${TXTFILE}: ${FOFILE}
123         @XML_CATALOG_FILES="$(CATALOG)" xsltproc --xinclude --output ${HTMLFILE} html.xsl $(DOCFILE)
124         lynx -dump ${HTMLFILE} > ${TXTFILE}
125
126 .PHONY: clean
127 clean: 
128         @rm -f *~ *.bak *.orig \#*\# .\#* texput.log
129         @rm -rf html ${PSFILE} ${HTMLFILE}
130         @rm -f ${TMPFILES} ${FOFILE}
131         @rm -f  ${DVIFILE} ${TXTFILE}
132
133 .PHONY: distclean
134 distclean: clean