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