null+****@clear*****
null+****@clear*****
2012年 5月 29日 (火) 10:58:34 JST
Kouhei Sutou 2012-05-29 10:58:34 +0900 (Tue, 29 May 2012)
New Revision: c9609045172adc36aa8954f2b038275843ed8019
Log:
doc: update document build system
They are copied from groonga.
Modified files:
build/makefiles/gettext.am
build/makefiles/locale.am
build/makefiles/sphinx-build.am
build/makefiles/sphinx.am
configure.ac
doc/Makefile.am
doc/locale/en/Makefile.am
doc/locale/ja/Makefile.am
Modified: build/makefiles/gettext.am (+15 -6)
===================================================================
--- build/makefiles/gettext.am 2012-05-29 10:09:24 +0900 (3e08168)
+++ build/makefiles/gettext.am 2012-05-29 10:58:34 +0900 (c397e1e)
@@ -1,14 +1,18 @@
include $(top_srcdir)/doc/files.am
include $(top_srcdir)/build/makefiles/sphinx-build.am
-if ENABLE_DOCUMENT
-BUILT_SOURCES += \
+EXTRA_DIST += \
+ $(po_files)
+
+if DOCUMENT_AVAILABLE
+EXTRA_DIST += \
$(mo_files)
endif
-EXTRA_DIST += \
- $(po_files) \
+if DOCUMENT_BUILDABLE
+BUILT_SOURCES += \
$(mo_files)
+endif
SUFFIXES += .pot .po .mo
@@ -22,11 +26,16 @@ all:
msgfmt -o $@ $<
update: pot-build-stamp $(po_files)
+
+if DOCUMENT_BUILDABLE
build: $(mo_files)
+else
+build:
+endif
-html-local: build
+html: build
man: build
-pdf-local: build
+pdf: build
gettext: sphinx-ensure-updated
rm *.pot || true
Modified: build/makefiles/locale.am (+4 -1)
===================================================================
--- build/makefiles/locale.am 2012-05-29 10:09:24 +0900 (20eaa5b)
+++ build/makefiles/locale.am 2012-05-29 10:58:34 +0900 (414c19a)
@@ -5,5 +5,8 @@ EXTRA_DIST =
include $(top_srcdir)/build/makefiles/sphinx.am
-init update-po:
+init:
cd LC_MESSAGES && $(MAKE) $@
+
+update-po:
+ cd LC_MESSAGES && $(MAKE) update
Modified: build/makefiles/sphinx-build.am (+12 -6)
===================================================================
--- build/makefiles/sphinx-build.am 2012-05-29 10:09:24 +0900 (d956195)
+++ build/makefiles/sphinx-build.am 2012-05-29 10:58:34 +0900 (b2f8a53)
@@ -8,18 +8,24 @@ PAPER =
SOURCE_DIR = $(abs_top_srcdir)/doc/source
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
-ALLSPHINXOPTS = -E $(SPHINXOPTS) $(SOURCE_DIR)
+ALLSPHINXOPTS = $(PAPEROPT_$(PAPER)) -E $(SPHINXOPTS) $(SOURCE_DIR)
SPHINX_DIR = $(abs_top_builddir)/doc/sphinx
SPHINX_BUILD = $(SPHINX_DIR)/sphinx-build.py
-SPHINX_BUILD_COMMAND = VERSION="$(VERSION)" LOCALE="$(LOCALE)" PYTHONPATH="$(SPHINX_DIR):$$PYTHONPATH" python $(SPHINX_BUILD)
+SPHINX_BUILD_COMMAND = \
+ VERSION="$(DOCUMENT_VERSION)" \
+ VERSION_FULL="$(DOCUMENT_VERSION_FULL)" \
+ LOCALE="$(LOCALE)" \
+ PYTHONPATH="$(SPHINX_DIR):$$PYTHONPATH" \
+ python $(SPHINX_BUILD)
.PHONY: sphinx-ensure-updated
-$(SPHINX_BUILD):
- $(HG) clone https://bitbucket.org/birkenfeld/sphinx $(SPHINX_DIR)
-
-sphinx-ensure-updated: $(SPHINX_BUILD)
+if DOCUMENT_BUILDABLE
+sphinx-ensure-updated:
if ! $(SPHINX_BUILD_COMMAND) 2>&1 | head -1 | grep 'v1.[2]' -q > /dev/null; then \
(cd $(SPHINX_DIR) && $(HG) pull --update); \
fi
+else
+sphinx-ensure-updated:
+endif
Modified: build/makefiles/sphinx.am (+15 -6)
===================================================================
--- build/makefiles/sphinx.am 2012-05-29 10:09:24 +0900 (6a11aff)
+++ build/makefiles/sphinx.am 2012-05-29 10:58:34 +0900 (d2652d2)
@@ -1,15 +1,17 @@
include $(top_srcdir)/doc/files.am
include $(top_srcdir)/build/makefiles/sphinx-build.am
-doc_localedir = $(docdir)/$(LOCALE)
-
$(html_files): html-build-stamp
$(html_files_relative_from_locale_dir): html-build-stamp
$(man_files): man-build-stamp
-if ENABLE_DOCUMENT
+am__nobase_dist_doc_locale_DATA_DIST =
+if DOCUMENT_AVAILABLE
+doc_localedir = $(docdir)/$(LOCALE)
nobase_dist_doc_locale_DATA = \
$(html_files_relative_from_locale_dir)
+am__nobase_dist_doc_locale_DATA_DIST += \
+ $(nobase_dist_doc_locale_DATA)
endif
document_source_files = \
@@ -20,12 +22,15 @@ document_source_files = \
required_build_stamps = \
html-build-stamp \
- man-build-stamp
+ man-build-stamp \
+ mo-build-stamp
+if DOCUMENT_BUILDABLE
EXTRA_DIST += $(required_build_stamps)
+endif
man_files = \
- man/mroonga.1
+ man/groonga.1
generated_files = \
$(DOCTREES_BASE) \
@@ -59,6 +64,7 @@ mo-build-stamp: $(po_files_relative_from_locale_dir)
cd LC_MESSAGES && $(MAKE) build
@touch $@
+if DOCUMENT_BUILDABLE
clean-local: $(clean_targets) clean-doctrees
clean-doctrees:
@@ -66,6 +72,7 @@ clean-doctrees:
maintainer-clean-local:
rm -rf -- $(generated_files)
+endif
.PHONY: help
.PHONY: man clean-man
@@ -81,6 +88,7 @@ maintainer-clean-local:
.PHONY: linkcheck
.PHONY: doctest
+if DOCUMENT_BUILDABLE
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " man to make man files"
@@ -98,7 +106,7 @@ help:
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
man: man-build-stamp
-html-local: html-build-stamp
+html: html-build-stamp
dirhtml: dirhtml-build-stamp
pickle: pickle-build-stamp
json: json-build-stamp
@@ -169,3 +177,4 @@ latex-message: latex-build-stamp
@echo "Build finished; the LaTeX files are in latex/*."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."
+endif
Modified: configure.ac (+32 -10)
===================================================================
--- configure.ac 2012-05-29 10:09:24 +0900 (60d62a5)
+++ configure.ac 2012-05-29 10:58:34 +0900 (fa44786)
@@ -1,3 +1,5 @@
+AC_PREREQ(2.59)
+
m4_define([mrn_version_major], m4_include(version_major))
m4_define([mrn_version_minor], m4_include(version_minor))
m4_define([mrn_version_micro], m4_include(version_micro))
@@ -297,29 +299,49 @@ AC_ARG_ENABLE(document,
[enable_document="auto"])
AC_MSG_RESULT($enable_document)
-# check sphinx-build for documentation
document_available=no
+document_buildable=no
+have_built_document=no
if test x"$enable_document" != x"no"; then
- AC_PATH_PROG(HG, hg, hg-not-found)
if test -f "$srcdir/doc/build-stamp"; then
document_available=yes
- else
- if test x"$HG" = x"hg-not-found"; then
- if test x"$enable_document" = x"yes"; then
- AC_MSG_ERROR("No hg found")
- fi
- else
+ have_built_document=yes
+ fi
+
+ if test x"$enable_document" = x"yes"; then
+ AC_PATH_PROG(HG, hg, [])
+ if test -n "$HG"; then
document_available=yes
+ document_buildable=yes
+ else
+ AC_MSG_ERROR("No hg found")
fi
+ AC_SUBST(HG)
fi
fi
-AC_SUBST(HG)
-AM_CONDITIONAL([ENABLE_DOCUMENT],
+AM_CONDITIONAL([WITH_HG], [test -n "${HG}"])
+
+AM_CONDITIONAL([DOCUMENT_AVAILABLE],
[test "${document_available}" = "yes"])
AC_MSG_CHECKING([whether document available])
AC_MSG_RESULT($document_available)
+AM_CONDITIONAL([DOCUMENT_BUILDABLE],
+ [test "${document_buildable}" = "yes"])
+AC_MSG_CHECKING([whether document buildable])
+AC_MSG_RESULT($document_buildable)
+
+AM_CONDITIONAL([HAVE_BUILT_DOCUMENT],
+ [test "${have_built_document}" = "yes"])
+AC_MSG_CHECKING([whether having built document])
+AC_MSG_RESULT($have_built_document)
+
+DOCUMENT_VERSION=mrn_version
+DOCUMENT_VERSION_FULL="$DOCUMENT_VERSION"
+AC_SUBST(DOCUMENT_VERSION)
+AC_SUBST(DOCUMENT_VERSION_FULL)
+
CFLAGS="$CFLAGS -Werror"
CXXFLAGS="$CXXFLAGS -Werror -fno-implicit-templates -fno-exceptions -fno-rtti -felide-constructors"
Modified: doc/Makefile.am (+23 -8)
===================================================================
--- doc/Makefile.am 2012-05-29 10:09:24 +0900 (efe9499)
+++ doc/Makefile.am 2012-05-29 10:58:34 +0900 (609b551)
@@ -1,6 +1,9 @@
SUBDIRS = \
locale
+BUILT_SOURCES =
+CLEANFILES =
+
all:
include $(top_srcdir)/doc/files.am
@@ -38,15 +41,27 @@ update-images:
cd $(srcdir)/source/images && \
make -f $(abs_srcdir)/images.mk update-images
-if ENABLE_DOCUMENT
+nobase_dist_doc_DATA = \
+ $(source_files_relative_from_doc_dir)
+
+if DOCUMENT_BUILDABLE
dist-hook: html man
@touch $(distdir)/build-stamp
-BUILT_SOURCES = \
- $(source_files_relative_from_doc_dir)
-nobase_dist_doc_DATA = \
- $(source_files_relative_from_doc_dir)
+
+CLEANFILES += build-stamp
+
+sphinx:
+ $(HG) clone https://bitbucket.org/birkenfeld/sphinx sphinx
+
+BUILT_SOURCES += sphinx
+
+maintainer-clean-local:
+ -rm -rf sphinx
+
+distclean-local:
+ -rm -rf sphinx
else
-dist-hook:
- @echo "must specify --enable-document for 'make dist'"
- @false
+if HAVE_BUILT_DOCUMENT
+EXTRA_DIST += build-stamp
+endif
endif
Modified: doc/locale/en/Makefile.am (+1 -1)
===================================================================
--- doc/locale/en/Makefile.am 2012-05-29 10:09:24 +0900 (7647c85)
+++ doc/locale/en/Makefile.am 2012-05-29 10:58:34 +0900 (2c6701e)
@@ -2,6 +2,6 @@ LOCALE = en
include $(top_srcdir)/build/makefiles/locale.am
-if ENABLE_DOCUMENT
+if DOCUMENT_AVAILABLE
dist_man1_MANS = $(man_files)
endif
Modified: doc/locale/ja/Makefile.am (+4 -1)
===================================================================
--- doc/locale/ja/Makefile.am 2012-05-29 10:09:24 +0900 (308a2f1)
+++ doc/locale/ja/Makefile.am 2012-05-29 10:58:34 +0900 (701aa06)
@@ -2,7 +2,10 @@ LOCALE = ja
include $(top_srcdir)/build/makefiles/locale.am
-if ENABLE_DOCUMENT
+am__dist_ja_man1_DATA_DIST =
+if DOCUMENT_AVAILABLE
ja_man1dir = $(mandir)/ja/man1
dist_ja_man1_DATA = $(man_files)
+am__dist_ja_man1_DATA_DIST += \
+ $(dist_ja_man1_DATA)
endif