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