From 57f2c61712d575be720d9c3380d2ca2f8ebfb5ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 11 Jan 2019 22:14:24 +0400 Subject: [PATCH] build-sys: improve asciidoc rules to allow multiple targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau Acked-by: Frediano Ziglio --- docs/Makefile.am | 26 +++++++++++++++++--------- docs/meson.build | 12 +++++++----- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/docs/Makefile.am b/docs/Makefile.am index 421e5f9..e7e126b 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -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 diff --git a/docs/meson.build b/docs/meson.build index 5e10d76..8901762 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -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