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