Remove redundancy: remove the manpage dir cleanup from bin/mk-manpages
[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 ## Where releases are found.
9 RELEASEDIR = /var/www/openssl/source
10
11 ##  Current series
12 SERIES=1.1.1 1.1.0 1.0.2
13 ##  Older series
14 OLDSERIES=1.0.1 1.0.0 0.9.8 0.9.7 0.9.6
15 ##  Current series with newer and older manpage layout
16 ##  (when the number of old man layout releases drop to none, this goes away)
17 NEWMANSERIES=1.1.1
18 OLDMANSERIES=1.1.0 1.0.2
19
20 # All simple generated files.
21 SIMPLE = newsflash.inc sitemap.txt \
22          community/committers.inc \
23          community/omc.inc community/omc-alumni.inc \
24          docs/faq.inc docs/fips.inc \
25          docs/OpenSSLStrategicArchitecture.html \
26          docs/OpenSSL300Design.html \
27          docs/manpages.html \
28          news/changelog.html \
29          $(foreach S,$(SERIES),news/openssl-$(S)-notes.inc) \
30          $(foreach S,$(SERIES),news/openssl-$(S)-notes.html) \
31          news/newsflash.inc \
32          news/vulnerabilities.inc \
33          $(foreach S,$(SERIES) $(OLDSERIES),news/vulnerabilities-$(S).inc) \
34          source/.htaccess \
35          source/index.inc
36 SRCLISTS = \
37            source/old/0.9.x/index.inc \
38            source/old/1.0.0/index.inc \
39            source/old/1.0.1/index.inc \
40            source/old/1.0.2/index.inc \
41            source/old/1.1.0/index.inc \
42            source/old/1.1.1/index.inc \
43            source/old/fips/index.inc \
44
45
46 .SUFFIXES: .md .html
47
48 .md.html:
49         @rm -f $@
50         ./bin/md-to-html5 $<
51
52 all: suball manmaster mancross
53
54 suball: $(SIMPLE) $(SRCLISTS)
55
56 relupd: suball manpages mancross
57
58 clean:
59         rm -f $(SIMPLE) $(SRCLISTS)
60
61 # Legacy targets
62 hack-source_htaccess: all
63 simple: all
64 generated: all
65 rebuild: all
66
67 # $(1) = input directory in CHECKOUTS, $(2) = release version
68 define makemanpages
69 manpages-$(2):
70         @rm -rf docs/man$(2)
71         @mkdir -p docs/man$(2) \
72                   docs/man$(2)/man1 \
73                   docs/man$(2)/man3 \
74                   docs/man$(2)/man5 \
75                   docs/man$(2)/man7
76         ./bin/mk-manpages $(CHECKOUTS)/$(1)/doc $(2) docs/man$(2)
77         ./bin/mk-apropos docs/man$(2)/man1 > docs/man$(2)/man1/index.inc
78         ./bin/mk-apropos docs/man$(2)/man3 > docs/man$(2)/man3/index.inc
79         ./bin/mk-apropos docs/man$(2)/man5 > docs/man$(2)/man5/index.inc
80         ./bin/mk-apropos docs/man$(2)/man7 > docs/man$(2)/man7/index.inc
81         ./bin/from-tt -d docs/man$(2)/man1 releases='$(SERIES)' release='$(2)' \
82                       < docs/sub-man1-index.html.tt > docs/man$(2)/man1/index.html
83         ./bin/from-tt -d docs/man$(2)/man1 releases='$(SERIES)' release='$(2)' \
84                       < docs/sub-man3-index.html.tt > docs/man$(2)/man3/index.html
85         ./bin/from-tt -d docs/man$(2)/man1 releases='$(SERIES)' release='$(2)' \
86                       < docs/sub-man5-index.html.tt > docs/man$(2)/man5/index.html
87         ./bin/from-tt -d docs/man$(2)/man1 releases='$(SERIES)' release='$(2)' \
88                       < docs/sub-man7-index.html.tt > docs/man$(2)/man7/index.html
89         ./bin/from-tt -d docs/man$(2) releases='$(SERIES)' release='$(2)' \
90                       < docs/sub-index.html.tt > docs/man$(2)/index.html
91 endef
92 # $(1) = release version
93 define makeoldmanmap
94 manmap-$(1):
95         ./bin/mk-manmap docs/man$(1) > docs/man$(1)/.htaccess
96 endef
97
98 $(eval $(call makemanpages,openssl,master))
99 $(foreach S,$(SERIES),$(eval $(call makemanpages,openssl-$(S)-stable,$(S))))
100 $(foreach S,$(OLDMANSERIES),$(eval $(call makeoldmanmap,$(S))))
101
102 manmaster: manpages-master
103 manpages: $(foreach S,$(NEWMANSERIES),manpages-$(S)) \
104           $(foreach S,$(OLDMANSERIES),manpages-$(S) manmap-$(S))
105
106 mancross:
107         ./bin/mk-mancross master $(SERIES)
108
109 docs/manpages.html: docs/manpages.html.tt
110         @rm -f $@
111         ./bin/from-tt releases='master $(SERIES)' docs/manpages.html.tt
112
113 ## $(SIMPLE) -- SIMPLE GENERATED FILES
114 .PHONY: sitemap community/committers.inc community/omc.inc community/omc-alumni.inc
115 newsflash.inc: news/newsflash.inc
116         @rm -f $@
117         head -7 $? >$@
118 sitemap sitemap.txt:
119         @rm -f sitemap.txt
120         ./bin/mk-sitemap master $(SERIES) > sitemap.txt
121
122 community/committers.inc:
123         @rm -f $@
124         wget -q https://api.openssl.org/0/Group/commit/Members
125         ./bin/mk-committers <Members >$@
126         @rm -f Members
127
128 community/omc.inc:
129         ./bin/mk-omc -n -e -l -p -t 'OMC Members' omc omc-inactive > $@
130 community/omc-alumni.inc:
131         ./bin/mk-omc -n -l -t 'OMC Alumni' omc-alumni omc-emeritus > $@
132
133 docs/faq.inc: $(wildcard docs/faq-[0-9]-*.txt) bin/mk-faq
134         @rm -f $@
135         ./bin/mk-faq docs/faq-[0-9]-*txt >$@
136 docs/fips.inc: $(wildcard docs/fips/*) bin/mk-filelist
137         @rm -f $@
138         ./bin/mk-filelist docs/fips fips/ '*' >$@
139
140 news/changelog.inc: news/changelog.txt bin/mk-changelog
141         @rm -f $@
142         ./bin/mk-changelog <news/changelog.txt >$@
143 news/changelog.html: news/changelog.html.tt news/changelog.inc
144         @rm -f $@
145         ./bin/from-tt 'releases=$(SERIES)' $<
146 news/changelog.html: $(foreach S,$(SERIES),news/cl$(subst .,,$(S)).txt)
147
148 # $(1) = output file, $(2) = source directory in CHECKOUTS
149 define mknews_changelogtxt
150 news/$(1): $(CHECKOUTS)/$(2)/CHANGES
151         @rm -f $$@
152         cp $$? $$@
153 endef
154 $(eval $(call mknews_changelogtxt,changelog.txt,openssl))
155 $(foreach S,$(SERIES),\
156 $(eval $(call mknews_changelogtxt,cl$(subst .,,$(S)).txt,openssl-$(S)-stable)))
157
158 # $(1) = release version
159 define mknews_noteshtml
160 news/openssl-$(1)-notes.html: news/openssl-notes.html.in
161         @rm -f $$@
162         sed -e 's|@VERSION@|$(1)|g' < $$< > $$@
163 news/openssl-$(1)-notes.inc: $(CHECKOUTS)/openssl-$(1)-stable/NEWS bin/mk-notes
164         @rm -f $$@
165         ./bin/mk-notes $(1) < $(CHECKOUTS)/openssl-$(1)-stable/NEWS > $$@
166 endef
167 $(foreach S,$(SERIES),$(eval $(call mknews_noteshtml,$(S))))
168
169 news/newsflash.inc: news/newsflash.txt
170         sed <$? >$@ \
171             -e '/^#/d' \
172             -e 's@^@<tr><td class="d">@' \
173             -e 's@: @</td><td class="t">@' \
174             -e 's@$$@</td></tr>@'
175
176 # $(1) = output file mod, $(2) = release version switch, $(3) = release version
177 define mknews_vulnerability
178 news/vulnerabilities$(1).inc: bin/mk-cvepage news/vulnerabilities.xml
179         @rm -f $$@
180         ./bin/mk-cvepage -i news/vulnerabilities.xml $(2) > $$@
181 endef
182 $(eval $(call mknews_vulnerability,,))
183 $(foreach S,$(SERIES) $(OLDSERIES),$(eval $(call mknews_vulnerability,-$(S),-b $(S))))
184
185 source/.htaccess: $(wildcard source/openssl-*.tar.gz) bin/mk-latest
186         @rm -f @?
187         ./bin/mk-latest source >$@
188 source/index.inc: $(wildcard $(RELEASEDIR)/openssl-*.tar.gz) bin/mk-filelist
189         @rm -f $@
190         ./bin/mk-filelist $(RELEASEDIR) '' 'openssl-*.tar.gz' >$@
191
192 ## $(SRCLISTS) -- LISTS OF SOURCES
193 source/old/0.9.x/index.inc: $(wildcard source/old/0.9.x/*.gz) bin/mk-filelist
194         @rm -f $@
195         ./bin/mk-filelist source/old/0.9.x '' '*.gz' >$@
196 source/old/1.0.0/index.inc: $(wildcard source/old/1.0.0/*.gz) bin/mk-filelist
197         @rm -f $@
198         ./bin/mk-filelist source/old/1.0.0 '' '*.gz' >$@
199 source/old/1.0.1/index.inc: $(wildcard source/old/1.0.1/*.gz) bin/mk-filelist
200         @rm -f $@
201         ./bin/mk-filelist source/old/1.0.1 '' '*.gz' >$@
202 source/old/1.0.2/index.inc: $(wildcard source/old/1.0.2/*.gz) bin/mk-filelist
203         @rm -f $@
204         ./bin/mk-filelist source/old/1.0.2 '' '*.gz' >$@
205 source/old/1.1.0/index.inc: $(wildcard source/old/1.1.0/*.gz) bin/mk-filelist
206         @rm -f $@
207         ./bin/mk-filelist source/old/1.1.0 '' '*.gz' >$@
208 source/old/1.1.1/index.inc: $(wildcard source/old/1.1.1/*.gz) bin/mk-filelist
209         @rm -f $@
210         ./bin/mk-filelist source/old/1.1.1 '' '*.gz' >$@
211 source/old/fips/index.inc: $(wildcard source/old/fips/*.gz) bin/mk-filelist
212         @rm -f $@
213         ./bin/mk-filelist source/old/fips '' '*.gz' >$@
214
215 # Because these the indexes of old tarballs will inevitably be newer
216 # than the tarballs that are moved into their respective directory,
217 # we must declare them phony, or they will not be regenerated when
218 # they should.
219 .PHONY : \
220          source/old/1.0.1/index.inc source/old/1.0.2/index.inc \
221          source/old/1.1.0/index.inc source/old/1.1.1/index.inc \
222          source/old/fips/index.inc