[Spice-devel] [PATCH spice-common 2/3] build-sys: improve asciidoc rules to allow multiple targets

marcandre.lureau at redhat.com marcandre.lureau at redhat.com
Fri Jan 11 19:07:13 UTC 2019


From: Marc-André Lureau <marcandre.lureau at redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
 docs/Makefile.am | 22 +++++++++++++++-------
 docs/meson.build | 12 +++++++-----
 2 files changed, 22 insertions(+), 12 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 =
+
+ASCIIDOC_FILES =				\
+	spice_protocol.txt			\
+	$(NULL)
+
+ASCIIDOC_FLAGS = -n -a icons -a toc
 
 EXTRA_DIST =					\
+	$(ASCIIDOC_FILES)			\
 	meson.build				\
-	spice_protocol.txt			\
 	$(NULL)
 
 if BUILD_HTML_MANUAL
-all-local: spice_protocol.html
+ASCIIDOC_HTML = $(ASCIIDOC_FILES:.txt=.html)
 
-spice_protocol.html: spice_protocol.txt
-	$(AM_V_GEN) $(ASCIIDOC) -n $(ASCIIDOC_FLAGS) -o $@ $<
-endif
+CLEANFILES += $(ASCIIDOC_HTML)
 
-CLEANFILES = spice_protocol.html
+all-local: $(ASCIIDOC_HTML)
+
+.txt.html:
+	$(AM_V_GEN)$(ASCIIDOC) $(ASCIIDOC_FLAGS) -o $@ $<
+endif
 
 -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 at .html',
+                    build_by_default : true,
+                    command : [asciidoc, '-n', '-a', 'icons', '-a', 'toc', '-o', '@OUTPUT@', '@INPUT@'])
+    endforeach
   endif
 endif
-- 
2.20.1.98.gecbdaf0899



More information about the Spice-devel mailing list