Subversion Repositories HelenOS-doc

Rev

Rev 106 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#
# Copyright (C) 2006 Sergey Bondari
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above copyright
#   notice, this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright
#   notice, this list of conditions and the following disclaimer in the
#   documentation and/or other materials provided with the distribution.
# - The name of the author may not be used to endorse or promote products
#   derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#


# Use xsltproc as XSL processor
XSLT = xsltproc

TOOLCHAIN_DIR = tools/

# DocBook XSL package
DOCBOOK_DIR = $(TOOLCHAIN_DIR)docbook-xsl/

# FOP - Apache XML graphics package
FOP_DIR=$(TOOLCHAIN_DIR)fop/
FOP=$(FOP_DIR)fop.sh

DBLATEX_DIR=$(TOOLCHAIN_DIR)dblatex/
DBLATEX=$(DBLATEX_DIR)bin/dblatex

# Output folders
BUILD_HTML_DIR = build/html/
BUILD_PDF_DIR = build/pdf/
BUILD_HTML_CHUNKED_DIR = build/html.chunked/


all: html htmlchunked pdf

build: clean all

html: imgconvert
    mkdir -p $(BUILD_HTML_DIR)
    mkdir -p $(BUILD_HTML_DIR)images
    cp src/images/* $(BUILD_HTML_DIR)images
    xsltproc \
      --stringparam section.autolabel 1 \
      --stringparam section.label.includes.component.label 1 \
      --stringparam section.autolabel.max.depth 2 \
      --stringparam preferred.mediaobject.role html \
      --output $(BUILD_HTML_DIR)index.html $(DOCBOOK_DIR)html/docbook.xsl src/index.xml
htmlchunked: imgconvert
    mkdir -p $(BUILD_HTML_CHUNKED_DIR)
    mkdir -p $(BUILD_HTML_CHUNKED_DIR)images
    cp src/images/* $(BUILD_HTML_CHUNKED_DIR)images
    xsltproc \
      --stringparam section.autolabel 1 \
      --stringparam section.label.includes.component.label 1 \
      --stringparam chunk.section.depth 0 \
      --stringparam section.autolabel.max.depth 2 \
      --stringparam preferred.mediaobject.role html \
      --output $(BUILD_HTML_CHUNKED_DIR)index.html $(DOCBOOK_DIR)html/chunk.xsl src/index.xml
pdf: dblatex-pdf
dblatex-pdf: imgconvert
    mkdir -p $(BUILD_PDF_DIR)
    $(DBLATEX) \
      -t pdf -T db2latex -f pdf \
      -p tools/extra/dblatex-extra.xsl \
      -o $(BUILD_PDF_DIR)HelenOS-doc-design.pdf \
      src/index.xml
fo-pdf: imgconvert
    mkdir -p $(BUILD_PDF_DIR)
    mkdir -p $(BUILD_PDF_DIR)images
    cp src/images/* $(BUILD_PDF_DIR)images
    xsltproc \
      --stringparam paper.type A4 \
      --stringparam fop.extensions 1 \
      --stringparam bondari.jimi.compatible 1 \
      --stringparam section.autolabel 1 \
      --stringparam section.label.includes.component.label 1 \
      --stringparam section.autolabel.max.depth 2 \
      --stringparam body.font.master 12 \
      --stringparam preferred.mediaobject.role fop \
      --output $(BUILD_PDF_DIR)index.fo $(DOCBOOK_DIR)fo/docbook.xsl src/index.xml

    $(FOP) -q -fo $(BUILD_PDF_DIR)index.fo -pdf $(BUILD_PDF_DIR)index.pdf
imgconvert:
    cd src/images; ./convert

distclean: clean

clean:
    rm -rf build
    rm -rf src/images/*.pdf
    rm -rf src/images/*.eps
    rm -rf src/images/*.png