Remove XSLT script to generate image dependencies, instead rely on make
authorJelmer Vernooij <jelmer@samba.org>
Fri, 1 May 2009 21:50:49 +0000 (23:50 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Fri, 1 May 2009 23:15:26 +0000 (01:15 +0200)
given that the number of image formats we use is limited.

docs-xml/Makefile
docs-xml/xslt/generate-dependencies.xsl [deleted file]

index c177ba721b882b0557ec3409b143e078e7daa539..dd6777c895377d5a4bd9846725cef843cd1bddc8 100644 (file)
@@ -53,14 +53,10 @@ release:: manpages3 htmlman3 html pdf
 clean::
        @echo "Cleaning up..." 
        rm -rf $(OUTPUTDIR)/* $(DOCBOOKDIR)
-       rm -f $(patsubst %.svg,%.png,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-dia))) \
-                       $(patsubst %.svg,%.pdf,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-svg))) \
-                       $(patsubst %.svg,%.eps,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-svg))) \
-                       $(patsubst %.svg,%.png,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-svg)))
-       rm -f *-attributions.xml *.d *.tpt *.tex *.loc *.toc *.lof *.glo *.idx *.aux
-       rm -f *-images-html*
-       rm -f *-images-latex-* $(LATEX_FIGURES)
-       rm -f xslt/figures/*pdf
+       rm -f $(patsubst %.svg,%.png,$(wildcard */images/*.svg)) \
+                 $(patsubst %.svg,%.eps,$(wildcard */images/*.svg)) \
+                 $(patsubst %.png,%.eps,$(wildcard */images/*.png))
+       rm -f *-attributions.xml *.tpt *.tex *.loc *.toc *.lof *.glo *.idx *.aux
        rm -f $(SMBDOTCONFDOC)/parameters.*.xml
        rm -f $(addsuffix .*,$(MAIN_DOCS))
        rm -f build/catalog.xml
@@ -109,7 +105,7 @@ $(HTMLDIR)/index.html: htmldocs.html
        @mkdir -p $(@D)
        cp $< $@
        
-$(HTMLDIR)/%/index.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/%/samba.css xslt/html-chunk.xsl %-images-html-chunks
+$(HTMLDIR)/%/index.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/%/samba.css xslt/html-chunk.xsl
        @mkdir -p $(@D)
        $(XSLTPROC) --stringparam base.dir "$(HTMLDIR)/$*/" xslt/html-chunk.xsl $<
 
@@ -118,7 +114,16 @@ $(OUTPUTDIR)/%/samba.css: xslt/html/samba.css
        @mkdir -p $(@D)
        cp $< $@
 
-$(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS)): $(HTMLDIR)/%.html: %-images-html-single
+$(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS)): $(HTMLDIR)/%.html: %-images-png
+
+define IMAGES_TEMPLATE
+$(1)-images-png:: $$(patsubst %.svg,%.png,$$(wildcard $(1)/images/*.svg)) ;
+$(1)-images-eps:: $$(patsubst %.svg,%.eps,$$(wildcard $(1)/images/*.svg)) ;
+$(1)-images-eps:: $$(patsubst %.png,%.eps,$$(wildcard $(1)/images/*.png)) ;
+
+endef
+
+$(eval $(foreach DOC, $(MAIN_DOCS),$(call IMAGES_TEMPLATE,$(DOC))))
 
 $(HTMLDIR)/%.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/samba.css xslt/html.xsl 
        $(XSLTPROC) --output $@ xslt/html.xsl $<
@@ -140,47 +145,12 @@ $(TXTDIR)/%.txt: $(HTMLDIR)/%.html
        @mkdir -p $(@D)
        @$(DBLATEX) $(DBLATEX_OPTIONS) -t tex -o $@ $<
 
-# Dependency files
-%.d: $(DOCBOOKDIR)/%.xml xslt/generate-dependencies.xsl
-       @echo "Generating dependency file for $*" 
-       @$(XSLTPROC) --novalid \
-               --stringparam txtbasedir "$(TXTDIR)/$*/" \
-               --stringparam target "$*" \
-               -o $@ xslt/generate-dependencies.xsl $<
-       @echo "$*-images-latex-svg = \$$(wildcard \$$(addsuffix .svg, \$$($*-images-latex)))" >> $@
-       @echo "$*-images-latex-eps: \$$(addsuffix .eps, \$$($*-images-latex))" >> $@
-       @echo "$*-images-latex-pdf: \$$(patsubst %.svg, %.pdf, \$$($*-images-latex-svg))" >> $@
-       @echo "$*-images-latex-png: \$$(filter-out \$$(patsubst %.svg,%.png,\$$($*-images-latex-svg)), \$$(addsuffix .png, \$$($*-images-latex)))" >> $@
-
-       @echo >> $@
-       @echo "\$$(HTMLDIR)/%: $*/%" >> $@
-       @echo " @mkdir -p \$$(@D)" >> $@
-       @echo " @cp \$$< \$$@" >> $@
-       @echo >> $@
-       @echo "\$$(HTMLDIR)/$*/%: $*/%" >> $@
-       @echo " @mkdir -p \$$(@D)" >> $@
-       @echo " @cp \$$< \$$@" >> $@
-       @echo >> $@
-       @echo "\$$(HTMLHELPDIR)/$*/%: $*/%" >> $@
-       @echo " @mkdir -p \$$(@D)" >> $@
-       @echo " @cp \$$< \$$@" >> $@
-       @echo >> $@
-       @echo "$*-images-html-single: \$$(addprefix \$$(HTMLDIR)/, \$$($*-images-html))" >> $@
-       @echo "$*-images-html-chunks: \$$(addprefix \$$(HTMLDIR)/$*/, \$$($*-images-html))" >> $@
-       @echo "$*-images-htmlhelp: \$$(addprefix \$$(HTMLHELPDIR)/$*/, \$$($*-images-html))" >> $@
-
-ifdef OUTPUTDIR 
-ifneq ($(MAKECMDGOALS),clobber)
--include $(addsuffix .d,$(MAIN_DOCS))
-endif
-endif
-
 # Adobe PDF files  
-$(PDFDIR)/%.pdf: %/index.xml $(PDFDIR) xslt/latex.xsl %-images-latex-png %-images-latex-pdf
+$(PDFDIR)/%.pdf: %/index.xml $(PDFDIR) xslt/latex.xsl %-images-png
        $(DBLATEX) $(DBLATEX_OPTIONS) -I $*/images -t pdf -o $@ $<
 
 # PostScript files
-$(PSDIR)/%.ps: %/index.xml $(PSDIR) xslt/latex.xsl %-images-latex-eps
+$(PSDIR)/%.ps: %/index.xml $(PSDIR) xslt/latex.xsl %-images-eps 
        $(DBLATEX) $(DBLATEX_OPTIONS) -I $*/images -t ps -o $@ $<
 
 %.eps: %.svg
@@ -195,7 +165,7 @@ $(PSDIR)/%.ps: %/index.xml $(PSDIR) xslt/latex.xsl %-images-latex-eps
 %.eps: %.png
        $(PNGTOPNM) $< | $(PNMTOPS) > $@
 
-$(HTMLHELPDIR)/%: $(DOCBOOKDIR)/%.xml %-images-htmlhelp
+$(HTMLHELPDIR)/%: $(DOCBOOKDIR)/%.xml %-images-png
        $(XSLTPROC) --stringparam htmlhelp.chm $*.chm \
                                --stringparam manifest.in.base.dir "$@/" \
                                --stringparam base.dir "$@/" \
@@ -274,11 +244,6 @@ archive: pdf
 # XSL scripts
 xslt/html.xsl: xslt/html-common.xsl 
 xslt/html-chunk.xsl: xslt/html-common.xsl 
-xslt/latex.xsl: 
-xslt/expand-sambadoc.xsl: 
-xslt/generate-attributions.xsl: 
-xslt/man.xsl:
-xslt/pearson.xsl:
 
 distclean clobber:: clean
        rm -f Makefile.settings config.status config.log
diff --git a/docs-xml/xslt/generate-dependencies.xsl b/docs-xml/xslt/generate-dependencies.xsl
deleted file mode 100644 (file)
index 2fe3dd0..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version='1.0'?>
-<!--
-       Find the image dependencies of a certain XML file
-       Generates (part of) a Makefile
-
-       - $(FNAME)-images-latex-{png,eps,pdf} for role=latex
-       - $(FNAME)-images-role for all other roles
-
-       (C) Jelmer Vernooij     2004-2005
-
-       Published under the GNU GPLv3 or later
--->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1">
-       <xsl:output method="text"/>
-
-       <xsl:template match="/">
-               <xsl:for-each select="//mediaobject/imageobject[@role and not(@role=following::imageobject/@role)]">
-                       <xsl:call-template name="generate-images">
-                               <xsl:with-param name="role"><xsl:value-of select="@role"/></xsl:with-param>
-                       </xsl:call-template>
-               </xsl:for-each>
-               <xsl:call-template name="generate-images">
-                       <xsl:with-param name="role"/>
-               </xsl:call-template>
-       </xsl:template>
-
-       <xsl:template name="generate-images">
-               <xsl:param name="role"/>
-               <xsl:value-of select="$target"/><xsl:text>-images-</xsl:text><xsl:value-of select="$role"/><xsl:text> = </xsl:text>
-               <xsl:for-each select="//mediaobject/imageobject[@role=$role]">
-                       <xsl:value-of select="imagedata/@fileref"/>
-                       <xsl:text> </xsl:text>
-               </xsl:for-each>
-               <xsl:text>&#10;</xsl:text>
-       </xsl:template>
-</xsl:stylesheet>