3 # Copyright(c) 2010-2012 Intel Corporation. All rights reserved.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
10 # * Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # * Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in
14 # the documentation and/or other materials provided with the
16 # * Neither the name of Intel Corporation nor the names of its
17 # contributors may be used to endorse or promote products derived
18 # from this software without specific prior written permission.
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 $(error "must be called from RTE root Makefile")
39 $(error "must be called from RTE root Makefile")
42 VPATH = $(abspath $(BASEDOCDIR)/$(DOCDIR))
44 pngfiles = $(patsubst %.svg,%.png,$(SVG))
45 pdfimgfiles = $(patsubst %.svg,%.pdf,$(SVG))
46 pdffiles = $(patsubst %.rst,%.pdf,$(RST))
50 compare = $(strip $(subst $(1),,$(2)) $(subst $(2),,$(1)))
51 dirname = $(patsubst %/,%,$(dir $1))
53 # windows only: this is needed for native programs that do not handle
54 # unix-like paths on win32
56 winpath = "$(shell cygpath --windows $(abspath $(1)))"
61 all doc: $(pngfiles) $(pdffiles) $(DIRS)
64 pdfdoc: $(pngfiles) $(pdffiles) $(DIRS)
67 doxydoc: $(pdfimgfiles) $(DIRS)
72 @[ -d $(CURDIR)/$@ ] || mkdir -p $(CURDIR)/$@
73 $(Q)$(MAKE) DOCDIR=$(DOCDIR)/$@ BASEDOCDIR=$(BASEDOCDIR)/.. \
74 -f $(RTE_SDK)/doc/$(DOCDIR)/$@/Makefile -C $(CURDIR)/$@ $(MAKECMDGOALS)
77 @echo " INKSCAPE $(@)"
78 $(Q)inkscape -d $(DEFAULT_DPI) -D -b ffffff -y 1.0 -e $(call winpath,$(@)) $(call winpath,$(<))
81 @echo " INKSCAPE $(@)"
82 $(Q)inkscape -d $(DEFAULT_DPI) -D -b ffffff -y 1.0 -A $(call winpath,$(@)) $(call winpath,$(<))
85 $(foreach f,$(RST),$(eval DEP_$(f:%.rst=%.html) = $(DEP_$(f))))
86 %.html: %.rst $$(DEP_$$@)
87 @echo " RST2HTML $(@)"
88 $(Q)mkdir -p `dirname $(@)` ; \
89 python $(BASEDOCDIR)/gen/gen-common.py html $(BASEDOCDIR) > $(BASEDOCDIR)/gen/rte.rst ; \
90 python $(BASEDOCDIR)/html/rst2html-highlight.py --link-stylesheet \
91 --stylesheet-path=$(BASEDOCDIR)/html/rte.css \
92 --strip-comments< $(<) > $(@) ; \
94 # there is a bug in rst2pdf (issue 311): replacement of DSTDIR is not
95 # what we expect: we should not have to add doc/
97 WORKAROUND_PATH=$(BASEDOCDIR)
99 WORKAROUND_PATH=$(BASEDOCDIR)/doc
103 $(foreach f,$(RST),$(eval DEP_$(f:%.rst=%.pdf) = $(DEP_$(f))))
104 %.pdf: %.rst $$(DEP_$$@)
105 @echo " RST2PDF $(@)"
106 $(Q)mkdir -p `dirname $(@)` ; \
107 python $(BASEDOCDIR)/gen/gen-common.py pdf $(BASEDOCDIR) > $(BASEDOCDIR)/gen/rte.rst ; \
108 rst2pdf -s $(BASEDOCDIR)/pdf/rte-stylesheet.json \
109 --default-dpi=300 < $(<) > $(@)
111 CLEANDIRS = $(addsuffix _clean,$(DIRS))
113 docclean clean: $(CLEANDIRS)
114 @rm -f $(htmlfiles) $(pdffiles) $(pngfiles) $(pdfimgfiles) $(BASEDOCDIR)/gen/rte.rst
117 @if [ -f $(RTE_SDK)/doc/$(DOCDIR)/$*/Makefile -a -d $(CURDIR)/$* ]; then \
118 $(MAKE) DOCDIR=$(DOCDIR)/$* BASEDOCDIR=$(BASEDOCDIR)/.. \
119 -f $(RTE_SDK)/doc/$(DOCDIR)/$*/Makefile -C $(CURDIR)/$* clean ; \