forked from SUSE/doc-susemanager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
412 lines (321 loc) · 13.2 KB
/
Makefile
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
# Makefile for SUSE Manager/Uyuni Documentation
# Author: Joseph Cayouette
# Inspired/modified from Owncloud's documentation Makefile written by Matthew Setter
SHELL = bash
# SUMA Productname and file replacement
PRODUCTNAME_SUMA ?= 'SUSE Manager'
FILENAME_SUMA ?= suse_manager
# UYUNI Productname and file replacement
PRODUCTNAME_UYUNI ?= Uyuni
FILENAME_UYUNI ?= uyuni
# PDF Resource Locations
PDF_FONTS_DIR ?= branding/pdf-resources/fonts
PDF_THEME_DIR ?= branding/pdf-resources/themes
# PDF Publishing Themes, draft uses a draft watermark.
# SUMA PDF Themes
# Available Choices set variable
# suse-draft
# suse
PDF_THEME_SUMA ?= suse-draft
# UYUNI PDF Themes
# Available Choices set variable
# uyuni-draft
# uyuni
PDF_THEME_UYUNI ?= uyuni
REVDATE ?= "$(shell date +'%B %d, %Y')"
CURDIR ?= .
# Build directories for TAR
HTML_BUILD_DIR ?= build
PDF_BUILD_DIR ?= build/pdf
# SUMA OBS Tarball Filenames
HTML_OUTPUT_SUMA ?= susemanager-docs_en
PDF_OUTPUT_SUMA ?= susemanager-docs_en-pdf
# UYUNI OBS Tarball Filenames
HTML_OUTPUT_UYUNI ?= uyuni-docs_en
PDF_OUTPUT_UYUNI ?= uyuni-docs_en-pdf
# Help Menu
PHONY: help
help: ## Prints a basic help menu about available targets
@IFS=$$'\n' ; \
help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/:/'`); \
printf "%-30s %s\n" "target" "help" ; \
printf "%-30s %s\n" "------" "----" ; \
for help_line in $${help_lines[@]}; do \
IFS=$$':' ; \
help_split=($$help_line) ; \
help_command=`echo $${help_split[0]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
help_info=`echo $${help_split[2]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
printf '\033[36m'; \
printf "%-30s %s" $$help_command ; \
printf '\033[0m'; \
printf "%s\n" $$help_info; \
done
# Clean up build artifacts
.PHONY: clean
clean: ## Remove build artifacts from output directory (Antora and PDF)
-rm -rf build/ .cache/ public/
# SUMA DOCUMENTATION BUILD COMMANDS
# To build for suma or uyuni you need to comment out the correct name/title in the antora.yml file. (TODO remove this manual method.)
.PHONY: antora-suma
antora-suma: clean pdf-all-suma ## Build the SUMA Antora static site (See README for more information)
sed -i "s/^ # *\(name: *suse-manager\)/\1/;\
s/^ # *\(title: *SUSE Manager\)/\1/;\
s/^ # *\(start_page: *ROOT:index-suma\)/\1/;\
s/^ *\(title: *Uyuni\)/#\1/;\
s/^ *\(name: *uyuni\)/#\1/;\
s/^ *\(start_page: *ROOT:index-uyuni\)/#\1/;" antora.yml
docker run -u 1000 -v `pwd`:/antora --rm -t antora/antora:latest suma-site.yml
# SUMA
.PHONY: obs-packages-suma
obs-packages-suma: clean pdf-all-suma antora-suma ## Generate SUMA OBS tar files
tar --exclude='$(PDF_BUILD_DIR)' -czvf $(HTML_OUTPUT_SUMA).tar.gz $(HTML_BUILD_DIR)
tar -czvf $(PDF_OUTPUT_SUMA).tar.gz $(PDF_BUILD_DIR)
mkdir build/packages
mv $(HTML_OUTPUT_SUMA).tar.gz $(PDF_OUTPUT_SUMA).tar.gz build/packages
.PHONY: pdf-all-suma
pdf-all-suma: pdf-install-suma pdf-client-config-suma pdf-upgrade-suma pdf-reference-suma pdf-administration-suma pdf-salt-suma pdf-retail-suma ##pdf-architecture-suma ## Generate PDF versions of all SUMA books
.PHONY: pdf-install-suma
pdf-install-suma: ## Generate PDF version of the SUMA Installation Guide
asciidoctor-pdf \
-r ./extensions/xref-converter.rb \
-a pdf-stylesdir=$(PDF_THEME_DIR)/ \
-a pdf-style=$(PDF_THEME_SUMA) \
-a pdf-fontsdir=$(PDF_FONTS_DIR) \
-a productname=$(PRODUCTNAME_SUMA) \
-a examplesdir=modules/installation/examples \
-a imagesdir=modules/installation/assets/images \
-a revdate=$(REVDATE) \
--base-dir . \
--out-file $(PDF_BUILD_DIR)/$(FILENAME_SUMA)_installation_guide.pdf \
modules/installation/nav-installation-guide.adoc
.PHONY: pdf-client-config-suma
pdf-client-config-suma: ## Generate PDF version of the SUMA Client Configuraiton Guide
asciidoctor-pdf \
-r ./extensions/xref-converter.rb \
-a pdf-stylesdir=$(PDF_THEME_DIR)/ \
-a pdf-style=$(PDF_THEME_SUMA) \
-a pdf-fontsdir=$(PDF_FONTS_DIR) \
-a productname=$(PRODUCTNAME_SUMA) \
-a examplesdir=modules/client-configuration/examples \
-a imagesdir=modules/client-configuration/assets/images \
-a revdate=$(REVDATE) \
--base-dir . \
--out-file $(PDF_BUILD_DIR)/$(FILENAME_SUMA)_client_configuration_guide.pdf \
modules/client-configuration/nav-client-config-guide.adoc
.PHONY: pdf-upgrade-suma
pdf-upgrade-suma: ## Generate PDF version of the SUMA Upgrade Guide
asciidoctor-pdf \
-r ./extensions/xref-converter.rb \
-a pdf-stylesdir=$(PDF_THEME_DIR)/ \
-a pdf-style=$(PDF_THEME_SUMA) \
-a pdf-fontsdir=$(PDF_FONTS_DIR) \
-a productname=$(PRODUCTNAME_SUMA) \
-a examplesdir=modules/upgrade/examples \
-a imagesdir=modules/upgrade/assets/images \
-a revdate=$(REVDATE) \
--base-dir . \
--out-file $(PDF_BUILD_DIR)/$(FILENAME_SUMA)_upgrade_guide.pdf \
modules/upgrade/nav-upgrade-guide.adoc
.PHONY: pdf-reference-suma
pdf-reference-suma: ## Generate PDF version of the SUMA Reference Manual
asciidoctor-pdf \
-r ./extensions/xref-converter.rb \
-a pdf-stylesdir=$(PDF_THEME_DIR)/ \
-a pdf-style=$(PDF_THEME_SUMA) \
-a pdf-fontsdir=$(PDF_FONTS_DIR) \
-a productname=$(PRODUCTNAME_SUMA) \
-a examplesdir=modules/reference/examples \
-a imagesdir=modules/reference/assets/images \
-a revdate=$(REVDATE) \
--base-dir . \
--out-file $(PDF_BUILD_DIR)/$(FILENAME_SUMA)_reference_manual.pdf \
modules/reference/nav-reference-manual.adoc
.PHONY: pdf-administration-suma
pdf-administration-suma: ## Generate PDF version of the SUMA Administration Guide
asciidoctor-pdf \
-r ./extensions/xref-converter.rb \
-a pdf-stylesdir=$(PDF_THEME_DIR)/ \
-a pdf-style=$(PDF_THEME_SUMA) \
-a pdf-fontsdir=$(PDF_FONTS_DIR) \
-a productname=$(PRODUCTNAME_SUMA) \
-a examplesdir=modules/administration/examples \
-a imagesdir=modules/administration/assets/images \
-a revdate=$(REVDATE) \
--base-dir . \
--out-file $(PDF_BUILD_DIR)/$(FILENAME_SUMA)_administration_guide.pdf \
modules/administration/nav-administration-guide.adoc
.PHONY: pdf-salt-suma
pdf-salt-suma: ## Generate PDF version of the SUMA Salt Guide
asciidoctor-pdf \
-r ./extensions/xref-converter.rb \
-a pdf-stylesdir=$(PDF_THEME_DIR)/ \
-a pdf-style=$(PDF_THEME_SUMA) \
-a pdf-fontsdir=$(PDF_FONTS_DIR) \
-a productname=$(PRODUCTNAME_SUMA) \
-a examplesdir=modules/salt/examples \
-a imagesdir=modules/salt/assets/images \
-a revdate=$(REVDATE) \
--base-dir . \
--out-file $(PDF_BUILD_DIR)/$(FILENAME_SUMA)_salt_guide.pdf \
modules/salt/nav-salt-guide.adoc
.PHONY: pdf-retail-suma
pdf-retail-suma: ## Generate PDF version of the SUMA Retail Guide
asciidoctor-pdf \
-r ./extensions/xref-converter.rb \
-a pdf-stylesdir=$(PDF_THEME_DIR)/ \
-a pdf-style=$(PDF_THEME_SUMA) \
-a pdf-fontsdir=$(PDF_FONTS_DIR) \
-a productname=$(PRODUCTNAME_SUMA) \
-a examplesdir=modules/retail/examples \
-a imagesdir=modules/retail/assets/images \
-a revdate=$(REVDATE) \
--base-dir . \
--out-file $(PDF_BUILD_DIR)/$(FILENAME_SUMA)_retail_guide.pdf \
modules/retail/nav-retail.adoc
.PHONY: pdf-architecture-suma
pdf-architecture-suma: ## Generate PDF version of the SUMA Architecture Guide
asciidoctor-pdf \
-r ./extensions/xref-converter.rb \
-a productname=$(PRODUCTNAME) \
-a pdf-stylesdir=$(PDF_THEME_DIR)/ \
-a pdf-style=$(PDF_THEME_SUMA) \
-a pdf-fontsdir=$(PDF_FONTS_DIR) \
-a productname=$(PRODUCTNAME_SUMA) \
-a examplesdir=modules/architecture/examples \
-a imagesdir=modules/architecture/assets/images \
-a revdate=$(REVDATE) \
--base-dir $(CURDIR) \
--out-file $(PDF_BUILD_DIR)/$(FILENAME_SUMA)_architecture.pdf \
modules/architecture/nav-architecture-components-guide.adoc
# UYUNI DOCUMENTATION BUILD COMMANDS
.PHONY: antora-uyuni
antora-uyuni: clean pdf-all-uyuni ## Build the UYUNI Antora static site (See README for more information)
sed -i "s/^ *\(name: *suse-manager\)/#\1/;\
s/^ *\(title: *SUSE Manager\)/#\1/;\
s/^ *\(start_page: *ROOT:index-suma\)/#\1/;\
s/^ *# *\(title: *Uyuni\)/\1/;\
s/^ *# *\(name: *uyuni\)/\1/;\
s/^ *# *\(start_page: *ROOT:index-uyuni\)/\1/;" antora.yml
docker run -u 1000 -v `pwd`:/antora --rm -t antora/antora:latest uyuni-site.yml
# UYUNI
.PHONY: obs-packages-uyuni
obs-packages-uyuni: clean pdf-all-uyuni antora-uyuni ## Generate UYUNI OBS tar files
tar --exclude='$(PDF_BUILD_DIR)' -czvf $(HTML_OUTPUT_UYUNI).tar.gz $(HTML_BUILD_DIR)
tar -czvf $(PDF_OUTPUT_UYUNI).tar.gz $(PDF_BUILD_DIR)
mkdir build/packages
mv $(HTML_OUTPUT_UYUNI).tar.gz $(PDF_OUTPUT_UYUNI).tar.gz build/packages
.PHONY: pdf-all-uyuni
pdf-all-uyuni: pdf-install-uyuni pdf-client-config-uyuni pdf-upgrade-uyuni pdf-reference-uyuni pdf-administration-uyuni pdf-salt-uyuni pdf-retail-uyuni pdf-architecture-uyuni ## Generate PDF versions of all UYUNI books
.PHONY: pdf-install-uyuni
pdf-install-uyuni: ## Generate PDF version of the UYUNI Installation Guide
asciidoctor-pdf \
-r ./extensions/xref-converter.rb \
-a pdf-stylesdir=$(PDF_THEME_DIR)/ \
-a pdf-style=$(PDF_THEME_UYUNI) \
-a pdf-fontsdir=$(PDF_FONTS_DIR) \
-a productname=$(PRODUCTNAME_UYUNI) \
-a examplesdir=modules/installation/examples \
-a imagesdir=modules/installation/assets/images \
-a revdate=$(REVDATE) \
--base-dir . \
--out-file $(PDF_BUILD_DIR)/$(FILENAME_UYUNI)_installation_guide.pdf \
modules/installation/nav-installation-guide.adoc
.PHONY: pdf-client-config-uyuni
pdf-client-config-uyuni: ## Generate PDF version of the UYUNI Client Configuraiton Guide
asciidoctor-pdf \
-r ./extensions/xref-converter.rb \
-a pdf-stylesdir=$(PDF_THEME_DIR)/ \
-a pdf-style=$(PDF_THEME_UYUNI) \
-a pdf-fontsdir=$(PDF_FONTS_DIR) \
-a productname=$(PRODUCTNAME_UYUNI) \
-a examplesdir=modules/client-configuration/examples \
-a imagesdir=modules/client-configuration/assets/images \
-a revdate=$(REVDATE) \
--base-dir . \
--out-file $(PDF_BUILD_DIR)/$(FILENAME_UYUNI)_client_configuration_guide.pdf \
modules/client-configuration/nav-client-config-guide.adoc
.PHONY: pdf-upgrade-uyuni
pdf-upgrade-uyuni: ## Generate PDF version of the UYUNI Upgrade Guide
asciidoctor-pdf \
-r ./extensions/xref-converter.rb \
-a pdf-stylesdir=$(PDF_THEME_DIR)/ \
-a pdf-style=$(PDF_THEME_UYUNI) \
-a pdf-fontsdir=$(PDF_FONTS_DIR) \
-a productname=$(PRODUCTNAME_UYUNI) \
-a examplesdir=modules/upgrade/examples \
-a imagesdir=modules/upgrade/assets/images \
-a revdate=$(REVDATE) \
--base-dir . \
--out-file $(PDF_BUILD_DIR)/$(FILENAME_UYUNI)_upgrade_guide.pdf \
modules/upgrade/nav-upgrade-guide.adoc
.PHONY: pdf-reference-uyuni
pdf-reference-uyuni: ## Generate PDF version of the UYUNI Reference Manual
asciidoctor-pdf \
-r ./extensions/xref-converter.rb \
-a pdf-stylesdir=$(PDF_THEME_DIR)/ \
-a pdf-style=$(PDF_THEME_UYUNI) \
-a pdf-fontsdir=$(PDF_FONTS_DIR) \
-a productname=$(PRODUCTNAME_UYUNI) \
-a examplesdir=modules/reference/examples \
-a imagesdir=modules/reference/assets/images \
-a revdate=$(REVDATE) \
--base-dir . \
--out-file $(PDF_BUILD_DIR)/$(FILENAME_UYUNI)_reference_manual.pdf \
modules/reference/nav-reference-manual.adoc
.PHONY: pdf-administration-uyuni
pdf-administration-uyuni: ## Generate PDF version of the UYUNI Administration Guide
asciidoctor-pdf \
-r ./extensions/xref-converter.rb \
-a pdf-stylesdir=$(PDF_THEME_DIR)/ \
-a pdf-style=$(PDF_THEME_UYUNI) \
-a pdf-fontsdir=$(PDF_FONTS_DIR) \
-a productname=$(PRODUCTNAME_UYUNI) \
-a examplesdir=modules/administration/examples \
-a imagesdir=modules/administration/assets/images \
-a revdate=$(REVDATE) \
--base-dir . \
--out-file $(PDF_BUILD_DIR)/$(FILENAME_UYUNI)_administration_guide.pdf \
modules/administration/nav-administration-guide.adoc
.PHONY: pdf-salt-uyuni
pdf-salt-uyuni: ## Generate PDF version of the UYUNI Salt Guide
asciidoctor-pdf \
-r ./extensions/xref-converter.rb \
-a pdf-stylesdir=$(PDF_THEME_DIR)/ \
-a pdf-style=$(PDF_THEME_UYUNI) \
-a pdf-fontsdir=$(PDF_FONTS_DIR) \
-a productname=$(PRODUCTNAME_UYUNI) \
-a examplesdir=modules/salt/examples \
-a imagesdir=modules/salt/assets/images \
-a revdate=$(REVDATE) \
--base-dir . \
--out-file $(PDF_BUILD_DIR)/$(FILENAME_UYUNI)_salt_guide.pdf \
modules/salt/nav-salt-guide.adoc
.PHONY: pdf-retail-uyuni
pdf-retail-uyuni: ## Generate PDF version of the UYUNI Retail Guide
asciidoctor-pdf \
-r ./extensions/xref-converter.rb \
-a pdf-stylesdir=$(PDF_THEME_DIR)/ \
-a pdf-style=$(PDF_THEME_UYUNI) \
-a pdf-fontsdir=$(PDF_FONTS_DIR) \
-a productname=$(PRODUCTNAME_UYUNI) \
-a examplesdir=modules/retail/examples \
-a imagesdir=modules/retail/assets/images \
-a revdate=$(REVDATE) \
--base-dir . \
--out-file $(PDF_BUILD_DIR)/$(FILENAME_UYUNI)_retail_guide.pdf \
modules/retail/nav-retail.adoc
.PHONY: pdf-architecture-uyuni
pdf-architecture-uyuni: ## Generate PDF version of the UYUNI Architecture Guide
asciidoctor-pdf \
-r ./extensions/xref-converter.rb \
-a productname=$(PRODUCTNAME_UYUNI) \
-a pdf-stylesdir=$(PDF_THEME_DIR)/ \
-a pdf-style=$(PDF_THEME_UYUNI) \
-a pdf-fontsdir=$(PDF_FONTS_DIR) \
-a productname=$(PRODUCTNAME) \
-a examplesdir=modules/architecture/examples \
-a imagesdir=modules/architecture/assets/images \
-a revdate=$(REVDATE) \
--base-dir $(CURDIR) \
--out-file $(PDF_BUILD_DIR)/$(FILENAME_UYUNI)_architecture.pdf \
modules/architecture/nav-architecture-components-guide.adoc