From 009e82533442d8d63632ac867c91da9e846725d5 Mon Sep 17 00:00:00 2001
From: Ron <ron@debian.org>
Date: Sun, 11 Nov 2012 22:09:29 +1030
Subject: [PATCH] Add some extra makefile targets

The opusfile and install-opusfile targets let us build and install just
the library (without the docs, even if doxygen is present and enabled).

The docs and install-docs targets let us build and install just the docs
without the library.

The default for make and make install remains to build both if doxgen
is present and enabled.

Signed-off-by: Ralph Giles <giles@mozilla.com>
---
 Makefile.am | 38 +++++++++++++++++++++++++++-----------
 1 file changed, 27 insertions(+), 11 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 7c208b5..fa75c36 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,22 +34,36 @@ EXTRA_DIST = \
  doc/git-version.sh \
  doc/opus_logo.svg
 
-#API Documentation
+# Targets to build and install just the library without the docs
+opusfile install-opusfile: export NO_DOXYGEN = 1
 
-if HAVE_DOXYGEN
+opusfile: all
+install-opusfile: install
+
+# Or just the docs
+docs: doc/doxygen-build.stamp
 
-all-local: doc/doxygen-build.stamp
+install-docs:
+	@if [ -z "$(NO_DOXYGEN)" ]; then \
+	  ( cd doc && \
+	    echo "Installing documentation in $(DESTDIR)$(docdir)"; \
+	    for f in `find html -type f \! -name "installdox"` ; do \
+	      $(INSTALL) -d $(DESTDIR)$(docdir)/html/search;   \
+	      $(INSTALL_DATA) $$f $(DESTDIR)$(docdir)/$$f;     \
+	    done ) \
+	fi
 
 doc/doxygen-build.stamp: doc/Doxyfile $(top_srcdir)/doc/opus_logo.svg \
- $(top_srcdir)/include/*.h
-	cd doc && doxygen
-	touch "$@"
+                         $(top_srcdir)/include/*.h
+	@[ -n "$(NO_DOXYGEN)" ] || ( cd doc && doxygen && touch $(@F) )
 
-install-data-local:
-	cd doc && for f in `find html -type f \! -name "installdox"` ; do \
-         $(INSTALL) -d $(DESTDIR)$(docdir)/html/search;   \
-         $(INSTALL_DATA) $$f $(DESTDIR)$(docdir)/$$f;     \
-	done
+
+if HAVE_DOXYGEN
+
+# Or everything (by default)
+all-local: docs
+
+install-data-local: install-docs
 
 clean-local:
 	$(RM) -r doc/html
@@ -60,3 +74,5 @@ uninstall-local:
 	$(RM) -r $(DESTDIR)$(docdir)/html
 
 endif
+
+.PHONY: opusfile install-opusfile docs install-docs
-- 
GitLab