r8261: Automated commit for Debian build of hyperobject upstream-version-2.8.8
[hyperobject.git] / doc / Makefile
1 ##############################################################################
2 # FILE IDENTIFICATION
3
4 #  Name:         Makefile
5 #  Purpose:      Makefile for the hyperobject documentation
6 #  Programer:    Kevin M. Rosenberg
7 #  Date Started: Mar 2002
8 #
9 #  CVS Id:   $Id$
10 #
11 # This file, part of HYPEROBJECT, is Copyright (c) 2002-2003 by Kevin M. Rosenberg
12 #
13 # HYPEROBJECT 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:=hyperobject
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 REDHAT=$(shell expr "`cat /etc/issue`" : '.*RedHat.*')
27
28
29 ifneq (${DEBIAN},0)
30 OS:=debian
31 else
32   ifneq (${SUSE},0)
33     OS=suse
34   else   
35     ifneq (${REDHAT},0)
36       OS=redhat
37     endif
38   endif
39 endif
40
41
42 ifndef DOCFILE_BASE
43 DOCFILE_BASE=${DOCFILE_BASE_DEFAULT}
44 endif
45
46 ifndef DOCFILE_EXT
47 DOCFILE_EXT=${DOCFILE_EXT_DEFAULT}
48 endif
49
50 DOCFILE:=${DOCFILE_BASE}.${DOCFILE_EXT}
51 FOFILE:=${DOCFILE_BASE}.fo
52 PDFFILE:=${DOCFILE_BASE}.pdf
53 PSFILE:=${DOCFILE_BASE}.ps
54 DVIFILE:=${DOCFILE_BASE}.dvi
55 TXTFILE:=${DOCFILE_BASE}.txt
56 HTMLFILE:=${DOCFILE_BASE}.html
57 TMPFILES:=${DOCFILE_BASE}.aux ${DOCFILE_BASE}.out ${DOCFILE_BASE}.log
58 DOCFILES:=$(shell echo *.xml *.xsl)
59
60 ifeq ($(XSLTPROC),)
61   XSLTPROC:=xsltproc
62 endif
63
64 CATALOG:=`pwd`/catalog-${OS}.xml
65 CHECK:=XML_CATALOG_FILES="$(CATALOG)" xmllint --noout --xinclude --postvalid $(DOCFILE) || exit 1
66
67 .PHONY: all
68 all: html pdf 
69
70 .PHONY: dist
71 dist: html pdf
72
73 .PHONY: doc
74 doc: html pdf
75
76 .PHONY: check
77 check:
78         @echo "Operating System Detected: ${OS}"
79         @$(CHECK)
80
81 .PHONY: html
82 html: html.tar.gz
83
84 html.tar.gz: $(DOCFILES) Makefile 
85         @rm -rf html
86         @mkdir html
87         @XML_CATALOG_FILES="$(CATALOG)" $(XSLTPROC) --stringparam chunker.output.encoding ISO-8859-1 \
88                  --xinclude --output html/ html_chunk.xsl $(DOCFILE)
89         @GZIP='-9' tar czf html.tar.gz html 
90
91 .PHONY: fo
92 fo: ${FOFILE}
93
94 ${FOFILE}: $(DOCFILES) Makefile 
95         @XML_CATALOG_FILES="$(CATALOG)" xsltproc --xinclude --output $(FOFILE) fo.xsl $(DOCFILE)
96
97 .PHONY: pdf
98 pdf: ${PDFFILE}
99
100 ${PDFFILE}: ${DOCFILES} Makefile
101         @$(MAKE) fo
102         @fop $(FOFILE) -pdf $(PDFFILE) > /dev/null
103
104 .PHONY: dvi
105 dvi: ${DVIFILE}
106
107 .PHONY: ps
108 ps: ${PSFILE}
109
110 ${PSFILE}: ${DOCFILES} Makefile
111         @$(MAKE) fo
112         @fop $(FOFILE) -ps $(PSFILE) > /dev/null
113
114
115 .PHONY: txt
116 txt: ${TXTFILE}
117
118 ${TXTFILE}: ${FOFILE}
119         @XML_CATALOG_FILES="$(CATALOG)" xsltproc --xinclude --output ${HTMLFILE} html.xsl $(DOCFILE)
120         lynx -dump ${HTMLFILE} > ${TXTFILE}
121
122 .PHONY: clean
123 clean: 
124         @rm -f *~ *.bak *.orig \#*\# .\#* texput.log
125         @rm -rf html ${PSFILE} ${HTMLFILE}
126         @rm -f ${TMPFILES} ${FOFILE}
127         @rm -f  ${DVIFILE} ${TXTFILE}
128
129 .PHONY: distclean
130 distclean: clean