build-sys: improve asciidoc rules to allow multiple targets

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Marc-André Lureau 2019-01-11 22:14:24 +04:00
parent 96700c849d
commit 57f2c61712
2 changed files with 24 additions and 14 deletions

View File

@ -1,18 +1,26 @@
NULL =
ASCIIDOC_FLAGS = -a icons -a toc
CLEANFILES =
EXTRA_DIST = \
meson.build \
ASCIIDOC_FILES = \
spice_protocol.txt \
$(NULL)
if BUILD_HTML_MANUAL
all-local: spice_protocol.html
ASCIIDOC_FLAGS = -n -a icons -a toc
spice_protocol.html: spice_protocol.txt
$(AM_V_GEN) $(ASCIIDOC) -n $(ASCIIDOC_FLAGS) -o $@ $<
EXTRA_DIST = \
$(ASCIIDOC_FILES) \
meson.build \
$(NULL)
if BUILD_HTML_MANUAL
ASCIIDOC_HTML = $(ASCIIDOC_FILES:.txt=.html)
CLEANFILES += $(ASCIIDOC_HTML)
all-local: $(ASCIIDOC_HTML)
.txt.html:
$(AM_V_GEN)$(ASCIIDOC) $(ASCIIDOC_FLAGS) -o $@ $<
endif
CLEANFILES = spice_protocol.html
-include $(top_srcdir)/git.mk

View File

@ -1,10 +1,12 @@
if get_option('manual')
asciidoc = find_program('asciidoc', required : false)
if asciidoc.found()
custom_target('spice_protocol.html',
input : files('spice_protocol.txt'),
output : 'spice_protocol.html',
build_by_default : true,
command : [asciidoc, '-n', '-a', 'icons', '-a', 'toc', '-o', '@OUTPUT@', '@INPUT@'])
foreach f: ['spice_protocol.txt']
custom_target('HTML for @0@'.format(f),
input : f,
output : '@BASENAME@.html',
build_by_default : true,
command : [asciidoc, '-n', '-a', 'icons', '-a', 'toc', '-o', '@OUTPUT@', '@INPUT@'])
endforeach
endif
endif