1 # 2 # CDDL HEADER START 3 # 4 # The contents of this file are subject to the terms of the 5 # Common Development and Distribution License (the "License"). 6 # You may not use this file except in compliance with the License. 7 # 8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 # or http://www.opensolaris.org/os/licensing. 10 # See the License for the specific language governing permissions 11 # and limitations under the License. 12 # 13 # When distributing Covered Code, include this CDDL HEADER in each 14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 # If applicable, add the following below this CDDL HEADER, with the 16 # fields enclosed by brackets "[]" replaced with your own identifying 17 # information: Portions Copyright [yyyy] [name of copyright owner] 18 # 19 # CDDL HEADER END 20 # 21 22 # 23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24 # Use is subject to license terms. 25 # 26 27 # NOTES 28 # 29 # 1) You need to set DOCBOOK to point to the root of your docbook 30 # files either by editing this Makefile or setting DOCBOOK 31 # appropriately in your environment and using 'make -e'. The DocBook 32 # XSL files are available on the web from: 33 # http://sourceforge.net/project/showfiles.php?group_id=21935#files 34 # The Makefile looks for the stylesheets in $DOCBOOK/XSL subdirectory. 35 # 36 # 2) You need xsltproc and xmllint in your path. If you are using the 37 # Solaris distribution you should already have these tools installed 38 # in /usr/bin. 39 # 40 # 3) The default target generates HTML for posting at the ON Community 41 # site (see note 6 below). Use "make devref.html" to get one big 42 # flat HTML file. Use "make index.html" to generate one HTML file per 43 # section, plus an index as index.html. (This produces too many 44 # chunks for posting at the ON Community.) 45 # 46 # 4) A 'make check' target is provided to check the xml source for 47 # compliance with the docbook 4.4 DTD (provided as docbookx.dtd). 48 # Since the xml provided here was generated from POD source there 49 # are a few existing DTD errors. 50 # 51 # 5) The provided CSS file should be made available with the resulting 52 # HTML. Feel free to edit it as you like, the default one provided 53 # here gives the document an opensolaris.org look-and-feel. 54 # 55 # 6) A 'make chunks' target is provided to generate HTML that has been 56 # chunked for posting at the ON Community. The resulting HTML is 57 # put in $(ONCHUNKDIR). It's under SCM control so that you can 58 # easily tell what files need to be uploaded. See 59 # http://www.sagehill.net/docbookxsl/Chunking.html for more 60 # technical detail. 61 # 62 DOCBOOK=SET_THIS_TO_THE_LOCATION_OF_YOUR_DOCBOOK_FILES 63 XSLTPROC=xsltproc 64 XMLLINT=xmllint 65 XSLTPROC_OPTS= \ 66 --nonet \ 67 --stringparam html.stylesheet "format.css" \ 68 --stringparam chunker.output.doctype-public \ 69 "-//W3C//DTD HTML 4.01 Transitional//EN" \ 70 --stringparam chunker.output.doctype-system \ 71 "http://www.w3.org/TR/html4/loose.dtd" 72 XSLT_DB2HTML=$(DOCBOOK)/html/docbook.xsl 73 XSLT_DB2IDXHTML=$(DOCBOOK)/html/chunk.xsl 74 XSLT_MAKETOC=$(DOCBOOK)/html/maketoc.xsl 75 XSLT_TOC_OPTS= 76 XSLT_CHUNKTOCHTML=$(DOCBOOK)/html/chunktoc.xsl 77 78 # 79 # Table-of-contents file that controls the chunking process. This 80 # file is under SCM control because it has been customized to 81 # approximate the chunking that is used for the DevRef that is posted 82 # under the ON community. If you want to regenerate the file from 83 # scratch, use the "raw-toc" target below. If you edit this file, you 84 # may need to update fixup.py. 85 # 86 ONCHUNKTOC=on-toc.xml 87 88 # Directory that the uploadable chunks live in. 89 ONCHUNKDIR=on-chunks 90 91 # Chunks used for the ON community copy. 92 ONCHUNKS=ch01 ch02 ch03a ch03b ch04 ch05 ch06 ch07 glossary 93 94 # temporary directory 95 RAWCHUNKDIR=raw-chunks 96 97 FILES= \ 98 devref.xml 99 100 %.html:%.xml 101 $(XSLTPROC) $(XSLTPROC_OPTS) -o $@ $(XSLT_DB2HTML) $< 102 103 default: chunks 104 105 all: chunks index.html devref.html 106 107 index.html: $(FILES) 108 $(XSLTPROC) $(XSLTPROC_OPTS) -o $@ $(XSLT_DB2IDXHTML) $(FILES) 109 110 raw-toc: $(FILES) 111 $(XSLTPROC) $(XSLT_TOC_OPTS) -o $@ $(XSLT_MAKETOC) $(FILES) 112 113 # Deposit uploadable files in $(ONCHUNKDIR). 114 chunks: $(ONCHUNKTOC) $(FILES) 115 [ -d $(RAWCHUNKDIR) ] || mkdir -p $(RAWCHUNKDIR) 116 $(XSLTPROC) --output $(RAWCHUNKDIR)/ --stringparam chunk.toc \ 117 $(ONCHUNKTOC) $(XSLT_CHUNKTOCHTML) $(FILES) 118 cd $(RAWCHUNKDIR); \ 119 mv apa.html glossary.html; \ 120 rm -f ch03b.html; \ 121 cat ch03b1.html ch03b2.html > ch03b.html; \ 122 for f in $(ONCHUNKS); do \ 123 python ../fixup.py < $$f.html > ../$(ONCHUNKDIR)/$$f.html; \ 124 done 125 126 clean: 127 rm -f devref.html 128 rm -f index.html ch??.html ch??s??.html apa.html 129 rm -rf $(RAWCHUNKDIR) 130 131 check: 132 $(XMLLINT) --valid --noout $(FILES) 133