r10846: Automated commit for Debian build of clsql upstream-version-3.5.0
[clsql.git] / doc / Makefile
index e061af2623d9e4d5e3bd9bcaa2e353ee3a16f98b..9f9327dfcb27c2660f3531140dd6c4b7ca4b4196 100644 (file)
 # (http://opensource.franz.com/preamble.html), also known as the LLGPL.
 ##############################################################################
 
-OS:=debian
 DOCFILE_BASE_DEFAULT:=clsql
 DOCFILE_EXT_DEFAULT:=xml
 
+
 # Standard docfile processing
 
+DEBIAN=$(shell expr "`cat /etc/issue 2> /dev/null`" : '.*Debian.*')
+SUSE=$(shell expr "`cat /etc/issue 2> /dev/null`" : '.*SuSE.*')
+SUSE91=$(shell expr "`cat /etc/issue 2> /dev/null`" : '.*SuSE Linux 9.1.*')
+REDHAT=$(shell expr "`cat /etc/issue 2> /dev/null`" : '.*Red Hat.*')
+MANDRAKE=$(shell expr "`cat /etc/issue 2> /dev/null`" : '.*Mandrake.*')
+DARWIN=$(shell expr "`uname -a`" : '.*Darwin.*')
+
+
+ifneq (${DEBIAN},0)
+OS:=debian
+else
+  ifneq (${SUSE91},0)
+    OS=suse91
+  else
+    ifneq (${SUSE},0)
+      OS=suse
+    else   
+      ifneq (${REDHAT},0)
+        OS=redhat
+      else   
+        ifneq (${MANDRAKE},0)
+          OS=mandrake
+       else   
+          ifneq (${DARWIN},0)
+            OS=darwin
+         endif 
+        endif
+      endif
+    endif
+  endif
+endif
+
 ifndef DOCFILE_BASE
 DOCFILE_BASE=${DOCFILE_BASE_DEFAULT}
 endif
@@ -35,9 +67,14 @@ PDFFILE:=${DOCFILE_BASE}.pdf
 PSFILE:=${DOCFILE_BASE}.ps
 DVIFILE:=${DOCFILE_BASE}.dvi
 TXTFILE:=${DOCFILE_BASE}.txt
+HTMLFILE:=${DOCFILE_BASE}.html
 TMPFILES:=${DOCFILE_BASE}.aux ${DOCFILE_BASE}.out ${DOCFILE_BASE}.log
 DOCFILES:=$(shell echo *.xml *.xsl)
 
+ifeq ($(XSLTPROC),)
+  XSLTPROC:=xsltproc
+endif
+
 CATALOG:=`pwd`/catalog-${OS}.xml
 CHECK:=XML_CATALOG_FILES="$(CATALOG)" xmllint --noout --xinclude --postvalid $(DOCFILE) || exit 1
 
@@ -52,6 +89,7 @@ doc: html pdf
 
 .PHONY: check
 check:
+       @echo "Operating system detected: ${OS}"
        @$(CHECK)
 
 .PHONY: html
@@ -60,7 +98,8 @@ html: html.tar.gz
 html.tar.gz: $(DOCFILES) Makefile 
        @rm -rf html
        @mkdir html
-       @XML_CATALOG_FILES="$(CATALOG)" xsltproc --xinclude --output html/ html.xsl $(DOCFILE)
+       @XML_CATALOG_FILES="$(CATALOG)" $(XSLTPROC) --stringparam chunker.output.encoding ISO-8859-1 \
+                --xinclude --output html/ html_chunk.xsl $(DOCFILE)
        @GZIP='-9' tar czf html.tar.gz html 
 
 .PHONY: fo
@@ -72,7 +111,8 @@ ${FOFILE}: $(DOCFILES) Makefile
 .PHONY: pdf
 pdf: ${PDFFILE}
 
-${PDFFILE}: ${FOFILE}
+${PDFFILE}: ${DOCFILES} Makefile
+       @$(MAKE) fo
        @fop $(FOFILE) -pdf $(PDFFILE) > /dev/null
 
 .PHONY: dvi
@@ -81,7 +121,8 @@ dvi: ${DVIFILE}
 .PHONY: ps
 ps: ${PSFILE}
 
-${PSFILE}: ${FOFILE}
+${PSFILE}: ${DOCFILES} Makefile
+       @$(MAKE) fo
        @fop $(FOFILE) -ps $(PSFILE) > /dev/null
 
 
@@ -89,12 +130,13 @@ ${PSFILE}: ${FOFILE}
 txt: ${TXTFILE}
 
 ${TXTFILE}: ${FOFILE}
-       @fop $(FOFILE) -txt $(TXTFILE) > /dev/null
+       @XML_CATALOG_FILES="$(CATALOG)" xsltproc --xinclude --output ${HTMLFILE} html.xsl $(DOCFILE)
+       lynx -dump ${HTMLFILE} > ${TXTFILE}
 
 .PHONY: clean
 clean: 
        @rm -f *~ *.bak *.orig \#*\# .\#* texput.log
-       @rm -rf html ${PSFILE}
+       @rm -rf html ${PSFILE} ${HTMLFILE}
        @rm -f ${TMPFILES} ${FOFILE}
        @rm -f  ${DVIFILE} ${TXTFILE}