-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
114 lines (78 loc) · 3.19 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
# This file is part of the project https://github.com/openSUSE/doc-kit
# DO NOT EDIT THIS FILE DOWNSTREAM. IT MAY BE OVERWRITTEN BY AN UPDATE.
#
# Copyright (c) 2014 Rick Salevsky <[email protected]>
# Copyright (c) 2014, 2015, 2016 Karl Eichwalder <[email protected]>
# Copyright (c) 2015, 2016, 2017, 2018, 2019 Stefan Knorr <[email protected]>
# Copyright (c) 2020, 2021, 2023, 2024 Lukas Kucharczyk <[email protected]>
#
# AsciiDoc conditional text (e.g. for "to be released" information during beta).
LIFECYCLE_VALID := beta maintained unmaintained
ifndef LIFECYCLE
LIFECYCLE := maintained
endif
ifneq "$(LIFECYCLE)" "$(filter $(LIFECYCLE),$(LIFECYCLE_VALID))"
override LIFECYCLE := maintained
endif
# valid values are:
# micro
PRODUCT_VERSION ?= micro
dc_file := DC-release-notes-$(PRODUCT_VERSION)
mainfile := adoc/release-notes-$(PRODUCT_VERSION).adoc
daps_command := daps
xsltproc_command := xsltproc \
--stringparam generate.toc "/article toc" \
--stringparam generate.section.toc.level 0 \
--stringparam section.autolabel 1 \
--stringparam section.label.includes.component.label 2 \
--stringparam variablelist.as.blocks 1 \
--stringparam toc.section.depth 2 \
--stringparam toc.max.depth 3 \
--stringparam show.comments 0 \
--xinclude \
--nonet
src_files := $(wildcard adoc/*.adoc adoc/*.xml)
daps_xslt_rn_dir := /usr/share/daps/daps-xslt/relnotes
profile_params := --adocattr lifecycle=$(LIFECYCLE)
text_params :=
# files to be created:
profile_result := build/.profiled/noprofile/release-notes-$(PRODUCT_VERSION).xml
text_result := build/release-notes-$(PRODUCT_VERSION)/release-notes-$(PRODUCT_VERSION).txt
yast_html_result_dir := build/release-notes-$(PRODUCT_VERSION)/yast-html
yast_html_result := $(yast_html_result_dir)/release-notes.html
.PHONY: all clean html pdf single-html text validate yast-html
all: validate single-html yast-html pdf text html
#----------------
clean:
rm -rf build/
#----------------
html: $(dc_file) $(src_files)
$(daps_command) -d $< -vv $(profile_params) html --param="toc.section.depth=2"
#----------------
pdf: $(dc_file) $(src_files)
$(daps_command) -d $< -vv $(profile_params) pdf
#----------------
single-html: $(dc_file) $(src_files)
$(daps_command) -d $< -vv $(profile_params) html --single --param="toc.section.depth=2"
#----------------
# We need the text in ASCII to avoid issues when this is shown in text-only
# YaST.
text: $(text_result)
iconv -f UTF-8 -t ASCII//TRANSLIT -o /dev/stdout $< > $<.tmp
mv $<.tmp $<
$(text_result): $(dc_file) $(src_files)
$(daps_command) -d $< -vv $(profile_params) text $(text_params)
#----------------
validate: $(dc_file) $(src_files)
$(daps_command) -d $< -vv $(profile_params) --adocattr attribute-missing=warn validate
#----------------
yast-html: $(yast_html_result)
$(yast_html_result): $(profile_result)
mkdir -p $(yast_html_result_dir)
$(xsltproc_command) $(daps_xslt_rn_dir)/yast.xsl $< > $@ 2>/dev/null
@echo "Created $@ for YaST HTML target."
$(profile_result): $(dc_file) $(src_files)
$(daps_command) -vv -d $< $(profile_params) profile
serve:
# needs Python 3.7 for the --directory argument
python3 -m http.server --directory $$(find . -iname index.html -exec dirname {} \;)