From 5c19b1f0a67a0bb737c87a374f6e1cd0fb51e1f0 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 28 Jun 2021 16:49:45 +0530 Subject: Makefile: Build workflow images. * configure.ac: Search for cwltool, dot and sed. * Makefile.am (DOC_IMAGES): New variable. ($(SKRIBILO_BUILD_DIR)/%.cwl, %.dot, %.svg): New rules. ($(SKRIBILO_BUILD_DIR)/ccwl.info): Depend on $(DOC_IMAGES). ($(SKRIBILO_BUILD_DIR)/ccwl.html): Depend on $(DOC_IMAGES). Build HTML into a directory. Copy $(DOC_IMAGES) into that directory. --- Makefile.am | 26 ++++++++++++++++++++------ configure.ac | 3 +++ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index d7c0823..b23a302 100644 --- a/Makefile.am +++ b/Makefile.am @@ -66,6 +66,19 @@ EXTRA_DIST += \ # Build documentation SKRIBILO_BUILD_DIR = $(srcdir)/doc/skribilo +DOC_IMAGES = $(addprefix $(SKRIBILO_BUILD_DIR)/,) + +$(SKRIBILO_BUILD_DIR)/%.cwl: doc/%.scm + $(MKDIR_P) $(SKRIBILO_BUILD_DIR) + $(AM_V_GEN)$(top_builddir)/pre-inst-env ccwl compile $< > $@ + +# Print out graph for graphviz's dot, but remove file path prefix from +# workflow step identifiers. +%.dot: %.cwl + $(CWLTOOL) --print-dot $< | $(SED) 's/file:[^#]*#//g' > $@ + +%.svg: %.dot + $(DOT) -Tsvg -o$@ $< # The info and html targets depend on the info-local and html-local # targets respectively. So, we use them to extend the info and html @@ -73,13 +86,15 @@ SKRIBILO_BUILD_DIR = $(srcdir)/doc/skribilo info-local: $(SKRIBILO_BUILD_DIR)/ccwl.info html-local: $(SKRIBILO_BUILD_DIR)/ccwl.html -$(SKRIBILO_BUILD_DIR)/ccwl.info: doc/ccwl.skb ccwl/skribilo.scm +$(SKRIBILO_BUILD_DIR)/ccwl.info: doc/ccwl.skb ccwl/skribilo.scm $(DOC_IMAGES) $(MKDIR_P) $(SKRIBILO_BUILD_DIR) $(AM_V_GEN)$(top_builddir)/pre-inst-env $(SKRIBILO) -t info $< -o $@ -$(SKRIBILO_BUILD_DIR)/ccwl.html: doc/ccwl.skb ccwl/skribilo.scm - $(MKDIR_P) $(SKRIBILO_BUILD_DIR) - $(AM_V_GEN)$(top_builddir)/pre-inst-env $(SKRIBILO) -t html $< -o $@ +$(SKRIBILO_BUILD_DIR)/ccwl.html: doc/ccwl.skb ccwl/skribilo.scm $(DOC_IMAGES) + rm -rf $@ + $(MKDIR_P) $@ + $(AM_V_GEN)$(top_builddir)/pre-inst-env $(SKRIBILO) -t html $< -o $@/index.html + cp -vr $(DOC_IMAGES) $@ install-data-local: install-info-local @@ -104,8 +119,7 @@ website/index.html: README.org website/manual/dev/en: $(SKRIBILO_BUILD_DIR)/ccwl.html rm -rf $@ - $(MKDIR_P) $@ - cp -v $< $@/index.html + cp -vr $< $@ # The clean target depends on clean-local. We use clean-local to clean # up the website and the skribilo build directory. diff --git a/configure.ac b/configure.ac index d75c699..e40d794 100644 --- a/configure.ac +++ b/configure.ac @@ -23,6 +23,9 @@ AM_SILENT_RULES([yes]) GUILE_PKG([3.0 2.2]) GUILE_PROGS +AC_PROG_SED +AC_PATH_PROG([DOT], [dot]) +AC_PATH_PROG([CWLTOOL], [cwltool]) AC_PATH_PROG([EMACS], [emacs]) AC_PATH_PROG([SKRIBILO], [skribilo]) -- cgit v1.2.3