3.9. Komplett Makefile

Vi lägger till ett clean kommando:

#A list over source files
SRC=datamodel.xml docbook_tables.xml tables.xml to_docbook_table.xsl
DB=/usr/share/sgml/docbook/xsl-stylesheets
SAXON=/home/bnl/distributions/java/saxon.jar
TARGET=/home/bnl/public_html/sslug/docbook_xml/target

OPTIONS=paper.type=A4 \
        admon.graphics=1 \
        admon.graphics.path=$(DB)/images/ \
        use.extensions=1 \
        fop.extensions=1 \
        section.autolabel=1 \
        callout.graphics.path=$(DB)/images/callouts/ \
        tablecolumns.extension=0

#What to do when just 'make' is run
all: docbook_tables.xml html html_one pdf

html_one: $(SRC)
        java -jar $(SAXON) datamodel.xml  $(DB)/html/docbook.xsl \
        $(OPTIONS) > $(TARGET)/html_one/datamodel.html
        touch html_one

html: $(SRC)
        java -jar $(SAXON) datamodel.xml  $(DB)/html/chunk.xsl \
        $(OPTIONS)
        cp *.html $(TARGET)/html
        rm -f *.html
        touch html

pdf: $(SRC)
        java -jar $(SAXON) datamodel.xml  $(DB)/fo/docbook.xsl \
        $(OPTIONS) > datamodel.fo
        $$FOP_HOME/fop.sh -fo datamodel.fo -pdf $(TARGET)/pdf/datamodel.pdf
        rm -f datamodel.fo
        touch pdf

docbook_tables.xml: tables.xml
        java -jar $(SAXON) tables.xml  to_docbook_table.xsl \
        $(OPTIONS) > docbook_tables.xml

.PHONY: clean
clean:
        rm -f docbook_tables.xml pdf html_one html
        rm -f $(TARGET)/pdf/*
        rm -f $(TARGET)/html/*
        rm -f $(TARGET)/html_one/*