diff options
author | Lennart Johansson <lennart.johansson@enea.com> | 2016-05-02 15:56:14 +0200 |
---|---|---|
committer | Lennart Johansson <lennart.johansson@enea.com> | 2016-05-02 15:56:14 +0200 |
commit | 91a599ada98154ae32449cbb8f58ca679a2b0937 (patch) | |
tree | cfa95fc337cbc01a074cd1dce07e7da0689a58f9 /doc/Makefile | |
parent | 2237fd6441696b7c5b8317be863171a75b49409b (diff) | |
download | el_manifests-standard-91a599ada98154ae32449cbb8f58ca679a2b0937.tar.gz |
First very prel version of release doc structure
Diffstat (limited to 'doc/Makefile')
-rw-r--r-- | doc/Makefile | 224 |
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 | ||
2 | SUBSYSROOT := $(shell pwd) | ||
3 | |||
4 | include init.mk | ||
5 | |||
6 | # ****************** SUPPORT FOR TARGETS *************************** | ||
7 | PATH_TARGETS = $(SUBSYSROOT)/s_targets | ||
8 | #Git repositories to be cloned | ||
9 | NAME_TARGETS := targets | ||
10 | #Path to the directory under which repos shall be cloned. | ||
11 | DOCBASEDIR=$(shell pwd) | ||
12 | REPODIR=$(DOCBASEDIR)/.. | ||
13 | TMPCLONEROOT_TARGETS := $(TMPCLONEROOT)/$(NAME_TARGETS) | ||
14 | TARGETDEFAULTXMLS := $(shell cd $(REPODIR); ls -1 */default.xml) | ||
15 | # URL and HASH of this manifest repository to be used by the repo tool | ||
16 | CURRENTHASH := $(shell git log -1 --pretty=format:%H 2>/dev/null) | ||
17 | CURRENTURL := $(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 | ||
25 | DOCBOOKMAKE = $(SUBSYSROOT)/s_docbuild/docmake | ||
26 | DOCBOOKTEMPLATE = $(SUBSYSROOT)/s_docbuild/template | ||
27 | |||
28 | #Path to the OLINK database including leading part of file name (will add -$(FORMAT).db) | ||
29 | DOCBOOKOLINKDB_BASE = $(SUBSYSROOT)/s_docbuild/olinkdb/olink-targetdb-master | ||
30 | |||
31 | DOCBOOK_OLINKS ?= yes | ||
32 | DOCBOOK_FO_USEFOP ?= yes | ||
33 | DOCBOOK_TO_BOOKDIR ?= yes | ||
34 | DOCBOOK_CLEANTMP ?= yes | ||
35 | |||
36 | #Components in this subsystem | ||
37 | COMPONENTS := 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 | ||
41 | REL_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 | |||
48 | ifneq ($(REL_VER_EXT),) | ||
49 | REL_VER ?= $(REL_VER_EXT) | ||
50 | else | ||
51 | REL_VER ?= undefined | ||
52 | endif | ||
53 | $(info REL_VER = $(REL_VER)) | ||
54 | |||
55 | # ----------------------------------------------------- | ||
56 | |||
57 | |||
58 | # -------------------------------------------------------------- | ||
59 | ifeq ($(VERBOSE),yes) | ||
60 | VERB := | ||
61 | else | ||
62 | VERB := @ | ||
63 | endif | ||
64 | MAKEFLAGS += --no-print-directory | ||
65 | MAKEFLAGS += --directory $(SUBSYSROOT) | ||
66 | MAKEFLAGS += --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 | ||
70 | VALIDATE = 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 | ||
77 | export | ||
78 | |||
79 | .PHONY: doc books docusage | ||
80 | |||
81 | |||
82 | docusage: | ||
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' | ||
136 | ifeq ($(DOCBOOK_TOOLS_VERSIONS),yes) | ||
137 | $(VERB)$(MAKE) -f $(DOCBOOKMAKE)/tools_book_standalone.mk book_tools_versions | ||
138 | endif | ||
139 | |||
140 | init: initbuild inittargets | ||
141 | pullall: pullbuild pulltargets | ||
142 | |||
143 | # If no COMP, iterate over books-* in COMPONENTS with make doc | ||
144 | ifeq ($(COMP),) | ||
145 | doc: | ||
146 | ifneq ($(filter book-%, $(COMPONENTS)),) | ||
147 | $(VERB)for comp in $(filter book-%, $(COMPONENTS)); do \ | ||
148 | $(MAKE) doc COMP=$$comp; \ | ||
149 | done | ||
150 | endif | ||
151 | |||
152 | else | ||
153 | include $(SUBSYSROOT)/$(COMP)/swcomp.mk | ||
154 | |||
155 | doc: books | ||
156 | @# | ||
157 | endif | ||
158 | |||
159 | |||
160 | # Default FORMATs | ||
161 | ifeq ($(FORMAT),) | ||
162 | FORMAT=html pdf eclipse | ||
163 | endif | ||
164 | |||
165 | |||
166 | books: 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 | ||
173 | ifeq ($(DOCBOOK_TO_BOOKDIR),yes) | ||
174 | $(VERB)rm -rf doc tmp | ||
175 | else | ||
176 | ifeq ($(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 | ||
179 | endif | ||
180 | endif | ||
181 | |||
182 | |||
183 | clean: cleaninit | ||
184 | $(VERB)rm -rf doc tmp 2>/dev/null | ||
185 | ifneq ($(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 | ||
190 | endif | ||
191 | |||
192 | |||
193 | # ****************************************************************** | ||
194 | # ****************** SUPPORT FOR TARGETS *************************** | ||
195 | inittargets: s_targets | ||
196 | pulltargets: | ||
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 | |||
205 | s_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 | # ****************************************************************** | ||