1#
2#  Copyright (c) 2016, The OpenThread Authors.
3#  All rights reserved.
4#
5#  Redistribution and use in source and binary forms, with or without
6#  modification, are permitted provided that the following conditions are met:
7#  1. Redistributions of source code must retain the above copyright
8#     notice, this list of conditions and the following disclaimer.
9#  2. Redistributions in binary form must reproduce the above copyright
10#     notice, this list of conditions and the following disclaimer in the
11#     documentation and/or other materials provided with the distribution.
12#  3. Neither the name of the copyright holder nor the
13#     names of its contributors may be used to endorse or promote products
14#     derived from this software without specific prior written permission.
15#
16#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26#  POSSIBILITY OF SUCH DAMAGE.
27#
28
29include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
30
31EXTRA_DIST                                      = \
32    $(srcdir)/Doxyfile.in                         \
33    $(srcdir)/header.html                         \
34    $(srcdir)/images/Open-Thread-Logo-200x42.png  \
35    $(srcdir)/images/openthread_logo.png          \
36    $(srcdir)/images/ot-contrib-arm.png           \
37    $(srcdir)/images/ot-contrib-cascoda.png       \
38    $(srcdir)/images/ot-contrib-google.png        \
39    $(srcdir)/images/ot-contrib-nordic.png        \
40    $(srcdir)/images/ot-contrib-nxp.png           \
41    $(srcdir)/images/ot-contrib-qc.png            \
42    $(srcdir)/images/ot-contrib-qorvo.png         \
43    $(srcdir)/images/ot-contrib-samsung.png       \
44    $(srcdir)/images/ot-contrib-silabs.png        \
45    $(srcdir)/images/ot-contrib-stm.png           \
46    $(srcdir)/images/ot-contrib-synopsys.png      \
47    $(srcdir)/images/ot-contrib-ti.png            \
48    $(srcdir)/images/ot-contrib-zephyr.png        \
49    $(srcdir)/ot_api_doc.h                        \
50    $(NULL)
51
52#
53# Override autotool's default notion of the package version variables.
54# This ensures that when we create a doc distribution that the
55# version is always the current version, not the version when the
56# package was bootstrapped.
57#
58PACKAGE_VERSION                                 = $(shell cat $(top_builddir)/.local-version)
59VERSION                                         = $(PACKAGE_VERSION)
60
61
62docdistdir                                     ?= .
63
64openthread_docdist_alias                        = \
65    $(PACKAGE_TARNAME)-docs
66
67openthread_docdist_name                         = \
68    $(openthread_docdist_alias)-$(VERSION)
69
70openthread_docdist_archive                      = \
71    $(docdistdir)/$(openthread_docdist_name).tar.gz
72
73CLEANFILES                                      = \
74    Doxyfile                                      \
75    $(openthread_docdist_archive)                 \
76    $(NULL)
77
78if OPENTHREAD_BUILD_DOCS
79
80openthreaddir = $(includedir)/openthread
81dist_openthread_HEADERS = ot_api_doc.h
82
83all-local: html/index.html
84
85#
86# We choose to manually transform Doxyfile.in into Doxyfile here in
87# the makefile rather than in the configure script so that we can take
88# advantage of live, at build time (rather than at configure time),
89# updating of the package version number.
90#
91
92Doxyfile: $(srcdir)/Doxyfile.in Makefile
93	$(AM_V_GEN)$(SED)                                     \
94	    -e "s,\@DOXYGEN_USE_DOT\@,$(DOXYGEN_USE_DOT),g"   \
95	    -e "s,\@PACKAGE_NAME\@,$(PACKAGE_NAME),g"         \
96	    -e "s,\@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g"   \
97	    -e "s,\@PERL\@,$(PERL),g"                         \
98	    -e "s,\@abs_builddir\@,$(abs_builddir),g"         \
99	    -e "s,\@abs_srcdir\@,$(abs_srcdir),g"             \
100	    -e "s,\@abs_top_builddir\@,$(abs_top_builddir),g" \
101	    -e "s,\@abs_top_srcdir\@,$(abs_top_srcdir),g"     \
102	    < "$(srcdir)/Doxyfile.in" > "$(@)"
103
104html/index.html: Doxyfile
105	$(AM_V_GEN)$(DOXYGEN) $(<)
106
107#
108# Addition rules and commands to create a documentation-only
109# distribution of openthread
110#
111
112$(openthread_docdist_name): html/index.html
113	$(AM_V_at)rm -f -r $(@)
114	$(call create-directory)
115	$(AM_V_at)cp -R html $(@)
116
117$(openthread_docdist_archive): $(openthread_docdist_name)
118	$(AM_V_at)echo "  TAR      $(@)"
119	$(AM_V_at)tardir="$(<)" && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c > "$(@)" && rm -rf $(<)
120
121docdist $(openthread_docdist_alias): $(openthread_docdist_archive)
122
123clean-local:
124	$(AM_V_at)rm -f -r html
125
126endif # OPENTHREAD_BUILD_DOCS
127
128include $(abs_top_nlbuild_autotools_dir)/automake/post.am
129