diff options
Diffstat (limited to 'documentation/Makefile')
-rw-r--r-- | documentation/Makefile | 172 |
1 files changed, 172 insertions, 0 deletions
diff --git a/documentation/Makefile b/documentation/Makefile new file mode 100644 index 0000000..d6683ce --- /dev/null +++ b/documentation/Makefile | |||
@@ -0,0 +1,172 @@ | |||
1 | #Path to this subsystem's root directory | ||
2 | SUBSYSROOT := $(shell pwd) | ||
3 | |||
4 | #Path to the directory under which both documentation and docbuild repos shall be cloned | ||
5 | CLONEROOT := $(dir $(abspath $(dir $(SUBSYSROOT)))) | ||
6 | |||
7 | #Path to each required git clone | ||
8 | CLONE_DOCBUILD = $(CLONEROOT)docbuild | ||
9 | CLONE_DOC = $(CLONEROOT)documentation | ||
10 | CLONE_CUSTOM = $(CLONEROOT)meta-enea-base-ppc | ||
11 | |||
12 | #Git repositories to be cloned | ||
13 | REPO_DOCBUILD = build/docbuild.git | ||
14 | REPO_DOC = linux/documentation.git | ||
15 | ## THIS clone | ||
16 | REPO_CUSTOM = linux/meta-enea-base-ppc.git | ||
17 | #Test if required clones exist | ||
18 | ifeq ($(wildcard $(CLONE_DOCBUILD)),) | ||
19 | $(error Cannot find expected clone of $(REPO_DOCBUILD) in $(CLONE_DOCBUILD)) | ||
20 | endif | ||
21 | ifeq ($(wildcard $(CLONE_DOC)),) | ||
22 | $(error Cannot find expected clone of $(REPO_DOC) in $(CLONE_DOC)) | ||
23 | endif | ||
24 | ifeq ($(wildcard $(CLONE_CUSTOM)),) | ||
25 | $(error Cannot find expected clone of $(REPO_CUSTOM) in $(CLONE_CUSTOM)) | ||
26 | endif | ||
27 | |||
28 | #Path to DocBook make files and templates | ||
29 | DOCBOOKMAKE = $(CLONE_DOCBUILD)/docmake | ||
30 | DOCBOOKTEMPLATE = $(CLONE_DOCBUILD)/template | ||
31 | |||
32 | #Path to the OLINK database including leading part of file name (will add -$(FORMAT).db) | ||
33 | DOCBOOKOLINKDB_BASE = $(CLONE_CUSTOM)/documentation/olinkdb/olink-targetdb-master | ||
34 | DOCBOOK_OLINKS ?= yes | ||
35 | |||
36 | #Components in this subsystem | ||
37 | COMPONENTS := book-enea-linux-users-guide book-enea-linux-release-info book-enea-linux-open-source | ||
38 | |||
39 | #Release version, used in labels and text | ||
40 | REL_VER_EXT := $(shell perl -e \ | ||
41 | 'while(<>) {\ | ||
42 | if (/<!ENTITY ENEA_LINUX_REL_VER "([\d\.-\w]+)">/) { print $$1 ; exit; }\ | ||
43 | }' \ | ||
44 | < $(CLONE_CUSTOM)/documentation/docsrc_common/pardoc-distro.xml 2>/dev/null) | ||
45 | #$(info REL_VER_EXT = $(REL_VER_EXT)) | ||
46 | |||
47 | ifneq ($(REL_VER_EXT),) | ||
48 | REL_VER ?= $(REL_VER_EXT) | ||
49 | else | ||
50 | REL_VER ?= undefined | ||
51 | endif | ||
52 | $(info REL_VER = $(REL_VER)) | ||
53 | |||
54 | # ----------------------------------------------------- | ||
55 | # Standalone builds | ||
56 | DOCBOOK_FO_USEFOP ?= yes | ||
57 | |||
58 | DOCBOOK_TO_BOOKDIR ?= yes | ||
59 | |||
60 | |||
61 | # -------------------------------------------------------------- | ||
62 | ifeq ($(VERBOSE),yes) | ||
63 | VERB := | ||
64 | else | ||
65 | VERB := @ | ||
66 | endif | ||
67 | MAKEFLAGS += --no-print-directory | ||
68 | MAKEFLAGS += --directory $(SUBSYSROOT) | ||
69 | MAKEFLAGS += --no-builtin-rules --no-builting-variables | ||
70 | |||
71 | # Skip xml validation to make it possible to include xml files with unresolved | ||
72 | # links from book-enea-linux-users-guide | ||
73 | VALIDATE = no | ||
74 | |||
75 | # BL_LABEL is either given on make command line or using BOOK_VER or defaults to a timestamp | ||
76 | |||
77 | # Export all parameters including those on the command line | ||
78 | export | ||
79 | |||
80 | .PHONY: doc books docusage | ||
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' | ||
86 | @echo 'The following directories must be cloned into the same directory before running make doc:' | ||
87 | @echo ' docbuild #Clone of repo $(REPO_DOCBUILD)' | ||
88 | @echo ' documentation #Clone of repo $(REPO_DOC)' | ||
89 | @echo ' meta-enea-base-ppc #Clone of repo $(REPO_CUSTOM) (build GA PPC userdoc from THIS clone)' | ||
90 | @echo 'Optional parameters for make doc:' | ||
91 | @echo ' COMP=<book-directory> #Component (book) to build. Book component names are book-*' | ||
92 | @echo ' #Default component/s:' | ||
93 | @echo ' $(COMPONENTS)' | ||
94 | @echo ' FORMAT=<format> #One of: pdf, html, or eclipse (Default all are built)' | ||
95 | @echo ' BL_LABEL=<baseline> #Becomes footer in book (default: date + time)' | ||
96 | @echo ' DOCBOOK_TO_BOOKDIR=no #(default yes) Avoid moving result to book directory' | ||
97 | @echo ' # and avoid erasing common doc and tmp directories' | ||
98 | @echo ' BOOKFORCE=yes #Force rebuilding (ignore dependency on file times or BL_LABEL)' | ||
99 | @echo ' # Dependency only works if common doc directory is kept' | ||
100 | @echo ' BOOKCONDITION="xx;yy;.." #Include XML elements with condition any of xx or yy' | ||
101 | @echo ' # (if rebuilding, BOOKFORCE=yes may be needed)' | ||
102 | @echo ' # Empty=only default. none=none, all=everything.' | ||
103 | @echo ' BOOKDEFAULTCONDITION #Default conditions, if no BOOKCONDITION. Used in book-*/swcomp.mk' | ||
104 | @echo ' SHOW_COMMENTS=yes #For proofread. Unhide <remark>..</remark> comments Only PDF' | ||
105 | @echo ' BOOKVERBOSE=yes #Verbose info building books' | ||
106 | @echo ' DOCBOOK_OLINKS=no #Avoid the olink database in Makefile (in book not using it)' | ||
107 | @echo ' DOCBOOK_OLINK_TARGETDB=only #Build a target db for this book (for links into it)' | ||
108 | @echo ' DOCBOOK_OLINK_TARGETDB=yes #Build a target db AND build the book' | ||
109 | @echo ' #Master olinkdb defined in this Makefile, one per generated format, is:' | ||
110 | @echo ' $(DOCBOOKOLINKDB_BASE)_*.db' | ||
111 | @echo ' Typical examples:' | ||
112 | @echo ' make doc Creates all books, all formats' | ||
113 | @echo ' make doc COMP=book-xxxx FORMAT=html' | ||
114 | @echo ' make doc COMP=book-xxxx FORMAT=pdf' | ||
115 | @echo ' make doc BL_LABEL="Version 1.2.3" Creates all with version in footers and front' | ||
116 | |||
117 | @echo ' Requires docbook-xsl-1.76.1 or later, docbook-xml 4.2, svg1.1, fop-1.0 + fop-hyph.jar' | ||
118 | @echo ' fop + the separate fop-hyph can be found together in package "libfop-java"' | ||
119 | @echo ' otherwise fetch fop-hyph.jar and place in same place as fop.jar' | ||
120 | @echo ' Requires libxml2-2.7.8 or later, libxslt-1.1.26 or later' | ||
121 | @echo ' Requires java machine to run fop (creating PDF). jar for optional FORMAT=eclipse' | ||
122 | @echo ' Without jar, the optional EclipseHelp format can not be built' | ||
123 | @echo ' tools_book_standalone.mk => libxml2, libxslt, and fop (and to catalog-el.xml)' | ||
124 | @echo ' catalog-el.xml => svg, docbook-xml, docbook-xsl' | ||
125 | ifeq ($(DOCBOOK_TOOLS_VERSIONS),yes) | ||
126 | $(VERB)$(MAKE) -f $(DOCBOOKMAKE)/tools_book_standalone.mk book_tools_versions | ||
127 | endif | ||
128 | |||
129 | # If no COMP, iterate over books-* in COMPONENTS with make doc | ||
130 | ifeq ($(COMP),) | ||
131 | doc: | ||
132 | ifneq ($(filter book-%, $(COMPONENTS)),) | ||
133 | $(VERB)for comp in $(filter book-%, $(COMPONENTS)); do \ | ||
134 | $(MAKE) doc COMP=$$comp; \ | ||
135 | done | ||
136 | endif | ||
137 | |||
138 | else | ||
139 | ifneq ($(wildcard $(SUBSYSROOT)/docsrc_common/conditions.mk),) | ||
140 | include $(SUBSYSROOT)/docsrc_common/conditions.mk | ||
141 | endif | ||
142 | include $(SUBSYSROOT)/$(COMP)/swcomp.mk | ||
143 | |||
144 | doc: books | ||
145 | @# | ||
146 | endif | ||
147 | |||
148 | # Default FORMATs | ||
149 | ifeq ($(FORMAT),) | ||
150 | FORMAT=html pdf eclipse | ||
151 | endif | ||
152 | |||
153 | |||
154 | books: | ||
155 | # BOOKPACKAGES is defined in all book-*/swcomp.mk | ||
156 | $(VERB)for book in $(BOOKPACKAGES); do \ | ||
157 | for format in $(FORMAT); do \ | ||
158 | $(MAKE) -f $(DOCBOOKMAKE)/make_docbook_standalone.mk BOOK=$$book FORMAT=$$format books || exit 10; \ | ||
159 | done ; \ | ||
160 | done | ||
161 | ifeq ($(DOCBOOK_TO_BOOKDIR),yes) | ||
162 | $(VERB)rm -rf doc tmp | ||
163 | endif | ||
164 | |||
165 | |||
166 | clean: | ||
167 | $(VERB)rm -rf doc tmp 2>/dev/null | ||
168 | ifneq ($(filter book-%, $(COMPONENTS)),) | ||
169 | $(VERB)for comp in $(filter book-%, $(COMPONENTS)); do \ | ||
170 | rm -rf $$comp/book*.pdf $$comp/html $$comp/eclipse 2>/dev/null; \ | ||
171 | done | ||
172 | endif | ||