/
Makefile
220 lines (159 loc) · 7.04 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
ROOT = "/"
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
default: all
HTML = \
404.html \
commercial-support.html \
community.html \
demos/index.html \
donate.html \
download.html \
features.html \
governance.html \
guides/ad-hoc-developer-environments.html \
guides/building-and-running-docker-images.html \
guides/continuous-integration-github-actions.html \
guides/contributing.html \
guides/declarative-and-reproducible-developer-environments.html \
guides/dev-environment.html \
guides/install-nix.html \
guides/towards-reproducibility-pinning-nixpkgs.html \
index.html \
learn.html \
news.html \
teams/discourse.html \
teams/infrastructure.html \
teams/marketing.html \
teams/nixcon.html \
teams/nixos_release.html \
teams/rfc-steering-committee.html \
teams/security.html
DEMOS = \
demos/cover.svg \
demos/example_1.svg \
demos/example_2.svg \
demos/example_3.svg \
demos/example_4.svg \
demos/example_5.svg \
demos/example_6.svg
NIX_DEV_MANUAL_IN ?= /no-such-path
NIX_DEV_MANUAL_OUT = guides
all: $(NIX_DEV_MANUAL_OUT) learn_guides.html.in
$(NIX_DEV_MANUAL_OUT) learn_guides.html.in: $(NIX_DEV_MANUAL_IN) layout.tt copy-nix-dev-tutorials.sh
bash copy-nix-dev-tutorials.sh $(NIX_DEV_MANUAL_OUT)
### Prettify the Nix Pills
NIX_PILLS_MANUAL_IN ?= /no-such-path
NIX_PILLS_MANUAL_OUT = guides/nix-pills
all: $(NIX_PILLS_MANUAL_OUT)
$(NIX_PILLS_MANUAL_OUT): $(NIX_PILLS_MANUAL_IN) bootstrapify-docbook.sh bootstrapify-docbook.xsl layout.tt common.tt
bash ./bootstrapify-docbook.sh $(NIX_PILLS_MANUAL_IN) $(NIX_PILLS_MANUAL_OUT) 'Nix Pills' nixos https://github.com/NixOS/nix-pills
### Prettify the Nix manual.
NIX_MANUAL_STABLE_IN ?= /no-such-path
NIX_MANUAL_STABLE_OUT = manual/nix/stable
all: $(NIX_MANUAL_STABLE_OUT)
$(NIX_MANUAL_STABLE_OUT): $(call rwildcard, $(NIX_MANUAL_STABLE_IN), *) bootstrapify-docbook.sh bootstrapify-docbook.xsl layout.tt common.tt
bash ./bootstrapify-docbook.sh $(NIX_MANUAL_STABLE_IN) $(NIX_MANUAL_STABLE_OUT) 'Nix $(NIX_STABLE_VERSION) manual' nix https://github.com/NixOS/nix/tree/master/doc/manual
NIX_MANUAL_UNSTABLE_IN ?= /no-such-path
NIX_MANUAL_UNSTABLE_OUT = manual/nix/unstable
all: $(NIX_MANUAL_UNSTABLE_OUT)
$(NIX_MANUAL_UNSTABLE_OUT): $(call rwildcard, $(NIX_MANUAL_UNSTABLE_IN), *) bootstrapify-docbook.sh bootstrapify-docbook.xsl layout.tt common.tt
mkdir -p $(NIX_MANUAL_UNSTABLE_OUT)
cp --no-preserve=mode,ownership -RL $(NIX_MANUAL_UNSTABLE_IN)/* $(NIX_MANUAL_UNSTABLE_OUT)
### Prettify the Nixpkgs manual.
NIXPKGS_MANUAL_STABLE_IN ?= /no-such-path
NIXPKGS_MANUAL_STABLE_OUT = manual/nixpkgs/stable
all: $(NIXPKGS_MANUAL_STABLE_OUT)
$(NIXPKGS_MANUAL_STABLE_OUT): $(NIXPKGS_MANUAL_STABLE_IN) bootstrapify-docbook.sh bootstrapify-docbook.xsl layout.tt common.tt
bash ./bootstrapify-docbook.sh $(NIXPKGS_MANUAL_STABLE_IN)/share/doc/nixpkgs $(NIXPKGS_MANUAL_STABLE_OUT) 'Nixpkgs $(NIXOS_STABLE_SERIES) manual' nixpkgs https://github.com/NixOS/nixpkgs/tree/master/doc
NIXPKGS_MANUAL_UNSTABLE_IN ?= /no-such-path
NIXPKGS_MANUAL_UNSTABLE_OUT = manual/nixpkgs/unstable
all: $(NIXPKGS_MANUAL_UNSTABLE_OUT)
$(NIXPKGS_MANUAL_UNSTABLE_OUT): $(NIXPKGS_MANUAL_UNSTABLE_IN) bootstrapify-docbook.sh bootstrapify-docbook.xsl layout.tt common.tt
bash ./bootstrapify-docbook.sh $(NIXPKGS_MANUAL_UNSTABLE_IN)/share/doc/nixpkgs $(NIXPKGS_MANUAL_UNSTABLE_OUT) 'Nixpkgs $(NIXOS_UNSTABLE_SERIES) manual' nixpkgs https://github.com/NixOS/nixpkgs/tree/master/doc
### Prettify the NixOS manual.
NIXOS_MANUAL_STABLE_IN ?= /no-such-path
NIXOS_MANUAL_STABLE_OUT = manual/nixos/stable
all: $(NIXOS_MANUAL_STABLE_OUT)
$(NIXOS_MANUAL_STABLE_OUT): $(NIXOS_MANUAL_STABLE_IN) bootstrapify-docbook.sh bootstrapify-docbook.xsl layout.tt common.tt
bash ./bootstrapify-docbook.sh $(NIXOS_MANUAL_STABLE_IN)/share/doc/nixos $(NIXOS_MANUAL_STABLE_OUT) 'NixOS $(NIXOS_STABLE_SERIES) manual' nixos https://github.com/NixOS/nixpkgs/tree/master/nixos/doc/manual
NIXOS_MANUAL_UNSTABLE_IN ?= /no-such-path
NIXOS_MANUAL_UNSTABLE_OUT = manual/nixos/unstable
all: $(NIXOS_MANUAL_UNSTABLE_OUT)
$(NIXOS_MANUAL_UNSTABLE_OUT): $(NIXOS_MANUAL_UNSTABLE_IN) bootstrapify-docbook.sh bootstrapify-docbook.xsl layout.tt common.tt
bash ./bootstrapify-docbook.sh $(NIXOS_MANUAL_UNSTABLE_IN)/share/doc/nixos $(NIXOS_MANUAL_UNSTABLE_OUT) 'NixOS $(NIXOS_UNSTABLE_SERIES) manual' nixos https://github.com/NixOS/nixpkgs/tree/master/nixos/doc/manual
all: $(HTML) favicon.png favicon.ico robots.txt \
styles \
$(subst .png,-small.png,$(filter-out %-small.png,$(wildcard images/screenshots/*)))
robots.txt: $(HTML)
echo "Users-agent: *" >> $@
#echo "Disallow: /" >> $@
#for page in $(HTML); do echo "Allow: /$$page" >> $@; done
favicon.png: logo/nixos-logo-only-hires.png
convert -resize 16x16 -background none -gravity center -extent 16x16 $< $@
favicon.ico: favicon.png
convert -resize x16 -gravity center -crop 16x16+0+0 -flatten -colors 256 -background transparent $< $@
%-small.png: %.png
convert -resize 200 $< $@
%.html: %.tt layout.tt common.tt $(DEMOS) $(NIX_DEV_MANUAL_OUT) learn_guides.html.in
tpage \
--pre_chomp --post_chomp \
--eval_perl \
--define root=$(ROOT) \
--define fileName=$< \
--define outputName=$@ \
--define nixosAmis=$(NIXOS_AMIS) \
--define latestNixVersion=$(NIX_STABLE_VERSION) \
--define latestNixOSSeries=$(NIXOS_STABLE_SERIES) \
--pre_process=common.tt \
$< > $@.tmp
xmllint --nonet --noout $@.tmp
mv $@.tmp $@
%: %.in common.tt $(NIX_DEV_MANUAL_OUT) learn_guides.html.in
echo $$PATH
tpage \
--define latestNixVersion=$(NIX_STABLE_VERSION) \
--pre_process=common.tt $< > $@.tmp
mv $@.tmp $@
news.html: all-news.xhtml
all-news.xhtml: news.xml news.xsl
xsltproc --param maxItem 10000 news.xsl news.xml > $@ || rm -f $@
news-rss.xml: news.xml news-rss.xsl
xsltproc news-rss.xsl news.xml > $@.tmp
mv $@.tmp $@
index.html: $(DEMOS) news-rss.xml latest-news.xhtml blogs.json
latest-news.xhtml: news.xml news.xsl
xsltproc --param maxItem 12 news.xsl news.xml > $@ || rm -f $@
check: $(HTML)
bash check-links.sh
blogs.xml:
curl --fail https://planet.nixos.org/rss20.xml > $@.tmp
mv $@.tmp $@
blogs.json: blogs.xml
perl -MJSON -MXML::Simple -e 'print encode_json(XMLin("blogs.xml"));' < $< > $@.tmp
mv $@.tmp $@
ifeq ($(UPDATE), 1)
.PHONY: blogs.xml
update: blogs.xml
@true
endif
# The nix-built site will use the provided SITE_STYLES
ifeq ($(strip $(SITE_STYLES)),)
# But development `make` builds will nix-build.
styles: $(wildcard site-styles/*)
nix-build -A packages.x86_64-linux.siteStyles --out-link $@
else
styles:
@ln -sfn $(SITE_STYLES) $@
endif
all: manuals
manuals:
bash ./fix-manual-headers.sh manual/nix stable
bash ./fix-manual-headers.sh manual/nixpkgs stable
bash ./fix-manual-headers.sh manual/nixos stable
all: $(DEMOS)
demos/%.svg: demos/%.scenario
echo "Generating $@ and $(patsubst %.svg,%.cast,$@) ..."
asciinema-scenario --preview-file "$@" $< > $(patsubst %.svg,%.cast,$@)
# XXX: this in until asciinema-scenario is fixed
# https://github.com/garbas/asciinema-scenario/issues/3
sed -i -e "s|<nixpkgs|\<nixpkgs|g" $@