| 1 |
################################################################# |
| 2 |
# Makefile for Samba Documentation |
| 3 |
# Authors: |
| 4 |
# James Moore <[email protected]> |
| 5 |
# Gerald Carter <[email protected]> |
| 6 |
# Jelmer Vernooij <[email protected]> |
| 7 |
include Makefile.settings |
| 8 |
|
| 9 |
export XML_CATALOG_FILES := $(XML_CATALOG_FILES) /etc/xml/catalog $(shell pwd)/build/catalog.xml |
| 10 |
|
| 11 |
# Docs to build |
| 12 |
MAIN_DOCS = $(patsubst %/index.xml,%,$(wildcard */index.xml)) |
| 13 |
MANPAGES = $(sort $(wildcard $(MANPAGEDIR)/*.?.xml)) |
| 14 |
|
| 15 |
# Lists of files to process |
| 16 |
DBLATEX_OPTIONS = -p xslt/latex.xsl -i xslt/latex |
| 17 |
|
| 18 |
DATETIME := $(shell date +%Y%m%d%H%M%S) |
| 19 |
|
| 20 |
XSLTPROC_DEPS = build/catalog.xml build/DTD/samba.build.version build/DTD/samba.build.pathconfig |
| 21 |
|
| 22 |
ifeq ($(PROFILE), Y) |
| 23 |
XSLTPROC += --profile --load-trace --timing |
| 24 |
endif |
| 25 |
|
| 26 |
ifndef OUTPUTDIR |
| 27 |
Makefile.settings: configure |
| 28 |
./configure |
| 29 |
|
| 30 |
configure: configure.ac |
| 31 |
autoreconf |
| 32 |
endif |
| 33 |
|
| 34 |
help: |
| 35 |
@echo "Supported make targets:" |
| 36 |
@echo " release - Build the docs needed for a Samba release" |
| 37 |
@echo " all - Build all docs that can be built using the utilities found by configure" |
| 38 |
@echo " everything - Build all of the above" |
| 39 |
@echo " pdf,tex,ps,manpages,htmlhelp - Build specific output format" |
| 40 |
@echo " html - Build multi-file HTML versions" |
| 41 |
@echo " html-single - Build single-file HTML versions" |
| 42 |
@echo " htmlman - Build HTML version of manpages" |
| 43 |
|
| 44 |
$(PDFDIR)/Samba3-Developers-Guide.pdf $(PSDIR)/Samba3-Developers-Guide.ps $(DOCBOOKDIR)/Samba3-Developers-Guide.xml Samba3-Developers-Guide.tex: $(wildcard Samba3-Developers-Guide/*.xml) Samba3-Developers-Guide-attributions.xml |
| 45 |
|
| 46 |
# Pseudo targets |
| 47 |
all:: $(TARGETS) |
| 48 |
everything:: manpages pdf html-single html htmlman ps fo htmlhelp |
| 49 |
release:: manpages htmlman html pdf |
| 50 |
clean:: |
| 51 |
@echo "Cleaning up..." |
| 52 |
rm -rf $(OUTPUTDIR)/* $(DOCBOOKDIR) |
| 53 |
rm -f *-attributions.xml |
| 54 |
rm -f *-attributions.xml *.d *.tpt *.tex *.loc *.toc *.lof *.glo *.idx *.aux |
| 55 |
rm -f *-images-html* |
| 56 |
rm -f *-images-latex-* $(LATEX_FIGURES) |
| 57 |
rm -f xslt/figures/*pdf |
| 58 |
rm -f $(SMBDOTCONFDOC)/parameters.*.xml |
| 59 |
rm -f build/catalog.xml |
| 60 |
rm -f DTD/samba.build.pathconfig |
| 61 |
|
| 62 |
# Output format targets |
| 63 |
pdf:: $(patsubst %,$(PDFDIR)/%.pdf,$(MAIN_DOCS)) |
| 64 |
ps:: $(patsubst %,$(PSDIR)/%.ps,$(MAIN_DOCS)) |
| 65 |
tex:: $(addsuffix .tex,$(MAIN_DOCS)) |
| 66 |
manpages:: $(patsubst $(MANPAGEDIR)/%.xml,$(OUTPUTDIR)/manpages/%,$(MANPAGES)) |
| 67 |
htmlman:: $(patsubst $(MANPAGEDIR)/%.xml,$(HTMLDIR)/manpages/%.html,$(MANPAGES)) $(HTMLDIR)/manpages/index.html |
| 68 |
html-single:: $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS)) |
| 69 |
html:: $(patsubst %,$(HTMLDIR)/%/index.html,$(MAIN_DOCS)) $(HTMLDIR)/index.html |
| 70 |
htmlhelp:: $(addprefix $(HTMLHELPDIR)/,$(MAIN_DOCS)) |
| 71 |
validate:: $(addsuffix -validate,$(MAIN_DOCS)) |
| 72 |
|
| 73 |
test:: validate |
| 74 |
check:: validate |
| 75 |
|
| 76 |
.PHONY: test check validate manpages |
| 77 |
|
| 78 |
# Intermediate docbook docs |
| 79 |
# |
| 80 |
$(DOCBOOKDIR)/%.xml: %/index.xml xslt/expand-sambadoc.xsl $(XSLTPROC_DEPS) |
| 81 |
@echo "Converting Samba-specific tags for $*..." |
| 82 |
@mkdir -p $(@D) |
| 83 |
@$(XSLTPROC) --stringparam latex.imagebasedir "$*/" --stringparam noreference 0 --xinclude --output $@ xslt/expand-sambadoc.xsl $< |
| 84 |
|
| 85 |
$(DOCBOOKDIR)/manpages/%.xml: $(MANPAGEDIR)/%.xml xslt/expand-sambadoc.xsl Makefile.settings $(XSLTPROC_DEPS) |
| 86 |
@mkdir -p $(@D) |
| 87 |
$(XSLTPROC) --xinclude --stringparam noreference 0 --output $@ xslt/expand-sambadoc.xsl $< |
| 88 |
|
| 89 |
$(DOCBOOKDIR)/manpages/index.xml: $(MANPAGES) xslt/manpage-summary.xsl $(XSLTPROC_DEPS) |
| 90 |
@mkdir -p $(@D) |
| 91 |
echo "<article><variablelist>" > $@ |
| 92 |
$(XSLTPROC) xslt/manpage-summary.xsl $(MANPAGES) >> $@ |
| 93 |
@echo "</variablelist></article>" >> $@ |
| 94 |
|
| 95 |
# HTML docs |
| 96 |
$(HTMLDIR)/index.html: htmldocs.html |
| 97 |
@mkdir -p $(@D) |
| 98 |
cp $< $@ |
| 99 |
|
| 100 |
$(HTMLDIR)/%/index.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/%/samba.css xslt/html-chunk.xsl %-images-html-chunks $(XSLTPROC_DEPS) |
| 101 |
@mkdir -p $(@D) |
| 102 |
$(XSLTPROC) --stringparam base.dir "$(HTMLDIR)/$*/" xslt/html-chunk.xsl $< |
| 103 |
|
| 104 |
# Single large HTML files |
| 105 |
$(OUTPUTDIR)/%/samba.css: xslt/html/samba.css $(XSLTPROC_DEPS) |
| 106 |
@mkdir -p $(@D) |
| 107 |
cp $< $@ |
| 108 |
|
| 109 |
$(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS)): $(HTMLDIR)/%.html: %-images-html-single |
| 110 |
|
| 111 |
$(HTMLDIR)/%.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/samba.css xslt/html.xsl $(XSLTPROC_DEPS) |
| 112 |
$(XSLTPROC) --output $@ xslt/html.xsl $< |
| 113 |
|
| 114 |
# Attributions |
| 115 |
%-attributions.xml: $(XSLTPROC_DEPS) |
| 116 |
@echo "Generating attributions file $@ from $*/" |
| 117 |
@cp -f templates/attributions.xml $@ |
| 118 |
@$(XSLTPROC) --xinclude -o $@ xslt/generate-attributions.xsl $*/index.xml |
| 119 |
|
| 120 |
# Tex files |
| 121 |
%.tex: %/index.xml xslt/latex.xsl |
| 122 |
@echo "Generating $@..." |
| 123 |
@mkdir -p $(@D) |
| 124 |
@$(DBLATEX) $(DBLATEX_OPTIONS) -t tex -o $@ $< |
| 125 |
|
| 126 |
# Dependency files |
| 127 |
%.d: $(DOCBOOKDIR)/%.xml xslt/generate-dependencies.xsl $(XSLTPROC_DEPS) |
| 128 |
@echo "Generating dependency file for $*" |
| 129 |
@$(XSLTPROC) --novalid \ |
| 130 |
--stringparam target "$*" \ |
| 131 |
-o $@ xslt/generate-dependencies.xsl $< |
| 132 |
@echo "$*-images-latex-eps: \$$(addsuffix .eps, \$$($*-images-latex))" >> $@ |
| 133 |
|
| 134 |
@echo >> $@ |
| 135 |
@echo "\$$(HTMLDIR)/%: $*/%" >> $@ |
| 136 |
@echo " @mkdir -p \$$(@D)" >> $@ |
| 137 |
@echo " @cp \$$< \$$@" >> $@ |
| 138 |
@echo >> $@ |
| 139 |
@echo "\$$(HTMLDIR)/$*/%: $*/%" >> $@ |
| 140 |
@echo " @mkdir -p \$$(@D)" >> $@ |
| 141 |
@echo " @cp \$$< \$$@" >> $@ |
| 142 |
@echo >> $@ |
| 143 |
@echo "\$$(HTMLHELPDIR)/$*/%: $*/%" >> $@ |
| 144 |
@echo " @mkdir -p \$$(@D)" >> $@ |
| 145 |
@echo " @cp \$$< \$$@" >> $@ |
| 146 |
@echo >> $@ |
| 147 |
@echo "$*-images-html-single: \$$(addprefix \$$(HTMLDIR)/, \$$($*-images-html))" >> $@ |
| 148 |
@echo "$*-images-html-chunks: \$$(addprefix \$$(HTMLDIR)/$*/, \$$($*-images-html))" >> $@ |
| 149 |
@echo "$*-images-htmlhelp: \$$(addprefix \$$(HTMLHELPDIR)/$*/, \$$($*-images-html))" >> $@ |
| 150 |
|
| 151 |
ifdef OUTPUTDIR |
| 152 |
ifneq ($(MAKECMDGOALS),clobber) |
| 153 |
-include $(addsuffix .d,$(MAIN_DOCS)) |
| 154 |
endif |
| 155 |
endif |
| 156 |
|
| 157 |
# Adobe PDF files |
| 158 |
$(PDFDIR)/%.pdf: %/index.xml $(PDFDIR) xslt/latex.xsl %-images-latex-png %-images-latex-pdf |
| 159 |
$(DBLATEX) $(DBLATEX_OPTIONS) -I $*/images -t pdf -o $@ $< |
| 160 |
|
| 161 |
# PostScript files |
| 162 |
$(PSDIR)/%.ps: %/index.xml $(PSDIR) xslt/latex.xsl %-images-latex-eps |
| 163 |
$(DBLATEX) $(DBLATEX_OPTIONS) -I $*/images -t ps -o $@ $< |
| 164 |
|
| 165 |
%.eps: %.png |
| 166 |
$(PNGTOPNM) $< | $(PNMTOPS) > $@ |
| 167 |
|
| 168 |
$(HTMLHELPDIR)/%: $(DOCBOOKDIR)/%.xml %-images-htmlhelp $(XSLTPROC_DEPS) |
| 169 |
$(XSLTPROC) --stringparam htmlhelp.chm $*.chm \ |
| 170 |
--stringparam manifest.in.base.dir "$@/" \ |
| 171 |
--stringparam base.dir "$@/" \ |
| 172 |
http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl $< |
| 173 |
|
| 174 |
# Manpages |
| 175 |
$(MANPAGEDIR)/smb.conf.5.xml: parameters |
| 176 |
|
| 177 |
# The phony parameters target exists in order to always create the |
| 178 |
# the parameters xml files. Otherwise, when parameters.*.xml does not exist |
| 179 |
# yet, the parameters are not generated when smb.conf.5.xml is newer than |
| 180 |
# any smbdotconf/*/*.xml file ... |
| 181 |
.PHONY: parameters pathconf |
| 182 |
|
| 183 |
parameters: $(SMBDOTCONFDOC)/parameters.all.xml |
| 184 |
|
| 185 |
pathconf: build/DTD/samba.build.pathconfig |
| 186 |
|
| 187 |
$(SMBDOTCONFDOC)/parameters.all.xml: $(wildcard $(SMBDOTCONFDOC)/*/*.xml) $(SMBDOTCONFDOC)/generate-file-list.sh |
| 188 |
$(SMBDOTCONFDOC)/generate-file-list.sh $(SMBDOTCONFDOC) > $@ |
| 189 |
|
| 190 |
build/DTD/samba.build.pathconfig: generate-pathconf-entities.sh |
| 191 |
./generate-pathconf-entities.sh > $@ |
| 192 |
|
| 193 |
$(OUTPUTDIR): |
| 194 |
test -d $@ || mkdir $@ |
| 195 |
|
| 196 |
$(OUTPUTDIR)/%: $(DOCBOOKDIR)/%.xml xslt/man.xsl |
| 197 |
@mkdir -p $(@D) |
| 198 |
$(XSLTPROC) --output $@ xslt/man.xsl $< |
| 199 |
|
| 200 |
# Individual smb.conf parameters |
| 201 |
smb.conf-chunks: $(patsubst $(SMBDOTCONFDOC)/%.xml,$(HTMLDIR)/smb.conf/%.html,$(wildcard $(SMBDOTCONFDOC)/*/*.xml)) |
| 202 |
|
| 203 |
$(HTMLDIR)/smb.conf/%.html: $(SMBDOTCONFDOC)/%.xml |
| 204 |
@mkdir -p $(@D) |
| 205 |
$(XSLTPROC) --output $@ xslt/smb.conf-html.xsl $< |
| 206 |
|
| 207 |
# Validation verification |
| 208 |
%-validate: %/index.xml |
| 209 |
cd $(<D) && $(XMLLINT) --xinclude --noent --postvalid --noout $(<F) |
| 210 |
|
| 211 |
build/catalog.xml: build/catalog.xml.in |
| 212 |
sed -e "s|@abs_top_srcdir@|`pwd`|g;s|@abs_top_builddir@|`pwd`|g" < build/catalog.xml.in > build/catalog.xml |
| 213 |
|
| 214 |
# XSL scripts |
| 215 |
xslt/html.xsl: xslt/html-common.xsl |
| 216 |
xslt/html-chunk.xsl: xslt/html-common.xsl |
| 217 |
xslt/latex.xsl: |
| 218 |
xslt/expand-sambadoc.xsl: |
| 219 |
xslt/generate-attributions.xsl: |
| 220 |
xslt/man.xsl: |
| 221 |
|
| 222 |
distclean clobber:: clean |
| 223 |
rm -f Makefile.settings config.status config.log |
| 224 |
|
| 225 |
realdistclean:: distclean |
| 226 |
rm -f configure |
| 227 |
rm -rf autom4te.cache |
| 228 |
rm -rf output |
| 229 |
|
| 230 |
# Always keep intermediate files if we can |
| 231 |
.SECONDARY: |
| 232 |
.PHONY: clean clobber release everything all |