]>
Commit | Line | Data |
---|---|---|
567a9e6f RL |
1 | ## |
2 | ## Makefile for OpenSSL | |
3 | ## | |
4 | ## {- join("\n## ", @autowarntext) -} | |
5 | {- | |
6 | sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ } | |
7 | sub shlib_ext { $target{shared_extension} || ".so" } | |
8 | sub shlib_ext_simple { (my $x = $target{shared_extension}) | |
9 | =~ s/\.\$\(SHLIB_MAJOR\)\.\$\(SHLIB_MINOR\)//; | |
10 | $x } | |
11 | -} | |
12 | PLATFORM={- $config{target} -} | |
13 | OPTIONS={- $config{options} -} | |
14 | CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -}) | |
15 | SRCDIR={- $config{sourcedir} -} | |
16 | BLDDIR={- $config{builddir} -} | |
17 | ||
18 | VERSION={- $config{version} -} | |
19 | MAJOR={- $config{major} -} | |
20 | MINOR={- $config{minor} -} | |
21 | SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -} | |
22 | SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -} | |
23 | SHLIB_MAJOR={- $config{shlib_major} -} | |
24 | SHLIB_MINOR={- $config{shlib_minor} -} | |
25 | SHLIB_TARGET={- $target{shared_target} -} | |
26 | ||
27 | EXE_EXT={- $target{exe_extension} || "" -} | |
28 | LIB_EXT={- $target{lib_extension} || ".a" -} | |
29 | SHLIB_EXT={- shlib_ext() -} | |
30 | SHLIB_EXT_SIMPLE={- shlib_ext_simple() -} | |
31 | OBJ_EXT={- $target{obj_extension} || ".o" -} | |
32 | DEP_EXT={- $target{dep_extension} || ".d" -} | |
33 | ||
34 | LIBS={- join(" ", map { $_."\$(LIB_EXT)" } @{$unified_info{libraries}}) -} | |
35 | SHLIBS={- join(" ", map { $_."\$(SHLIB_EXT)" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) -} | |
36 | ENGINES={- join(" ", map { $_."\$(SHLIB_EXT_SIMPLE)" } @{$unified_info{engines}}) -} | |
37 | PROGRAMS={- join(" ", map { $_."\$(EXE_EXT)" } grep { !m|^test/| } @{$unified_info{programs}}) -} | |
38 | TESTPROGS={- join(" ", map { $_."\$(EXE_EXT)" } grep { m|^test/| } @{$unified_info{programs}}) -} | |
39 | SCRIPTS={- join(" ", @{$unified_info{scripts}}) -} | |
c058fcd7 RL |
40 | DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; } |
41 | grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } | |
42 | keys %{$unified_info{sources}}); -} | |
43 | ||
567a9e6f RL |
44 | BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash |
45 | MISC_SCRIPTS=$(SRCDIR)/tools/c_hash $(SRCDIR)/tools/c_info \ | |
46 | $(SRCDIR)/tools/c_issuer $(SRCDIR)/tools/c_name \ | |
47 | $(BLDDIR)/apps/CA.pl $(SRCDIR)/apps/tsget | |
48 | ||
3c65577f RL |
49 | # DESTDIR is for package builders so that they can configure for, say, |
50 | # /usr/ and yet have everything installed to /tmp/somedir/usr/. | |
567a9e6f | 51 | # Normally it is left empty. |
3c65577f | 52 | DESTDIR= |
567a9e6f RL |
53 | |
54 | # Do not edit these manually. Use Configure with --prefix or --openssldir | |
55 | # to change this! Short explanation in the top comment in Configure | |
56 | INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet | |
57 | # | |
58 | our $prefix = $config{prefix} || "/usr/local"; | |
59 | $prefix -} | |
60 | OPENSSLDIR={- # | |
61 | # The logic here is that if no --openssldir was given, | |
62 | # OPENSSLDIR will get the value from $prefix plus "/ssl". | |
63 | # If --openssldir was given and the value is an absolute | |
64 | # path, OPENSSLDIR will get its value without change. | |
65 | # If the value from --openssldir is a relative path, | |
66 | # OPENSSLDIR will get $prefix with the --openssldir | |
67 | # value appended as a subdirectory. | |
68 | # | |
69 | use File::Spec::Functions; | |
70 | our $openssldir = | |
71 | $config{openssldir} ? | |
72 | (file_name_is_absolute($config{openssldir}) ? | |
73 | $config{openssldir} | |
74 | : catdir($prefix, $config{openssldir})) | |
75 | : catdir($prefix, "ssl"); | |
76 | $openssldir -} | |
77 | LIBDIR={- # | |
78 | # if $prefix/lib$target{multilib} is not an existing | |
79 | # directory, then assume that it's not searched by linker | |
80 | # automatically, in which case adding $target{multilib} suffix | |
81 | # causes more grief than we're ready to tolerate, so don't... | |
82 | our $multilib = | |
83 | -d "$prefix/lib$target{multilib}" ? $target{multilib} : ""; | |
84 | our $libdir = $config{libdir} || "lib$multilib"; | |
85 | $libdir -} | |
86 | ENGINESDIR={- use File::Spec::Functions; | |
87 | catdir($prefix,$libdir,"engines") -} | |
88 | ||
dde10ab4 | 89 | MANDIR=$(INSTALLTOP)/share/man |
8be7bdb5 RL |
90 | DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME) |
91 | HTMLDIR=$(DOCDIR)/html | |
567a9e6f | 92 | |
3544091a RL |
93 | # MANSUFFIX is for the benefit of anyone who may want to have a suffix |
94 | # appended after the manpage file section number. "ssl" is popular, | |
95 | # resulting in files such as config.5ssl rather than config.5. | |
96 | MANSUFFIX= | |
567a9e6f RL |
97 | HTMLSUFFIX=html |
98 | ||
99 | ||
100 | ||
101 | CROSS_COMPILE= {- $config{cross_compile_prefix} -} | |
102 | CC= $(CROSS_COMPILE){- $target{cc} -} | |
076e596f RL |
103 | CFLAGS={- our $cflags2 = join(" ",(map { "-D".$_} @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $config{cflags} -} |
104 | CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -} | |
567a9e6f RL |
105 | LDFLAGS= {- $config{lflags} -} |
106 | PLIB_LDFLAGS= {- $config{plib_lflags} -} | |
107 | EX_LIBS= {- $config{ex_libs} -} | |
108 | SHARED_LDFLAGS={- $target{shared_ldflag} | |
109 | # Unlike other OSes (like Solaris, Linux, Tru64, | |
110 | # IRIX) BSD run-time linkers (tested OpenBSD, NetBSD | |
111 | # and FreeBSD) "demand" RPATH set on .so objects. | |
112 | # Apparently application RPATH is not global and | |
113 | # does not apply to .so linked with other .so. | |
114 | # Problem manifests itself when libssl.so fails to | |
115 | # load libcrypto.so. One can argue that we should | |
116 | # engrave this into Makefile.shared rules or into | |
117 | # BSD-* config lines above. Meanwhile let's try to | |
118 | # be cautious and pass -rpath to linker only when | |
119 | # $prefix is not /usr. | |
120 | . ($config{target} =~ m|^BSD-| && $prefix !~ m|^/usr/.*$| | |
121 | ? " -Wl,-rpath,\$\$(LIBRPATH)" : "") -} | |
af093bf4 | 122 | SHARED_RCFLAGS={- $target{shared_rcflag} -} |
567a9e6f RL |
123 | |
124 | PERL={- $config{perl} -} | |
125 | ||
126 | ARFLAGS= {- $target{arflags} -} | |
127 | AR=$(CROSS_COMPILE){- $target{ar} || "ar" -} $(ARFLAGS) r | |
128 | RANLIB= {- $target{ranlib} -} | |
129 | NM= $(CROSS_COMPILE){- $target{nm} || "nm" -} | |
130 | RM= rm -f | |
131 | TAR= {- $target{tar} || "tar" -} | |
132 | TARFLAGS= {- $target{tarflags} -} | |
7d103766 | 133 | MAKEDEPEND=$(CROSS_COMPILE){- $config{makedepprog} -} |
567a9e6f RL |
134 | |
135 | BASENAME= openssl | |
136 | NAME= $(BASENAME)-$(VERSION) | |
137 | TARFILE= ../$(NAME).tar | |
138 | ||
139 | # We let the C compiler driver to take care of .s files. This is done in | |
140 | # order to be excused from maintaining a separate set of architecture | |
141 | # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC | |
142 | # gcc, then the driver will automatically translate it to -xarch=v8plus | |
143 | # and pass it down to assembler. | |
144 | AS=$(CC) -c | |
145 | ASFLAG=$(CFLAGS) | |
146 | PERLASM_SCHEME= {- $target{perlasm_scheme} -} | |
147 | ||
148 | # For x86 assembler: Set PROCESSOR to 386 if you want to support | |
149 | # the 80386. | |
150 | PROCESSOR= {- $config{processor} -} | |
151 | ||
152 | # The main targets ################################################### | |
153 | ||
27f42b46 | 154 | all: configdata.pm build_libs_nodep build_engines_nodep build_apps_nodep \ |
c058fcd7 | 155 | depend link-utils |
567a9e6f | 156 | |
27f42b46 | 157 | build_libs: configdata.pm build_libs_nodep depend |
c058fcd7 | 158 | build_libs_nodep: libcrypto.pc libssl.pc openssl.pc |
27f42b46 | 159 | build_engines: configdata.pm build_engines_nodep depend |
c058fcd7 | 160 | build_engines_nodep: $(ENGINES) |
27f42b46 | 161 | build_apps: configdata.pm build_apps_nodep depend |
c058fcd7 | 162 | build_apps_nodep: $(PROGRAMS) $(SCRIPTS) |
27f42b46 | 163 | build_tests: configdata.pm build_tests_nodep depend |
c058fcd7 | 164 | build_tests_nodep: $(TESTPROGS) |
68a5f1a2 | 165 | |
c058fcd7 | 166 | test tests: build_tests_nodep build_apps_nodep build_engines_nodep depend rehash |
567a9e6f RL |
167 | ( cd test; \ |
168 | SRCTOP=../$(SRCDIR) \ | |
169 | BLDTOP=../$(BLDDIR) \ | |
f325fba5 | 170 | EXE_EXT=$(EXE_EXT) \ |
567a9e6f RL |
171 | $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) ) |
172 | ||
173 | list-tests: | |
174 | @TOP=$(SRCDIR) PERL=$(PERL) $(PERL) $(SRCDIR)/test/run_tests.pl list | |
175 | ||
176 | libclean: | |
177 | -rm -f `find $(BLDDIR) -name '*$(LIB_EXT)' -o -name '*$(SHLIB_EXT)'` | |
178 | ||
dde10ab4 | 179 | install: install_sw install_ssldirs install_docs |
567a9e6f RL |
180 | |
181 | uninstall: uninstall_docs uninstall_sw | |
182 | ||
183 | clean: libclean | |
184 | rm -f $(PROGRAMS) $(TESTPROGS) | |
185 | rm -f `find $(BLDDIR) -name '*$(DEP_EXT)'` | |
186 | rm -f `find $(BLDDIR) -name '*$(OBJ_EXT)'` | |
187 | rm -f $(BLDDIR)/core $(BLDDIR)/rehash.time | |
188 | rm -f $(BLDDIR)/tags $(BLDDIR)/TAGS | |
189 | rm -f $(BLDDIR)/openssl.pc $(BLDDIR)/libcrypto.pc $(BLDDIR)/libssl.pc | |
190 | -rm -f `find $(BLDDIR) -type l` | |
191 | rm -f $(TARFILE) | |
192 | ||
c058fcd7 RL |
193 | # This exists solely for those who still type 'make depend' |
194 | depend: Makefile | |
195 | Makefile: FORCE | |
196 | @( sed -e '/^# DO NOT DELETE THIS LINE.*/,$$d' < Makefile; \ | |
567a9e6f RL |
197 | echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \ |
198 | echo; \ | |
c058fcd7 RL |
199 | for d in $(DEPS); do \ |
200 | if [ -f $$d ]; then cat $$d; fi; \ | |
201 | done ) > Makefile.new | |
202 | @if ! cmp Makefile.new Makefile >/dev/null 2>&1; then \ | |
203 | mv -f Makefile.new Makefile; \ | |
204 | fi | |
567a9e6f RL |
205 | |
206 | # Install helper targets ############################################# | |
207 | ||
208 | install_sw: all install_dev install_engines install_runtime | |
209 | ||
210 | uninstall_sw: uninstall_dev uninstall_engines uninstall_runtime | |
211 | ||
212 | install_docs: install_man_docs install_html_docs | |
213 | ||
214 | uninstall_docs: uninstall_man_docs uninstall_html_docs | |
8be7bdb5 | 215 | $(RM) -r -v $(DESTDIR)$(DOCDIR) |
567a9e6f | 216 | |
dde10ab4 RL |
217 | install_ssldirs: |
218 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs | |
219 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private | |
220 | ||
567a9e6f RL |
221 | install_dev: |
222 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
223 | @echo "*** Installing development files" | |
3c65577f | 224 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl |
567a9e6f RL |
225 | @set -e; for i in $(SRCDIR)/include/openssl/*.h \ |
226 | $(BLDDIR)/include/openssl/*.h; do \ | |
227 | fn=`basename $$i`; \ | |
3c65577f RL |
228 | echo "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ |
229 | cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ | |
230 | chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ | |
567a9e6f | 231 | done |
3c65577f | 232 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR) |
567a9e6f RL |
233 | @set -e; for l in $(LIBS); do \ |
234 | fn=`basename $$l`; \ | |
3c65577f RL |
235 | echo "install $$l -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ |
236 | cp $$l $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ | |
237 | $(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ | |
238 | chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ | |
239 | mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \ | |
240 | $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \ | |
567a9e6f RL |
241 | done |
242 | @ : {- output_off() if $config{no_shared}; "" -} | |
243 | @set -e; for s in $(SHLIBS); do \ | |
244 | fn=`basename $$s`; \ | |
3c65577f RL |
245 | echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ |
246 | cp $$s $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ | |
247 | chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ | |
248 | mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \ | |
249 | $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \ | |
567a9e6f | 250 | if [ "$(SHLIB_EXT)" != "$(SHLIB_EXT_SIMPLE)" ]; then \ |
3c65577f | 251 | echo "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ |
567a9e6f | 252 | fn2=`basename $$fn $(SHLIB_EXT)`$(SHLIB_EXT_SIMPLE); \ |
3c65577f | 253 | ln -sf $$fn $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ |
567a9e6f | 254 | fi; \ |
fcf80c46 | 255 | : {- output_off() unless windowsdll(); "" -}; \ |
3c65577f RL |
256 | echo "install $$s.a -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a"; \ |
257 | cp $$s.a $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a.new; \ | |
258 | chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a.new; \ | |
259 | mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a.new \ | |
260 | $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a; \ | |
dac494d2 | 261 | : {- output_on() unless windowsdll(); "" -}; \ |
567a9e6f | 262 | done |
dac494d2 | 263 | @ : {- output_on() if $config{no_shared}; "" -} |
3c65577f RL |
264 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig |
265 | @echo "install libcrypto.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc" | |
266 | @cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig | |
267 | @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc | |
268 | @echo "install libssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc" | |
269 | @cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig | |
270 | @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc | |
271 | @echo "install openssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc" | |
272 | @cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig | |
273 | @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc | |
567a9e6f RL |
274 | |
275 | uninstall_dev: | |
276 | @echo "*** Uninstalling development files" | |
277 | @set -e; for i in $(SRCDIR)/include/openssl/*.h \ | |
278 | $(BLDDIR)/include/openssl/*.h; do \ | |
279 | fn=`basename $$i`; \ | |
3c65577f RL |
280 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ |
281 | $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ | |
567a9e6f RL |
282 | done |
283 | @set -e; for l in $(LIBS); do \ | |
284 | fn=`basename $$l`; \ | |
3c65577f RL |
285 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ |
286 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \ | |
567a9e6f RL |
287 | done |
288 | @set -e; for s in $(SHLIBS); do \ | |
289 | fn=`basename $$s`; \ | |
290 | if [ "$(SHLIB_EXT)" != "$(SHLIB_EXT_SIMPLE)" ]; then \ | |
291 | fn2=`basename $$fn $(SHLIB_EXT)`$(SHLIB_EXT_SIMPLE); \ | |
3c65577f RL |
292 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \ |
293 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ | |
567a9e6f | 294 | fi; \ |
3c65577f RL |
295 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ |
296 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \ | |
fcf80c46 | 297 | : {- output_off() unless windowsdll(); "" -}; \ |
3c65577f RL |
298 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a"; \ |
299 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a; \ | |
dac494d2 | 300 | : {- output_on() unless windowsdll(); "" -}; \ |
567a9e6f | 301 | done |
3c65577f RL |
302 | @echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc" |
303 | @$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc | |
304 | @echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc" | |
305 | @$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc | |
306 | @echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc" | |
307 | @$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc | |
567a9e6f RL |
308 | |
309 | install_engines: | |
310 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
3c65577f | 311 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/ |
567a9e6f RL |
312 | @echo "*** Installing engines" |
313 | @set -e; for e in $(ENGINES); do \ | |
314 | fn=`basename $$e`; \ | |
3c65577f RL |
315 | echo "install $$e -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
316 | cp $$e $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn.new; \ | |
317 | chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn.new; \ | |
318 | mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn.new \ | |
319 | $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn; \ | |
567a9e6f RL |
320 | done |
321 | ||
322 | uninstall_engines: | |
323 | @echo "*** Uninstalling engines" | |
324 | @set -e; for e in $(ENGINES); do \ | |
325 | fn=`basename $$e`; \ | |
3c65577f RL |
326 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
327 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn; \ | |
567a9e6f RL |
328 | done |
329 | ||
330 | install_runtime: | |
331 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
3c65577f RL |
332 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin |
333 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc | |
567a9e6f | 334 | @echo "*** Installing runtime files" |
fcf80c46 RL |
335 | : {- output_off() unless windowsdll(); "" -}; |
336 | @set -e; for s in $(SHLIBS); do \ | |
337 | fn=`basename $$i`; \ | |
3c65577f RL |
338 | echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
339 | cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
340 | chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
341 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ | |
342 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
fcf80c46 | 343 | done |
dac494d2 | 344 | : {- output_on() unless windowsdll(); "" -}; |
567a9e6f RL |
345 | @set -e; for x in $(PROGRAMS); do \ |
346 | fn=`basename $$x`; \ | |
3c65577f RL |
347 | echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
348 | cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
349 | chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
350 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ | |
351 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f RL |
352 | done |
353 | @set -e; for x in $(BIN_SCRIPTS); do \ | |
354 | fn=`basename $$x`; \ | |
3c65577f RL |
355 | echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
356 | cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
357 | chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
358 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ | |
359 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f RL |
360 | done |
361 | @set -e; for x in $(MISC_SCRIPTS); do \ | |
362 | fn=`basename $$x`; \ | |
3c65577f RL |
363 | echo "install $$x -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ |
364 | cp $$x $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \ | |
365 | chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \ | |
366 | mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \ | |
367 | $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \ | |
567a9e6f | 368 | done |
3c65577f RL |
369 | @echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf" |
370 | @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new | |
371 | @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new | |
372 | @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf | |
567a9e6f RL |
373 | |
374 | uninstall_runtime: | |
375 | @echo "*** Uninstalling runtime files" | |
376 | @set -e; for x in $(PROGRAMS); \ | |
377 | do \ | |
378 | fn=`basename $$x`; \ | |
3c65577f RL |
379 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
380 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f RL |
381 | done; |
382 | @set -e; for x in $(BIN_SCRIPTS); \ | |
383 | do \ | |
384 | fn=`basename $$x`; \ | |
3c65577f RL |
385 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
386 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f RL |
387 | done |
388 | @set -e; for x in $(MISC_SCRIPTS); \ | |
389 | do \ | |
390 | fn=`basename $$x`; \ | |
3c65577f RL |
391 | echo "$(RM) $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ |
392 | $(RM) $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \ | |
567a9e6f | 393 | done |
fcf80c46 RL |
394 | : {- output_off() unless windowsdll(); "" -}; |
395 | @set -e; for s in $(SHLIBS); do \ | |
396 | fn=`basename $$i`; \ | |
3c65577f RL |
397 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
398 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
fcf80c46 | 399 | done |
dac494d2 | 400 | : {- output_on() unless windowsdll(); "" -}; |
3c65577f | 401 | $(RM) $(DESTDIR)$(OPENSSLDIR)/openssl.cnf |
567a9e6f RL |
402 | |
403 | # A method to extract all names from a .pod file | |
404 | # The first sed extracts everything between "=head1 NAME" and the next =head1 | |
405 | # The second sed joins all the lines into one | |
406 | # The third sed removes the description and turns all commas into spaces | |
407 | # Voilà , you have a space separated list of names! | |
408 | EXTRACT_NAMES=sed -e '1,/^=head1 *NAME *$$/d;/^=head1/,$$d' | \ | |
409 | sed -e ':a;{N;s/\n/ /;ba}' | \ | |
410 | sed -e 's/ - .*$$//;s/,/ /g' | |
411 | PROCESS_PODS=\ | |
412 | set -e; \ | |
413 | here=`cd $(SRCDIR); pwd`; \ | |
414 | point=$$here/util/point.sh; \ | |
415 | for ds in apps:1 crypto:3 ssl:3; do \ | |
416 | defdir=`echo $$ds | cut -f1 -d:`; \ | |
417 | defsec=`echo $$ds | cut -f2 -d:`; \ | |
418 | for p in $(SRCDIR)/doc/$$defdir/*.pod; do \ | |
419 | SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \ | |
420 | [ -z "$$SEC" ] && SEC=$$defsec; \ | |
421 | fn=`basename $$p .pod`; \ | |
422 | NAME=`echo $$fn | tr [a-z] [A-Z]`; \ | |
423 | suf=`eval "echo $$OUTSUFFIX"`; \ | |
424 | top=`eval "echo $$OUTTOP"`; \ | |
425 | $(PERL) $(SRCDIR)/util/mkdir-p.pl $$top/man$$SEC; \ | |
426 | echo "install $$p -> $$top/man$$SEC/$$fn$$suf"; \ | |
427 | cat $$p | eval "$$GENERATE" \ | |
428 | > $$top/man$$SEC/$$fn$$suf; \ | |
429 | names=`cat $$p | $(EXTRACT_NAMES)`; \ | |
430 | ( cd $$top/man$$SEC; \ | |
431 | for n in $$names; do \ | |
3af104f3 RL |
432 | comp_n="$$n"; \ |
433 | comp_fn="$$fn"; \ | |
434 | case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \ | |
435 | comp_n=`echo "$$n" | tr [A-Z] [a-z]`; \ | |
436 | comp_fn=`echo "$$fn" | tr [A-Z] [a-z]`; \ | |
437 | ;; \ | |
438 | esac; \ | |
439 | if [ "$$comp_n" != "$$comp_fn" ]; then \ | |
567a9e6f RL |
440 | echo "link $$top/man$$SEC/$$n$$suf -> $$top/man$$SEC/$$fn$$suf"; \ |
441 | PLATFORM=$(PLATFORM) $$point $$fn$$suf $$n$$suf; \ | |
442 | fi; \ | |
443 | done ); \ | |
444 | done; \ | |
445 | done | |
446 | UNINSTALL_DOCS=\ | |
447 | set -e; \ | |
448 | here=`cd $(SRCDIR); pwd`; \ | |
449 | for ds in apps:1 crypto:3 ssl:3; do \ | |
450 | defdir=`echo $$ds | cut -f1 -d:`; \ | |
451 | defsec=`echo $$ds | cut -f2 -d:`; \ | |
452 | for p in $(SRCDIR)/doc/$$defdir/*.pod; do \ | |
453 | SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \ | |
454 | [ -z "$$SEC" ] && SEC=$$defsec; \ | |
455 | fn=`basename $$p .pod`; \ | |
456 | suf=`eval "echo $$OUTSUFFIX"`; \ | |
457 | top=`eval "echo $$OUTTOP"`; \ | |
458 | echo "$(RM) $$top/man$$SEC/$$fn$$suf"; \ | |
459 | $(RM) $$top/man$$SEC/$$fn$$suf; \ | |
460 | names=`cat $$p | $(EXTRACT_NAMES)`; \ | |
461 | for n in $$names; do \ | |
3af104f3 RL |
462 | comp_n="$$n"; \ |
463 | comp_fn="$$fn"; \ | |
464 | case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \ | |
465 | comp_n=`echo "$$n" | tr [A-Z] [a-z]`; \ | |
466 | comp_fn=`echo "$$fn" | tr [A-Z] [a-z]`; \ | |
467 | ;; \ | |
468 | esac; \ | |
469 | if [ "$$comp_n" != "$$comp_fn" ]; then \ | |
567a9e6f RL |
470 | echo "$(RM) $$top/man$$SEC/$$n$$suf"; \ |
471 | $(RM) $$top/man$$SEC/$$n$$suf; \ | |
472 | fi; \ | |
473 | done; \ | |
8be7bdb5 | 474 | ( $(RMDIR) $$top/man$$SEC 2>/dev/null || exit 0 ); \ |
567a9e6f RL |
475 | done; \ |
476 | done | |
477 | ||
478 | install_man_docs: | |
479 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
480 | @echo "*** Installing manpages" | |
481 | @\ | |
482 | OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \ | |
3c65577f | 483 | OUTTOP="$(DESTDIR)$(MANDIR)"; \ |
567a9e6f RL |
484 | GENERATE='pod2man --name=$$NAME --section=$$SEC --center=OpenSSL --release=$(VERSION)'; \ |
485 | $(PROCESS_PODS) | |
486 | ||
487 | uninstall_man_docs: | |
488 | @echo "*** Uninstalling manpages" | |
489 | @\ | |
490 | OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \ | |
3c65577f | 491 | OUTTOP="$(DESTDIR)$(MANDIR)"; \ |
567a9e6f RL |
492 | $(UNINSTALL_DOCS) |
493 | ||
494 | install_html_docs: | |
495 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
496 | @echo "*** Installing HTML manpages" | |
497 | @\ | |
498 | OUTSUFFIX='.$(HTMLSUFFIX)'; \ | |
3c65577f | 499 | OUTTOP="$(DESTDIR)$(HTMLDIR)"; \ |
567a9e6f RL |
500 | GENERATE="pod2html --podroot=$(SRCDIR)/doc --htmldir=.. \ |
501 | --podpath=apps:crypto:ssl \ | |
502 | | sed -e 's|href=\"http://man.he.net/man|href=\"../man|g'"; \ | |
503 | $(PROCESS_PODS) | |
504 | ||
505 | uninstall_html_docs: | |
506 | @echo "*** Uninstalling manpages" | |
507 | @\ | |
508 | OUTSUFFIX='.$(HTMLSUFFIX)'; \ | |
3c65577f | 509 | OUTTOP="$(DESTDIR)$(HTMLDIR)"; \ |
567a9e6f RL |
510 | $(UNINSTALL_DOCS) |
511 | ||
512 | ||
513 | # Developer targets (note: these are only available on Unix) ######### | |
514 | ||
6bb2106e RL |
515 | update: generate errors ordinals |
516 | ||
517 | generate: generate_apps generate_crypto_bn generate_crypto_objects | |
567a9e6f RL |
518 | |
519 | # Test coverage is a good idea for the future | |
520 | #coverage: $(PROGRAMS) $(TESTPROGRAMS) | |
521 | # ... | |
522 | ||
523 | # Currently disabled, util/selftest.pl needs a rewrite | |
524 | #report: | |
525 | # SRCDIR=$(SRCDIR) @$(PERL) util/selftest.pl | |
526 | ||
527 | lint: | |
528 | lint -DLINT $(INCLUDES) $(SRCS) | |
529 | ||
fb3e2a88 | 530 | generate_apps: $(SRCDIR)/apps/openssl-vms.cnf $(SRCDIR)/apps/progs.h |
6bb2106e RL |
531 | |
532 | generate_crypto_bn: $(SRCDIR)/crypto/bn/bn_prime.h | |
533 | ||
534 | generate_crypto_objects: $(SRCDIR)/crypto/objects/obj_dat.h \ | |
535 | $(SRCDIR)/include/openssl/obj_mac.h \ | |
536 | $(SRCDIR)/crypto/objects/obj_xref.h | |
537 | ||
567a9e6f RL |
538 | errors: |
539 | ( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c ) | |
540 | ( cd $(SRCDIR); $(PERL) util/mkerr.pl -recurse -write ) | |
541 | ( cd $(SRCDIR)/engines; \ | |
542 | for e in *.ec; do \ | |
543 | $(PERL) ../util/mkerr.pl -conf $$e \ | |
544 | -nostatic -staticloader -write *.c; \ | |
545 | done ) | |
546 | ( cd $(SRCDIR)/crypto/ct; \ | |
547 | $(PERL) ../../util/mkerr.pl -conf ct.ec -hprefix internal/ -write *.c ) | |
548 | ||
549 | ordinals: | |
550 | ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update ) | |
551 | ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update ) | |
552 | ||
553 | test_ordinals: | |
554 | ( cd test; \ | |
555 | SRCTOP=../$(SRCDIR) \ | |
556 | BLDTOP=../$(BLDDIR) \ | |
557 | $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals ) | |
558 | ||
559 | tags TAGS: FORCE | |
560 | rm -f TAGS tags | |
561 | -ctags -R . | |
562 | -etags `find . -name '*.[ch]' -o -name '*.pm'` | |
563 | ||
564 | # Release targets (note: only available on Unix) ##################### | |
565 | ||
566 | tar: | |
567 | TMPDIR=/var/tmp/openssl-copy.$$$$; \ | |
568 | DISTDIR=openssl-$(VERSION); \ | |
569 | mkdir -p $$TMPDIR/$$DISTDIR; \ | |
570 | (cd $(SRCDIR); \ | |
571 | git ls-tree -r --name-only --full-tree HEAD \ | |
572 | | while read F; do \ | |
573 | mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \ | |
574 | cp $$F $$TMPDIR/$$DISTDIR/$$F; \ | |
575 | done); \ | |
576 | (cd $$TMPDIR; \ | |
577 | [ -n "$(PREPARE_CMD)" ] && $(PREPARE_CMD); \ | |
578 | find $$TMPDIR/$$DISTDIR -type d -print | xargs chmod 755; \ | |
579 | find $$TMPDIR/$$DISTDIR -type f -print | xargs chmod a+r; \ | |
580 | find $$TMPDIR/$$DISTDIR -type f -perm -0100 -print | xargs chmod a+x; \ | |
581 | $(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf - $$DISTDIR) \ | |
582 | | (cd $(SRCDIR); gzip --best > $(TARFILE).gz); \ | |
583 | rm -rf $$TMPDIR | |
584 | cd $(SRCDIR); ls -l $(TARFILE).gz | |
585 | ||
586 | dist: | |
587 | @$(MAKE) PREPARE_CMD='./Configure dist' tar | |
588 | ||
589 | # Helper targets ##################################################### | |
590 | ||
c058fcd7 | 591 | rehash: link-utils copy-certs build_apps_nodep |
567a9e6f RL |
592 | @if [ -z "$(CROSS_COMPILE)" ]; then \ |
593 | (OPENSSL="$(BLDDIR)/util/shlib_wrap.sh apps/openssl"; \ | |
594 | [ -x "$(BLDDIR)/openssl.exe" ] && OPENSSL="$(BLDDIR)/openssl.exe" || :; \ | |
595 | OPENSSL_DEBUG_MEMORY=on; OPENSSL_CONF=/dev/null ; \ | |
596 | export OPENSSL OPENSSL_DEBUG_MEMORY OPENSSL_CONF; \ | |
597 | $$OPENSSL rehash certs/demo \ | |
598 | || $(PERL) tools/c_rehash certs/demo) && \ | |
599 | touch rehash.time; \ | |
600 | else :; fi | |
601 | ||
602 | link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/shlib_wrap.sh | |
603 | ||
27f42b46 | 604 | $(BLDDIR)/util/opensslwrap.sh: configdata.pm |
567a9e6f RL |
605 | @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ |
606 | mkdir -p "$(BLDDIR)/util"; \ | |
607 | ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \ | |
608 | fi | |
27f42b46 | 609 | $(BLDDIR)/util/shlib_wrap.sh: configdata.pm |
567a9e6f RL |
610 | @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ |
611 | mkdir -p "$(BLDDIR)/util"; \ | |
612 | ln -sf "../$(SRCDIR)/util/shlib_wrap.sh" "$(BLDDIR)/util"; \ | |
613 | fi | |
614 | ||
615 | copy-certs: FORCE | |
616 | @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ | |
617 | cp -R "$(SRCDIR)/certs" "$(BLDDIR)/"; \ | |
618 | fi | |
619 | ||
6bb2106e RL |
620 | $(SRCDIR)/apps/openssl-vms.cnf: $(SRCDIR)/apps/openssl.cnf |
621 | $(PERL) $(SRCDIR)/VMS/VMSify-conf.pl \ | |
622 | < $(SRCDIR)/apps/openssl.cnf > $(SRCDIR)/apps/openssl-vms.cnf | |
623 | ||
fb3e2a88 RL |
624 | {- # because the program apps/openssl has object files as sources, and |
625 | # they then have the corresponding C files as source, we need to chain | |
626 | # the lookups in %unified_info | |
627 | my $apps_openssl = catfile("apps","openssl"); | |
628 | our @openssl_source = map { @{$unified_info{sources}->{$_}} } | |
629 | @{$unified_info{sources}->{$apps_openssl}}; | |
630 | ""; -} | |
631 | $(SRCDIR)/apps/progs.h: | |
632 | $(RM) $@ | |
633 | $(PERL) $(SRCDIR)/apps/progs.pl {- join(" ", @openssl_source) -} > $@ | |
634 | ||
6bb2106e RL |
635 | $(SRCDIR)/crypto/bn/bn_prime.h: $(SRCDIR)/crypto/bn/bn_prime.pl |
636 | $(PERL) $(SRCDIR)/crypto/bn/bn_prime.pl > $(SRCDIR)/crypto/bn/bn_prime.h | |
637 | ||
638 | $(SRCDIR)/crypto/objects/obj_dat.h: $(SRCDIR)/crypto/objects/obj_dat.pl \ | |
639 | $(SRCDIR)/include/openssl/obj_mac.h | |
640 | $(PERL) $(SRCDIR)/crypto/objects/obj_dat.pl \ | |
641 | $(SRCDIR)/include/openssl/obj_mac.h \ | |
642 | $(SRCDIR)/crypto/objects/obj_dat.h | |
643 | ||
644 | # objects.pl both reads and writes obj_mac.num | |
645 | $(SRCDIR)/include/openssl/obj_mac.h: $(SRCDIR)/crypto/objects/objects.pl \ | |
646 | $(SRCDIR)/crypto/objects/objects.txt \ | |
647 | $(SRCDIR)/crypto/objects/obj_mac.num | |
648 | $(PERL) $(SRCDIR)/crypto/objects/objects.pl \ | |
649 | $(SRCDIR)/crypto/objects/objects.txt \ | |
650 | $(SRCDIR)/crypto/objects/obj_mac.num \ | |
651 | $(SRCDIR)/include/openssl/obj_mac.h | |
652 | @sleep 1; touch $(SRCDIR)/include/openssl/obj_mac.h; sleep 1 | |
653 | ||
654 | $(SRCDIR)/crypto/objects/obj_xref.h: $(SRCDIR)/crypto/objects/objxref.pl \ | |
655 | $(SRCDIR)/crypto/objects/obj_xref.txt \ | |
656 | $(SRCDIR)/crypto/objects/obj_mac.num | |
657 | $(PERL) $(SRCDIR)/crypto/objects/objxref.pl \ | |
658 | $(SRCDIR)/crypto/objects/obj_mac.num \ | |
659 | $(SRCDIR)/crypto/objects/obj_xref.txt \ | |
660 | > $(SRCDIR)/crypto/objects/obj_xref.h | |
661 | @sleep 1; touch $(SRCDIR)/crypto/objects/obj_xref.h; sleep 1 | |
662 | ||
c058fcd7 | 663 | FORCE: |
567a9e6f RL |
664 | |
665 | # Building targets ################################################### | |
666 | ||
27f42b46 | 667 | libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) |
567a9e6f RL |
668 | libcrypto.pc: |
669 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
670 | echo 'exec_prefix=$${prefix}'; \ | |
671 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
672 | echo 'includedir=$${prefix}/include'; \ | |
673 | echo ''; \ | |
674 | echo 'Name: OpenSSL-libcrypto'; \ | |
675 | echo 'Description: OpenSSL cryptography library'; \ | |
676 | echo 'Version: '$(VERSION); \ | |
677 | echo 'Libs: -L$${libdir} -lcrypto'; \ | |
678 | echo 'Libs.private: $(EX_LIBS)'; \ | |
679 | echo 'Cflags: -I$${includedir}' ) > libcrypto.pc | |
680 | ||
681 | libssl.pc: | |
682 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
683 | echo 'exec_prefix=$${prefix}'; \ | |
684 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
685 | echo 'includedir=$${prefix}/include'; \ | |
686 | echo ''; \ | |
687 | echo 'Name: OpenSSL-libssl'; \ | |
688 | echo 'Description: Secure Sockets Layer and cryptography libraries'; \ | |
689 | echo 'Version: '$(VERSION); \ | |
690 | echo 'Requires.private: libcrypto'; \ | |
691 | echo 'Libs: -L$${libdir} -lssl'; \ | |
692 | echo 'Libs.private: $(EX_LIBS)'; \ | |
693 | echo 'Cflags: -I$${includedir}' ) > libssl.pc | |
694 | ||
695 | openssl.pc: | |
696 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
697 | echo 'exec_prefix=$${prefix}'; \ | |
698 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
699 | echo 'includedir=$${prefix}/include'; \ | |
700 | echo ''; \ | |
701 | echo 'Name: OpenSSL'; \ | |
702 | echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \ | |
703 | echo 'Version: '$(VERSION); \ | |
704 | echo 'Requires: libssl libcrypto' ) > openssl.pc | |
705 | ||
706 | # Note on the use of $(MFLAGS): this was an older variant of MAKEFLAGS which | |
707 | # wasn't passed down automatically. It's quite safe to use it like we do | |
708 | # below; if it doesn't exist, the result will be empty and 'make' will pick | |
709 | # up $(MAKEFLAGS) which is passed down as an environment variable. | |
27f42b46 RL |
710 | configdata.pm: {- $config{build_file_template} -} $(SRCDIR)/Configure $(SRCDIR)/config |
711 | @echo "Detected changed: $?" | |
567a9e6f RL |
712 | @echo "Reconfiguring..." |
713 | $(SRCDIR)/Configure reconf | |
714 | @echo "**************************************************" | |
715 | @echo "*** ***" | |
716 | @echo "*** Please run the same make command again ***" | |
717 | @echo "*** ***" | |
718 | @echo "**************************************************" | |
719 | @false | |
720 | ||
721 | {- | |
722 | use File::Basename; | |
723 | use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/; | |
cedbb146 RL |
724 | |
725 | # Helper function to figure out dependencies on libraries | |
726 | # It takes a list of library names and outputs a list of dependencies | |
727 | sub compute_lib_depends { | |
728 | if ($config{no_shared}) { | |
729 | return map { $_."\$(LIB_EXT)" } @_; | |
730 | } | |
731 | ||
732 | # Depending on shared libraries: | |
733 | # On Windows POSIX layers, we depend on {libname}.dll.a | |
734 | # On Unix platforms, we depend on {shlibname}.so | |
735 | return map { if (windowsdll()) { | |
736 | "$_\$(SHLIB_EXT_SIMPLE).a" | |
737 | } else { | |
738 | my $libname = | |
739 | $unified_info{sharednames}->{$_} || $_; | |
740 | "$libname\$(SHLIB_EXT_SIMPLE)" | |
741 | } } @_; | |
742 | } | |
743 | ||
88297284 | 744 | sub src2obj { |
567a9e6f | 745 | my %args = @_; |
88297284 | 746 | my $obj = $args{obj}; |
567a9e6f | 747 | my $srcs = join(" ", @{$args{srcs}}); |
50e83cdd | 748 | my $deps = join(" ", @{$args{srcs}}, @{$args{deps}}); |
567a9e6f RL |
749 | my $incs = join(" ", map { " -I".$_ } @{$args{incs}}); |
750 | my $makedepprog = $config{makedepprog}; | |
751 | if ($makedepprog eq "makedepend") { | |
752 | return <<"EOF"; | |
88297284 | 753 | $obj\$(DEP_EXT): $deps |
567a9e6f | 754 | rm -f \$\@.tmp; touch \$\@.tmp |
ce192ebe | 755 | \$(MAKEDEPEND) -f\$\@.tmp -o"|$obj" -- \$(CFLAGS)$incs -- $srcs \\ |
7d103766 RL |
756 | 2>/dev/null |
757 | sed -e 's/^.*|//' -e 's/ \\/\\(\\\\.\\|[^ ]\\)*//g' -e '/: *\$\$/d' -e '/^\\(#.*\\| *\\)\$\$/d' \$\@.tmp > \$\@ | |
567a9e6f | 758 | rm \$\@.tmp |
88297284 RL |
759 | $obj\$(OBJ_EXT): $obj\$(DEP_EXT) |
760 | \$(CC) \$(CFLAGS)$incs -c -o \$\@ $srcs | |
567a9e6f RL |
761 | EOF |
762 | } | |
763 | return <<"EOF"; | |
88297284 | 764 | $obj\$(DEP_EXT): $deps |
ce192ebe | 765 | \$(CC) \$(CFLAGS)$incs -MM -MF \$\@ -MQ $obj $srcs |
88297284 | 766 | $obj\$(OBJ_EXT): $obj\$(DEP_EXT) |
567a9e6f RL |
767 | \$(CC) \$(CFLAGS)$incs -c -o \$\@ $srcs |
768 | EOF | |
769 | } | |
770 | # On Unix, we build shlibs from static libs, so we're ignoring the | |
771 | # object file array. We *know* this routine is only called when we've | |
772 | # configure 'shared'. | |
773 | sub libobj2shlib { | |
774 | my %args = @_; | |
775 | my $lib = $args{lib}; | |
776 | my $shlib = $args{shlib}; | |
777 | my $libd = dirname($lib); | |
778 | my $libn = basename($lib); | |
779 | (my $libname = $libn) =~ s/^lib//; | |
cedbb146 RL |
780 | my $linklibs = join("", map { my $d = dirname($_); |
781 | my $f = basename($_); | |
782 | (my $l = $f) =~ s/^lib//; | |
783 | " -L$d -l$l" } @{$args{deps}}); | |
784 | my $deps = join(" ",compute_lib_depends(@{$args{deps}})); | |
567a9e6f RL |
785 | my $shlib_target = $target{shared_target}; |
786 | my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : ""; | |
cedbb146 RL |
787 | my $shlibtarget = windowsdll() ? |
788 | "$lib\$(SHLIB_EXT_SIMPLE).a" : "$shlib\$(SHLIB_EXT_SIMPLE)"; | |
567a9e6f | 789 | return <<"EOF" |
cedbb146 RL |
790 | # With a build on a Windows POSIX layer (Cygwin or Mingw), we know for a fact |
791 | # that two files get produced, {shlibname}.dll and {libname}.dll.a. | |
792 | # With all other Unix platforms, we often build a shared library with the | |
793 | # SO version built into the file name and a symlink without the SO version | |
794 | # It's not necessary to have both as targets. The choice falls on the | |
795 | # simplest, {libname}\$(SHLIB_EXT_SIMPLE).a for Windows POSIX layers and | |
796 | # {libname}\$(SHLIB_EXT_SIMPLE) for the Unix platforms. | |
88297284 | 797 | $shlibtarget: $lib\$(LIB_EXT) $deps $ordinalsfile |
567a9e6f | 798 | \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\ |
cedbb146 | 799 | PLATFORM=\$(PLATFORM) \\ |
567a9e6f | 800 | PERL=\$(PERL) SRCDIR="\$(SRCDIR)" DSTDIR="$libd" \\ |
cedbb146 RL |
801 | INSTALLTOP="\$(INSTALLTOP)" LIBDIR="\$(LIBDIR)" \\ |
802 | LIBDEPS="\$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS)" \\ | |
803 | LIBNAME=$libname LIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\ | |
804 | LIBCOMPATVERSIONS=";\$(SHLIB_VERSION_HISTORY)" \\ | |
805 | CC="\$(CC)" CFLAGS="\$(CFLAGS)" LDFLAGS="\$(LDFLAGS)" \\ | |
806 | CROSS_COMPILE="\$(CROSS_COMPILE)" \\ | |
807 | SHARED_LDFLAGS="\$(SHARED_LDFLAGS)" SHLIB_EXT=\$(SHLIB_EXT) \\ | |
af093bf4 | 808 | SHARED_RCFLAGS="\$(SHARED_RCFLAGS)" \\ |
cedbb146 | 809 | link_a.$shlib_target |
fcf80c46 RL |
810 | EOF |
811 | . (windowsdll() ? <<"EOF" : ""); | |
812 | rm -f apps/$shlib\$(SHLIB_EXT) | |
813 | rm -f test/$shlib\$(SHLIB_EXT) | |
814 | cp -p $shlib\$(SHLIB_EXT) apps/ | |
815 | cp -p $shlib\$(SHLIB_EXT) test/ | |
567a9e6f RL |
816 | EOF |
817 | } | |
818 | sub obj2dynlib { | |
819 | my %args = @_; | |
820 | my $lib = $args{lib}; | |
821 | my $libd = dirname($lib); | |
822 | my $libn = basename($lib); | |
823 | (my $libname = $libn) =~ s/^lib//; | |
824 | my $shlibdeps = join("", map { my $d = dirname($_); | |
825 | my $f = basename($_); | |
826 | (my $l = $f) =~ s/^lib//; | |
827 | " -L$d -l$l" } @{$args{deps}}); | |
cedbb146 | 828 | my $deps = join(" ",compute_lib_depends(@{$args{deps}})); |
567a9e6f RL |
829 | my $shlib_target = $target{shared_target}; |
830 | my $objs = join(" ", map { $_."\$(OBJ_EXT)" } @{$args{objs}}); | |
831 | return <<"EOF"; | |
832 | $lib\$(SHLIB_EXT_SIMPLE): $objs $deps | |
833 | \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\ | |
cedbb146 RL |
834 | PLATFORM=\$(PLATFORM) \\ |
835 | PERL=\$(PERL) SRCDIR="\$(SRCDIR)" DSTDIR="$libd" \\ | |
836 | LIBDEPS="\$(PLIB_LDFLAGS) $shlibdeps \$(EX_LIBS)" \\ | |
837 | LIBNAME=$libname LDFLAGS="\$(LDFLAGS)" \\ | |
838 | CC="\$(CC)" CFLAGS="\$(CFLAGS)" \\ | |
839 | SHARED_LDFLAGS="\$(SHARED_LDFLAGS)" \\ | |
567a9e6f RL |
840 | SHLIB_EXT=\$(SHLIB_EXT_SIMPLE) \\ |
841 | LIBEXTRAS="$objs" \\ | |
cedbb146 | 842 | link_o.$shlib_target |
567a9e6f RL |
843 | EOF |
844 | } | |
845 | sub obj2lib { | |
846 | my %args = @_; | |
847 | my $lib = $args{lib}; | |
848 | my $objs = join(" ", map { $_."\$(OBJ_EXT)" } @{$args{objs}}); | |
849 | return <<"EOF"; | |
88297284 | 850 | $lib\$(LIB_EXT): $objs |
567a9e6f RL |
851 | \$(AR) \$\@ $objs |
852 | \$(RANLIB) \$\@ || echo Never mind. | |
853 | EOF | |
854 | } | |
855 | sub obj2bin { | |
856 | my %args = @_; | |
857 | my $bin = $args{bin}; | |
858 | my $bind = dirname($bin); | |
859 | my $binn = basename($bin); | |
860 | my $objs = join(" ", map { $_."\$(OBJ_EXT)" } @{$args{objs}}); | |
cedbb146 RL |
861 | my $deps = join(" ",compute_lib_depends(@{$args{deps}})); |
862 | my $linklibs = join("", map { my $d = dirname($_); | |
863 | my $f = basename($_); | |
864 | $d = "." if $d eq $f; | |
865 | (my $l = $f) =~ s/^lib//; | |
866 | " -L$d -l$l" } @{$args{deps}}); | |
567a9e6f RL |
867 | my $shlib_target = $config{no_shared} ? "" : $target{shared_target}; |
868 | return <<"EOF"; | |
88297284 | 869 | $bin\$(EXE_EXT): $objs $deps |
567a9e6f RL |
870 | \$(RM) $bin\$(EXE_EXT) |
871 | \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\ | |
cedbb146 | 872 | PERL=\$(PERL) SRCDIR=\$(SRCDIR) \\ |
567a9e6f | 873 | APPNAME=$bin OBJECTS="$objs" \\ |
af093bf4 | 874 | LIBDEPS="\$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS)" \\ |
cedbb146 RL |
875 | CC="\$(CC)" CFLAGS="\$(CFLAGS)" LDFLAGS="\$(LDFLAGS)" \\ |
876 | LIBRPATH="\$(INSTALLTOP)/\$(LIBDIR)" \\ | |
567a9e6f RL |
877 | link_app.$shlib_target |
878 | EOF | |
879 | } | |
880 | sub in2script { | |
881 | my %args = @_; | |
882 | my $script = $args{script}; | |
883 | my $sources = join(" ", @{$args{sources}}); | |
884 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, | |
885 | "util", "dofile.pl")), | |
886 | rel2abs($config{builddir})); | |
887 | return <<"EOF"; | |
88297284 | 888 | $script: $sources |
4b799cea | 889 | \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ |
ba327ade | 890 | "-o$target{build_file}" $sources > "$script" |
567a9e6f RL |
891 | chmod a+x $script |
892 | EOF | |
893 | } | |
894 | "" # Important! This becomes part of the template result. | |
895 | -} |