# [PATCH] Makefile: include contrib docs in dist-doc tarballs

2 messages from 2019-06-24 to 2019-06-24. Participants: robbat2@gentoo.org, Junio C Hamano.
Thread: https://gitlist.dev/t/51367

## robbat2@gentoo.org, 2019-06-23 21:50

Subject: [PATCH] Makefile: include contrib docs in dist-doc tarballs
Message-ID: <20190623215046.24030-1-robbat2@gentoo.org>
URL: https://gitlist.dev/e/20190623215046.24030-1-robbat2%40gentoo.org

```
From: "Robin H. Johnson" <robbat2@gentoo.org>

The pre-built htmldoc/manpage tarballs do not include any documentation
from the contrib code. As a result, if you want that documentation, you
need the full documentation stack to build them.

By including the contrib docs in the tarballs, this is prevented.

The documentation process in the contrib directories could use some
general cleanups, but this gets it going for now.
- Add doc install target that includes the .txt files
- svn-fe has no doc install targets at all.

See-Also: https://bugs.gentoo.org/687886
See-Also: https://bugs.gentoo.org/687848
See-Also: https://bugs.gentoo.org/517794
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
---
 Makefile | 43 +++++++++++++++++++++++++++++++++++--------
 1 file changed, 35 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index f58bf14c7b..fc36a9211e 100644
--- a/Makefile
+++ b/Makefile
@@ -3008,21 +3008,48 @@ artifacts-tar:: $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) \
 
 htmldocs = git-htmldocs-$(GIT_VERSION)
 manpages = git-manpages-$(GIT_VERSION)
-.PHONY: dist-doc distclean
-dist-doc:
+.PHONY: dist-doc distclean contrib-doc
+
+# subdirs with install-html & install-man targets
+contrib_doc_dirs := contrib/contacts contrib/subtree
+doc_dirs := Documentation $(contrib_doc_dirs)
+
+contrib-doc:
+	$(MAKE) -C contrib/svn-fe svn-fe.html svn-fe.1 # no doc target
+	for d in $(contrib_doc_dirs) ; do \
+		$(MAKE) -C $$d doc ; \
+	done
+
+dist-doc: doc contrib-doc
 	$(RM) -r .doc-tmp-dir
 	mkdir .doc-tmp-dir
-	$(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
+	for d in $(doc_dirs) ; do \
+		$(MAKE) -C $$d \
+			DESTDIR=$(PWD)/ \
+			htmldir=/.doc-tmp-dir/ \
+			install-html ; \
+	done
+	: # These files have no install targets
+	cp --target .doc-tmp-dir \
+		contrib/subtree/git-subtree.txt \
+		contrib/contacts/git-contacts.txt \
+		contrib/svn-fe/svn-fe.html \
+		contrib/svn-fe/svn-fe.txt
 	cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
 	gzip -n -9 -f $(htmldocs).tar
 	:
 	$(RM) -r .doc-tmp-dir
 	mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
-	$(MAKE) -C Documentation DESTDIR=./ \
-		man1dir=../.doc-tmp-dir/man1 \
-		man5dir=../.doc-tmp-dir/man5 \
-		man7dir=../.doc-tmp-dir/man7 \
-		install
+	for d in $(doc_dirs) ; do \
+		$(MAKE) -C $$d DESTDIR=$(PWD)/ \
+		man1dir=/.doc-tmp-dir/man1 \
+		man5dir=/.doc-tmp-dir/man5 \
+		man7dir=/.doc-tmp-dir/man7 \
+		install-man ; \
+	done
+	: # These files have no install targets
+	cp --target .doc-tmp-dir/man1/ \
+		contrib/svn-fe/svn-fe.1
 	cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
 	gzip -n -9 -f $(manpages).tar
 	$(RM) -r .doc-tmp-dir
-- 
2.22.0


```

## Junio C Hamano, 2019-06-24 18:47

Subject: Re: [PATCH] Makefile: include contrib docs in dist-doc tarballs
Message-ID: <xmqqk1dahlc1.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqqk1dahlc1.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <20190623215046.24030-1-robbat2@gentoo.org>

```
robbat2@gentoo.org writes:

> +.PHONY: dist-doc distclean contrib-doc

I do not think I want to do this.

Contrib are not part of the core because they are not.  We do not
install their "executable" from the top-level Makefile and I prefer
to keep it that way.  Why should we ship their documentation
ourselves?  If somebody wants to build and distribute the contrib
material, they should be spending their cycles to also build and
distribute the matching docs, not me.

> +# subdirs with install-html & install-man targets
> +contrib_doc_dirs := contrib/contacts contrib/subtree
> +doc_dirs := Documentation $(contrib_doc_dirs)
> +
> +contrib-doc:
> +	$(MAKE) -C contrib/svn-fe svn-fe.html svn-fe.1 # no doc target
> +	for d in $(contrib_doc_dirs) ; do \
> +		$(MAKE) -C $$d doc ; \
> +	done
> +
> +dist-doc: doc contrib-doc
>  	$(RM) -r .doc-tmp-dir
>  	mkdir .doc-tmp-dir
> -	$(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
> +	for d in $(doc_dirs) ; do \
> +		$(MAKE) -C $$d \
> +			DESTDIR=$(PWD)/ \
> +			htmldir=/.doc-tmp-dir/ \
> +			install-html ; \
> +	done
> +	: # These files have no install targets
> +	cp --target .doc-tmp-dir \

"cp --target"???  It may be tempting but I do not think we can rely
on it being available everywhere.

> +		contrib/subtree/git-subtree.txt \
> +		contrib/contacts/git-contacts.txt \
> +		contrib/svn-fe/svn-fe.html \
> +		contrib/svn-fe/svn-fe.txt

```
