summaryrefslogtreecommitdiffstats
path: root/documentation/Makefile
blob: d6683ce23f4ae8a340d6d826e6f810ebb6cfe02e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#Path to this subsystem's root directory
SUBSYSROOT := $(shell pwd)

#Path to the directory under which both documentation and docbuild repos shall be cloned
CLONEROOT := $(dir $(abspath $(dir $(SUBSYSROOT))))

#Path to each required git clone
CLONE_DOCBUILD  = $(CLONEROOT)docbuild
CLONE_DOC       = $(CLONEROOT)documentation
CLONE_CUSTOM    = $(CLONEROOT)meta-enea-base-ppc

#Git repositories to be cloned
REPO_DOCBUILD  = build/docbuild.git
REPO_DOC       = linux/documentation.git
## THIS clone
REPO_CUSTOM    = linux/meta-enea-base-ppc.git
#Test if required clones exist
ifeq ($(wildcard $(CLONE_DOCBUILD)),)
$(error Cannot find expected clone of $(REPO_DOCBUILD) in $(CLONE_DOCBUILD))
endif
ifeq ($(wildcard $(CLONE_DOC)),)
$(error Cannot find expected clone of $(REPO_DOC) in $(CLONE_DOC))
endif
ifeq ($(wildcard $(CLONE_CUSTOM)),)
$(error Cannot find expected clone of $(REPO_CUSTOM) in $(CLONE_CUSTOM))
endif

#Path to DocBook make files and templates
DOCBOOKMAKE         = $(CLONE_DOCBUILD)/docmake
DOCBOOKTEMPLATE     = $(CLONE_DOCBUILD)/template

#Path to the OLINK database including leading part of file name (will add -$(FORMAT).db)
DOCBOOKOLINKDB_BASE = $(CLONE_CUSTOM)/documentation/olinkdb/olink-targetdb-master
DOCBOOK_OLINKS ?= yes

#Components in this subsystem
COMPONENTS := book-enea-linux-users-guide book-enea-linux-release-info book-enea-linux-open-source

#Release version, used in labels and text
REL_VER_EXT := $(shell perl -e \
'while(<>) {\
  if (/<!ENTITY ENEA_LINUX_REL_VER "([\d\.-\w]+)">/) { print $$1 ; exit; }\
}' \
< $(CLONE_CUSTOM)/documentation/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))

# -----------------------------------------------------
# Standalone builds
DOCBOOK_FO_USEFOP ?= yes

DOCBOOK_TO_BOOKDIR ?= yes


# --------------------------------------------------------------
ifeq ($(VERBOSE),yes)
VERB :=
else
VERB := @
endif
MAKEFLAGS += --no-print-directory
MAKEFLAGS += --directory $(SUBSYSROOT)
MAKEFLAGS += --no-builtin-rules --no-builting-variables

# Skip xml validation to make it possible to include xml files with unresolved
# links from book-enea-linux-users-guide
VALIDATE = no

# BL_LABEL is either given on make command line or using BOOK_VER or defaults to a timestamp

# Export all parameters including those on the command line
export

.PHONY: doc books docusage

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'
	@echo 'The following directories must be cloned into the same directory before running make doc:'
	@echo '  docbuild                  #Clone of repo $(REPO_DOCBUILD)'
	@echo '  documentation             #Clone of repo $(REPO_DOC)'
	@echo '  meta-enea-base-ppc        #Clone of repo $(REPO_CUSTOM) (build GA PPC userdoc from THIS clone)'
	@echo 'Optional parameters for make doc:'
	@echo '  COMP=<book-directory>     #Component (book) to build. Book component names are book-*'
	@echo '                            #Default component/s:'
	@echo '    $(COMPONENTS)'
	@echo '  FORMAT=<format>           #One of: pdf, html, or eclipse (Default all are built)'
	@echo '  BL_LABEL=<baseline>       #Becomes footer in book (default: date + time)'
	@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)'
	@echo '                            #   Dependency only works if common doc directory is kept'
	@echo '  BOOKCONDITION="xx;yy;.."  #Include XML elements with condition any of xx or yy'
	@echo '                            #   (if rebuilding, BOOKFORCE=yes may be needed)'
	@echo '                            #   Empty=only default. none=none, all=everything.'
	@echo '  BOOKDEFAULTCONDITION      #Default conditions, if no BOOKCONDITION. Used in book-*/swcomp.mk'
	@echo '  SHOW_COMMENTS=yes         #For proofread. Unhide <remark>..</remark> comments Only PDF'
	@echo '  BOOKVERBOSE=yes           #Verbose info building books'
	@echo '  DOCBOOK_OLINKS=no         #Avoid the olink database in Makefile (in book not using it)'
	@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 '  Typical examples:'
	@echo '     make doc                          Creates all books, all formats'
	@echo '     make doc COMP=book-xxxx FORMAT=html'
	@echo '     make doc COMP=book-xxxx FORMAT=pdf'
	@echo '     make doc BL_LABEL="Version 1.2.3"  Creates all with version in footers and front'

	@echo '  Requires docbook-xsl-1.76.1 or later, docbook-xml 4.2, svg1.1, fop-1.0 + fop-hyph.jar'
	@echo '     fop + the separate fop-hyph can be found together in package "libfop-java"'
	@echo '     otherwise fetch fop-hyph.jar and place in same place as fop.jar'
	@echo '  Requires libxml2-2.7.8 or later, libxslt-1.1.26 or later'
	@echo '  Requires java machine to run fop (creating PDF). jar for optional FORMAT=eclipse'
	@echo '      Without jar, the optional EclipseHelp format can not be built'
	@echo '  tools_book_standalone.mk => libxml2, libxslt, and fop (and to catalog-el.xml)'
	@echo '  catalog-el.xml => svg, docbook-xml, docbook-xsl'
ifeq ($(DOCBOOK_TOOLS_VERSIONS),yes)
	$(VERB)$(MAKE) -f $(DOCBOOKMAKE)/tools_book_standalone.mk book_tools_versions
endif

# If no COMP, iterate over books-* in COMPONENTS with make doc
ifeq ($(COMP),)
doc:
ifneq ($(filter book-%, $(COMPONENTS)),)
	$(VERB)for comp in $(filter book-%, $(COMPONENTS)); do \
	  $(MAKE) doc COMP=$$comp; \
	done
endif

else
ifneq ($(wildcard $(SUBSYSROOT)/docsrc_common/conditions.mk),)
include $(SUBSYSROOT)/docsrc_common/conditions.mk
endif
include $(SUBSYSROOT)/$(COMP)/swcomp.mk

doc: books
	@#
endif

# Default FORMATs
ifeq ($(FORMAT),)
FORMAT=html pdf eclipse
endif


books:
# BOOKPACKAGES is defined in all book-*/swcomp.mk
	$(VERB)for book in $(BOOKPACKAGES); do \
	  for format in $(FORMAT); do \
	    $(MAKE) -f $(DOCBOOKMAKE)/make_docbook_standalone.mk BOOK=$$book FORMAT=$$format books || exit 10; \
	  done ; \
	done
ifeq ($(DOCBOOK_TO_BOOKDIR),yes)
	$(VERB)rm -rf doc tmp
endif


clean:
	$(VERB)rm -rf doc tmp 2>/dev/null
ifneq ($(filter book-%, $(COMPONENTS)),)
	$(VERB)for comp in $(filter book-%, $(COMPONENTS)); do \
	  rm -rf $$comp/book*.pdf $$comp/html $$comp/eclipse 2>/dev/null; \
	done
endif