diff options
Diffstat (limited to 'doc/Makefile')
-rw-r--r-- | doc/Makefile | 283 |
1 files changed, 0 insertions, 283 deletions
diff --git a/doc/Makefile b/doc/Makefile deleted file mode 100644 index 19c8a1f..0000000 --- a/doc/Makefile +++ /dev/null | |||
@@ -1,283 +0,0 @@ | |||
1 | #Path to this subsystem's root directory | ||
2 | SUBSYSROOT := $(shell pwd) | ||
3 | |||
4 | MANIFEST_DIR = $(dir $(SUBSYSROOT)) | ||
5 | MANIFEST_NAME = $(lastword $(subst /, ,$(MANIFEST_DIR))) | ||
6 | MANIFEST_TAIL = $(word 2,$(subst -, ,$(MANIFEST_NAME))) | ||
7 | |||
8 | # Generic docbuild.git auto-clone + s_docbuild symlink. Includes TMPCLONEROOT | ||
9 | include init.mk | ||
10 | |||
11 | # ****************** SUPPORT FOR TARGETS *************************** | ||
12 | PATH_TARGETS = $(SUBSYSROOT)/s_targets | ||
13 | #Git repositories to be cloned | ||
14 | NAME_TARGETS := targets | ||
15 | #Path to the directory under which repos shall be cloned. | ||
16 | DOCBASEDIR=$(shell pwd) | ||
17 | REPODIR=$(DOCBASEDIR)/.. | ||
18 | TMPCLONEROOT_TARGETS := $(TMPCLONEROOT)/$(NAME_TARGETS) | ||
19 | TARGETDEFAULTXMLS := $(shell cd $(REPODIR); ls -1 */default.xml) | ||
20 | # URL and HASH of this manifest repository to be used by the repo tool | ||
21 | CURRENTHASH := $(shell git log -1 --pretty=format:%H 2>/dev/null) | ||
22 | CURRENTURL := $(shell git remote show origin | sed -n '/Fetch URL: /s/^.*URL: //p' 2>/dev/null) | ||
23 | |||
24 | # ******************* AutoGenerated chapter from template and target READMEs ******* | ||
25 | BUILDBOOT_XML := book-enea-linux-release-info/doc/build_boot_generated.xml | ||
26 | BUILDBOOT_TEMPLATE := book-enea-linux-release-info/doc/build_boot_template.xml | ||
27 | |||
28 | |||
29 | |||
30 | # ----------------------------------------------------- | ||
31 | #Path to DocBook make files and templates | ||
32 | DOCBOOKMAKE = $(SUBSYSROOT)/s_docbuild/docmake | ||
33 | DOCBOOKTEMPLATE = $(SUBSYSROOT)/s_docbuild/template | ||
34 | |||
35 | #Path to the OLINK database including leading part of file name (will add -$(FORMAT).db) | ||
36 | DOCBOOKOLINKDB_BASE = $(SUBSYSROOT)/s_docbuild/olinkdb/olink-targetdb-master | ||
37 | |||
38 | DOCBOOK_OLINKS ?= yes | ||
39 | DOCBOOK_FO_USEFOP ?= yes | ||
40 | DOCBOOK_TO_BOOKDIR ?= yes | ||
41 | DOCBOOK_CLEANTMP ?= yes | ||
42 | |||
43 | #Components (books) in this subsystem | ||
44 | # COMPONENTS := book-enea-linux-release-info book-enea-linux-open-source | ||
45 | # COMPONENTS += book-enea-linux-eclipse-open-source | ||
46 | COMPONENTS := $(shell ls -d book-enea* ) | ||
47 | |||
48 | # -------------------------------------------------------------- | ||
49 | ifeq ($(VERBOSE),yes) | ||
50 | VERB := | ||
51 | else | ||
52 | VERB := @ | ||
53 | endif | ||
54 | MAKEFLAGS += --no-print-directory | ||
55 | MAKEFLAGS += --directory $(SUBSYSROOT) | ||
56 | MAKEFLAGS += --no-builtin-rules --no-builting-variables | ||
57 | |||
58 | # Skip xml validation to make it possible to include xml files with unresolved | ||
59 | # links from book-enea-linux-users-guide | ||
60 | VALIDATE = no | ||
61 | |||
62 | # BL_LABEL is either given on make command line or using BOOK_VER or defaults to a timestamp | ||
63 | |||
64 | # ****************************************************************** | ||
65 | |||
66 | # Export all parameters including those on the command line | ||
67 | export | ||
68 | |||
69 | .PHONY: doc books docusage init initbuild inittargets initpardoc initbuildboot dist | ||
70 | |||
71 | |||
72 | docusage: | ||
73 | @echo 'make docusage #Shows this help text' | ||
74 | @echo ' DOCBOOK_TOOLS_VERSIONS=yes #Displays DocBook tools versions in this machine' | ||
75 | @echo 'make doc #Builds the userdoc, does autoinit if needed' | ||
76 | @echo 'make dist BOOK_DIST_DIR=xx/doc #Builds all and copies results to BOOK_DIST_DIR' | ||
77 | @echo ' #Does not work with DOCBOOK_TO_BOOKDIR or BOOK_BUILD_DIR' | ||
78 | @echo ' #Currently EclipseHelp formated doc will not be in BOOK_DIST_DIR' | ||
79 | @echo ' # unless BOOK_DIST_ECLIPSE is set to yes' | ||
80 | @echo 'make init #Init all needed init* below' | ||
81 | @echo 'make initbuild #Init s_docbuild Docbook build system and central files' | ||
82 | @echo 'make inittargets #Init s_targets using repo tool Targets in this distro with poky' | ||
83 | @echo 'make initpardoc #Init s_docsrc_common using info from poky/' | ||
84 | @echo 'make initbuildboot #Init build_boot chapter from READMEs and template in release info' | ||
85 | @echo ' DOCBOOK_CLEANTMP=no #Option to keep temp files in doc/ and tmp/' | ||
86 | @echo ' BOOK_GLOBALCLONEROOT=yes #Option for all init above to clone all outside the doc directory' | ||
87 | @echo ' BOOK_GLOBALCLONEROOT=otherpath #Option for all init above to clone all' | ||
88 | @echo 'make pullbuild #git pull in s_docbuild' | ||
89 | @echo 'make pulltargets #git pull in s_targets. You need also initpardoc initbuildboot' | ||
90 | @echo 'make clean #Clean. Also clean s_* but not any external clones' | ||
91 | @echo '' | ||
92 | @echo 'Optional parameters for make doc:' | ||
93 | @echo ' COMP=<book-directory> #Component (book) to build. Book component names are book-*' | ||
94 | @echo ' #Default component/s:' | ||
95 | @echo ' $(COMPONENTS)' | ||
96 | @echo ' FORMAT=<format> #One of: pdf, html, or eclipse (Default all are built)' | ||
97 | @echo ' BL_LABEL=<baseline> #Becomes footer in book (default: from poky enea.conf MAJORMINOR)' | ||
98 | @echo ' DOCBOOK_TO_BOOKDIR=no #(default yes) Avoid moving result to book directory' | ||
99 | @echo ' # and avoid erasing common doc and tmp directories' | ||
100 | @echo ' BOOKFORCE=yes #Force rebuilding (ignore dependency on file times or BL_LABEL)' | ||
101 | @echo ' # Dependency only works if common doc directory is kept' | ||
102 | @echo ' BOOKCONDITION="xx;yy;.." #Include XML elements with condition any of xx or yy' | ||
103 | @echo ' # (if rebuilding, BOOKFORCE=yes may be needed)' | ||
104 | @echo ' # Empty=only default. none=none, all=everything.' | ||
105 | @echo ' BOOKDEFAULTCONDITION #Default conditions, if no BOOKCONDITION. Used in book-*/swcomp.mk' | ||
106 | @echo ' SHOW_COMMENTS=yes #For proofread. Unhide <remark>..</remark> comments Only PDF' | ||
107 | @echo ' BOOKVERBOSE=yes #Verbose info building books' | ||
108 | @echo ' DOCBOOK_OLINKS=no #Avoid the olink database in Makefile (in book not using it)' | ||
109 | @echo ' DOCBOOK_OLINK_TARGETDB=only #Build a target db for this book (for links into it)' | ||
110 | @echo ' DOCBOOK_OLINK_TARGETDB=yes #Build a target db AND build the book' | ||
111 | @echo ' #Master olinkdb defined in this Makefile, one per generated format, is:' | ||
112 | @echo ' $(DOCBOOKOLINKDB_BASE)_*.db' | ||
113 | @echo ' Typical examples:' | ||
114 | @echo ' make doc Creates all books, all formats' | ||
115 | @echo ' make doc COMP=book-xxxx FORMAT=html' | ||
116 | @echo ' make doc COMP=book-xxxx FORMAT=pdf' | ||
117 | @echo ' make doc BL_LABEL="Version 1.2.3" Creates all with version in footers and front' | ||
118 | |||
119 | @echo ' Requires docbook-xsl-1.76.1 or later, docbook-xml 4.2, svg1.1, fop-1.0 + fop-hyph.jar' | ||
120 | @echo ' fop + the separate fop-hyph can be found together in package "libfop-java"' | ||
121 | @echo ' otherwise fetch fop-hyph.jar and place in same place as fop.jar' | ||
122 | @echo ' Requires libxml2-2.7.8 or later, libxslt-1.1.26 or later' | ||
123 | @echo ' Requires java machine to run fop (creating PDF). jar for optional FORMAT=eclipse' | ||
124 | @echo ' Without jar, the optional EclipseHelp format can not be built' | ||
125 | @echo ' tools_book_standalone.mk => libxml2, libxslt, and fop (and to catalog-el.xml)' | ||
126 | @echo ' catalog-el.xml => svg, docbook-xml, docbook-xsl' | ||
127 | ifeq ($(DOCBOOK_TOOLS_VERSIONS),yes) | ||
128 | $(VERB)$(MAKE) -f $(DOCBOOKMAKE)/tools_book_standalone.mk book_tools_versions | ||
129 | endif | ||
130 | |||
131 | # We rely on make doing these in order left to right | ||
132 | init: initbuild inittargets initpardoc initbuildboot | ||
133 | pullall: pullbuild pulltargets | ||
134 | |||
135 | # If no COMP, iterate over books-* in COMPONENTS with make doc | ||
136 | ifeq ($(COMP),) | ||
137 | doc: | ||
138 | ifneq ($(filter book-%, $(COMPONENTS)),) | ||
139 | $(VERB)for comp in $(filter book-%, $(COMPONENTS)); do \ | ||
140 | $(MAKE) doc COMP=$$comp; \ | ||
141 | done | ||
142 | endif | ||
143 | |||
144 | else | ||
145 | include $(SUBSYSROOT)/$(COMP)/swcomp.mk | ||
146 | |||
147 | doc: books | ||
148 | @# | ||
149 | endif | ||
150 | |||
151 | dist: doc | ||
152 | @echo "Copying resulting built documents to $(BOOK_DIST_DIR)" | ||
153 | $(VERB)if [ "$(BOOK_DIST_DIR)" = "" ]; then echo "ERROR: Missing BOOK_DIST_DIR parameter, typically shall be xxx/doc"; exit 10; fi | ||
154 | $(VERB)if [ ! -d "`dirname $(BOOK_DIST_DIR)`" ]; then echo "ERROR: Missing parent for BOOK_DIST_DIR"; exit 10; fi | ||
155 | $(VERB)if [ -f "$(BOOK_DIST_DIR)/Makefile" ]; then echo "ERROR: Wrong BOOK_DIST_DIR, contains a Makefile?"; exit 10; fi | ||
156 | $(VERB)if [ ! -d "$(BOOK_DIST_DIR)" ]; then mkdir -p "$(BOOK_DIST_DIR)" ; fi | ||
157 | $(VERB)for book in $(COMPONENTS); do \ | ||
158 | if ls -d $$book/book*.pdf >/dev/null 2>&1; then cp --preserve=timestamps $$book/book*.pdf "$(BOOK_DIST_DIR)" ; fi ; \ | ||
159 | if ls -d $$book/html >/dev/null 2>&1; then cp -r --preserve=timestamps $$book/html "$(BOOK_DIST_DIR)" ; fi ; \ | ||
160 | if [ "$(BOOK_DIST_ECLIPSE)" = "yes" ]; then \ | ||
161 | if ls -d $$book/eclipse >/dev/null 2>&1; then cp -r --preserve=timestamps $$book/eclipse "$(BOOK_DIST_DIR)" ; fi ; \ | ||
162 | fi ; \ | ||
163 | done | ||
164 | |||
165 | # Default FORMATs | ||
166 | ifeq ($(FORMAT),) | ||
167 | FORMAT=html pdf eclipse | ||
168 | endif | ||
169 | |||
170 | |||
171 | books: init | ||
172 | # BOOKPACKAGES is defined in all book-*/swcomp.mk | ||
173 | $(VERB)DISTRO_VERSION_MAJOR=`egrep '"EneaLinux_DISTRO_VERSION_MAJOR"' s_docsrc_common/pardoc-distro.xml | sed 's/.*<phrase>//;s/<\/phrase>.*//'` ; \ | ||
174 | DISTRO_VERSION_MINOR=`egrep '"EneaLinux_DISTRO_VERSION_MINOR"' s_docsrc_common/pardoc-distro.xml | sed 's/.*<phrase>//;s/<\/phrase>.*//'` ; \ | ||
175 | BOOKVER="Profile $(MANIFEST_TAIL)-$$DISTRO_VERSION_MAJOR$$DISTRO_VERSION_MINOR" ; \ | ||
176 | for book in $(BOOKPACKAGES); do \ | ||
177 | for format in $(FORMAT); do \ | ||
178 | $(MAKE) -f $(DOCBOOKMAKE)/make_docbook_standalone.mk BOOK=$$book FORMAT=$$format BOOK_VER="$$BOOKVER" books || exit 10; \ | ||
179 | done ; \ | ||
180 | done | ||
181 | ifeq ($(DOCBOOK_TO_BOOKDIR),yes) | ||
182 | $(VERB)rm -rf doc tmp | ||
183 | else | ||
184 | ifeq ($(DOCBOOK_CLEANTMP),yes) | ||
185 | # keep only doc/pdf/book-*.pdf doc/eclipse/plugins/com.enea.doc.book-* but delete doc/eclipse/plugins/com.enea.doc.book-*/done* | ||
186 | $(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 | ||
187 | endif | ||
188 | endif | ||
189 | |||
190 | # cleaninit cleans ALL tmpcommon and all s_* and generated build_boot chapter xml | ||
191 | clean: cleaninit cleanbuildboot | ||
192 | $(VERB)rm -rf doc tmp 2>/dev/null | ||
193 | ifneq ($(filter book-%, $(COMPONENTS)),) | ||
194 | $(VERB)for comp in $(filter book-%, $(COMPONENTS)); do \ | ||
195 | rm -rf $$comp/book*.pdf $$comp/html $$comp/eclipse 2>/dev/null; \ | ||
196 | done | ||
197 | $(VERB)rm -rf doc tmp 2>/dev/null | ||
198 | endif | ||
199 | |||
200 | |||
201 | # ****************************************************************** | ||
202 | # ****************** SUPPORT FOR TARGETS *************************** | ||
203 | inittargets: s_targets | ||
204 | pulltargets: | ||
205 | $(VERB)if [ ! -d s_targets ]; then echo "ERROR: No s_targets exists?" ; exit 10 ; fi | ||
206 | $(VERB)cd s_targets; for targ in *; do ( cd $targ ; git pull ) | ||
207 | |||
208 | |||
209 | # ----------------------------------------- | ||
210 | |||
211 | # Use repo to auto-clone each target separately - VERY LARGE if there are many targets (5 targets => about 1.3 Gytes) | ||
212 | |||
213 | s_targets: $(TMPCLONEROOT_TARGETS) | ||
214 | $(VERB)rm s_targets 2>/dev/null; ln -s $(TMPCLONEROOT_TARGETS) s_targets | ||
215 | |||
216 | |||
217 | $(TMPCLONEROOT_TARGETS): | ||
218 | $(VERB)if [ ! -d "$(TMPCLONEROOT)" ] ; then mkdir -p "$(TMPCLONEROOT)" ; fi | ||
219 | $(VERB)if [ ! -d $(TMPCLONEROOT_TARGETS) ]; then mkdir -p $(TMPCLONEROOT_TARGETS) ; fi | ||
220 | @echo "Cloning all targets using repo tool into $(TMPCLONEROOT_TARGETS)" | ||
221 | @echo "TARGETDEFAULTXMLS is <$(TARGETDEFAULTXMLS)>" | ||
222 | $(VERB)for target_default_xml in $(TARGETDEFAULTXMLS); \ | ||
223 | do \ | ||
224 | TARGDIR=$(TMPCLONEROOT_TARGETS)/`dirname $$target_default_xml` ; \ | ||
225 | echo "TARGDIR=<$$TARGDIR>" ; \ | ||
226 | if [ ! -d $$TARGDIR ]; then mkdir -p $$TARGDIR ; fi ; \ | ||
227 | ( cd $$TARGDIR ; \ | ||
228 | echo "*** Doing repo init -u $(CURRENTURL) -b $(CURRENTHASH) -m $$target_default_xml ; repo sync"; \ | ||
229 | repo init -u $(CURRENTURL) -b $(CURRENTHASH) -m $$target_default_xml ; repo sync ; \ | ||
230 | ) ; \ | ||
231 | done | ||
232 | |||
233 | # **************************************************************************** | ||
234 | # ******************** SUPPORT FOR dynamic pardoc with added parameters ****** | ||
235 | # pardoc-distro can contain MAJOR.MINOR-xxxxx keeping -xxxx when replacing MINOR.MINOR from enea.conf | ||
236 | |||
237 | PATH_DOCSRC_COMMON = $(SUBSYSROOT)/s_docsrc_common | ||
238 | NAME_DOCSRC_COMMON = docsrc_common | ||
239 | TMPCLONEROOT_DOCSRC_COMMON := $(TMPCLONEROOT)/$(NAME_DOCSRC_COMMON) | ||
240 | TMPPARDOC := $(TMPCLONEROOT_DOCSRC_COMMON)/pardoc-distro.xml | ||
241 | |||
242 | initpardoc: s_docsrc_common | ||
243 | |||
244 | cleanpardoc: | ||
245 | $(VERB)rm -rf $(TMPCLONEROOT_DOCSRC_COMMON) ; rm s_docsrc_common | ||
246 | |||
247 | s_docsrc_common: $(TMPCLONEROOT_DOCSRC_COMMON) | ||
248 | $(VERB)rm s_docsrc_common 2>/dev/null; ln -s $(TMPCLONEROOT_DOCSRC_COMMON) s_docsrc_common | ||
249 | |||
250 | $(TMPCLONEROOT_DOCSRC_COMMON): s_targets | ||
251 | $(VERB)if [ ! -d "$(TMPCLONEROOT)" ] ; then mkdir -p "$(TMPCLONEROOT)" ; fi | ||
252 | $(VERB)if [ ! -d $(TMPCLONEROOT_DOCSRC_COMMON) ]; then mkdir -p $(TMPCLONEROOT_DOCSRC_COMMON) ; fi | ||
253 | @echo "Copy and patch docsrc_common/ files to $(TMPCLONEROOT_DOCSRC_COMMON)" | ||
254 | $(VERB)FIRSTTARGET=`ls -1 s_targets/ | head -1`; \ | ||
255 | ENEACONF=s_targets/$$FIRSTTARGET/poky/meta-el-common/conf/distro/enea.conf ; \ | ||
256 | DISTRO_VERSION_MAJOR=`egrep '^DISTRO_VERSION_MAJOR' $$ENEACONF | sed 's/^[^"]*"//;s/".*//'` ; \ | ||
257 | DISTRO_VERSION_MINOR=`egrep '^DISTRO_VERSION_MINOR' $$ENEACONF | sed 's/^[^"]*"//;s/".*//'` ; \ | ||
258 | cat docsrc_common/pardoc-distro.xml | sed '/<\/section>/d' | \ | ||
259 | sed '/<!ENTITY ENEA_LINUX_REL_VER/s/MAJOR.MINOR/'"$$DISTRO_VERSION_MAJOR$$DISTRO_VERSION_MINOR"'/' | \ | ||
260 | sed '/<!ENTITY . common_poky_entities SYSTEM/s/s_targets\/[^\/]*\/poky/s_targets\/'"$$FIRSTTARGET"'\/poky/' >$(TMPPARDOC) ; \ | ||
261 | echo "<para id=\"EneaLinux_DISTRO_VERSION_MAJOR\"><phrase>$$DISTRO_VERSION_MAJOR</phrase></para>" >>$(TMPPARDOC) ; \ | ||
262 | echo "<para id=\"EneaLinux_DISTRO_VERSION_MINOR\"><phrase>$$DISTRO_VERSION_MINOR</phrase></para>" >>$(TMPPARDOC) ; \ | ||
263 | echo "</section>" >>$(TMPPARDOC) | ||
264 | |||
265 | # **************************************************************************** | ||
266 | # ***** Create XML chapter with build/boot commands from all README files in s_targets | ||
267 | |||
268 | initbuildboot: $(BUILDBOOT_XML) | ||
269 | |||
270 | cleanbuildboot: | ||
271 | $(VERB)rm -f $(BUILDBOOT_XML) 2>/dev/null | ||
272 | |||
273 | |||
274 | $(BUILDBOOT_XML): s_targets $(BUILDBOOT_TEMPLATE) | ||
275 | @echo "Creating $(BUILDBOOT_XML) from READMEs" | ||
276 | $(VERB)INITBB_CMD=initbuildboot.sh ; \ | ||
277 | if [ -f "$$INITBB_CMD" ]; then \ | ||
278 | sh "$$INITBB_CMD" -xml $(BUILDBOOT_XML) -template $(BUILDBOOT_TEMPLATE) ; \ | ||
279 | else \ | ||
280 | echo "ERROR: Missing $$INITBB_CMD, can not create $(BUILDBOOT_XML)"; exit 10; \ | ||
281 | fi | ||
282 | |||
283 | # **************************************************************************** | ||