From 4b391c153ae20b1d0fa77bc97c3256c04e393a6b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?=
 <rafael.carre@savoirfairelinux.com>
Date: Mon, 8 Aug 2011 16:40:53 -0400
Subject: [PATCH] Simplify doc build rules

---
 sflphone-common/Makefile.am             |  9 ++------
 sflphone-common/configure.ac            | 30 +++++--------------------
 sflphone-common/doc/Makefile.am         |  6 +++--
 sflphone-common/doc/doxygen/Makefile.am |  2 +-
 4 files changed, 12 insertions(+), 35 deletions(-)

diff --git a/sflphone-common/Makefile.am b/sflphone-common/Makefile.am
index c06b61eb6f..4fa6a7d84b 100644
--- a/sflphone-common/Makefile.am
+++ b/sflphone-common/Makefile.am
@@ -18,13 +18,8 @@ unittest:
 	@echo " -- You need the cppunit devel package to compile the unitary tests."
 endif
 
-doc:
-	@(cd doc; make)
-	@echo ""
-	@echo "D-Bus API HTML documentation has been generated in doc/dbus-api/doc/spec"
-	@echo ""
-
 ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = libs src ringtones man $(TESTS_DIR)
+SUBDIRS = libs src ringtones man $(TESTS_DIR) doc
+
 EXTRA_DIST = m4/*.m4 images/* README.gentoo
 
diff --git a/sflphone-common/configure.ac b/sflphone-common/configure.ac
index bf06147a02..7fad216b76 100644
--- a/sflphone-common/configure.ac
+++ b/sflphone-common/configure.ac
@@ -324,36 +324,16 @@ AM_CONDITIONAL(USE_NETWORKMANAGER, test "x$with_networkmanager" = "xyes" )
 # ----------------------------------------------------------------------------
 AC_DEFUN([BB_ENABLE_DOXYGEN],
     [
-    AC_ARG_ENABLE(doxygen, [  --enable-doxygen        enable documentation generation with doxygen (auto)])
+    AC_ARG_ENABLE(doxygen, [  --enable-doxygen        enable documentation generation with doxygen (disabled by default)])
     AC_ARG_ENABLE(dot, [  --enable-dot            use 'dot' to generate graphs in doxygen (auto)])
-    AC_ARG_ENABLE(html-docs, [  --enable-html-docs      enable HTML generation with doxygen (yes)], [], [ enable_html_docs=yes])
-    AC_ARG_ENABLE(latex-docs, [  --enable-latex-docs     enable LaTeX documentation generation with doxygen (no)], [], [ enable_latex_docs=no])
-    if test "x$enable_doxygen" = xno; then
-        enable_doc=no
-    else
+    if test "x$enable_doxygen" = xyes; then
         AC_PATH_PROG(DOXYGEN, doxygen, , $PATH)
-        if test x$DOXYGEN = x; then
-            test "x$enable_doxygen" = xyes && AC_MSG_ERROR([could not find doxygen])
-            enable_doc=no
-        else
-            enable_doc=yes
+        test x$DOXYGEN = x && AC_MSG_ERROR([could not find doxygen])
         AC_PATH_PROG(DOT, dot, , $PATH)
-        fi
+        test x$DOT = x -a "x$enable_dot" = xyes && AC_MSG_ERROR([could not find dot])
     fi
-    AM_CONDITIONAL(DOC, test x$enable_doc = xyes)
-
-	if test x$DOT = x; then
-        test "x$enable_dot" = xyes && AC_MSG_ERROR([could not find dot])
-        enable_dot=no
-	else
-        enable_dot=yes
-	fi
-	AM_CONDITIONAL(ENABLE_DOXYGEN, test x$enable_doc = xtrue)
-	AC_SUBST(enable_dot)
-	AC_SUBST(enable_html_docs)
-	AC_SUBST(enable_latex_docs)
+	AM_CONDITIONAL(ENABLE_DOXYGEN, test x$DOXYGEN = xyes)
 ])
-
 # Acutally perform the doxygen check
 BB_ENABLE_DOXYGEN
 
diff --git a/sflphone-common/doc/Makefile.am b/sflphone-common/doc/Makefile.am
index f742c26ce5..10aa20d83f 100644
--- a/sflphone-common/doc/Makefile.am
+++ b/sflphone-common/doc/Makefile.am
@@ -1,5 +1,7 @@
- 
-SUBDIRS = doxygen dbus-api
+SUBDIRS = dbus-api
+if ENABLE_DOXYGEN
+	SUBDIRS += doxygen
+endif
 
 .PHONY: doc
 doc:
diff --git a/sflphone-common/doc/doxygen/Makefile.am b/sflphone-common/doc/doxygen/Makefile.am
index 57c36f9880..75d619d822 100644
--- a/sflphone-common/doc/doxygen/Makefile.am
+++ b/sflphone-common/doc/doxygen/Makefile.am
@@ -12,7 +12,7 @@ all: doxygen-trac
 doxygen-trac: clean core-doc-trac gtk-gui-doc-trac
 
 %-doc-trac : %-doc
-	ln -s ${html_parent_dir}/$< ${html_parent_dir}/$</html
+	ln -sf ${html_parent_dir}/$< ${html_parent_dir}/$</html
 
 doc: clean core-doc gtk-gui-doc
 
-- 
GitLab