Make targets that uses scripts depend on those scripts
[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
12 # All simple generated files.
13 SIMPLE = newsflash.inc sitemap.txt \
14          docs/faq.inc docs/fips.inc \
15          news/changelog.inc news/changelog.txt \
16          news/cl101.txt news/cl102.txt \
17          news/openssl-1.0.1-notes.inc news/openssl-1.0.2-notes.inc \
18          news/openssl-1.1.0-notes.inc \
19          news/newsflash.inc \
20          news/vulnerabilities.inc \
21          source/.htaccess \
22          source/license.txt \
23          source/index.inc
24 SRCLISTS = \
25            source/old/0.9.x/index.inc \
26            source/old/1.0.0/index.inc \
27            source/old/1.0.1/index.inc \
28            source/old/1.0.2/index.inc \
29            source/old/1.1.0/index.inc \
30            source/old/fips/index.inc \
31
32 all: $(SIMPLE) $(SRCLISTS) manmaster
33
34 relupd: all manpages
35
36 define makemanpages
37         ./bin/mk-manpages $(1) $(2) docs
38         ./bin/mk-filelist -a docs/man$(2)/apps '' '*.html' >docs/man$(2)/apps/index.inc
39         ./bin/mk-filelist -a docs/man$(2)/crypto '' '*.html' >docs/man$(2)/crypto/index.inc
40         ./bin/mk-filelist -a docs/man$(2)/ssl '' '*.html' >docs/man$(2)/ssl/index.inc
41 endef
42 manpages: manmaster
43         $(call makemanpages,$(CHECKOUTS)/openssl-1.1.0-stable,1.1.0)
44         $(call makemanpages,$(CHECKOUTS)/openssl-1.0.2-stable,1.0.2)
45         $(call makemanpages,$(CHECKOUTS)/openssl-1.0.1-stable,1.0.1)
46
47 manmaster:
48         $(call makemanpages,$(CHECKOUTS)/openssl,master)
49
50 # Legacy targets
51 hack-source_htaccess: all
52 simple: all
53 generated: all
54 rebuild: all
55
56 clean:
57         rm -f $(SIMPLE) $(SRCLISTS)
58
59 newsflash.inc: news/newsflash.inc
60         @rm -f $@
61         head -6 $? >$@
62 sitemap.txt: bin/mk-sitemap
63         @rm -f $@
64         ./bin/mk-sitemap >$@
65
66 news/changelog.inc: news/changelog.txt bin/mk-changelog
67         @rm -f $@
68         ./bin/mk-changelog <news/changelog.txt >$@
69 news/changelog.txt: $(SNAP)/CHANGES
70         @rm -f $@
71         cp $? $@
72 news/cl101.txt: $(CHECKOUTS)/openssl-1.0.1-stable/CHANGES
73         @rm -f $@
74         cp $? $@
75 news/cl102.txt: $(CHECKOUTS)/openssl-1.0.2-stable/CHANGES
76         @rm -f $@
77         cp $? $@
78 news/cl110.txt: $(CHECKOUTS)/openssl-1.1.0-stable/CHANGES
79         @rm -f $@
80         cp $? $@
81
82 news/openssl-1.0.1-notes.html: news/openssl-notes.html.in
83         @rm -f $@
84         sed -e 's|@VERSION@|1.0.1|g' < $< > $@
85 news/openssl-1.0.2-notes.html: news/openssl-notes.html.in
86         @rm -f $@
87         sed -e 's|@VERSION@|1.0.2|g' < $< > $@
88 news/openssl-1.1.0-notes.html: news/openssl-notes.html.in
89         @rm -f $@
90         sed -e 's|@VERSION@|1.1.0|g' < $< > $@
91 news/openssl-1.0.1-notes.inc: $(CHECKOUTS)/openssl-1.0.1-stable/NEWS news/openssl-1.0.1-notes.html bin/mk-notes
92         @rm -f $@
93         ./bin/mk-notes 1.0.1 < $(CHECKOUTS)/openssl-1.0.1-stable/NEWS > $@
94 news/openssl-1.0.2-notes.inc: $(CHECKOUTS)/openssl-1.0.2-stable/NEWS news/openssl-1.0.2-notes.html bin/mk-notes
95         @rm -f $@
96         ./bin/mk-notes 1.0.2 < $(CHECKOUTS)/openssl-1.0.2-stable/NEWS > $@
97 news/openssl-1.1.0-notes.inc: $(CHECKOUTS)/openssl-1.1.0-stable/NEWS news/openssl-1.1.0-notes.html bin/mk-notes
98         @rm -f $@
99         ./bin/mk-notes 1.1.0 < $(CHECKOUTS)/openssl-1.1.0-stable/NEWS > $@
100
101 news/newsflash.inc: news/newsflash.txt
102         sed <$? >$@ \
103             -e '/^#/d' \
104             -e 's@^@<tr><td class="d">@' \
105             -e 's@: @</td><td class="t">@' \
106             -e 's@$$@</td></tr>@'
107 news/vulnerabilities.inc: bin/vulnerabilities.xsl news/vulnerabilities.xml
108         @rm -f $@
109         xsltproc bin/vulnerabilities.xsl news/vulnerabilities.xml >$@
110
111 docs/faq.inc: docs/faq.txt bin/mk-faq
112         @rm -f $@
113         ./bin/mk-faq <$? >$@
114 docs/fips.inc: $(wildcard docs/fips/*) bin/mk-filelist
115         @rm -f $@
116         ./bin/mk-filelist docs/fips fips/ '*' >$@
117
118 source/.htaccess: $(wildcard source/openssl-*.tar.gz) bin/mk-latest
119         @rm -f @?
120         ./bin/mk-latest source >$@
121 source/license.txt: $(SNAP)/LICENSE
122         @rm -f $@
123         cp $? $@
124 source/index.inc: $(wildcard $(RELEASEDIR)/openssl-*.tar.gz) bin/mk-filelist
125         @rm -f $@
126         ./bin/mk-filelist -a $(RELEASEDIR) '' 'openssl-*.tar.gz' >$@
127
128 source/old/0.9.x/index.inc: $(wildcard source/old/0.9.x/*.gz) bin/mk-filelist
129         @rm -f $@
130         ./bin/mk-filelist source/old/0.9.x '' '*.gz' >$@
131 source/old/1.0.0/index.inc: $(wildcard source/old/1.0.0/*.gz) bin/mk-filelist
132         @rm -f $@
133         ./bin/mk-filelist source/old/1.0.0 '' '*.gz' >$@
134 source/old/1.0.1/index.inc: $(wildcard source/old/1.0.1/*.gz) bin/mk-filelist
135         @rm -f $@
136         ./bin/mk-filelist source/old/1.0.1 '' '*.gz' >$@
137 source/old/1.0.2/index.inc: $(wildcard source/old/1.0.2/*.gz) bin/mk-filelist
138         @rm -f $@
139         ./bin/mk-filelist source/old/1.0.2 '' '*.gz' >$@
140 source/old/1.1.0/index.inc: $(wildcard source/old/1.1.0/*.gz) bin/mk-filelist
141         @rm -f $@
142         ./bin/mk-filelist source/old/1.1.0 '' '*.gz' >$@
143 source/old/fips/index.inc: $(wildcard source/old/fips/*.gz) bin/mk-filelist
144         @rm -f $@
145         ./bin/mk-filelist source/old/fips '' '*.gz' >$@
146
147 # Because these the indexes of old tarballs will inevitably be newer
148 # than the tarballs that are moved into their respective directory,
149 # we must declare them phony, or they will not be regenerated when
150 # they should.
151 .PHONY : \
152          source/old/1.0.1/index.inc source/old/1.0.2/index.inc \
153          source/old/1.1.0/index.inc source/old/fips/index.inc