From 8decb3267be14596c377155d6bc84a0eb61f04e9 Mon Sep 17 00:00:00 2001 From: Lennart Johansson Date: Thu, 2 Jun 2016 13:41:16 +0200 Subject: Doc Add autovariables from manifest, poky.ent, enea.conf Add autovariable from manifest repository name, e.g. the profile name Add autovariables from poky.ent, e.g. Yocto version etc.. in pardoc-distro Add autovariables from enea.conf e.g. release MAJOR MINOR via generated s_docsrc_common/pardoc-distro and also pick up MAJOR MINOR into the make system to create BOOK_VER => BL_LABEL on books Add autocreate build_boot chapter in release info from the README files in all included targets Adapt book XML files to the above Currently this makes the Makefile and init scripts identical in different el6-.git All are now automatic: Just clone el6-xxxx.git and cd el6-xxx/doc ; make doc and all are done until the books are built and ready. It takes several minutes to autofetch all from git using the repo command according to the target manifests before the books start to build. Rebuilding books are quick. Signed-off-by: Lennart Johansson --- doc/Makefile | 136 ++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 89 insertions(+), 47 deletions(-) (limited to 'doc/Makefile') diff --git a/doc/Makefile b/doc/Makefile index 306bd4d..59d25d5 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 *************************** @@ -15,8 +20,10 @@ TARGETDEFAULTXMLS := $(shell cd $(REPODIR); ls -1 */default.xml) # URL and HASH of this manifest repository to be used by the repo tool CURRENTHASH := $(shell git log -1 --pretty=format:%H 2>/dev/null) CURRENTURL := $(shell git remote show origin | sed -n '/Fetch URL: /s/^.*URL: //p' 2>/dev/null) -.PHONY: inittargets -# ****************************************************************** + +# ******************* AutoGenerated chapter from template and target READMEs ******* +BUILDBOOT_XML := book-enea-linux-release-info/doc/build_boot_generated.xml +BUILDBOOT_TEMPLATE := book-enea-linux-release-info/doc/build_boot_template.xml @@ -33,27 +40,10 @@ DOCBOOK_FO_USEFOP ?= yes DOCBOOK_TO_BOOKDIR ?= yes DOCBOOK_CLEANTMP ?= yes -#Components in this subsystem -COMPONENTS := book-enea-linux-release-info book-enea-linux-open-source -# COMPONENTS += book-enea-linux-target-guide -# ----------------------------------------------------- -#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 (books) in this subsystem +# COMPONENTS := book-enea-linux-release-info book-enea-linux-open-source +# COMPONENTS += book-enea-linux-eclipse-open-source +COMPONENTS := $(shell ls -d book-enea* ) # -------------------------------------------------------------- ifeq ($(VERBOSE),yes) @@ -76,34 +66,31 @@ VALIDATE = no # Export all parameters including those on the command line export -.PHONY: doc books docusage +.PHONY: doc books docusage init initbuild inittargets initpardoc initbuildboot 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 init* 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 'make initbuildboot #Init build_boot chapter from READMEs and template in release info' @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 pulltargets #git pull in s_targets' + @echo 'make pullbuild #git pull in s_docbuild' + @echo 'make pulltargets #git pull in s_targets. You need also initpardoc initbuildboot' @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)' @@ -118,7 +105,7 @@ docusage: @echo ' DOCBOOK_OLINK_TARGETDB=only #Build a target db for this book (for links into it)' @echo ' DOCBOOK_OLINK_TARGETDB=yes #Build a target db AND build the book' @echo ' #Master olinkdb defined in this Makefile, one per generated format, is:' - @echo ' $(DOCBOOKOLINKDB_BASE)_*.db' + @echo ' $(DOCBOOKOLINKDB_BASE)_*.db' @echo ' Typical examples:' @echo ' make doc Creates all books, all formats' @echo ' make doc COMP=book-xxxx FORMAT=html' @@ -137,7 +124,8 @@ ifeq ($(DOCBOOK_TOOLS_VERSIONS),yes) $(VERB)$(MAKE) -f $(DOCBOOKMAKE)/tools_book_standalone.mk book_tools_versions endif -init: initbuild inittargets +# We rely on make doing these in order left to right +init: initbuild inittargets initpardoc initbuildboot pullall: pullbuild pulltargets # If no COMP, iterate over books-* in COMPONENTS with make doc @@ -163,24 +151,27 @@ FORMAT=html pdf eclipse endif -books: initbuild inittargets +books: init # 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 - -clean: cleaninit +# cleaninit cleans ALL tmpcommon and all s_* and generated build_boot chapter xml +clean: cleaninit cleanbuildboot $(VERB)rm -rf doc tmp 2>/dev/null ifneq ($(filter book-%, $(COMPONENTS)),) $(VERB)for comp in $(filter book-%, $(COMPONENTS)); do \ @@ -221,4 +212,55 @@ $(TMPCLONEROOT_TARGETS): repo init -u $(CURRENTURL) -b $(CURRENTHASH) -m $$target_default_xml ; repo sync ; \ ) ; \ done -# ****************************************************************** + +# **************************************************************************** +# ******************** SUPPORT FOR dynamic pardoc with added parameters ****** +# pardoc-distro can contain MAJOR.MINOR-xxxxx keeping -xxxx when replacing MINOR.MINOR from enea.conf + +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 + +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`; \ + 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) + +# **************************************************************************** +# ***** Create XML chapter with build/boot commands from all README files in s_targets + +initbuildboot: $(BUILDBOOT_XML) + +cleanbuildboot: + $(VERB)rm -f $(BUILDBOOT_XML) 2>/dev/null + + +$(BUILDBOOT_XML): s_targets $(BUILDBOOT_TEMPLATE) + @echo "Creating $(BUILDBOOT_XML) from READMEs" + $(VERB)INITBB_CMD=initbuildboot.sh ; \ + if [ -f "$$INITBB_CMD" ]; then \ + sh "$$INITBB_CMD" -xml $(BUILDBOOT_XML) -template $(BUILDBOOT_TEMPLATE) ; \ + else \ + echo "ERROR: Missing $$INITBB_CMD, can not create $(BUILDBOOT_XML)"; exit 10; \ + fi + +# **************************************************************************** -- cgit v1.2.3-54-g00ecf