[gnutls-devel] [PATCH 5/5] Fix build failures involving doc/invoke-*.texi

Kevin Cernekee cernekee at gmail.com
Fri Mar 7 07:35:09 CET 2014


Several problems were found in this area:

1) Currently, if SRC_DEF_* are undefined, autogen will get invoked with
no input file and it will hang forever waiting for content from stdin:

    mv -f enums.texi-tmp enums.texi
    mkdir enums
    ../../doc/scripts/split-texi.pl enums enum < enums.texi
    echo stamp_enums > stamp_enums
    cd ../src/ && autogen -Tagtexi-cmd.tpl  && \
        rm -f ../doc/invoke-gnutls-cli.texi && \
        ../doc/scripts/cleanup-autogen.pl <../src/invoke-gnutls-cli.texi >../doc/invoke-gnutls-cli.texi.tmp && \
        mv -f ../doc/invoke-gnutls-cli.texi.tmp ../doc/invoke-gnutls-cli.texi && \
        rm -f ../src/invoke-gnutls-cli.texi
    <HANG>

Since these documents are @include'd by other documents, it is probably
a good idea to make sure the targets are buildable in case they get
listed as prerequisites.

2) SRC_DEF_* used relative paths which are correct for an in-place build,
but incorrect for an out-of-tree build.  They should use something like
$(top_srcdir)/src to resolve the ambiguity.

3) cleanup-autogen.pl was also referenced using a relative pathname,
breaking out-of-tree builds.

4) Copy&paste targets that could be replaced with simple patterns.

Signed-off-by: Kevin Cernekee <cernekee at gmail.com>
---
 doc/Makefile.am | 141 ++++++++++++--------------------------------------------
 1 file changed, 30 insertions(+), 111 deletions(-)

diff --git a/doc/Makefile.am b/doc/Makefile.am
index 7c33cfa..a876845 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -32,112 +32,36 @@ endif
 -include $(top_srcdir)/doc/doc.mk
 
 
-SRC_DEF_CLI = 
-SRC_DEF_CLI_DEBUG = 
-SRC_DEF_SERV = 
-SRC_DEF_CERTTOOL = 
-SRC_DEF_OCSPTOOL = 
-SRC_DEF_DANETOOL = 
-SRC_DEF_SRPTOOL = 
-SRC_DEF_PSKTOOL = 
-SRC_DEF_P11TOOL = 
-SRC_DEF_TPMTOOL = 
-if WANT_TEST_SUITE
-SRC_DEF_CLI += ../src/cli-args.def
-SRC_DEF_CLI_DEBUG += ../src/cli-debug-args.def
-SRC_DEF_SERV += ../src/serv-args.def
-SRC_DEF_CERTTOOL += ../src/certtool-args.def
-SRC_DEF_OCSPTOOL += ../src/ocsptool-args.def
-SRC_DEF_DANETOOL += ../src/danetool-args.def
-SRC_DEF_SRPTOOL += ../src/srptool-args.def
-SRC_DEF_PSKTOOL += ../src/psk-args.def
-SRC_DEF_P11TOOL += ../src/p11tool-args.def
-SRC_DEF_TPMTOOL += ../src/tpmtool-args.def
-endif
-
-invoke-gnutls-cli.texi: $(SRC_DEF_CLI)
-	-cd ../src/ && $(AUTOGEN) -Tagtexi-cmd.tpl $< && \
-	rm -f ../doc/$@ && \
-	../doc/scripts/cleanup-autogen.pl <../src/$@ >../doc/$@.tmp && \
-	mv -f ../doc/$@.tmp ../doc/$@ && \
-	rm -f ../src/$@
-
-invoke-gnutls-cli-debug.texi: $(SRC_DEF_CLI_DEBUG) invoke-gnutls-cli.texi
-	-cd ../src/ && $(AUTOGEN) -Tagtexi-cmd.tpl $< && \
-	rm -f ../doc/$@ && \
-	../doc/scripts/cleanup-autogen.pl <../src/$@ >../doc/$@.tmp && \
-	mv -f ../doc/$@.tmp ../doc/$@ && \
-	rm -f ../src/$@
-
-invoke-gnutls-serv.texi: $(SRC_DEF_SERV) invoke-gnutls-cli-debug.texi
-	-cd ../src/ && $(AUTOGEN) -Tagtexi-cmd.tpl $< && \
-	rm -f ../doc/$@ && \
-	../doc/scripts/cleanup-autogen.pl <../src/$@ >../doc/$@.tmp && \
-	mv -f ../doc/$@.tmp ../doc/$@ && \
-	rm -f ../src/$@
-
-invoke-certtool.texi: $(SRC_DEF_CERTTOOL) invoke-gnutls-serv.texi
-	-cd ../src/ && $(AUTOGEN) -Tagtexi-cmd.tpl $< && \
-	rm -f ../doc/$@ && \
-	../doc/scripts/cleanup-autogen.pl <../src/$@ >../doc/$@.tmp && \
-	mv -f ../doc/$@.tmp ../doc/$@ && \
-	rm -f ../src/$@ && \
-	sed -i 's/@subheading/@subsubheading/g' ../doc/$@ && \
-	sed -i 's/@section/@subsection/g' ../doc/$@
-
-invoke-ocsptool.texi: $(SRC_DEF_OCSPTOOL) invoke-certtool.texi
-	-cd ../src/ && $(AUTOGEN) -Tagtexi-cmd.tpl $< && \
-	rm -f ../doc/$@ && \
-	../doc/scripts/cleanup-autogen.pl <../src/$@ >../doc/$@.tmp && \
-	mv -f ../doc/$@.tmp ../doc/$@ && \
-	rm -f ../src/$@ && \
-	sed -i 's/@subheading/@subsubheading/g' ../doc/$@ && \
-	sed -i 's/@section/@subsection/g' ../doc/$@
-
-invoke-danetool.texi: $(SRC_DEF_DANETOOL) invoke-ocsptool.texi
-	-cd ../src/ && $(AUTOGEN) -Tagtexi-cmd.tpl $< && \
-	rm -f ../doc/$@ && \
-	../doc/scripts/cleanup-autogen.pl <../src/$@ >../doc/$@.tmp && \
-	mv -f ../doc/$@.tmp ../doc/$@ && \
-	rm -f ../src/$@ && \
-	sed -i 's/@subheading/@subsubheading/g' ../doc/$@ && \
-	sed -i 's/@section/@subsection/g' ../doc/$@
-
-invoke-srptool.texi: $(SRC_DEF_SRPTOOL) invoke-danetool.texi
-	-cd ../src/ && $(AUTOGEN) -Tagtexi-cmd.tpl $< && \
-	rm -f ../doc/$@ && \
-	../doc/scripts/cleanup-autogen.pl <../src/$@ >../doc/$@.tmp && \
-	mv -f ../doc/$@.tmp ../doc/$@ && \
-	rm -f ../src/$@ && \
-	sed -i 's/@subheading/@subsubheading/g' ../doc/$@ && \
-	sed -i 's/@section/@subsubsection/g' ../doc/$@
-
-invoke-psktool.texi: $(SRC_DEF_PSKTOOL) invoke-srptool.texi
-	-cd ../src/ && $(AUTOGEN) -Tagtexi-cmd.tpl $< && \
-	rm -f ../doc/$@ && \
-	../doc/scripts/cleanup-autogen.pl <../src/$@ >../doc/$@.tmp && \
-	mv -f ../doc/$@.tmp ../doc/$@ && \
-	rm -f ../src/$@ && \
-	sed -i 's/@subheading/@subsubheading/g' ../doc/$@ && \
-	sed -i 's/@section/@subsubsection/g' ../doc/$@
-
-invoke-p11tool.texi: $(SRC_DEF_P11TOOL) invoke-psktool.texi
-	-cd ../src/ && $(AUTOGEN) -Tagtexi-cmd.tpl $< && \
-	rm -f ../doc/$@ && \
-	../doc/scripts/cleanup-autogen.pl <../src/$@ >../doc/$@.tmp && \
-	mv -f ../doc/$@.tmp ../doc/$@ && \
-	rm -f ../src/$@ && \
-	sed -i 's/@subheading/@subsubheading/g' ../doc/$@ && \
-	sed -i 's/@section/@subsection/g' ../doc/$@
-
-invoke-tpmtool.texi: $(SRC_DEF_TPMTOOL) invoke-p11tool.texi
-	-cd ../src/ && $(AUTOGEN) -Tagtexi-cmd.tpl $< && \
-	rm -f ../doc/$@ && \
-	../doc/scripts/cleanup-autogen.pl <../src/$@ >../doc/$@.tmp && \
-	mv -f ../doc/$@.tmp ../doc/$@ && \
-	rm -f ../src/$@ && \
-	sed -i 's/@subheading/@subsubheading/g' ../doc/$@ && \
-	sed -i 's/@section/@subsection/g' ../doc/$@
+AUTOGENED_GNUTLS_DOC = invoke-gnutls-cli.texi invoke-gnutls-cli-debug.texi \
+	invoke-gnutls-serv.texi
+AUTOGENED_UTIL0_DOC = invoke-certtool.texi invoke-ocsptool.texi \
+	invoke-p11tool.texi invoke-tpmtool.texi invoke-danetool.texi
+AUTOGENED_UTIL1_DOC = invoke-psktool.texi invoke-srptool.texi
+
+AUTOGENED_DOC = $(AUTOGENED_GNUTLS_DOC) $(AUTOGENED_UTIL0_DOC) \
+	$(AUTOGENED_UTIL1_DOC)
+
+# $(AUTOGEN) could be /bin/true.  If so, just use the shipped texi file.
+autogen_common = \
+	$(AUTOGEN) -Tagtexi-cmd.tpl $1; \
+	if [ ! -e $2 ]; then \
+		cp $(srcdir)/$2 .; \
+	fi; \
+	$(srcdir)/scripts/cleanup-autogen.pl < $2 > $2.tmp && \
+	mv -f $2.tmp $2
+
+$(AUTOGENED_GNUTLS_DOC) : invoke-gnutls-%.texi : $(top_srcdir)/src/%-args.def
+	$(call autogen_common,$<,$@)
+
+$(AUTOGENED_UTIL0_DOC) : invoke-%.texi : $(top_srcdir)/src/%-args.def
+	$(call autogen_common,$<,$@) && \
+		sed -i 's/@subheading/@subsubheading/g' $@ && \
+		sed -i 's/@section/@subsection/g' $@
+
+$(AUTOGENED_UTIL1_DOC) : invoke-%.texi : $(top_srcdir)/src/%-args.def
+	$(call autogen_common,$<,$@) && \
+		sed -i 's/@subheading/@subsubheading/g' $@ && \
+		sed -i 's/@section/@subsubsection/g' $@
 
 info_TEXINFOS = gnutls.texi gnutls-guile.texi
 gnutls_TEXINFOS = gnutls.texi fdl-1.3.texi				\
@@ -149,11 +73,6 @@ gnutls_TEXINFOS = gnutls.texi fdl-1.3.texi				\
 	cha-shared-key.texi cha-gtls-examples.texi cha-upgrade.texi 	\
 	cha-tokens.texi cha-crypto.texi cha-auth.texi
 
-AUTOGENED_DOC = invoke-gnutls-cli.texi invoke-gnutls-cli-debug.texi \
-	invoke-gnutls-serv.texi invoke-certtool.texi invoke-srptool.texi \
-	invoke-ocsptool.texi invoke-psktool.texi invoke-p11tool.texi \
-	invoke-tpmtool.texi invoke-danetool.texi
-
 gnutls_TEXINFOS += stamp_functions
 
 # Examples.
-- 
1.8.3.2




More information about the Gnutls-devel mailing list