From 08fa38306c1313fc2898e091c1e5babe7db35732 Mon Sep 17 00:00:00 2001 From: Lennart Johansson Date: Mon, 23 May 2016 11:10:25 +0200 Subject: Doc - Autofetch parameters to doc also from enea.conf Implement autofetch of parameters also from other places than poky.ent. pardoc-distro.xml is patched with information from enea.conf and placed in tmpcommon/ and new s_docsrc_common symlink points to it. The books use s_docsrc_common instead of docsrc_common. Signed-off-by: Lennart Johansson --- doc/Makefile | 92 +++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 57 insertions(+), 35 deletions(-) (limited to 'doc/Makefile') diff --git a/doc/Makefile b/doc/Makefile index 768b950..7fd9b52 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,6 +1,11 @@ #Path to this subsystem's root directory SUBSYSROOT := $(shell pwd) +MANIFEST_DIR = $(dir $(SUBSYSROOT)) +MANIFEST_NAME = $(lastword $(subst /, ,$(MANIFEST_DIR))) +MANIFEST_TAIL = $(word 2,$(subst -, ,$(MANIFEST_NAME))) + +# Generic docbuild.git auto-clone + s_docbuild symlink. Includes TMPCLONEROOT include init.mk # ****************** SUPPORT FOR TARGETS *************************** @@ -36,23 +41,7 @@ DOCBOOK_CLEANTMP ?= yes #Components in this subsystem COMPONENTS := book-enea-linux-release-info book-enea-linux-open-source # COMPONENTS += book-enea-linux-eclipse-open-source -# ----------------------------------------------------- -#Release version, used in labels and text -REL_VER_EXT := $(shell perl -e \ -'while(<>) {\ - if (//) { print $$1 ; exit; }\ -}' \ -< $(SUBSYSROOT)/docsrc_common/pardoc-distro.xml 2>/dev/null) -#$(info REL_VER_EXT = $(REL_VER_EXT)) - -ifneq ($(REL_VER_EXT),) -REL_VER ?= $(REL_VER_EXT) -else -REL_VER ?= undefined -endif -$(info REL_VER = $(REL_VER)) - -# ----------------------------------------------------- +# COMPONENTS += book-enea-linux-target-guide # -------------------------------------------------------------- @@ -83,27 +72,25 @@ docusage: @echo 'make docusage #Shows this help text' @echo ' DOCBOOK_TOOLS_VERSIONS=yes #Displays DocBook tools versions in this machine' @echo 'make doc #Builds the userdoc, does autoinit if needed' - @echo 'make init #Init both below' - @echo 'make initbuild #Init s_docbuild' - @echo 'make inittargets #Init s_targets using repo tool' + @echo 'make init #Init all needed s_* below' + @echo 'make initbuild #Init s_docbuild Docbook build system and central files' + @echo 'make inittargets #Init s_targets using repo tool Targets in this distro with poky' + @echo 'make initpardoc #Init s_docsrc_common using info from poky/' @echo ' DOCBOOK_CLEANTMP=no #Option to keep temp files in doc/ and tmp/' @echo ' BOOK_GLOBALCLONEROOT=yes #Option for all init above to clone all outside the doc directory' @echo ' BOOK_GLOBALCLONEROOT=otherpath #Option for all init above to clone all' @echo #Force rebuilding (ignore dependency on file times or BL_LABEL)' @echo ' # Dependency only works if common doc directory is kept' - @echo ' BOOKCONDITION'make pullbuild #git pull in s_docbuild' + @echo 'make pullbuild #git pull in s_docbuild' @echo 'make pulltargets #git pull in s_targets' @echo 'make clean #Clean. Also clean s_* but not any external clones' - @echo 'The following directories are cloned via the init commands (s_* are symlinks to clones):' - @echo ' s_docbuild #Docbook build system and central files' - @echo ' s_targets #targets in this distro with poky, for picking some parameters' @echo '' @echo 'Optional parameters for make doc:' @echo ' COMP= #Component (book) to build. Book component names are book-*' @echo ' #Default component/s:' @echo ' $(COMPONENTS)' @echo ' FORMAT= #One of: pdf, html, or eclipse (Default all are built)' - @echo ' BL_LABEL= #Becomes footer in book (default: date + time)' + @echo ' BL_LABEL= #Becomes footer in book (default: from poky enea.conf MAJORMINOR)' @echo ' DOCBOOK_TO_BOOKDIR=no #(default yes) Avoid moving result to book directory' @echo ' # and avoid erasing common doc and tmp directories' @echo ' BOOKFORCE=yes #Force rebuilding (ignore dependency on file times or BL_LABEL)' @@ -137,7 +124,7 @@ ifeq ($(DOCBOOK_TOOLS_VERSIONS),yes) $(VERB)$(MAKE) -f $(DOCBOOKMAKE)/tools_book_standalone.mk book_tools_versions endif -init: initbuild inittargets +init: initbuild inittargets initpardoc pullall: pullbuild pulltargets # If no COMP, iterate over books-* in COMPONENTS with make doc @@ -163,23 +150,26 @@ FORMAT=html pdf eclipse endif -books: initbuild inittargets +books: initbuild inittargets initpardoc # BOOKPACKAGES is defined in all book-*/swcomp.mk - $(VERB)for book in $(BOOKPACKAGES); do \ + $(VERB)DISTRO_VERSION_MAJOR=`egrep '"EneaLinux_DISTRO_VERSION_MAJOR"' s_docsrc_common/pardoc-distro.xml | sed 's/.*//;s/<\/phrase>.*//'` ; \ + DISTRO_VERSION_MINOR=`egrep '"EneaLinux_DISTRO_VERSION_MINOR"' s_docsrc_common/pardoc-distro.xml | sed 's/.*//;s/<\/phrase>.*//'` ; \ + BOOKVER="Profile $(MANIFEST_TAIL)-$$DISTRO_VERSION_MAJOR$$DISTRO_VERSION_MINOR" ; \ + for book in $(BOOKPACKAGES); do \ for format in $(FORMAT); do \ - $(MAKE) -f $(DOCBOOKMAKE)/make_docbook_standalone.mk BOOK=$$book FORMAT=$$format books || exit 10; \ + $(MAKE) -f $(DOCBOOKMAKE)/make_docbook_standalone.mk BOOK=$$book FORMAT=$$format BOOK_VER="$$BOOKVER" books || exit 10; \ done ; \ - done + done ifeq ($(DOCBOOK_TO_BOOKDIR),yes) - $(VERB)rm -rf doc tmp + $(VERB)rm -rf doc tmp else ifeq ($(DOCBOOK_CLEANTMP),yes) -# keep only doc/pdf/book-*.pdf doc/eclipse/plugins/com.enea.doc.book-* but delete doc/eclipse/plugins/com.enea.doc.book-*/done* - $(VERB)rm -rf tmp 2>/dev/null ; rm -rf doc/pdf/book-*/ ; rm -rf doc/eclipse/plugins/com.enea.doc.book-*/done* 2>/dev/null +# keep only doc/pdf/book-*.pdf doc/eclipse/plugins/com.enea.doc.book-* but delete doc/eclipse/plugins/com.enea.doc.book-*/done* + $(VERB)rm -rf tmp 2>/dev/null ; rm -rf doc/pdf/book-*/ ; rm -rf doc/eclipse/plugins/com.enea.doc.book-*/done* 2>/dev/null endif endif - +# cleaninit cleans ALL tmpcommon and all s_* clean: cleaninit $(VERB)rm -rf doc tmp 2>/dev/null ifneq ($(filter book-%, $(COMPONENTS)),) @@ -221,4 +211,36 @@ $(TMPCLONEROOT_TARGETS): repo init -u $(CURRENTURL) -b $(CURRENTHASH) -m $$target_default_xml ; repo sync ; \ ) ; \ done -# ****************************************************************** + +# **************************************************************************** +# ******************** SUPPORT FOR dynamic pardoc with added parameters ****** + +PATH_DOCSRC_COMMON = $(SUBSYSROOT)/s_docsrc_common +NAME_DOCSRC_COMMON = docsrc_common +TMPCLONEROOT_DOCSRC_COMMON := $(TMPCLONEROOT)/$(NAME_DOCSRC_COMMON) +TMPPARDOC := $(TMPCLONEROOT_DOCSRC_COMMON)/pardoc-distro.xml +.PHONY: initpardoc + +initpardoc: s_docsrc_common + +cleanpardoc: + $(VERB)rm -rf $(TMPCLONEROOT_DOCSRC_COMMON) ; rm s_docsrc_common + +s_docsrc_common: $(TMPCLONEROOT_DOCSRC_COMMON) + $(VERB)rm s_docsrc_common 2>/dev/null; ln -s $(TMPCLONEROOT_DOCSRC_COMMON) s_docsrc_common + +$(TMPCLONEROOT_DOCSRC_COMMON): s_targets + $(VERB)if [ ! -d "$(TMPCLONEROOT)" ] ; then mkdir -p "$(TMPCLONEROOT)" ; fi + $(VERB)if [ ! -d $(TMPCLONEROOT_DOCSRC_COMMON) ]; then mkdir -p $(TMPCLONEROOT_DOCSRC_COMMON) ; fi + @echo "Copy and patch docsrc_common/ files to $(TMPCLONEROOT_DOCSRC_COMMON)" + $(VERB)FIRSTTARGET=`ls -1 s_targets/ | head -1`; echo "FIRSTTARGET is $$FIRSTTARGET" ; \ + ENEACONF=s_targets/$$FIRSTTARGET/poky/meta-el-common/conf/distro/enea.conf ; \ + DISTRO_VERSION_MAJOR=`egrep '^DISTRO_VERSION_MAJOR' $$ENEACONF | sed 's/^[^"]*"//;s/".*//'` ; \ + DISTRO_VERSION_MINOR=`egrep '^DISTRO_VERSION_MINOR' $$ENEACONF | sed 's/^[^"]*"//;s/".*//'` ; \ + cat docsrc_common/pardoc-distro.xml | sed '/<\/section>/d' | \ + sed '/$(TMPPARDOC) ; \ + echo "$$DISTRO_VERSION_MAJOR" >>$(TMPPARDOC) ; \ + echo "$$DISTRO_VERSION_MINOR" >>$(TMPPARDOC) ; \ + echo "" >>$(TMPPARDOC) + +# **************************************************************************** -- cgit v1.2.3-54-g00ecf