summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.in10
-rwxr-xr-xbin/ptxdist34
-rw-r--r--doc/conf.py82
3 files changed, 102 insertions, 24 deletions
diff --git a/Makefile.in b/Makefile.in
index 1e2a8be43..387088374 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -16,6 +16,7 @@ CPPFLAGS := @CPPFLAGS@
LDFLAGS := @LDFLAGS@
SHELL := @BASH@
+RST2MAN := @RST2MAN@
export SHELL
@@ -69,6 +70,7 @@ environment:
@ln -sf @BASH@ "$(abs_srcdir)/bin/bash"
@ln -sf @SYSCTL@ "$(abs_srcdir)/bin/sysctl"
@ln -sf @MAKE@ "$(abs_srcdir)/bin/make"
+ @ln -sf @SPHINX@ "$(abs_srcdir)/bin/sphinx-build"
@echo " done"
man: man/ptxdist.1.gz
@@ -139,11 +141,3 @@ maintainer-clean: distclean
release:
@scripts/make_$@.sh
-SPHINXBUILD = @SPHINX@
-RST2MAN = @RST2MAN@
-
-docs:
- @. scripts/ptxdist_version.sh && \
- export PTXDIST_VERSION_FULL && \
- export PTXDIST_VERSION="$${PTXDIST_VERSION_YEAR}.$${PTXDIST_VERSION_MONTH}.$${PTXDIST_VERSION_BUGFIX}" && \
- $(SPHINXBUILD) -b html -d ./Documentation ./doc ./Documentation/html
diff --git a/bin/ptxdist b/bin/ptxdist
index 970cb9aad..5e3e461a5 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -1006,6 +1006,8 @@ Misc:
Not specifying the directory will undo the change.
bash enter a ptxdist environment bash shell
bash <cmd> [args...] execute <cmd> in ptxdist environment
+ docs-html generate HTML documentation
+ docs-latex generate LaTeX / PDF documentation
export_src <target dir> export all source archives needed for this
project to <target dir>
Overwrite defaults:
@@ -1201,6 +1203,34 @@ drop() {
fi
}
+create_docs() {
+ local builder srcdir outdir dir entry
+
+ builder="${1}"
+ outdir=${PTXDIST_WORKSPACE}/Documentation
+
+ if [ "${PTXDIST_TOPDIR}" = "${PTXDIST_WORKSPACE}" ]; then
+ srcdir="${PTXDIST_TEMPDIR}/docs"
+ else
+ srcdir="${STATEDIR}/docs"
+ rm -rf "${srcdir}" &&
+ ptxd_source_kconfig "${PTXDIST_PTXCONFIG}" &&
+ ptxd_source_kconfig "${PTXDIST_PLATFORMCONFIG}"
+ fi &&
+
+ mkdir "${srcdir}" &&
+ ptxd_in_path PTXDIST_PATH doc &&
+ for dir in "${ptxd_reply[@]}"; do
+ for entry in $(cd "${dir}"; ls); do
+ cp -an "${dir}/${entry}" "${srcdir}/${entry}" || return
+ done
+ done &&
+ sphinx-build -b "${builder}" -d "${outdir}/.doctrees" "${srcdir}" \
+ "${outdir}/${builder}" &&
+ if [ "${builder}" = "latex" ]; then
+ make -C "${outdir}/${builder}"
+ fi
+}
projects() {
local ifs_old projects projectdir
@@ -1884,6 +1914,10 @@ EOF
drop "${1}" "${2}"
exit
;;
+ docs-*)
+ create_docs "${cmd#docs-}" &&
+ exit
+ ;;
export_src)
if [ -z "${1}" ]; then
echo
diff --git a/doc/conf.py b/doc/conf.py
index bd2ca1917..d55a8361c 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -14,6 +14,7 @@
import sys
import os
+import re
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@@ -97,24 +98,73 @@ pygments_style = 'none'
numfig = True
+gnu_target = os.getenv("PTXCONF_GNU_TARGET") or "arm-v5te-linux-gnueabi"
+try:
+ toolchain = os.readlink(os.path.join(os.getenv("PTXDIST_PLATFORMDIR",""), "selected_toolchain")).split("/")
+except:
+ toolchain = "/opt/OSELAS.Toolchain-2014.12.2/arm-v5te-linux-gnueabi/gcc-4.9.2-glibc-2.20-binutils-2.24-kernel-3.16-sanitized/bin".split("/")
+
+ptxdistPlatformDir = "``platform-" + (os.getenv("PTXCONF_PLATFORM") or "versatilepb") + "``"
+oselasTCNarch = gnu_target.split("-")[0]
+oselasTCNvariant = gnu_target.split("-")[1]
+oselasTCNVendorVersion = toolchain[-4].split("-")[1]
+oselasTCNVendorptxdistversion = re.sub(r"\..$",".0", toolchain[-4].split("-")[1])
+oselasToolchainName = toolchain[-3] + "_" + re.sub(r"-([a-z])",r"_\1", toolchain[-2], 3)
+ptxdistBSPName = os.getenv("PTXCONF_PROJECT", "") + os.getenv("PTXCONF_PROJECT_VERSION", "") or "OSELAS.BSP-Pengutronix-Generic-2015.03.1"
+ptxdistCompilerName = gnu_target
+ptxdistCompilerVersion = toolchain[-2]
+ptxdistPlatformKernelRev = os.getenv("PTXCONF_KERNEL_VERSION") or "4.5"
+ptxdistPlatformKernelRevNext = "4.6"
+ptxdistPlatformName = os.getenv("PTXCONF_PLATFORM") or "versatilepb"
+ptxdistPlatformVariant = "\ "
+ptxdistPlatformCollection = "\ "
+ptxdistVendorVersion = os.getenv("PTXDIST_VERSION_YEAR") + "." + os.getenv("PTXDIST_VERSION_MONTH") + "." + os.getenv("PTXDIST_VERSION_BUGFIX")
+package = "<package>"
+
+sys.path.append(".")
+try:
+ from replace import *
+except:
+ pass
+
rst_epilog = """
-.. |ptxdistPlatformDir| replace:: ``platform-versatilepb``
-.. |oselasTCNarch| replace:: arm
-.. |oselasTCNvariant| replace:: v5te
-.. |oselasTCNVendorVersion| replace:: 2014.12.0
-.. |oselasTCNVendorptxdistversion| replace:: 2014.12.0
-.. |oselasToolchainName| replace:: arm-v5te-linux-gnueabi_gcc-4.8.2_glibc-2.18_binutils-2.24_kernel-3.12-sanitized
-.. |ptxdistBSPName| replace:: OSELAS.BSP-Pengutronix-Generic-2015.03.1
-.. |ptxdistCompilerName| replace:: arm-v5te-linux-gnueabi
-.. |ptxdistCompilerVersion| replace:: gcc-4.8.2-glibc-2.18-binutils-2.24-kernel-3.12-sanitized
-.. |ptxdistPlatformKernelRev| replace:: 3.19
-.. |ptxdistPlatformKernelRevNext| replace:: 4.0
-.. |ptxdistPlatformName| replace:: arm-qemu
-.. |ptxdistPlatformVariant| replace:: \
-.. |ptxdistPlatformCollection| replace:: \
+.. |ptxdistPlatformDir| replace:: %s
+.. |oselasTCNarch| replace:: %s
+.. |oselasTCNvariant| replace:: %s
+.. |oselasTCNVendorVersion| replace:: %s
+.. |oselasTCNVendorptxdistversion| replace:: %s
+.. |oselasToolchainName| replace:: %s
+.. |ptxdistBSPName| replace:: %s
+.. |ptxdistCompilerName| replace:: %s
+.. |ptxdistCompilerVersion| replace:: %s
+.. |ptxdistPlatformKernelRev| replace:: %s
+.. |ptxdistPlatformKernelRevNext| replace:: %s
+.. |ptxdistPlatformName| replace:: %s
+.. |ptxdistPlatformVariant| replace:: %s
+.. |ptxdistPlatformCollection| replace:: %s
.. |ptxdistVendorVersion| replace:: %s
-.. |package| replace:: <pagage>
-""" % os.getenv("PTXDIST_VERSION")
+.. |package| replace:: %s
+""" % (
+ ptxdistPlatformDir,
+ oselasTCNarch,
+ oselasTCNvariant,
+ oselasTCNVendorVersion,
+ oselasTCNVendorptxdistversion,
+ oselasToolchainName,
+ ptxdistBSPName,
+ ptxdistCompilerName,
+ ptxdistCompilerVersion,
+ ptxdistPlatformKernelRev,
+ ptxdistPlatformKernelRevNext,
+ ptxdistPlatformName,
+ ptxdistPlatformVariant,
+ ptxdistPlatformCollection,
+ ptxdistVendorVersion,
+ package
+)
+
+if os.getenv("PTXDIST_VERBOSE","0") == "1":
+ print(rst_epilog)
# -- Options for HTML output ----------------------------------------------