Blog

Doxygen を github-pages にあげるのをお気楽にやる方法

ってことは、この2つを簡単にくみあわせられれば最強じゃね?

ということでやってみた。

gh-pages branch の生成はいつものようにおこなう。

$ git symbolic-ref HEAD refs/heads/gh-pages
$ rm .git/index
$ git clean -fdx

そしたら、master にもどして、gh-pages branch を docs/ という名前で submodule にする

$ git co master
$ git submodule add -b gh-pages `git remote -v|grep origin|awk '{print$2}'` docs

doxygen の設定ファイルの雛形をつくる(Doxyfile という名前のファイルができる)

$ doxygen -g 

Doxyfile を編集する。今回は以下のように変更した。

--- Doxyfile.org	2010-03-10 10:32:29.000000000 +0900
+++ Doxyfile	2010-03-10 10:49:52.000000000 +0900
@@ -137,7 +137,7 @@
 # comments will behave just like regular Qt-style comments
 # (thus requiring an explicit @brief command for a brief description.)
 
-JAVADOC_AUTOBRIEF      = NO
+JAVADOC_AUTOBRIEF      = YES
 
 # If the QT_AUTOBRIEF tag is set to YES then Doxygen will
 # interpret the first line (until the first dot) of a Qt-style
@@ -186,7 +186,7 @@
 # For instance, some of the names that are used will be different. The list
 # of all members will be omitted, etc.
 
-OPTIMIZE_OUTPUT_FOR_C  = NO
+OPTIMIZE_OUTPUT_FOR_C  = YES
 
 # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
 # sources only. Doxygen will then generate output that is more tailored for
@@ -297,7 +297,7 @@
 # Private class members and static file members will be hidden unless
 # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
 
-EXTRACT_ALL            = NO
+EXTRACT_ALL            = YES
 
 # If the EXTRACT_PRIVATE tag is set to YES all private members of a class
 # will be included in the documentation.
@@ -568,7 +568,7 @@
 # directories like "/usr/src/myproject". Separate the files or directories
 # with spaces.
 
-INPUT                  =
+INPUT                  = src/
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
@@ -591,7 +591,7 @@
 # should be searched for input files as well. Possible values are YES and NO.
 # If left blank NO is used.
 
-RECURSIVE              = NO
+RECURSIVE              = YES
 
 # The EXCLUDE tag can be used to specify files and/or directories that should
 # excluded from the INPUT source files. This way you can easily exclude a
@@ -684,7 +684,7 @@
 # Note: To get rid of all source code in the generated output, make sure also
 # VERBATIM_HEADERS is set to NO.
 
-SOURCE_BROWSER         = NO
+SOURCE_BROWSER         = YES
 
 # Setting the INLINE_SOURCES tag to YES will include the body
 # of functions and classes directly in the documentation.
@@ -767,7 +767,7 @@
 # If a relative path is entered the value of OUTPUT_DIRECTORY will be
 # put in front of it. If left blank `html' will be used as the default path.
 
-HTML_OUTPUT            = html
+HTML_OUTPUT            = docs/
 
 # The HTML_FILE_EXTENSION tag can be used to specify the file extension for
 # each generated HTML page (for example: .htm,.php,.asp). If it is left blank
@@ -983,7 +983,7 @@
 # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
 # generate Latex output.
 
-GENERATE_LATEX         = YES
+GENERATE_LATEX         = NO
 
 # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
 # If a relative path is entered the value of OUTPUT_DIRECTORY will be

このように変更すれば、doxygen コマンド一発で docs/ 以下にファイルができるので、あとは Makefile なりなんなりに以下のような設定を追記する。perl で EU::MM をつかってる場合には postambles() に追加すればよい。

docs: src/*.c src/*.h Doxyfile
    doxygen && cd docs/ && git add . && git ci -m 'updated docs' && git push origin gh-pages && cd .. && git ci -m 'updated docs' docs/

たったこれだけで gh-pages に doxyfile おけるので楽でよいとおもった。