Convert SSI includes to tt includes in community/
[openssl-web.git] / Makefile
1 ##
2 ## Build procedure for www.openssl.org
3
4 ##  Checkouts.
5 CHECKOUTS = /var/cache/openssl/checkouts
6 ##  Snapshot directory
7 SNAP = $(CHECKOUTS)/openssl
8 ##  OMC data directory
9 OMCDATA = $(CHECKOUTS)/data
10 ## Where releases are found.
11 RELEASEDIR = /srv/ftp/source
12
13 ## The OMC repository checkout can be used for dependencies.
14 ## By default, we don't assume it, as not everyone has access to it.
15 ## If you have it, do 'make PERSONDB=PATH/TO/omc/persondb.yaml' where
16 ## PATH/TO/omc is the checked out OMC repository.
17 ## We let it be FORCE by default...  This forces the production of files
18 ## that depend on this database, instead of just conditionally.
19 PERSONDB=FORCE
20
21 ######################################################################
22 ##
23 ##  Release series.  These represent our release branches, and are
24 ##  our foundation for what should be built and how (often generated)
25 ##
26 ##  The numbers given here RULE
27 ##
28
29 ##  Current series.  Variable names are numbered to indicate:
30 ##
31 ##  SERIES1     OpenSSL pre-3.0
32 ##  SERIES3     OpenSSL 3.0 and on
33 ##  SERIES      The concatenation of the above, for ease of use
34 ##
35 ##  We mostly use $(SERIES) further down, but there are places where we
36 ##  need to make the distinction, because certain files are produced
37 ##  differently.
38 SERIES1=1.1.1
39 SERIES3=3.1 3.0
40 SERIES=$(SERIES3) $(SERIES1)
41 ##  Older series.  The second type is for source listings
42 OLDSERIES=1.1.0 1.0.2 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6
43 OLDSERIES2=1.1.0 1.0.2 1.0.1 1.0.0 0.9.x
44 ##  Series for manual layouts, named similar to SERIES1, SERIES3, SERIES
45 MANSERIES1=1.1.1 1.0.2
46 MANSERIES3=3.1 3.0
47 MANSERIES=$(MANSERIES3) $(MANSERIES1)
48
49 ##  Future series, i.e. a series that hasn't had any final release yet.
50 ##  This would typically be a major or minor version that's still only
51 ##  on the master branch, but that has come far enough for us to start
52 ##  to make alpha and beta releases.
53 ##  We distinguish them to avoid having to produce notes, vulnerability
54 ##  documents, ... but still being able to present tarballs.
55 FUTURESERIES=
56
57 # All simple generated files.
58
59 # The H_ variables hold renderings of .md files present in the local
60 # repository.  This does not include .md files taken from other repositories,
61 # they have their own special handling.
62 H_TOP = $(addsuffix .html,$(basename $(shell git ls-files -- *.md)))
63 H_COMMUNITY = $(addsuffix .html,\
64                 $(basename $(shell git ls-files -- community/*.md)) \
65                 $(basename $(basename $(shell git ls-files -- community/*.md.tt))))
66 # We filter out any file starting with 'sub-'...  they get special treatment
67 H_DOCS = $(addsuffix .html,\
68            $(basename $(shell git ls-files -- docs/*.md \
69                                               docs/*.md.tt \
70                               | grep -v '/sub-')))
71 H_NEWS = $(addsuffix .html,$(basename $(shell git ls-files -- news/*.md)))
72 H_POLICIES = $(addsuffix .html,\
73                $(basename $(shell git ls-files -- \
74                                   policies/*.md \
75                                   policies/general/*.md \
76                                   policies/technical/*.md \
77                                   policies/general-supplemental/*.md)))
78 # We filter out any file starting with 'sub-'...  they get special treatment
79 H_SOURCE= $(addsuffix .html,\
80             $(basename $(shell git ls-files -- source/*.md \
81                                                source/old/*.md \
82                                | grep -v '/sub-') \
83                        $(basename $(shell git ls-files -- source/*.md.tt \
84                                                           source/old/*.md.tt \
85                                           | grep -v '/sub-'))))
86 H_SUPPORT = $(addsuffix .html,$(basename $(shell git ls-files -- support/*.md)))
87
88 SIMPLE = $(H_TOP) \
89          newsflash.inc \
90          $(H_COMMUNITY) \
91          news/changelog.html \
92          $(foreach S,$(SERIES),news/openssl-$(S)-notes.inc) \
93          $(foreach S,$(SERIES),news/openssl-$(S)-notes.html) \
94          $(H_NEWS) \
95          news/newsflash.inc \
96          news/secadv \
97          news/secjson \
98          news/vulnerabilities.inc \
99          news/vulnerabilities.html \
100          $(foreach S,$(SERIES) $(OLDSERIES),news/vulnerabilities-$(S).inc) \
101          $(foreach S,$(SERIES) $(OLDSERIES),news/vulnerabilities-$(S).html) \
102          $(H_POLICIES) \
103          policies/glossary.html \
104          $(H_SOURCE) \
105          source/.htaccess \
106          source/index.inc \
107          $(H_SUPPORT)
108 SRCLISTS = $(foreach S,$(FUTURESERIES) $(SERIES) $(OLDSERIES2) fips,source/old/$(S)/index.inc source/old/$(S)/index.html)
109
110 SIMPLEDOCS = $(H_DOCS) \
111              docs/faq.inc \
112              docs/OpenSSLStrategicArchitecture.html \
113              docs/OpenSSL300Design.html \
114              docs/manpages.html
115
116 GLOSSARY=$(CHECKOUTS)/general-policies/policies/glossary.md
117 all_GENERAL_POLICIES=$(wildcard $(CHECKOUTS)/general-policies/policies/*.md)
118 all_GENERAL_POLICY_SUPPL=$(wildcard $(CHECKOUTS)/general-policies/policy-supplemental/*.md)
119 all_TECHNICAL_POLICIES=$(wildcard $(CHECKOUTS)/technical-policies/policies/*.md)
120 GENERAL_POLICIES=$(filter-out $(CHECKOUTS)/general-policies/policies/README.md $(GLOSSARY),$(all_GENERAL_POLICIES))
121 GENERAL_POLICY_SUPPL=$(filter-out $(CHECKOUTS)/general-policies/policy-supplemental/README.md,$(all_GENERAL_POLICY_SUPPL))
122 TECHNICAL_POLICIES=$(filter-out $(CHECKOUTS)/technical-policies/policies/README.md,$(all_TECHNICAL_POLICIES))
123
124 .PHONY : FORCE
125
126 %.html : %.md bin/md-to-html5
127         @rm -f $@
128         ./bin/md-to-html5 $<
129 % : %.tt bin/from-tt
130         @rm -f $@
131         ./bin/from-tt $<
132
133 all: suball subdocs manmaster mancross sitemap akamai-purge
134
135 suball: $(SIMPLE) $(SRCLISTS)
136
137 relupd: suball docs sitemap akamai-purge
138
139 docs: subdocs manpages mancross
140
141 subdocs: $(SIMPLEDOCS)
142
143 clean:
144         rm -f $(SIMPLE) $(SIMPLEDOCS) $(SRCLISTS)
145
146 akamai-purge:
147
148 # Legacy targets
149 hack-source_htaccess: all
150 simple: all
151 generated: all
152 rebuild: all
153
154 # For our use of pandoc for full documents, we create a template suitable
155 # for us.
156 inc/pandoc-template.html5: inc/pandoc-header.html5 inc/pandoc-body-prologue.html5 inc/pandoc-body-epilogue.html5 bin/mk-pandoc-template Makefile
157         pandoc --print-default-template=html5 \
158                 | ./bin/mk-pandoc-template html5 > $@
159 # Make bin/md-to-html5 depend on inc/pandoc-template.html5
160 bin/md-to-html5: inc/pandoc-template.html5
161
162 ######################################################################
163 ##
164 ##  Man-page building section
165 ##
166 ##  This is quite a complex set of rules, because there are many
167 ##  things that need to be built:
168 ##
169 ##  -   The man-pages themselves
170 ##  -   Apropos-like listings
171 ##  -   Cross-references between man-pages in different OpenSSL
172 ##      versions
173 ##
174 ##  A lot of the work is made with generated rules.
175
176 # makemanpages1 and makemanpages3 creates rules for targets like man-pages-1.1.1,
177 # to build the set of man-pages.  makemanpages1 is used for pre-3.0 OpenSSL,
178 # while makemanpages3 is used for OpenSSL 3.0 and on.
179 # makemanapropos creates rules for targets like man-apropos-1.1.1, to build
180 # 'apropos' like indexes for all the manpages.
181 # makemanindexes creates rules for targets like man-index-1.1.1, to build the
182 # main HTML index for a set of man-pages.
183 #
184 # $(1) = input directory in CHECKOUTS, $(2) = release version
185
186 # This variant is for pre-3.0 documentation
187 define makemanpages1
188 man-pages-$(2):
189         @rm -rf docs/man$(2)
190         @mkdir -p docs/man$(2) \
191                   docs/man$(2)/man1 \
192                   docs/man$(2)/man3 \
193                   docs/man$(2)/man5 \
194                   docs/man$(2)/man7
195         ./bin/mk-manpages $(CHECKOUTS)/$(1)/doc $(2) docs/man$(2)
196 endef
197 # This variant is for 3.0 documentation
198 define makemanpages3
199 man-pages-$(2):
200         @rm -rf docs/man$(2)
201         @mkdir -p docs/man$(2) \
202                   docs/man$(2)/man1 \
203                   docs/man$(2)/man3 \
204                   docs/man$(2)/man5 \
205                   docs/man$(2)/man7
206         ./bin/mk-manpages3 $(CHECKOUTS)/$(1) $(2) docs/man$(2)
207 endef
208 define makemanapropos
209 docs/man$(2)/man1/index.inc: bin/mk-apropos Makefile
210         ./bin/mk-apropos docs/man$(2)/man1 > $$@
211 docs/man$(2)/man3/index.inc: bin/mk-apropos Makefile
212         ./bin/mk-apropos docs/man$(2)/man3 > $$@
213 docs/man$(2)/man5/index.inc: bin/mk-apropos Makefile
214         ./bin/mk-apropos docs/man$(2)/man5 > $$@
215 docs/man$(2)/man7/index.inc: bin/mk-apropos Makefile
216         ./bin/mk-apropos docs/man$(2)/man7 > $$@
217 endef
218 define makemanindexes
219 docs/man$(2)/man1/index.md: docs/sub-man1-index.md.tt bin/from-tt Makefile
220         ./bin/from-tt -d docs/man$(2)/man1 \
221                       releases='$(MANSERIES)' release='$(2)' \
222                       < $$< > $$@
223 docs/man$(2)/man3/index.md: docs/sub-man3-index.md.tt bin/from-tt Makefile
224         ./bin/from-tt -d docs/man$(2)/man3 \
225                       releases='$(MANSERIES)' release='$(2)' \
226                       < $$< > $$@
227 docs/man$(2)/man5/index.md: docs/sub-man5-index.md.tt bin/from-tt Makefile
228         ./bin/from-tt -d docs/man$(2)/man5 \
229                       releases='$(MANSERIES)' release='$(2)' \
230                       < $$< > $$@
231 docs/man$(2)/man7/index.md: docs/sub-man7-index.md.tt bin/from-tt Makefile
232         ./bin/from-tt -d docs/man$(2)/man7 \
233                       releases='$(MANSERIES)' release='$(2)' \
234                       < $$< > $$@
235 docs/man$(2)/index.md: docs/sub-index.md.tt bin/from-tt Makefile
236         ./bin/from-tt -d docs/man$(2) \
237                       releases='$(MANSERIES)' release='$(2)' \
238                       < $$< > $$@
239 endef
240 define makemandirdata
241 docs/man$(2)/man1/dirdata.yaml: docs/sub-dirdata.yaml.tt bin/from-tt Makefile
242         ./bin/from-tt -d docs/man$(2)/man1 \
243                       releases='$(MANSERIES)' release='$(2)' \
244                       < $$< > $$@
245 docs/man$(2)/man3/dirdata.yaml: docs/sub-dirdata.yaml.tt bin/from-tt Makefile
246         ./bin/from-tt -d docs/man$(2)/man3 \
247                       releases='$(MANSERIES)' release='$(2)' \
248                       < $$< > $$@
249 docs/man$(2)/man5/dirdata.yaml: docs/sub-dirdata.yaml.tt bin/from-tt Makefile
250         ./bin/from-tt -d docs/man$(2)/man5 \
251                       releases='$(MANSERIES)' release='$(2)' \
252                       < $$< > $$@
253 docs/man$(2)/man7/dirdata.yaml: docs/sub-dirdata.yaml.tt bin/from-tt Makefile
254         ./bin/from-tt -d docs/man$(2)/man7 \
255                       releases='$(MANSERIES)' release='$(2)' \
256                       < $$< > $$@
257 docs/man$(2)/dirdata.yaml: docs/sub-dirdata.yaml.tt bin/from-tt Makefile
258         ./bin/from-tt -d docs/man$(2) \
259                       releases='$(MANSERIES)' release='$(2)' \
260                       < $$< > $$@
261 endef
262 define makemanuals1
263 $(eval $(call makemanpages1,$(1),$(2)))
264 $(eval $(call makemanapropos,$(1),$(2)))
265 $(eval $(call makemanindexes,$(1),$(2)))
266 $(eval $(call makemandirdata,$(1),$(2)))
267 endef
268 define makemanuals3
269 $(eval $(call makemanpages3,$(1),$(2)))
270 $(eval $(call makemanapropos,$(1),$(2)))
271 $(eval $(call makemanindexes,$(1),$(2)))
272 $(eval $(call makemandirdata,$(1),$(2)))
273 endef
274
275 # Now that we have the generating macros in place, let's use them!
276 #
277 # Start off with creating the 'manpages-master' target, taking the
278 # source from $(CHECKOUTS)/openssl/doc
279 $(eval $(call makemanuals3,openssl,master))
280
281 # Next, create 'manpages-x.y' for all current releases from 3.0 and on,
282 # taking the source from $(CHECKOUTS)/openssl-x.y/doc
283 $(foreach S,$(MANSERIES3),$(eval $(call makemanuals3,openssl-$(S),$(S))))
284
285 # Next, create 'manpages-x.y.z' for all current pre-3.0 releases, taking the
286 # source from $(CHECKOUTS)/openssl-x.y.z-stable/doc
287 $(foreach S,$(MANSERIES1),$(eval $(call makemanuals1,openssl-$(S)-stable,$(S))))
288
289 MANMASTER_TARGETS = \
290         man-pages-master docs/manmaster/index.html \
291         $(foreach SEC,1 3 5 7, docs/manmaster/man$(SEC)/index.inc \
292                                docs/manmaster/man$(SEC)/index.html)
293 manmaster: $(MANMASTER_TARGETS)
294 MANPAGES_TARGETS = \
295         $(foreach S,$(MANSERIES), \
296           man-pages-$(S) docs/man$(S)/index.html \
297           $(foreach SEC,1 3 5 7, docs/man$(S)/man$(SEC)/index.inc \
298                                  docs/man$(S)/man$(SEC)/index.html))
299 manpages: manmaster $(MANPAGES_TARGETS)
300
301 mancross:
302         ./bin/mk-mancross master $(MANSERIES)
303
304 docs/manpages.md: docs/manpages.md.tt Makefile bin/from-tt
305         @rm -f $@
306         ./bin/from-tt releases='master $(MANSERIES)' $<
307
308 docs/mansidebar.html: docs/mansidebar.html.tt Makefile bin/from-tt
309         @rm -f $@
310         ./bin/from-tt releases='master $(MANSERIES)' $<
311
312 docs/faq.inc: $(wildcard docs/faq-[0-9]-*.txt) Makefile bin/mk-faq
313         @rm -f $@
314         ./bin/mk-faq docs/faq-[0-9]-*txt >$@
315
316 ######################################################################
317 ##
318 ##  Policy page building section
319 ##
320
321 .PHONY: technical-policies
322 technical-policies: $(TECHNICAL_POLICIES) bin/md-to-html5
323         mkdir -p policies/technical
324         for x in $(TECHNICAL_POLICIES); do \
325                 d=$$(dirname $$x); \
326                 f=$$(basename $$x .md); \
327                 cat "$$x" \
328                         | sed -E -e 's!https?://github\.com/openssl/(general|technical)-policies/blob/master/policies/(.*)\.md!../\1/\2.html!' \
329                         | sed -E -e 's!https?://github\.com/openssl/(general|technical)-policies/blob/master/policy-supplemental/(.*)\.md!../\1-supplemental/\2.html!' \
330                         | sed -E -e 's!\.\./general/glossary\.html!../glossary.html!' \
331                         | ./bin/md-to-html5 -o policies/technical/"$$f".html; \
332         done
333 policies/technical/index.inc: technical-policies bin/mk-md-titlelist Makefile
334         ./bin/mk-md-titlelist '' $(TECHNICAL_POLICIES) > $@
335 policies/technical/index.html: \
336         policies/technical/index.md policies/technical/index.inc \
337         policies/technical/dirdata.yaml
338
339 .PHONY: general-policies
340 general-policies: $(GENERAL_POLICIES) bin/md-to-html5
341         mkdir -p policies/general
342         for x in $(GENERAL_POLICIES); do \
343                 d=$$(dirname "$$x"); \
344                 f=$$(basename "$$x" .md); \
345                 cat "$$x" \
346                         | sed -E -e 's!https?://github\.com/openssl/(general|technical)-policies/blob/master/policies/(.*)\.md!../\1/\2.html!' \
347                         | sed -E -e 's!https?://github\.com/openssl/(general|technical)-policies/blob/master/policy-supplemental/(.*)\.md!../\1-supplemental/\2.html!' \
348                         | sed -E -e 's!\.\./policy-supplemental/(.*)\.html!../general-supplemental/\1.html!' \
349                         | sed -E -e 's!\.\./general/glossary\.html!../glossary.html!' \
350                         | ./bin/md-to-html5 -o policies/general/"$$f".html; \
351         done
352 policies/general/index.inc: general-policies general-policy-supplemental bin/mk-md-titlelist Makefile
353         ./bin/mk-md-titlelist '' $(GENERAL_POLICIES) > $@
354 policies/general/index.html: \
355         policies/general/index.md policies/general/index.inc \
356         policies/general/dirdata.yaml
357
358 .PHONY: general-policy-supplemental
359 general-policy-supplemental: $(GENERAL_POLICY_SUPPL) bin/md-to-html5
360         mkdir -p policies/general-supplemental
361         for x in $(GENERAL_POLICY_SUPPL); do \
362                 d=$$(dirname "$$x"); \
363                 f=$$(basename "$$x" .md); \
364                 cat "$$x" \
365                         | ./bin/md-to-html5 -o policies/general-supplemental/"$$f".html; \
366         done
367
368 policies/glossary.html: $(GLOSSARY) bin/md-to-html5 policies/dirdata.yaml
369         cat "$(GLOSSARY)" \
370                 | sed -E -e 's!https?://github\.com/openssl/(general|technical)-policies/blob/master/policies/(.*)\.md!\1/\2.html!' \
371                 | sed -E -e 's!general/glossary\.html!glossary.html!' \
372                 | ./bin/md-to-html5 -o policies/glossary.html
373
374 ######################################################################
375 ##
376 ##  $(SIMPLE) -- SIMPLE GENERATED FILES
377 ##
378 .PHONY: sitemap
379 newsflash.inc: news/newsflash.inc
380         @rm -f $@
381         head -7 $< >$@
382 sitemap sitemap.txt: bin/mk-sitemap Makefile
383         @rm -f sitemap.txt
384         ./bin/mk-sitemap master $(SERIES) > sitemap.txt
385
386 community/committers.inc: $(PERSONDB) bin/mk-committers Makefile
387         @rm -f $@
388         wget -q https://api.openssl.org/0/Group/commit/Members
389         ./bin/mk-committers <Members >$@
390         @rm -f Members
391 community/committers.md: community/committers.inc
392
393 community/otc.inc: $(PERSONDB) bin/mk-omc Makefile
394         ./bin/mk-omc -n -p -t 'OTC Members' otc otc-inactive > $@
395 community/omc.inc: $(PERSONDB) bin/mk-omc Makefile
396         ./bin/mk-omc -n -e -l -p -t 'OMC Members' omc omc-inactive > $@
397 community/omc.md: community/omc.inc
398 community/omc-alumni.inc: $(PERSONDB) bin/mk-omc Makefile
399         ./bin/mk-omc -n -l -t 'OMC Alumni' omc-alumni omc-emeritus > $@
400 community/omc-alumni.md: community/omc-alumni.inc
401
402 news/changelog.inc: news/changelog.txt bin/post-process-html5 Makefile
403         @rm -f $@
404         (echo 'Table of contents'; sed -e '1,/^OpenSSL Releases$$/d' < $<) \
405                 | pandoc -t html5 -f commonmark | ./bin/post-process-html5 >$@
406 news/changelog.md: news/changelog.md.tt news/changelog.inc Makefile bin/from-tt
407         @rm -f $@
408         ./bin/from-tt 'releases=$(SERIES)' $<
409 # Additionally, make news/changelog.html depend on clxy[z].txt, where xy[z]
410 # comes from the release number x.y[.z].  This permits it to be automatically
411 # recreated whenever there's a new major release.
412 news/changelog.html: $(foreach S,$(SERIES),news/cl$(subst .,,$(S)).txt)
413
414 # mknews_changelogtxt creates a target and ruleset for any changelog text
415 # file depending on the CHANGES file from the target release.
416 #
417 # $(1) = output file, $(2) = CHANGES files, relative to CHECKOUTS
418 define mknews_changelogtxt
419 news/$(1): $(CHECKOUTS)/$(2)
420         @rm -f $$@
421         cp $$< $$@
422 endef
423
424 # Create the target 'news/changelog.txt', taking the source from
425 # $(CHECKOUTS)/openssl/CHANGES.md
426 # We use the .txt extension for multiple purposes:
427 # 1. So the web server maps to the MIME type text/plain
428 # 2. To ensure there's no need to publish any .md file (since they're all
429 #    supposed to be used to generate .html files)
430 # 3. Because it was changelog.txt before, a well known target.  Why change it?
431 $(eval $(call mknews_changelogtxt,changelog.txt,openssl/CHANGES.md))
432
433 # Create the target 'news/clxy.md' for all releases from 3.0 and on, taking
434 # the source from $(CHECKOUTS)/openssl-x.y/CHANGES.md
435 $(foreach S,$(SERIES3),\
436 $(eval $(call mknews_changelogtxt,cl$(subst .,,$(S)).txt,openssl-$(S)/CHANGES.md)))
437
438 # Create the targets 'news/clxyz.txt' for all current pre-3.0 releases,
439 # taking the source from $(CHECKOUTS)/openssl-x.y.z-stable/CHANGES
440 $(foreach S,$(SERIES1),\
441 $(eval $(call mknews_changelogtxt,cl$(subst .,,$(S)).txt,openssl-$(S)-stable/CHANGES)))
442
443 # mknews_noteshtml creates two targets and rulesets for creating notes from
444 # the NEWS file for each release.  One target is to create a wrapping HTML
445 # file from a template, the other is to create the inclusion file with the
446 # actual text.
447 #
448 # $(1) = release version, $(2) = NEWS file, relative to CHECKOUTS
449 define mknews_noteshtml
450 news/openssl-$(1)-notes.md: news/openssl-notes.md.tt bin/from-tt Makefile
451         @rm -f $$@
452         ./bin/from-tt -d news -i $$< -o $$@ release='$(1)'
453 news/openssl-$(1)-notes.inc: $(CHECKOUTS)/$(2) bin/mk-notes Makefile
454         @rm -f $$@
455         ./bin/mk-notes $(1) < $(CHECKOUTS)/$(2) > $$@
456 endef
457
458 # Create the targets 'news/openssl-x.y-notes.html' and
459 # 'news/openssl-x.y-notes.inc' for each release number x.y starting with 3.0,
460 # taking the source from the news file given as second argument.
461 $(foreach S,$(SERIES3),\
462 $(eval $(call mknews_noteshtml,$(S),openssl-$(S)/NEWS.md)))
463
464 # Create the targets 'news/openssl-x.y.z-notes.html' and
465 # 'news/openssl-x.y.z-notes.inc' for each pre-3.0 release number x.y.z,
466 # taking the source from the news file given as second argument.
467 $(foreach S,$(SERIES1),\
468 $(eval $(call mknews_noteshtml,$(S),openssl-$(S)-stable/NEWS)))
469
470 news/newsflash.inc: $(OMCDATA)/newsflash.txt Makefile
471         sed <$< >$@ \
472             -e '/^#/d' \
473             -e 's@^@<tr><td class="d">@' \
474             -e 's@: @</td><td class="t">@' \
475             -e 's@$$@</td></tr>@'
476
477 # mknews_vulnerability creates two targets and rulesets for creating
478 # vulnerability lists for each release.  One target is to create a wrapping
479 # HTML file from a template, the other is to create the inclusion file with
480 # the actual text.
481 #
482 # $(1) = output file mod, $(2) = release version switch, $(3) = release version
483 define mknews_vulnerability
484 news/vulnerabilities$(1).inc: bin/cvejsontohtml.py news/secjson Makefile
485         @rm -f $$@
486         python3 ./bin/cvejsontohtml.py -i news/secjson/ $(2) > $$@
487 news/vulnerabilities$(1).md: news/vulnerabilities.md.tt bin/from-tt Makefile
488         @rm -f $$@
489         ./bin/from-tt -d news vulnerabilitiesinc='vulnerabilities$(1).inc' < $$< > $$@
490 endef
491
492 # Create the main vulnerability index 'news/vulnerabilities.html' and
493 # 'news/vulnerabilities.inc'
494 $(eval $(call mknews_vulnerability,,))
495
496 # Create the vulnerability index 'news/vulnerabilities-x.y[.z].html' and
497 # 'news/vulnerabilities-x.y[.z].inc' for each release x.y[.z]
498 $(foreach S,$(SERIES) $(OLDSERIES),\
499 $(eval $(call mknews_vulnerability,-$(S),-b $(S))))
500
501 source/.htaccess: $(wildcard source/openssl-*.tar.gz) bin/mk-latest Makefile
502         @rm -f @?
503         ./bin/mk-latest $(RELEASEDIR) >$@
504 source/index.inc: $(wildcard $(RELEASEDIR)/openssl-*.tar.gz) bin/mk-filelist Makefile
505         @rm -f $@
506         ./bin/mk-filelist $(RELEASEDIR) '' 'openssl-*.tar.gz' >$@
507
508 # mknews_secadv creates a target to copy a secadv file from $(OMCDATA)/secadv
509 # to news/secadv/.
510 # $(1) = file name
511 define mknews_secadv
512 news/secadv/$(1): $(OMCDATA)/secadv/$(1)
513         cp $$< $$@
514 endef
515
516 # mknews_secjson creates a target to copy a security json file from $(OMCDATA)/vulnerabilities-json
517 # to news/secjson/.
518 # $(1) = file name
519 define mknews_secjson
520 news/secjson/$(1): $(OMCDATA)/vulnerabilities-json/$(1)
521         cp $$< $$@
522 endef
523
524 # Get the set of files in $(OMCDATA)/secadv/
525 SECADV_FILES = $(shell cd $(OMCDATA)/secadv/; git ls-files)
526 $(foreach F,$(SECADV_FILES),$(eval $(call mknews_secadv,$(F))))
527
528 # Get the set of files in $(OMCDATA)/vulnerabilities-json/
529 SECJSON_FILES = $(shell cd $(OMCDATA)/vulnerabilities-json/; git ls-files)
530 $(foreach F,$(SECJSON_FILES),$(eval $(call mknews_secjson,$(F))))
531
532 mkdirnews_secadv: FORCE
533         mkdir -p news/secadv
534 news/secadv: mkdirnews_secadv $(addprefix news/secadv/,$(SECADV_FILES))
535 .PHONY: news/secadv mkdirnews_secadv
536
537 mkdirnews_secjson: FORCE
538         mkdir -p news/secjson
539 news/secjson: mkdirnews_secjson $(addprefix news/secjson/,$(SECJSON_FILES))
540 .PHONY: news/secjson mkdirnews_secjson
541
542 ######################################################################
543 ##
544 ##  $(SRCLISTS) -- LISTS OF SOURCES
545 ##
546
547 # mkoldsourceindex creates two targets and rulesets for creating the
548 # list of update tarballs for each release.  One target is to create a
549 # wrapping HTML file from a template, the other is to create the
550 # inclusion file with the actual text.
551 #
552 # $(1) = release, $(2) = release title
553 define mkoldsourceindex
554 source/old/$(1)/index.inc: $(RELEASEDIR)/old/$(1) bin/mk-filelist Makefile
555         @mkdir -p `dirname $$@`
556         @rm -f $$@
557         ./bin/mk-filelist $(RELEASEDIR)/old/$(1) '' '*.gz' > $$@
558 source/old/$(1)/index.md: source/old/sub-index.md.tt bin/from-tt Makefile
559         @mkdir -p `dirname $$@`
560         @rm -f $$@
561         ./bin/from-tt -d source/old/$(1) \
562                       release='$(1)' releasetitle='Old $(2) Releases' \
563                       < $$< > $$@
564 endef
565 define mkoldsourcedirdata
566 source/old/$(1)/dirdata.yaml: source/old/sub-dirdata.yaml.tt bin/from-tt Makefile
567         @mkdir -p `dirname $$@`
568         @rm -f $$@
569         ./bin/from-tt -d source/old/$(1) \
570                       release='$(1)' releasetitle='Old $(2) Releases' \
571                       < $$< > $$@
572 source/old/$(1)/index.html: source/old/$(1)/dirdata.yaml
573 endef
574
575 # Create the update tarball index 'source/old/x.y.z/index.html' and
576 # 'source/old/x.y.z/index.inc' for each release x.y.z.
577 # We also create a list specifically for the old FIPS module, carefully
578 # crafting an HTML title with an uppercase 'FIPS' while the subdirectory
579 # remains named 'fips'
580 $(foreach S,fips $(SERIES) $(OLDSERIES2),$(eval $(call mkoldsourceindex,$(S),$(patsubst fips,FIPS,$(S)))))
581 $(foreach S,fips $(SERIES) $(OLDSERIES2),$(eval $(call mkoldsourcedirdata,$(S),$(patsubst fips,FIPS,$(S)))))
582
583 source/old/index.md: source/old/index.md.tt Makefile bin/from-tt Makefile
584         @mkdir -p `dirname $@`
585         @rm -f $@
586         ./bin/from-tt releases='$(SERIES) $(OLDSERIES2) fips' $<
587
588 # Extra inc -> markdown dependencies
589
590
591 # Extra HTML dependencies (apart from the markdown file it comes from)
592
593 # makehtmldepend creates a standard dependency for HTML files rendered from
594 # markdown files
595 # $(1) = HTML file
596 define makehtmldepend
597 $(1): bin/md-to-html5 $(dir $(1))dirdata.yaml
598 endef
599
600 # Generate standard dependencies for our known HTML outputs.
601 $(foreach H, \
602   $(H_TOP) \
603   $(H_COMMUNITY) \
604   $(H_DOCS) \
605   $(filter %.html,$(MANMASTER_TARGETS)) \
606   $(filter %.html,$(MANPAGES_TARGETS)) \
607   $(H_NEWS) \
608   $(H_POLICIES) \
609   $(H_SOURCE) \
610   $(H_SUPPORT) \
611 ,$(eval $(call makehtmldepend,$(H))))