summaryrefslogtreecommitdiffstats
path: root/doc/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'doc/Makefile')
-rw-r--r--doc/Makefile224
1 files changed, 224 insertions, 0 deletions
diff --git a/doc/Makefile b/doc/Makefile
new file mode 100644
index 0000000..306bd4d
--- /dev/null
+++ b/doc/Makefile
@@ -0,0 +1,224 @@
1#Path to this subsystem's root directory
2SUBSYSROOT := $(shell pwd)
3
4include init.mk
5
6# ****************** SUPPORT FOR TARGETS ***************************
7PATH_TARGETS = $(SUBSYSROOT)/s_targets
8#Git repositories to be cloned
9NAME_TARGETS := targets
10#Path to the directory under which repos shall be cloned.
11DOCBASEDIR=$(shell pwd)
12REPODIR=$(DOCBASEDIR)/..
13TMPCLONEROOT_TARGETS := $(TMPCLONEROOT)/$(NAME_TARGETS)
14TARGETDEFAULTXMLS := $(shell cd $(REPODIR); ls -1 */default.xml)
15# URL and HASH of this manifest repository to be used by the repo tool
16CURRENTHASH := $(shell git log -1 --pretty=format:%H 2>/dev/null)
17CURRENTURL := $(shell git remote show origin | sed -n '/Fetch URL: /s/^.*URL: //p' 2>/dev/null)
18.PHONY: inittargets
19# ******************************************************************
20
21
22
23# -----------------------------------------------------
24#Path to DocBook make files and templates
25DOCBOOKMAKE = $(SUBSYSROOT)/s_docbuild/docmake
26DOCBOOKTEMPLATE = $(SUBSYSROOT)/s_docbuild/template
27
28#Path to the OLINK database including leading part of file name (will add -$(FORMAT).db)
29DOCBOOKOLINKDB_BASE = $(SUBSYSROOT)/s_docbuild/olinkdb/olink-targetdb-master
30
31DOCBOOK_OLINKS ?= yes
32DOCBOOK_FO_USEFOP ?= yes
33DOCBOOK_TO_BOOKDIR ?= yes
34DOCBOOK_CLEANTMP ?= yes
35
36#Components in this subsystem
37COMPONENTS := book-enea-linux-release-info book-enea-linux-open-source
38# COMPONENTS += book-enea-linux-target-guide
39# -----------------------------------------------------
40#Release version, used in labels and text
41REL_VER_EXT := $(shell perl -e \
42'while(<>) {\
43 if (/<!ENTITY ENEA_LINUX_REL_VER "([\d\.-\w]+)">/) { print $$1 ; exit; }\
44}' \
45< $(SUBSYSROOT)/docsrc_common/pardoc-distro.xml 2>/dev/null)
46#$(info REL_VER_EXT = $(REL_VER_EXT))
47
48ifneq ($(REL_VER_EXT),)
49REL_VER ?= $(REL_VER_EXT)
50else
51REL_VER ?= undefined
52endif
53$(info REL_VER = $(REL_VER))
54
55# -----------------------------------------------------
56
57
58# --------------------------------------------------------------
59ifeq ($(VERBOSE),yes)
60VERB :=
61else
62VERB := @
63endif
64MAKEFLAGS += --no-print-directory
65MAKEFLAGS += --directory $(SUBSYSROOT)
66MAKEFLAGS += --no-builtin-rules --no-builting-variables
67
68# Skip xml validation to make it possible to include xml files with unresolved
69# links from book-enea-linux-users-guide
70VALIDATE = no
71
72# BL_LABEL is either given on make command line or using BOOK_VER or defaults to a timestamp
73
74# ******************************************************************
75
76# Export all parameters including those on the command line
77export
78
79.PHONY: doc books docusage
80
81
82docusage:
83 @echo 'make docusage #Shows this help text'
84 @echo ' DOCBOOK_TOOLS_VERSIONS=yes #Displays DocBook tools versions in this machine'
85 @echo 'make doc #Builds the userdoc, does autoinit if needed'
86 @echo 'make init #Init both below'
87 @echo 'make initbuild #Init s_docbuild'
88 @echo 'make inittargets #Init s_targets using repo tool'
89 @echo ' DOCBOOK_CLEANTMP=no #Option to keep temp files in doc/ and tmp/'
90 @echo ' BOOK_GLOBALCLONEROOT=yes #Option for all init above to clone all outside the doc directory'
91 @echo ' BOOK_GLOBALCLONEROOT=otherpath #Option for all init above to clone all'
92 @echo #Force rebuilding (ignore dependency on file times or BL_LABEL)'
93 @echo ' # Dependency only works if common doc directory is kept'
94 @echo ' BOOKCONDITION'make pullbuild #git pull in s_docbuild'
95 @echo 'make pulltargets #git pull in s_targets'
96 @echo 'make clean #Clean. Also clean s_* but not any external clones'
97 @echo 'The following directories are cloned via the init commands (s_* are symlinks to clones):'
98 @echo ' s_docbuild #Docbook build system and central files'
99 @echo ' s_targets #targets in this distro with poky, for picking some parameters'
100 @echo ''
101 @echo 'Optional parameters for make doc:'
102 @echo ' COMP=<book-directory> #Component (book) to build. Book component names are book-*'
103 @echo ' #Default component/s:'
104 @echo ' $(COMPONENTS)'
105 @echo ' FORMAT=<format> #One of: pdf, html, or eclipse (Default all are built)'
106 @echo ' BL_LABEL=<baseline> #Becomes footer in book (default: date + time)'
107 @echo ' DOCBOOK_TO_BOOKDIR=no #(default yes) Avoid moving result to book directory'
108 @echo ' # and avoid erasing common doc and tmp directories'
109 @echo ' BOOKFORCE=yes #Force rebuilding (ignore dependency on file times or BL_LABEL)'
110 @echo ' # Dependency only works if common doc directory is kept'
111 @echo ' BOOKCONDITION="xx;yy;.." #Include XML elements with condition any of xx or yy'
112 @echo ' # (if rebuilding, BOOKFORCE=yes may be needed)'
113 @echo ' # Empty=only default. none=none, all=everything.'
114 @echo ' BOOKDEFAULTCONDITION #Default conditions, if no BOOKCONDITION. Used in book-*/swcomp.mk'
115 @echo ' SHOW_COMMENTS=yes #For proofread. Unhide <remark>..</remark> comments Only PDF'
116 @echo ' BOOKVERBOSE=yes #Verbose info building books'
117 @echo ' DOCBOOK_OLINKS=no #Avoid the olink database in Makefile (in book not using it)'
118 @echo ' DOCBOOK_OLINK_TARGETDB=only #Build a target db for this book (for links into it)'
119 @echo ' DOCBOOK_OLINK_TARGETDB=yes #Build a target db AND build the book'
120 @echo ' #Master olinkdb defined in this Makefile, one per generated format, is:'
121 @echo ' $(DOCBOOKOLINKDB_BASE)_*.db'
122 @echo ' Typical examples:'
123 @echo ' make doc Creates all books, all formats'
124 @echo ' make doc COMP=book-xxxx FORMAT=html'
125 @echo ' make doc COMP=book-xxxx FORMAT=pdf'
126 @echo ' make doc BL_LABEL="Version 1.2.3" Creates all with version in footers and front'
127
128 @echo ' Requires docbook-xsl-1.76.1 or later, docbook-xml 4.2, svg1.1, fop-1.0 + fop-hyph.jar'
129 @echo ' fop + the separate fop-hyph can be found together in package "libfop-java"'
130 @echo ' otherwise fetch fop-hyph.jar and place in same place as fop.jar'
131 @echo ' Requires libxml2-2.7.8 or later, libxslt-1.1.26 or later'
132 @echo ' Requires java machine to run fop (creating PDF). jar for optional FORMAT=eclipse'
133 @echo ' Without jar, the optional EclipseHelp format can not be built'
134 @echo ' tools_book_standalone.mk => libxml2, libxslt, and fop (and to catalog-el.xml)'
135 @echo ' catalog-el.xml => svg, docbook-xml, docbook-xsl'
136ifeq ($(DOCBOOK_TOOLS_VERSIONS),yes)
137 $(VERB)$(MAKE) -f $(DOCBOOKMAKE)/tools_book_standalone.mk book_tools_versions
138endif
139
140init: initbuild inittargets
141pullall: pullbuild pulltargets
142
143# If no COMP, iterate over books-* in COMPONENTS with make doc
144ifeq ($(COMP),)
145doc:
146ifneq ($(filter book-%, $(COMPONENTS)),)
147 $(VERB)for comp in $(filter book-%, $(COMPONENTS)); do \
148 $(MAKE) doc COMP=$$comp; \
149 done
150endif
151
152else
153include $(SUBSYSROOT)/$(COMP)/swcomp.mk
154
155doc: books
156 @#
157endif
158
159
160# Default FORMATs
161ifeq ($(FORMAT),)
162FORMAT=html pdf eclipse
163endif
164
165
166books: initbuild inittargets
167# BOOKPACKAGES is defined in all book-*/swcomp.mk
168 $(VERB)for book in $(BOOKPACKAGES); do \
169 for format in $(FORMAT); do \
170 $(MAKE) -f $(DOCBOOKMAKE)/make_docbook_standalone.mk BOOK=$$book FORMAT=$$format books || exit 10; \
171 done ; \
172 done
173ifeq ($(DOCBOOK_TO_BOOKDIR),yes)
174 $(VERB)rm -rf doc tmp
175else
176ifeq ($(DOCBOOK_CLEANTMP),yes)
177# keep only doc/pdf/book-*.pdf doc/eclipse/plugins/com.enea.doc.book-* but delete doc/eclipse/plugins/com.enea.doc.book-*/done*
178 $(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
179endif
180endif
181
182
183clean: cleaninit
184 $(VERB)rm -rf doc tmp 2>/dev/null
185ifneq ($(filter book-%, $(COMPONENTS)),)
186 $(VERB)for comp in $(filter book-%, $(COMPONENTS)); do \
187 rm -rf $$comp/book*.pdf $$comp/html $$comp/eclipse 2>/dev/null; \
188 done
189 $(VERB)rm -rf doc tmp 2>/dev/null
190endif
191
192
193# ******************************************************************
194# ****************** SUPPORT FOR TARGETS ***************************
195inittargets: s_targets
196pulltargets:
197 $(VERB)if [ ! -d s_targets ]; then echo "ERROR: No s_targets exists?" ; exit 10 ; fi
198 $(VERB)cd s_targets; for targ in *; do ( cd $targ ; git pull )
199
200
201# -----------------------------------------
202
203# Use repo to auto-clone each target separately - VERY LARGE if there are many targets (5 targets => about 1.3 Gytes)
204
205s_targets: $(TMPCLONEROOT_TARGETS)
206 $(VERB)rm s_targets 2>/dev/null; ln -s $(TMPCLONEROOT_TARGETS) s_targets
207
208
209$(TMPCLONEROOT_TARGETS):
210 $(VERB)if [ ! -d "$(TMPCLONEROOT)" ] ; then mkdir -p "$(TMPCLONEROOT)" ; fi
211 $(VERB)if [ ! -d $(TMPCLONEROOT_TARGETS) ]; then mkdir -p $(TMPCLONEROOT_TARGETS) ; fi
212 @echo "Cloning all targets using repo tool into $(TMPCLONEROOT_TARGETS)"
213 @echo "TARGETDEFAULTXMLS is <$(TARGETDEFAULTXMLS)>"
214 $(VERB)for target_default_xml in $(TARGETDEFAULTXMLS); \
215 do \
216 TARGDIR=$(TMPCLONEROOT_TARGETS)/`dirname $$target_default_xml` ; \
217 echo "TARGDIR=<$$TARGDIR>" ; \
218 if [ ! -d $$TARGDIR ]; then mkdir -p $$TARGDIR ; fi ; \
219 ( cd $$TARGDIR ; \
220 echo "*** Doing repo init -u $(CURRENTURL) -b $(CURRENTHASH) -m $$target_default_xml ; repo sync"; \
221 repo init -u $(CURRENTURL) -b $(CURRENTHASH) -m $$target_default_xml ; repo sync ; \
222 ) ; \
223 done
224# ******************************************************************