[GTK][CMAKE] gtk-doc HTML documentation is generated by default when building with CMake
https://bugs.webkit.org/show_bug.cgi?id=130016

Reviewed by Carlos Garcia Campos.

* Source/PlatformGTK.cmake: Add two gtkdoc targets, one which builds HTML and one which
doesn't. Add the non-HTML version to the default target, but not the HTML version. The
HTML version will still run when building the distribution tarball.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165386 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/ChangeLog b/ChangeLog
index 3fb6379..9ef8c79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2014-03-10  Martin Robinson  <mrobinson@igalia.com>
 
+        [GTK][CMAKE] gtk-doc HTML documentation is generated by default when building with CMake
+        https://bugs.webkit.org/show_bug.cgi?id=130016
+
+        Reviewed by Carlos Garcia Campos.
+
+        * Source/PlatformGTK.cmake: Add two gtkdoc targets, one which builds HTML and one which
+        doesn't. Add the non-HTML version to the default target, but not the HTML version. The
+        HTML version will still run when building the distribution tarball.
+
+2014-03-10  Martin Robinson  <mrobinson@igalia.com>
+
         [GTK] [CMake] Clean up library linking
         https://bugs.webkit.org/show_bug.cgi?id=129782
 
diff --git a/Source/PlatformGTK.cmake b/Source/PlatformGTK.cmake
index 64cf50f..5a55c62 100644
--- a/Source/PlatformGTK.cmake
+++ b/Source/PlatformGTK.cmake
@@ -29,26 +29,26 @@
     )
 endif ()
 
-add_custom_command(
-    OUTPUT "${CMAKE_BINARY_DIR}/docs-build.stamp"
-    DEPENDS ${DocumentationDependencies}
-    COMMAND CC="${CMAKE_C_COMPILER}" ${CMAKE_SOURCE_DIR}/Tools/gtk/generate-gtkdoc
-    COMMAND touch docs-build.stamp
-    WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+macro(ADD_GTKDOC_GENERATOR _stamp_name _extra_args)
+    add_custom_command(
+        OUTPUT "${CMAKE_BINARY_DIR}/${_stamp_name}"
+        DEPENDS ${DocumentationDependencies}
+        COMMAND CC="${CMAKE_C_COMPILER}" ${CMAKE_SOURCE_DIR}/Tools/gtk/generate-gtkdoc ${_extra_args}
+        COMMAND touch ${_stamp_name}
+        WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+    )
+endmacro()
+
+add_gtkdoc_generator("docs-build-no-html.stamp" "--skip-html")
+add_custom_target(gtkdoc-no-html ALL
+    DEPENDS "${CMAKE_BINARY_DIR}/docs-build-no-html.stamp"
 )
 
-add_custom_target(fake-docs-target ALL
+add_gtkdoc_generator("docs-build.stamp" "")
+add_custom_target(gtkdoc
     DEPENDS "${CMAKE_BINARY_DIR}/docs-build.stamp"
 )
 
-if (ENABLE_WEBKIT)
-    add_dependencies(fake-docs-target WebKit)
-endif ()
-
-if (ENABLE_WEBKIT2)
-    add_dependencies(fake-docs-target WebKit2)
-endif ()
-
 add_custom_target(check
     COMMAND ${TOOLS_DIR}/Scripts/run-gtk-tests
     COMMAND ${TOOLS_DIR}/gtk/check-for-webkitdom-api-breaks
@@ -61,6 +61,7 @@
         DEPENDS ${TOOLS_DIR}/gtk/manifest.txt
         DEPENDS WebKit
         DEPENDS WebKit2
+        DEPENDS gtkdoc
         COMMAND ${TOOLS_DIR}/gtk/make-dist.py
                 --source-dir=${CMAKE_SOURCE_DIR}
                 --build-dir=${CMAKE_BINARY_DIR}