From: Michael Smith Date: Sat, 18 Mar 2006 06:49:25 +0000 (+0000) Subject: Use XSLT to check if a DocBook source file contains a Refentry X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c993a143de313c9c3ee574cfc3893d836fb7702;p=docbook-dsssl Use XSLT to check if a DocBook source file contains a Refentry (instead of using hacky "cat" check). --- diff --git a/contrib/tools/make/Makefile.DocBook b/contrib/tools/make/Makefile.DocBook index 48b44ba8e..60d4685fc 100644 --- a/contrib/tools/make/Makefile.DocBook +++ b/contrib/tools/make/Makefile.DocBook @@ -197,6 +197,19 @@ FILES_MAN = $(shell for manifest in $(LISTS_MAN); do if [ -f "$$manifest" ]; t FILES_MANP = $(foreach base,$(FILES_MAN),$(base).pdf) FILES_MANT = $(foreach base,$(FILES_MAN),$(base).txt) +# ----------------------------------------------------------------- +# ** stylesheet for testing whether a file has a refentry +# ----------------------------------------------------------------- +REFENTRY_CHECK := \ + \ + \ + \ + true \ + \ + \ + + # ----------------------------------------------------------------- # ** Stylesheet Customization Layers ** # ----------------------------------------------------------------- @@ -467,17 +480,16 @@ endif # pattern rule for making man pages # ----------------------------------------------------------------- %.$(MAN_MANIFEST_EXT): %.xml - mkdir $(DOCBOOK_TMP) - echo '$(MAN_CUSTOM)' > $(DOCBOOK_TMP)/man.xsl - $(XSLT) $(XSLT_FLAGS) $(STRIP_NS) $< | $(XSLT) $(XSLT_FLAGS) $(MAN_PARAMS) \ - --stringparam man.manifest.filename $@ \ - $(DOCBOOK_TMP)/man.xsl \ - - \ - 2>&1 | tee $(MAN_LOG); - if [ "`cat $(MAN_LOG)`" == "No refentry elements!" ]; then \ + if [ "$(strip $(shell echo '$(REFENTRY_CHECK)' | $(XSLT) $(XSLT_FLAGS) - $<))" != "true" ]; then \ touch $@; \ - fi; - $(RM) -r $(DOCBOOK_TMP) + else \ + mkdir $(DOCBOOK_TMP); \ + echo '$(MAN_CUSTOM)' > $(DOCBOOK_TMP)/man.xsl; \ + $(XSLT) $(XSLT_FLAGS) $(STRIP_NS) $< | $(XSLT) $(XSLT_FLAGS) $(MAN_PARAMS) \ + --stringparam man.manifest.filename $@ \ + $(DOCBOOK_TMP)/man.xsl - ; \ + $(RM) -r $(DOCBOOK_TMP); \ + fi # ----------------------------------------------------------------- # pattern rule for enabling direct "make foo.1" to work