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