]> git.ipfire.org Git - thirdparty/openssl.git/blob - Configurations/unix-Makefile.tmpl
Fix memleaks in KDF implementations
[thirdparty/openssl.git] / Configurations / unix-Makefile.tmpl
1 ##
2 ## Makefile for OpenSSL
3 ##
4 ## {- join("\n## ", @autowarntext) -}
5 {-
6 our $makedepprog = platform->makedepprog();
7
8 sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ }
9
10 # Shared AIX support is special. We put libcrypto[64].so.ver into
11 # libcrypto.a and use libcrypto_a.a as static one.
12 sub sharedaix { !$disabled{shared} && $config{target} =~ /^aix/ }
13
14 our $sover_dirname = platform->shlib_version_as_filename();
15
16 # This makes sure things get built in the order they need
17 # to. You're welcome.
18 sub dependmagic {
19 my $target = shift;
20
21 return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target";
22 }
23 '';
24 -}
25 PLATFORM={- $config{target} -}
26 OPTIONS={- $config{options} -}
27 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
28 SRCDIR={- $config{sourcedir} -}
29 BLDDIR={- $config{builddir} -}
30
31 VERSION={- "$config{full_version}" -}
32 MAJOR={- $config{major} -}
33 MINOR={- $config{minor} -}
34 SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
35 SHLIB_TARGET={- $target{shared_target} -}
36
37 LIBS={- join(" ", map { platform->staticlib($_) // () } @{$unified_info{libraries}}) -}
38 SHLIBS={- join(" ", map { platform->sharedlib($_) // () } @{$unified_info{libraries}}) -}
39 SHLIB_INFO={- join(" ", map { my $x = platform->sharedlib($_);
40 my $y = platform->sharedlib_simple($_);
41 $x ? "\"$x;$y\"" : () }
42 @{$unified_info{libraries}}) -}
43 MODULES={- join(" ", map { platform->dso($_) } @{$unified_info{modules}}) -}
44 PROGRAMS={- join(" ", map { platform->bin($_) } @{$unified_info{programs}}) -}
45 SCRIPTS={- join(" ", @{$unified_info{scripts}}) -}
46 {- output_off() if $disabled{makedepend}; "" -}
47 DEPS={- join(" ", map { platform->isobj($_) ? platform->dep($_) : () }
48 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
49 keys %{$unified_info{sources}}); -}
50 {- output_on() if $disabled{makedepend}; "" -}
51 GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}}) -}
52 GENERATED={- # common0.tmpl provides @generated
53 join(" ", map { platform->convertext($_) } @generated ) -}
54
55 INSTALL_LIBS={-
56 join(" ", map { platform->staticlib($_) // () }
57 grep { !$unified_info{attributes}->{$_}->{noinst} }
58 @{$unified_info{libraries}})
59 -}
60 INSTALL_SHLIBS={-
61 join(" ", map { platform->sharedlib($_) // () }
62 grep { !$unified_info{attributes}->{$_}->{noinst} }
63 @{$unified_info{libraries}})
64 -}
65 INSTALL_SHLIB_INFO={-
66 join(" ", map { my $x = platform->sharedlib($_);
67 my $y = platform->sharedlib_simple($_);
68 $x ? "\"$x;$y\"" : () }
69 grep { !$unified_info{attributes}->{$_}->{noinst} }
70 @{$unified_info{libraries}})
71 -}
72 INSTALL_ENGINES={-
73 join(" ", map { platform->dso($_) }
74 grep { !$unified_info{attributes}->{$_}->{noinst}
75 && $unified_info{attributes}->{$_}->{engine} }
76 @{$unified_info{modules}})
77 -}
78 INSTALL_PROGRAMS={-
79 join(" ", map { platform->bin($_) }
80 grep { !$unified_info{attributes}->{$_}->{noinst} }
81 @{$unified_info{programs}})
82 -}
83 BIN_SCRIPTS={-
84 join(" ", map { my $x = $unified_info{attributes}->{$_}->{linkname};
85 $x ? "$_:$x" : $_ }
86 grep { !$unified_info{attributes}->{$_}->{noinst}
87 && !$unified_info{attributes}->{$_}->{misc} }
88 @{$unified_info{scripts}})
89 -}
90 MISC_SCRIPTS={-
91 join(" ", map { my $x = $unified_info{attributes}->{$_}->{linkname};
92 $x ? "$_:$x" : $_ }
93 grep { !$unified_info{attributes}->{$_}->{noinst}
94 && $unified_info{attributes}->{$_}->{misc} }
95 @{$unified_info{scripts}})
96 -}
97
98 APPS_OPENSSL={- use File::Spec::Functions;
99 catfile("apps","openssl") -}
100
101 # DESTDIR is for package builders so that they can configure for, say,
102 # /usr/ and yet have everything installed to /tmp/somedir/usr/.
103 # Normally it is left empty.
104 DESTDIR=
105
106 # Do not edit these manually. Use Configure with --prefix or --openssldir
107 # to change this! Short explanation in the top comment in Configure
108 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
109 #
110 our $prefix = $config{prefix} || "/usr/local";
111 $prefix -}
112 OPENSSLDIR={- #
113 # The logic here is that if no --openssldir was given,
114 # OPENSSLDIR will get the value from $prefix plus "/ssl".
115 # If --openssldir was given and the value is an absolute
116 # path, OPENSSLDIR will get its value without change.
117 # If the value from --openssldir is a relative path,
118 # OPENSSLDIR will get $prefix with the --openssldir
119 # value appended as a subdirectory.
120 #
121 use File::Spec::Functions;
122 our $openssldir =
123 $config{openssldir} ?
124 (file_name_is_absolute($config{openssldir}) ?
125 $config{openssldir}
126 : catdir($prefix, $config{openssldir}))
127 : catdir($prefix, "ssl");
128 $openssldir -}
129 LIBDIR={- our $libdir = $config{libdir};
130 unless ($libdir) {
131 #
132 # if $prefix/lib$target{multilib} is not an existing
133 # directory, then assume that it's not searched by linker
134 # automatically, in which case adding $target{multilib} suffix
135 # causes more grief than we're ready to tolerate, so don't...
136 our $multilib =
137 -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
138 $libdir = "lib$multilib";
139 }
140 file_name_is_absolute($libdir) ? "" : $libdir -}
141 # $(libdir) is chosen to be compatible with the GNU coding standards
142 libdir={- file_name_is_absolute($libdir)
143 ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -}
144 ENGINESDIR=$(libdir)/engines-{- $sover_dirname -}
145 MODULESDIR=$(libdir)/ossl-modules
146
147 # Convenience variable for those who want to set the rpath in shared
148 # libraries and applications
149 LIBRPATH=$(libdir)
150
151 MANDIR=$(INSTALLTOP)/share/man
152 DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
153 HTMLDIR=$(DOCDIR)/html
154
155 # MANSUFFIX is for the benefit of anyone who may want to have a suffix
156 # appended after the manpage file section number. "ssl" is popular,
157 # resulting in files such as config.5ssl rather than config.5.
158 MANSUFFIX=
159 HTMLSUFFIX=html
160
161 # For "optional" echo messages, to get "real" silence
162 ECHO = echo
163
164 ##### User defined commands and flags ################################
165
166 # We let the C compiler driver to take care of .s files. This is done in
167 # order to be excused from maintaining a separate set of architecture
168 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
169 # gcc, then the driver will automatically translate it to -xarch=v8plus
170 # and pass it down to assembler. In any case, we do not define AS or
171 # ASFLAGS for this reason.
172
173 CROSS_COMPILE={- $config{CROSS_COMPILE} -}
174 CC=$(CROSS_COMPILE){- $config{CC} -}
175 CXX={- $config{CXX} ? "\$(CROSS_COMPILE)$config{CXX}" : '' -}
176 CPPFLAGS={- our $cppflags1 = join(" ",
177 (map { "-D".$_} @{$config{CPPDEFINES}}),
178 (map { "-I".$_} @{$config{CPPINCLUDES}}),
179 @{$config{CPPFLAGS}}) -}
180 CFLAGS={- join(' ', @{$config{CFLAGS}}) -}
181 CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -}
182 LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -}
183 EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -}
184
185 MAKEDEPEND={- $config{makedepprog} -}
186
187 PERL={- $config{PERL} -}
188
189 AR=$(CROSS_COMPILE){- $config{AR} -}
190 ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -}
191 RANLIB={- $config{RANLIB} ? "\$(CROSS_COMPILE)$config{RANLIB}" : "true"; -}
192 RC= $(CROSS_COMPILE){- $config{RC} -}
193 RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} {- $target{shared_rcflag} -}
194
195 RM= rm -f
196 RMDIR= rmdir
197 TAR= {- $target{TAR} || "tar" -}
198 TARFLAGS= {- $target{TARFLAGS} -}
199
200 BASENAME= openssl
201 NAME= $(BASENAME)-$(VERSION)
202 # Relative to $(SRCDIR)
203 TARFILE= ../$(NAME).tar
204
205 ##### Project flags ##################################################
206
207 # Variables starting with CNF_ are common variables for all product types
208
209 CNF_CPPFLAGS={- our $cppflags2 =
210 join(' ', $target{cppflags} || (),
211 (map { "-D".$_} @{$target{defines}},
212 @{$config{defines}}),
213 (map { "-I".$_} @{$target{includes}},
214 @{$config{includes}}),
215 @{$config{cppflags}}) -}
216 CNF_CFLAGS={- join(' ', $target{cflags} || (),
217 @{$config{cflags}}) -}
218 CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (),
219 @{$config{cxxflags}}) -}
220 CNF_LDFLAGS={- join(' ', $target{lflags} || (),
221 @{$config{lflags}}) -}
222 CNF_EX_LIBS={- join(' ', $target{ex_libs} || (),
223 @{$config{ex_libs}}) -}
224
225 # Variables starting with LIB_ are used to build library object files
226 # and shared libraries.
227 # Variables starting with DSO_ are used to build DSOs and their object files.
228 # Variables starting with BIN_ are used to build programs and their object
229 # files.
230
231 LIB_CPPFLAGS={- our $lib_cppflags =
232 join(' ', $target{lib_cppflags} || (),
233 $target{shared_cppflag} || (),
234 (map { '-D'.$_ }
235 @{$config{lib_defines} || ()},
236 @{$config{shared_defines} || ()}),
237 @{$config{lib_cppflags}},
238 @{$config{shared_cppflag}});
239 join(' ', $lib_cppflags,
240 (map { '-D'.$_ }
241 'OPENSSLDIR="\"$(OPENSSLDIR)\""',
242 'ENGINESDIR="\"$(ENGINESDIR)\""',
243 'MODULESDIR="\"$(MODULESDIR)\""'),
244 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
245 LIB_CFLAGS={- join(' ', $target{lib_cflags} || (),
246 $target{shared_cflag} || (),
247 @{$config{lib_cflags}},
248 @{$config{shared_cflag}},
249 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
250 LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (),
251 $target{shared_cxxflag} || (),
252 @{$config{lib_cxxflags}},
253 @{$config{shared_cxxflag}},
254 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
255 LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (),
256 $config{shared_ldflag} || (),
257 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
258 LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
259 DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (),
260 $target{module_cppflags} || (),
261 (map { '-D'.$_ }
262 @{$config{dso_defines} || ()},
263 @{$config{module_defines} || ()}),
264 @{$config{dso_cppflags}},
265 @{$config{module_cppflags}},
266 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
267 DSO_CFLAGS={- join(' ', $target{dso_cflags} || (),
268 $target{module_cflags} || (),
269 @{$config{dso_cflags}},
270 @{$config{module_cflags}},
271 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
272 DSO_CXXFLAGS={- join(' ', $target{dso_cxxflags} || (),
273 $target{module_cxxflags} || (),
274 @{$config{dso_cxxflags}},
275 @{$config{module_cxxflag}},
276 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
277 DSO_LDFLAGS={- join(' ', $target{dso_ldflags} || (),
278 $target{module_ldflags} || (),
279 @{$config{dso_ldflags}},
280 @{$config{module_ldflags}},
281 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
282 DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
283 BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (),
284 (map { '-D'.$_ } @{$config{bin_defines} || ()}),
285 @{$config{bin_cppflags}},
286 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
287 BIN_CFLAGS={- join(' ', $target{bin_cflags} || (),
288 @{$config{bin_cflags}},
289 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
290 BIN_CXXFLAGS={- join(' ', $target{bin_cxxflags} || (),
291 @{$config{bin_cxxflags}},
292 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
293 BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
294 @{$config{bin_lflags}},
295 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
296 BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
297
298 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
299 CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
300 $cppflags2 =~ s|([\\"])|\\$1|g;
301 $lib_cppflags =~ s|([\\"])|\\$1|g;
302 join(' ', $lib_cppflags || (), $cppflags2 || (),
303 $cppflags1 || ()) -}
304
305 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
306
307 # For x86 assembler: Set PROCESSOR to 386 if you want to support
308 # the 80386.
309 PROCESSOR= {- $config{processor} -}
310
311 # We want error [and other] messages in English. Trouble is that make(1)
312 # doesn't pass macros down as environment variables unless there already
313 # was corresponding variable originally set. In other words we can only
314 # reassign environment variables, but not set new ones, not in portable
315 # manner that is. That's why we reassign several, just to be sure...
316 LC_ALL=C
317 LC_MESSAGES=C
318 LANG=C
319
320 # The main targets ###################################################
321
322 {- dependmagic('all'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils
323 {- dependmagic('build_libs'); -}: build_libs_nodep
324 {- dependmagic('build_modules'); -}: build_modules_nodep
325 {- dependmagic('build_programs'); -}: build_programs_nodep
326
327 build_generated: $(GENERATED_MANDATORY)
328 build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
329 build_modules_nodep: $(MODULES)
330 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
331
332 # Kept around for backward compatibility
333 build_apps build_tests: build_programs
334
335 # Convenience target to prebuild all generated files, not just the mandatory
336 # ones
337 build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
338 @ : {- output_off() if $disabled{makedepend}; "" -}
339 @echo "Warning: consider configuring with no-makedepend, because if"
340 @echo " target system doesn't have $(PERL),"
341 @echo " then make will fail..."
342 @ : {- output_on() if $disabled{makedepend}; "" -}
343
344 test: tests
345 {- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep link-utils
346 @ : {- output_off() if $disabled{tests}; "" -}
347 ( cd test; \
348 mkdir -p test-runs; \
349 SRCTOP=../$(SRCDIR) \
350 BLDTOP=../$(BLDDIR) \
351 RESULT_D=test-runs \
352 PERL="$(PERL)" \
353 EXE_EXT={- platform->binext() -} \
354 OPENSSL_ENGINES=`cd ../$(BLDDIR)/engines 2>/dev/null && pwd` \
355 OPENSSL_MODULES=`cd ../$(BLDDIR)/providers 2>/dev/null && pwd` \
356 OPENSSL_DEBUG_MEMORY=on \
357 $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
358 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
359 @echo "Tests are not supported with your chosen Configure options"
360 @ : {- output_on() if !$disabled{tests}; "" -}
361
362 list-tests:
363 @ : {- output_off() if $disabled{tests}; "" -}
364 @SRCTOP="$(SRCDIR)" \
365 $(PERL) $(SRCDIR)/test/run_tests.pl list
366 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
367 @echo "Tests are not supported with your chosen Configure options"
368 @ : {- output_on() if !$disabled{tests}; "" -}
369
370 install: install_sw install_ssldirs install_docs
371
372 uninstall: uninstall_docs uninstall_sw
373
374 libclean:
375 @set -e; for s in $(SHLIB_INFO); do \
376 if [ "$$s" = ";" ]; then continue; fi; \
377 s1=`echo "$$s" | cut -f1 -d";"`; \
378 s2=`echo "$$s" | cut -f2 -d";"`; \
379 $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\
380 $(RM) apps/$$s1; \
381 $(RM) test/$$s1; \
382 $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\
383 $(RM) $$s1; \
384 if [ "$$s1" != "$$s2" ]; then \
385 $(ECHO) $(RM) $$s2; \
386 $(RM) $$s2; \
387 fi; \
388 done
389 $(RM) $(LIBS)
390 $(RM) *{- platform->defext() -}
391
392 clean: libclean
393 $(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(SCRIPTS)
394 $(RM) $(GENERATED_MANDATORY) $(GENERATED)
395 -$(RM) `find . -name '*{- platform->depext() -}' \! -name '.*' -print`
396 -$(RM) `find . -name '*{- platform->objext() -}' \! -name '.*' -print`
397 $(RM) core
398 $(RM) tags TAGS doc-nits
399 $(RM) -r test/test-runs
400 $(RM) openssl.pc libcrypto.pc libssl.pc
401 -$(RM) `find . -type l \! -name '.*' -print`
402 $(RM) $(TARFILE)
403
404 distclean: clean
405 $(RM) configdata.pm
406 $(RM) Makefile
407
408 # We check if any depfile is newer than Makefile and decide to
409 # concatenate only if that is true.
410 depend:
411 @: {- output_off() if $disabled{makedepend}; "" -}
412 @$(PERL) $(SRCDIR)/util/add-depends.pl {-
413 defined $makedepprog && $makedepprog =~ /\/makedepend/
414 ? 'makedepend' : 'gcc' -}
415 @: {- output_on() if $disabled{makedepend}; "" -}
416
417 # Install helper targets #############################################
418
419 install_sw: install_dev install_engines install_runtime
420
421 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
422
423 install_docs: install_man_docs install_html_docs
424
425 uninstall_docs: uninstall_man_docs uninstall_html_docs
426 $(RM) -r $(DESTDIR)$(DOCDIR)
427
428 install_ssldirs:
429 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
430 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
431 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
432 @set -e; for x in dummy $(MISC_SCRIPTS); do \
433 if [ "$$x" = "dummy" ]; then continue; fi; \
434 x1=`echo "$$x" | cut -f1 -d:`; \
435 x2=`echo "$$x" | cut -f2 -d:`; \
436 fn=`basename $$x1`; \
437 $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
438 cp $$x1 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
439 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
440 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
441 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
442 if [ "$$x1" != "$$x2" ]; then \
443 ln=`basename "$$x2"`; \
444 : {- output_off() unless windowsdll(); "" -}; \
445 $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
446 cp $(DESTDIR)$(OPENSSLDIR)/misc/$$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
447 : {- output_on() unless windowsdll();
448 output_off() if windowsdll(); "" -}; \
449 $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
450 ln -sf $$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
451 : {- output_on() if windowsdll(); "" -}; \
452 fi; \
453 done
454 @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
455 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
456 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
457 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist
458 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
459 $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
460 cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
461 chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
462 fi
463 @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
464 @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
465 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
466 @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist
467 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \
468 $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
469 cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
470 chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
471 fi
472
473 install_dev: install_runtime_libs
474 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
475 @$(ECHO) "*** Installing development files"
476 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
477 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
478 @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
479 @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
480 @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
481 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
482 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
483 $(BLDDIR)/include/openssl/*.h; do \
484 fn=`basename $$i`; \
485 $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
486 cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
487 chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
488 done
489 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
490 @set -e; for l in $(INSTALL_LIBS); do \
491 fn=`basename $$l`; \
492 $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \
493 cp $$l $(DESTDIR)$(libdir)/$$fn.new; \
494 $(RANLIB) $(DESTDIR)$(libdir)/$$fn.new; \
495 chmod 644 $(DESTDIR)$(libdir)/$$fn.new; \
496 mv -f $(DESTDIR)$(libdir)/$$fn.new \
497 $(DESTDIR)$(libdir)/$$fn; \
498 done
499 @ : {- output_off() if $disabled{shared}; "" -}
500 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
501 s1=`echo "$$s" | cut -f1 -d";"`; \
502 s2=`echo "$$s" | cut -f2 -d";"`; \
503 fn1=`basename $$s1`; \
504 fn2=`basename $$s2`; \
505 : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \
506 if [ "$$fn1" != "$$fn2" ]; then \
507 $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \
508 ln -sf $$fn1 $(DESTDIR)$(libdir)/$$fn2; \
509 fi; \
510 : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \
511 $(ECHO) "install $$s2 -> $(DESTDIR)$(libdir)/$$fn2"; \
512 cp $$s2 $(DESTDIR)$(libdir)/$$fn2.new; \
513 chmod 755 $(DESTDIR)$(libdir)/$$fn2.new; \
514 mv -f $(DESTDIR)$(libdir)/$$fn2.new \
515 $(DESTDIR)$(libdir)/$$fn2; \
516 : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \
517 a=$(DESTDIR)$(libdir)/$$fn2; \
518 $(ECHO) "install $$s1 -> $$a"; \
519 if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \
520 mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \
521 cp -f $$a $$a.new; \
522 for so in `$(AR) t $$a`; do \
523 $(AR) x $$a $$so; \
524 chmod u+w $$so; \
525 strip -X32_64 -e $$so; \
526 $(AR) r $$a.new $$so; \
527 done; \
528 )); fi; \
529 $(AR) r $$a.new $$s1; \
530 mv -f $$a.new $$a; \
531 : {- output_off() if sharedaix(); output_on(); "" -}; \
532 done
533 @ : {- output_on() if $disabled{shared}; "" -}
534 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)/pkgconfig
535 @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc"
536 @cp libcrypto.pc $(DESTDIR)$(libdir)/pkgconfig
537 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
538 @$(ECHO) "install libssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/libssl.pc"
539 @cp libssl.pc $(DESTDIR)$(libdir)/pkgconfig
540 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
541 @$(ECHO) "install openssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/openssl.pc"
542 @cp openssl.pc $(DESTDIR)$(libdir)/pkgconfig
543 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
544
545 uninstall_dev: uninstall_runtime_libs
546 @$(ECHO) "*** Uninstalling development files"
547 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
548 @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
549 @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
550 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
551 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
552 $(BLDDIR)/include/openssl/*.h; do \
553 fn=`basename $$i`; \
554 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
555 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
556 done
557 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
558 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
559 @set -e; for l in $(INSTALL_LIBS); do \
560 fn=`basename $$l`; \
561 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \
562 $(RM) $(DESTDIR)$(libdir)/$$fn; \
563 done
564 @ : {- output_off() if $disabled{shared}; "" -}
565 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
566 s1=`echo "$$s" | cut -f1 -d";"`; \
567 s2=`echo "$$s" | cut -f2 -d";"`; \
568 fn1=`basename $$s1`; \
569 fn2=`basename $$s2`; \
570 : {- output_off() if windowsdll(); "" -}; \
571 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
572 $(RM) $(DESTDIR)$(libdir)/$$fn2; \
573 if [ "$$fn1" != "$$fn2" -a -f "$(DESTDIR)$(libdir)/$$fn1" ]; then \
574 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \
575 $(RM) $(DESTDIR)$(libdir)/$$fn1; \
576 fi; \
577 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
578 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
579 $(RM) $(DESTDIR)$(libdir)/$$fn2; \
580 : {- output_on() unless windowsdll(); "" -}; \
581 done
582 @ : {- output_on() if $disabled{shared}; "" -}
583 $(RM) $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
584 $(RM) $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
585 $(RM) $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
586 -$(RMDIR) $(DESTDIR)$(libdir)/pkgconfig
587 -$(RMDIR) $(DESTDIR)$(libdir)
588
589 install_engines: install_runtime_libs build_modules
590 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
591 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
592 @$(ECHO) "*** Installing ENGINE modules"
593 @set -e; for e in dummy $(INSTALL_ENGINES); do \
594 if [ "$$e" = "dummy" ]; then continue; fi; \
595 fn=`basename $$e`; \
596 $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
597 cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
598 chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
599 mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \
600 $(DESTDIR)$(ENGINESDIR)/$$fn; \
601 done
602
603 uninstall_engines:
604 @$(ECHO) "*** Uninstalling ENGINE modules"
605 @set -e; for e in dummy $(INSTALL_ENGINES); do \
606 if [ "$$e" = "dummy" ]; then continue; fi; \
607 fn=`basename $$e`; \
608 if [ "$$fn" = '{- platform->dso("ossltest") -}' ]; then \
609 continue; \
610 fi; \
611 $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
612 $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
613 done
614 -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
615
616 install_runtime: install_programs
617
618 install_runtime_libs: build_libs
619 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
620 @ : {- output_off() if windowsdll(); "" -}
621 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
622 @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -}
623 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
624 @ : {- output_on() unless windowsdll(); "" -}
625 @$(ECHO) "*** Installing runtime libraries"
626 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
627 if [ "$$s" = "dummy" ]; then continue; fi; \
628 fn=`basename $$s`; \
629 : {- output_off() unless windowsdll(); "" -}; \
630 $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
631 cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
632 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
633 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
634 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
635 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
636 $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \
637 cp $$s $(DESTDIR)$(libdir)/$$fn.new; \
638 chmod 755 $(DESTDIR)$(libdir)/$$fn.new; \
639 mv -f $(DESTDIR)$(libdir)/$$fn.new \
640 $(DESTDIR)$(libdir)/$$fn; \
641 : {- output_on() if windowsdll(); "" -}; \
642 done
643
644 install_programs: install_runtime_libs build_programs
645 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
646 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
647 @$(ECHO) "*** Installing runtime programs"
648 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
649 if [ "$$x" = "dummy" ]; then continue; fi; \
650 fn=`basename $$x`; \
651 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
652 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
653 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
654 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
655 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
656 done
657 @set -e; for x in dummy $(BIN_SCRIPTS); do \
658 if [ "$$x" = "dummy" ]; then continue; fi; \
659 fn=`basename $$x`; \
660 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
661 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
662 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
663 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
664 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
665 done
666
667 uninstall_runtime: uninstall_programs uninstall_runtime_libs
668
669 uninstall_programs:
670 @$(ECHO) "*** Uninstalling runtime programs"
671 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
672 do \
673 if [ "$$x" = "dummy" ]; then continue; fi; \
674 fn=`basename $$x`; \
675 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
676 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
677 done;
678 @set -e; for x in dummy $(BIN_SCRIPTS); \
679 do \
680 if [ "$$x" = "dummy" ]; then continue; fi; \
681 fn=`basename $$x`; \
682 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
683 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
684 done
685 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
686
687 uninstall_runtime_libs:
688 @$(ECHO) "*** Uninstalling runtime libraries"
689 @ : {- output_off() unless windowsdll(); "" -}
690 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
691 if [ "$$s" = "dummy" ]; then continue; fi; \
692 fn=`basename $$s`; \
693 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
694 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
695 done
696 @ : {- output_on() unless windowsdll(); "" -}
697
698
699 install_man_docs:
700 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
701 @$(ECHO) "*** Installing manpages"
702 $(PERL) $(SRCDIR)/util/process_docs.pl \
703 --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX)
704
705 uninstall_man_docs:
706 @$(ECHO) "*** Uninstalling manpages"
707 $(PERL) $(SRCDIR)/util/process_docs.pl \
708 --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \
709 --remove
710
711 install_html_docs:
712 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
713 @$(ECHO) "*** Installing HTML manpages"
714 $(PERL) $(SRCDIR)/util/process_docs.pl \
715 --destdir=$(DESTDIR)$(HTMLDIR) --type=html
716
717 uninstall_html_docs:
718 @$(ECHO) "*** Uninstalling manpages"
719 $(PERL) $(SRCDIR)/util/process_docs.pl \
720 --destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove
721
722
723 # Developer targets (note: these are only available on Unix) #########
724
725 update: generate errors ordinals
726
727 generate: generate_apps generate_crypto_bn generate_crypto_objects \
728 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
729
730 .PHONY: doc-nits
731 doc-nits: build_generated
732 (cd $(SRCDIR); $(PERL) util/find-doc-nits -n -p -s ) >doc-nits
733 @if [ -s doc-nits ] ; then cat doc-nits ; exit 1; \
734 else echo 'doc-nits: no errors.'; rm doc-nits ; fi
735
736 # Test coverage is a good idea for the future
737 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
738 # ...
739
740 lint:
741 lint -DLINT $(INCLUDES) $(SRCS)
742
743 generate_apps:
744 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
745 < apps/openssl.cnf > apps/openssl-vms.cnf )
746 @ : {- output_off() if $disabled{apps}; "" -}
747 ( b=`pwd`; cd $(SRCDIR); \
748 $(PERL) -I$$b apps/progs.pl -H $(APPS_OPENSSL) > apps/progs.h )
749 ( b=`pwd`; cd $(SRCDIR); \
750 $(PERL) -I$$b apps/progs.pl -C $(APPS_OPENSSL) > apps/progs.c )
751 @ : {- output_on() if $disabled{apps}; "" -}
752
753 generate_crypto_bn:
754 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
755
756 generate_crypto_objects:
757 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \
758 crypto/objects/objects.txt \
759 crypto/objects/obj_mac.num \
760 > crypto/objects/obj_mac.new && \
761 mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num )
762 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
763 crypto/objects/objects.txt \
764 crypto/objects/obj_mac.num \
765 > include/openssl/obj_mac.h )
766 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
767 include/openssl/obj_mac.h \
768 > crypto/objects/obj_dat.h )
769 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
770 crypto/objects/obj_mac.num \
771 crypto/objects/obj_xref.txt \
772 > crypto/objects/obj_xref.h )
773
774 generate_crypto_conf:
775 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
776 > crypto/conf/conf_def.h )
777
778 generate_crypto_asn1:
779 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
780 > crypto/asn1/charmap.h )
781
782 generate_fuzz_oids:
783 ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \
784 crypto/objects/obj_dat.h \
785 > fuzz/oids.txt )
786
787 # Set to -force to force a rebuild
788 ERROR_REBUILD=
789 errors:
790 ( b=`pwd`; set -e; cd $(SRCDIR); \
791 $(PERL) util/ck_errf.pl -strict -internal; \
792 $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal )
793 ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \
794 for E in *.ec ; do \
795 $(PERL) ../util/ck_errf.pl -strict \
796 -conf $$E `basename $$E .ec`.c; \
797 $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \
798 -conf $$E `basename $$E .ec`.c ; \
799 done )
800
801 {- use File::Basename;
802
803 our @sslheaders =
804 qw( include/openssl/ssl.h
805 include/openssl/ssl2.h
806 include/openssl/ssl3.h
807 include/openssl/sslerr.h
808 include/openssl/tls1.h
809 include/openssl/dtls1.h
810 include/openssl/srtp.h );
811 our @cryptoheaders =
812 qw( include/internal/dso.h
813 include/internal/o_dir.h
814 include/internal/err.h
815 include/internal/sslconf.h );
816 our @cryptoskipheaders = ( @sslheaders,
817 qw( include/openssl/conf_api.h
818 include/openssl/ebcdic.h
819 include/openssl/opensslconf.h
820 include/openssl/symhacks.h ) );
821 foreach my $f ( glob(catfile($config{sourcedir},
822 'include','openssl','*.h')) ) {
823 my $fn = "include/openssl/" . basename($f);
824 push @cryptoheaders, $fn unless grep { $_ eq $fn } @cryptoskipheaders;
825 }
826 "";
827 -}
828 CRYPTOHEADERS={- join(" \\\n\t", sort @cryptoheaders) -}
829 SSLHEADERS={- join(" \\\n\t", sort @sslheaders) -}
830 ordinals:
831 ( cd $(SRCDIR); \
832 $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
833 --ordinals util/libcrypto.num \
834 --symhacks include/openssl/symhacks.h \
835 $(CRYPTOHEADERS) )
836 ( cd $(SRCDIR); \
837 $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
838 --ordinals util/libssl.num \
839 --symhacks include/openssl/symhacks.h \
840 $(SSLHEADERS))
841
842 test_ordinals:
843 ( cd test; \
844 SRCTOP=../$(SRCDIR) \
845 BLDTOP=../$(BLDDIR) \
846 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
847
848 tags TAGS: FORCE
849 rm -f TAGS tags
850 -ctags -R .
851 -etags `find . -name '*.[ch]' -o -name '*.pm'`
852
853 # Release targets (note: only available on Unix) #####################
854
855 tar:
856 (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
857
858 # Helper targets #####################################################
859
860 link-utils: $(BLDDIR)/util/opensslwrap.sh
861
862 $(BLDDIR)/util/opensslwrap.sh: configdata.pm
863 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
864 mkdir -p "$(BLDDIR)/util"; \
865 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
866 fi
867
868 FORCE:
869
870 # Building targets ###################################################
871
872 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // () } @{$unified_info{libraries}}) -}
873 libcrypto.pc:
874 @ ( echo 'prefix=$(INSTALLTOP)'; \
875 echo 'exec_prefix=$${prefix}'; \
876 if [ -n "$(LIBDIR)" ]; then \
877 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
878 else \
879 echo 'libdir=$(libdir)'; \
880 fi; \
881 echo 'includedir=$${prefix}/include'; \
882 echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \
883 echo ''; \
884 echo 'Name: OpenSSL-libcrypto'; \
885 echo 'Description: OpenSSL cryptography library'; \
886 echo 'Version: '$(VERSION); \
887 echo 'Libs: -L$${libdir} -lcrypto'; \
888 echo 'Libs.private: $(LIB_EX_LIBS)'; \
889 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
890
891 libssl.pc:
892 @ ( echo 'prefix=$(INSTALLTOP)'; \
893 echo 'exec_prefix=$${prefix}'; \
894 if [ -n "$(LIBDIR)" ]; then \
895 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
896 else \
897 echo 'libdir=$(libdir)'; \
898 fi; \
899 echo 'includedir=$${prefix}/include'; \
900 echo ''; \
901 echo 'Name: OpenSSL-libssl'; \
902 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
903 echo 'Version: '$(VERSION); \
904 echo 'Requires.private: libcrypto'; \
905 echo 'Libs: -L$${libdir} -lssl'; \
906 echo 'Cflags: -I$${includedir}' ) > libssl.pc
907
908 openssl.pc:
909 @ ( echo 'prefix=$(INSTALLTOP)'; \
910 echo 'exec_prefix=$${prefix}'; \
911 if [ -n "$(LIBDIR)" ]; then \
912 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
913 else \
914 echo 'libdir=$(libdir)'; \
915 fi; \
916 echo 'includedir=$${prefix}/include'; \
917 echo ''; \
918 echo 'Name: OpenSSL'; \
919 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
920 echo 'Version: '$(VERSION); \
921 echo 'Requires: libssl libcrypto' ) > openssl.pc
922
923 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
924 @echo "Detected changed: $?"
925 $(PERL) configdata.pm -r
926 @echo "**************************************************"
927 @echo "*** ***"
928 @echo "*** Please run the same make command again ***"
929 @echo "*** ***"
930 @echo "**************************************************"
931 @false
932
933 reconfigure reconf:
934 $(PERL) configdata.pm -r
935
936 {-
937 use File::Basename;
938 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
939
940 # Helper function to figure out dependencies on libraries
941 # It takes a list of library names and outputs a list of dependencies
942 sub compute_lib_depends {
943 # Depending on shared libraries:
944 # On Windows POSIX layers, we depend on {libname}.dll.a
945 # On Unix platforms, we depend on {shlibname}.so
946 return map { platform->sharedlib_simple($_) // platform->staticlib($_) } @_;
947 }
948
949 sub generatesrc {
950 my %args = @_;
951 my $generator = join(" ", @{$args{generator}});
952 my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
953 my $incs = join("", map { " -I".$_ } @{$args{incs}});
954 my $defs = join("", map { " -D".$_ } @{$args{defs}});
955 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
956
957 if (platform->isdef($args{src})) {
958 my $target = platform->def($args{src});
959 (my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
960 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
961 my $ord_name = $args{generator}->[1] || $args{product};
962 return <<"EOF";
963 $target: $args{generator}->[0] $deps \$(SRCDIR)/util/mkdef.pl
964 \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --ordinals $args{generator}->[0] --name $ord_name --OS $mkdef_os > $target
965 EOF
966 } elsif (!platform->isasm($args{src})) {
967 if ($args{generator}->[0] =~ m|^.*\.in$|) {
968 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
969 "util", "dofile.pl")),
970 rel2abs($config{builddir}));
971 return <<"EOF";
972 $args{src}: $args{generator}->[0] $deps
973 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
974 "-o$target{build_file}" $generator > \$@
975 EOF
976 } else {
977 return <<"EOF";
978 $args{src}: $args{generator}->[0] $deps
979 \$(PERL)$generator_incs $generator > \$@
980 EOF
981 }
982 } else {
983 if ($args{generator}->[0] =~ /\.pl$/) {
984 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator;
985 } elsif ($args{generator}->[0] =~ /\.m4$/) {
986 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
987 } elsif ($args{generator}->[0] =~ /\.S$/) {
988 $generator = undef;
989 } else {
990 die "Generator type for $args{src} unknown: $generator\n";
991 }
992
993 my $cppflags = {
994 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
995 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
996 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
997 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
998 } -> {$args{intent}};
999 if (defined($generator)) {
1000 return <<"EOF";
1001 $args{src}: $args{generator}->[0] $deps
1002 $generator \$@
1003 EOF
1004 }
1005 return <<"EOF";
1006 $args{src}: $args{generator}->[0] $deps
1007 \$(CC) $incs $cppflags $defs -E $args{generator}->[0] | \\
1008 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
1009 EOF
1010 }
1011 }
1012
1013 # Should one wonder about the end of the Perl snippet, it's because this
1014 # second regexp eats up line endings as well, if the removed path is the
1015 # last in the line. We may therefore need to put back a line ending.
1016 sub src2obj {
1017 my %args = @_;
1018 my $obj = platform->obj($args{obj});
1019 my $dep = platform->dep($args{obj});
1020 my @srcs = @{$args{srcs}};
1021 my $srcs = join(" ", @srcs);
1022 my $deps = join(" ", @srcs, @{$args{deps}});
1023 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1024 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1025 my $cmd;
1026 my $cmdflags;
1027 my $cmdcompile;
1028 if (grep /\.rc$/, @srcs) {
1029 $cmd = '$(RC)';
1030 $cmdflags = '$(RCFLAGS)';
1031 $cmdcompile = '';
1032 } elsif (grep /\.(cc|cpp)$/, @srcs) {
1033 $cmd = '$(CXX)';
1034 $cmdcompile = ' -c';
1035 $cmdflags = {
1036 shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1037 lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1038 dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)',
1039 bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)'
1040 } -> {$args{intent}};
1041 } else {
1042 $cmd = '$(CC)';
1043 $cmdcompile = ' -c';
1044 $cmdflags = {
1045 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1046 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1047 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1048 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1049 } -> {$args{intent}};
1050 }
1051 my $recipe;
1052 # extension-specific rules
1053 if (grep /\.s$/, @srcs) {
1054 $recipe .= <<"EOF";
1055 $obj: $deps
1056 $cmd $cmdflags -c -o \$\@ $srcs
1057 EOF
1058 } elsif (grep /\.S$/, @srcs) {
1059 # Originally there was mutli-step rule with $(CC) -E file.S
1060 # followed by $(CC) -c file.s. It compensated for one of
1061 # legacy platform compiler's inability to handle .S files.
1062 # The platform is long discontinued by vendor so there is
1063 # hardly a point to drag it along...
1064 $recipe .= <<"EOF";
1065 $obj: $deps
1066 $cmd $incs $defs $cmdflags -c -o \$\@ $srcs
1067 EOF
1068 } elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/
1069 && !grep /\.rc$/, @srcs) {
1070 $recipe .= <<"EOF";
1071 $obj: $deps
1072 $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs
1073 \@touch $dep.tmp
1074 \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\
1075 rm -f $dep.tmp; \\
1076 else \\
1077 mv $dep.tmp $dep; \\
1078 fi
1079 EOF
1080 } else {
1081 $recipe .= <<"EOF";
1082 $obj: $deps
1083 $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs
1084 EOF
1085 if (defined $makedepprog && $makedepprog =~ /\/makedepend/) {
1086 $recipe .= <<"EOF";
1087 \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\
1088 > $dep
1089 EOF
1090 }
1091 }
1092 return $recipe;
1093 }
1094 # We *know* this routine is only called when we've configure 'shared'.
1095 sub obj2shlib {
1096 my %args = @_;
1097 my @linkdirs = ();
1098 foreach (@{args{deps}}) {
1099 my $d = dirname($_);
1100 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1101 }
1102 my $linkflags = join("", map { "-L$_ " } @linkdirs);
1103 my $linklibs = join("", map { my $f = basename($_);
1104 (my $l = $f) =~ s/^lib//;
1105 " -l$l" } @{$args{deps}});
1106 my @objs = map { platform->obj($_) }
1107 grep { !platform->isdef($_) }
1108 @{$args{objs}};
1109 my @defs = map { platform->def($_) }
1110 grep { platform->isdef($_) }
1111 @{$args{objs}};
1112 my @deps = compute_lib_depends(@{$args{deps}});
1113 die "More than one exported symbol map" if scalar @defs > 1;
1114 my $objs = join(" ", @objs);
1115 my $deps = join(" ", @objs, @defs, @deps);
1116 my $simple = platform->sharedlib_simple($args{lib});
1117 my $full = platform->sharedlib($args{lib});
1118 my $shared_soname = "";
1119 $shared_soname .= ' '.$target{shared_sonameflag}.basename($full)
1120 if defined $target{shared_sonameflag};
1121 my $shared_imp = "";
1122 $shared_imp .= ' '.$target{shared_impflag}.basename($simple)
1123 if defined $target{shared_impflag};
1124 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1125 my $recipe = <<"EOF";
1126 $simple: $full
1127 EOF
1128 if (sharedaix()) {
1129 $recipe .= <<"EOF";
1130 rm -f $simple && \\
1131 \$(AR) r $simple $full
1132 EOF
1133 } elsif ($simple ne $full) {
1134 $recipe .= <<"EOF";
1135 rm -f $simple && \\
1136 ln -s $full $simple
1137 EOF
1138 }
1139 $recipe .= <<"EOF";
1140 $full: $deps
1141 \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
1142 -o $full$shared_def $objs \\
1143 $linklibs \$(LIB_EX_LIBS)
1144 EOF
1145 if (windowsdll()) {
1146 $recipe .= <<"EOF";
1147 rm -f apps/$full
1148 rm -f test/$full
1149 rm -f fuzz/$full
1150 cp -p $full apps/
1151 cp -p $full test/
1152 cp -p $full fuzz/
1153 EOF
1154 }
1155 return $recipe;
1156 }
1157 sub obj2dso {
1158 my %args = @_;
1159 my $dso = platform->dso($args{lib});
1160 my @linkdirs = ();
1161 foreach (@{args{deps}}) {
1162 my $d = dirname($_);
1163 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1164 }
1165 my $linkflags = join("", map { "-L$_ " } @linkdirs);
1166 my $linklibs = join("", map { my $f = basename($_);
1167 (my $l = $f) =~ s/^lib//;
1168 " -l$l" } @{$args{deps}});
1169 my @objs = map { platform->obj($_) }
1170 grep { !platform->isdef($_) }
1171 @{$args{objs}};
1172 my @defs = map { platform->def($_) }
1173 grep { platform->isdef($_) }
1174 @{$args{objs}};
1175 my @deps = compute_lib_depends(@{$args{deps}});
1176 my $objs = join(" ", @objs);
1177 my $deps = join(" ", @objs, @defs, @deps);
1178 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1179 return <<"EOF";
1180 $dso: $deps
1181 \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
1182 -o $dso$shared_def $objs \\
1183 $linklibs \$(DSO_EX_LIBS)
1184 EOF
1185 }
1186 sub obj2lib {
1187 my %args = @_;
1188 my $lib = platform->staticlib($args{lib});
1189 my @objs = map { platform->obj($_) } @{$args{objs}};
1190 my $objs = join(" ", @objs);
1191 return <<"EOF";
1192 $lib: $objs
1193 \$(AR) \$(ARFLAGS) \$\@ \$\?
1194 \$(RANLIB) \$\@ || echo Never mind.
1195 EOF
1196 }
1197 sub obj2bin {
1198 my %args = @_;
1199 my $bin = platform->bin($args{bin});
1200 my $objs = join(" ", map { platform->obj($_) } @{$args{objs}});
1201 my $deps = join(" ", compute_lib_depends(@{$args{deps}}));
1202 my @linkdirs = ();
1203 foreach (@{args{deps}}) {
1204 next if $_ =~ /\.a$/;
1205 my $d = dirname($_);
1206 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1207 }
1208 my $linkflags = join("", map { "-L$_ " } @linkdirs);
1209 my $linklibs = join("", map { if ($_ =~ m/\.a$/) {
1210 " ".platform->staticlib($_);
1211 } else {
1212 my $f = basename($_);
1213 (my $l = $f) =~ s/^lib//;
1214 " -l$l"
1215 }
1216 } @{$args{deps}});
1217 my $cmd = '$(CC)';
1218 my $cmdflags = '$(BIN_CFLAGS)';
1219 if (grep /_cc\.o$/, @{$args{objs}}) {
1220 $cmd = '$(CXX)';
1221 $cmdflags = '$(BIN_CXXFLAGS)';
1222 }
1223 return <<"EOF";
1224 $bin: $objs $deps
1225 rm -f $bin
1226 \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
1227 -o $bin $objs \\
1228 $linklibs \$(BIN_EX_LIBS)
1229 EOF
1230 }
1231 sub in2script {
1232 my %args = @_;
1233 my $script = $args{script};
1234 my $sources = join(" ", @{$args{sources}});
1235 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1236 "util", "dofile.pl")),
1237 rel2abs($config{builddir}));
1238 return <<"EOF";
1239 $script: $sources
1240 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1241 "-o$target{build_file}" $sources > "$script"
1242 chmod a+x $script
1243 EOF
1244 }
1245 sub generatedir {
1246 my %args = @_;
1247 my $dir = $args{dir};
1248 my @deps = map { platform->convertext($_) } @{$args{deps}};
1249 my @actions = ();
1250 my %extinfo = ( dso => platform->dsoext(),
1251 lib => platform->libext(),
1252 bin => platform->binext() );
1253
1254 # We already have a 'test' target, and the top directory is just plain
1255 # silly
1256 return if $dir eq "test" || $dir eq ".";
1257
1258 foreach my $type (("dso", "lib", "bin", "script")) {
1259 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
1260 # For lib object files, we could update the library. However, it
1261 # was decided that it's enough to build the directory local object
1262 # files, so we don't need to add any actions, and the dependencies
1263 # are already taken care of.
1264 if ($type ne "lib") {
1265 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
1266 if (dirname($prod) eq $dir) {
1267 push @deps, $prod.$extinfo{$type};
1268 } else {
1269 push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1270 }
1271 }
1272 }
1273 }
1274
1275 my $deps = join(" ", @deps);
1276 my $actions = join("\n", "", @actions);
1277 return <<"EOF";
1278 $dir $dir/: $deps$actions
1279 EOF
1280 }
1281 "" # Important! This becomes part of the template result.
1282 -}