getting_oe.xml: Update getting openembedded section.
[openembedded.git] / docs / usermanual / Makefile
1 topdir = .
2 manual = $(topdir)/usermanual.xml
3 # types = pdf txt rtf ps xhtml html man tex texi dvi
4 # types = pdf txt
5 types = $(xmltotypes) $(htmltypes) $(docbooktotypes)
6 xmltotypes = 
7 docbooktotypes = dvi pdf ps rtf tex texi txt
8 htmltypes = html xhtml
9 htmlxsl = $(if $(filter $@,$(foreach type,$(htmltypes),$(type)-nochunks)),docbook-utf8.xsl,http://docbook.sourceforge.net/release/xsl/current/$@/chunk.xsl)
10 htmlcssfile = docbook.css
11 htmlcss = $(topdir)/html.css
12 # htmlcssfile =
13 # htmlcss =
14 cleanfiles = $(foreach i,$(types),$(topdir)/$(i))
15
16 ifdef DEBUG
17 define command
18         $(1)
19 endef
20 else
21 define command
22         @echo $(2) $(3) $(4)
23         @$(1) >/dev/null
24 endef
25 endif
26
27 all: $(types)
28
29 lint: $(manual) FORCE
30         $(call command,xmllint --xinclude --postvalid --noout $(manual),XMLLINT $(manual))
31
32 $(types) $(foreach type,$(htmltypes),$(type)-nochunks): lint FORCE
33
34 $(foreach type,$(htmltypes),$(type)-nochunks): $(if $(htmlcss),$(htmlcss)) $(manual)
35         @mkdir -p $@
36 ifdef htmlcss
37         $(call command,install -m 0644 $(htmlcss) $@/$(htmlcssfile),CP $(htmlcss) $@/$(htmlcssfile))
38 endif
39         $(call command,xsltproc --stringparam base.dir $@/ $(if $(htmlcssfile),--stringparam html.stylesheet $(htmlcssfile)) $(htmlxsl) $(manual) > $@/index.$(patsubst %-nochunks,%,$@),XSLTPROC $@ $(manual))
40
41 $(htmltypes): $(if $(htmlcss),$(htmlcss)) $(manual)
42         @mkdir -p $@
43 ifdef htmlcss
44         $(call command,install -m 0644 $(htmlcss) $@/$(htmlcssfile),CP $(htmlcss) $@/$(htmlcssfile))
45 endif
46         $(call command,xsltproc --param use.id.as.filename 1 --stringparam base.dir $@/ $(if $(htmlcssfile),--stringparam html.stylesheet $(htmlcssfile)) $(htmlxsl) $(manual),XSLTPROC $@ $(manual))
47
48 $(xmltotypes): $(manual)
49         $(call command,xmlto --extensions -o $(topdir)/$@ $@ $(manual),XMLTO $@ $(manual))
50
51 $(docbooktotypes): $(manual)
52         $(call command,docbook2$@ $(manual),DOCBOOK2 $@ $(manual))
53
54 clean:
55         rm -rf $(cleanfiles)
56
57 $(foreach i,$(types) $(foreach type,$(htmltypes),$(type)-nochunks),clean-$(i)):
58         rm -rf $(patsubst clean-%,%,$@)
59
60 FORCE: