]> git.ipfire.org Git - thirdparty/openssl.git/blob - Configurations/unix-Makefile.tmpl
Refactor apps/progs.* to be generate with 'make update'
[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_DEBUG_MEMORY=on \
356 $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
357 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
358 @echo "Tests are not supported with your chosen Configure options"
359 @ : {- output_on() if !$disabled{tests}; "" -}
360
361 list-tests:
362 @ : {- output_off() if $disabled{tests}; "" -}
363 @SRCTOP="$(SRCDIR)" \
364 $(PERL) $(SRCDIR)/test/run_tests.pl list
365 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
366 @echo "Tests are not supported with your chosen Configure options"
367 @ : {- output_on() if !$disabled{tests}; "" -}
368
369 install: install_sw install_ssldirs install_docs
370
371 uninstall: uninstall_docs uninstall_sw
372
373 libclean:
374 @set -e; for s in $(SHLIB_INFO); do \
375 if [ "$$s" = ";" ]; then continue; fi; \
376 s1=`echo "$$s" | cut -f1 -d";"`; \
377 s2=`echo "$$s" | cut -f2 -d";"`; \
378 $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\
379 $(RM) apps/$$s1; \
380 $(RM) test/$$s1; \
381 $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\
382 $(RM) $$s1; \
383 if [ "$$s1" != "$$s2" ]; then \
384 $(ECHO) $(RM) $$s2; \
385 $(RM) $$s2; \
386 fi; \
387 done
388 $(RM) $(LIBS)
389 $(RM) *{- platform->defext() -}
390
391 clean: libclean
392 $(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(SCRIPTS)
393 $(RM) $(GENERATED_MANDATORY) $(GENERATED)
394 -$(RM) `find . -name .git -prune -o -name '*{- platform->depext() -}' -print`
395 -$(RM) `find . -name .git -prune -o -name '*{- platform->objext() -}' -print`
396 $(RM) core
397 $(RM) tags TAGS doc-nits
398 $(RM) -r test/test-runs
399 $(RM) openssl.pc libcrypto.pc libssl.pc
400 -$(RM) `find . -name .git -prune -o -type l -print`
401 $(RM) $(TARFILE)
402
403 distclean: clean
404 $(RM) configdata.pm
405 $(RM) Makefile
406
407 # We check if any depfile is newer than Makefile and decide to
408 # concatenate only if that is true.
409 depend:
410 @: {- output_off() if $disabled{makedepend}; "" -}
411 @$(PERL) $(SRCDIR)/util/add-depends.pl {-
412 defined $makedepprog && $makedepprog =~ /\/makedepend/
413 ? 'makedepend' : 'gcc' -}
414 @: {- output_on() if $disabled{makedepend}; "" -}
415
416 # Install helper targets #############################################
417
418 install_sw: install_dev install_engines install_runtime
419
420 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
421
422 install_docs: install_man_docs install_html_docs
423
424 uninstall_docs: uninstall_man_docs uninstall_html_docs
425 $(RM) -r $(DESTDIR)$(DOCDIR)
426
427 install_ssldirs:
428 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
429 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
430 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
431 @set -e; for x in dummy $(MISC_SCRIPTS); do \
432 if [ "$$x" = "dummy" ]; then continue; fi; \
433 x1=`echo "$$x" | cut -f1 -d:`; \
434 x2=`echo "$$x" | cut -f2 -d:`; \
435 fn=`basename $$x1`; \
436 $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
437 cp $$x1 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
438 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
439 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
440 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
441 if [ "$$x1" != "$$x2" ]; then \
442 ln=`basename "$$x2"`; \
443 : {- output_off() unless windowsdll(); "" -}; \
444 $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
445 cp $(DESTDIR)$(OPENSSLDIR)/misc/$$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
446 : {- output_on() unless windowsdll();
447 output_off() if windowsdll(); "" -}; \
448 $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
449 ln -sf $$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
450 : {- output_on() if windowsdll(); "" -}; \
451 fi; \
452 done
453 @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
454 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
455 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
456 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist
457 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
458 $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
459 cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
460 chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
461 fi
462 @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
463 @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
464 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
465 @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist
466 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \
467 $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
468 cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
469 chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
470 fi
471
472 install_dev: install_runtime_libs
473 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
474 @$(ECHO) "*** Installing development files"
475 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
476 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
477 @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
478 @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
479 @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
480 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
481 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
482 $(BLDDIR)/include/openssl/*.h; do \
483 fn=`basename $$i`; \
484 $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
485 cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
486 chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
487 done
488 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
489 @set -e; for l in $(INSTALL_LIBS); do \
490 fn=`basename $$l`; \
491 $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \
492 cp $$l $(DESTDIR)$(libdir)/$$fn.new; \
493 $(RANLIB) $(DESTDIR)$(libdir)/$$fn.new; \
494 chmod 644 $(DESTDIR)$(libdir)/$$fn.new; \
495 mv -f $(DESTDIR)$(libdir)/$$fn.new \
496 $(DESTDIR)$(libdir)/$$fn; \
497 done
498 @ : {- output_off() if $disabled{shared}; "" -}
499 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
500 s1=`echo "$$s" | cut -f1 -d";"`; \
501 s2=`echo "$$s" | cut -f2 -d";"`; \
502 fn1=`basename $$s1`; \
503 fn2=`basename $$s2`; \
504 : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \
505 if [ "$$fn1" != "$$fn2" ]; then \
506 $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \
507 ln -sf $$fn1 $(DESTDIR)$(libdir)/$$fn2; \
508 fi; \
509 : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \
510 $(ECHO) "install $$s2 -> $(DESTDIR)$(libdir)/$$fn2"; \
511 cp $$s2 $(DESTDIR)$(libdir)/$$fn2.new; \
512 chmod 755 $(DESTDIR)$(libdir)/$$fn2.new; \
513 mv -f $(DESTDIR)$(libdir)/$$fn2.new \
514 $(DESTDIR)$(libdir)/$$fn2; \
515 : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \
516 a=$(DESTDIR)$(libdir)/$$fn2; \
517 $(ECHO) "install $$s1 -> $$a"; \
518 if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \
519 mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \
520 cp -f $$a $$a.new; \
521 for so in `$(AR) t $$a`; do \
522 $(AR) x $$a $$so; \
523 chmod u+w $$so; \
524 strip -X32_64 -e $$so; \
525 $(AR) r $$a.new $$so; \
526 done; \
527 )); fi; \
528 $(AR) r $$a.new $$s1; \
529 mv -f $$a.new $$a; \
530 : {- output_off() if sharedaix(); output_on(); "" -}; \
531 done
532 @ : {- output_on() if $disabled{shared}; "" -}
533 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)/pkgconfig
534 @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc"
535 @cp libcrypto.pc $(DESTDIR)$(libdir)/pkgconfig
536 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
537 @$(ECHO) "install libssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/libssl.pc"
538 @cp libssl.pc $(DESTDIR)$(libdir)/pkgconfig
539 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
540 @$(ECHO) "install openssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/openssl.pc"
541 @cp openssl.pc $(DESTDIR)$(libdir)/pkgconfig
542 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
543
544 uninstall_dev: uninstall_runtime_libs
545 @$(ECHO) "*** Uninstalling development files"
546 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
547 @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
548 @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
549 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
550 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
551 $(BLDDIR)/include/openssl/*.h; do \
552 fn=`basename $$i`; \
553 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
554 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
555 done
556 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
557 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
558 @set -e; for l in $(INSTALL_LIBS); do \
559 fn=`basename $$l`; \
560 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \
561 $(RM) $(DESTDIR)$(libdir)/$$fn; \
562 done
563 @ : {- output_off() if $disabled{shared}; "" -}
564 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
565 s1=`echo "$$s" | cut -f1 -d";"`; \
566 s2=`echo "$$s" | cut -f2 -d";"`; \
567 fn1=`basename $$s1`; \
568 fn2=`basename $$s2`; \
569 : {- output_off() if windowsdll(); "" -}; \
570 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
571 $(RM) $(DESTDIR)$(libdir)/$$fn2; \
572 if [ "$$fn1" != "$$fn2" -a -f "$(DESTDIR)$(libdir)/$$fn1" ]; then \
573 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \
574 $(RM) $(DESTDIR)$(libdir)/$$fn1; \
575 fi; \
576 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
577 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
578 $(RM) $(DESTDIR)$(libdir)/$$fn2; \
579 : {- output_on() unless windowsdll(); "" -}; \
580 done
581 @ : {- output_on() if $disabled{shared}; "" -}
582 $(RM) $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
583 $(RM) $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
584 $(RM) $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
585 -$(RMDIR) $(DESTDIR)$(libdir)/pkgconfig
586 -$(RMDIR) $(DESTDIR)$(libdir)
587
588 install_engines: install_runtime_libs build_modules
589 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
590 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
591 @$(ECHO) "*** Installing ENGINE modules"
592 @set -e; for e in dummy $(INSTALL_ENGINES); do \
593 if [ "$$e" = "dummy" ]; then continue; fi; \
594 fn=`basename $$e`; \
595 $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
596 cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
597 chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
598 mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \
599 $(DESTDIR)$(ENGINESDIR)/$$fn; \
600 done
601
602 uninstall_engines:
603 @$(ECHO) "*** Uninstalling ENGINE modules"
604 @set -e; for e in dummy $(INSTALL_ENGINES); do \
605 if [ "$$e" = "dummy" ]; then continue; fi; \
606 fn=`basename $$e`; \
607 if [ "$$fn" = '{- platform->dso("ossltest") -}' ]; then \
608 continue; \
609 fi; \
610 $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
611 $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
612 done
613 -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
614
615 install_runtime: install_programs
616
617 install_runtime_libs: build_libs
618 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
619 @ : {- output_off() if windowsdll(); "" -}
620 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
621 @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -}
622 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
623 @ : {- output_on() unless windowsdll(); "" -}
624 @$(ECHO) "*** Installing runtime libraries"
625 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
626 if [ "$$s" = "dummy" ]; then continue; fi; \
627 fn=`basename $$s`; \
628 : {- output_off() unless windowsdll(); "" -}; \
629 $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
630 cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
631 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
632 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
633 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
634 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
635 $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \
636 cp $$s $(DESTDIR)$(libdir)/$$fn.new; \
637 chmod 755 $(DESTDIR)$(libdir)/$$fn.new; \
638 mv -f $(DESTDIR)$(libdir)/$$fn.new \
639 $(DESTDIR)$(libdir)/$$fn; \
640 : {- output_on() if windowsdll(); "" -}; \
641 done
642
643 install_programs: install_runtime_libs build_programs
644 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
645 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
646 @$(ECHO) "*** Installing runtime programs"
647 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
648 if [ "$$x" = "dummy" ]; then continue; fi; \
649 fn=`basename $$x`; \
650 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
651 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
652 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
653 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
654 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
655 done
656 @set -e; for x in dummy $(BIN_SCRIPTS); do \
657 if [ "$$x" = "dummy" ]; then continue; fi; \
658 fn=`basename $$x`; \
659 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
660 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
661 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
662 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
663 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
664 done
665
666 uninstall_runtime: uninstall_programs uninstall_runtime_libs
667
668 uninstall_programs:
669 @$(ECHO) "*** Uninstalling runtime programs"
670 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
671 do \
672 if [ "$$x" = "dummy" ]; then continue; fi; \
673 fn=`basename $$x`; \
674 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
675 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
676 done;
677 @set -e; for x in dummy $(BIN_SCRIPTS); \
678 do \
679 if [ "$$x" = "dummy" ]; then continue; fi; \
680 fn=`basename $$x`; \
681 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
682 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
683 done
684 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
685
686 uninstall_runtime_libs:
687 @$(ECHO) "*** Uninstalling runtime libraries"
688 @ : {- output_off() unless windowsdll(); "" -}
689 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
690 if [ "$$s" = "dummy" ]; then continue; fi; \
691 fn=`basename $$s`; \
692 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
693 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
694 done
695 @ : {- output_on() unless windowsdll(); "" -}
696
697
698 install_man_docs:
699 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
700 @$(ECHO) "*** Installing manpages"
701 $(PERL) $(SRCDIR)/util/process_docs.pl \
702 --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX)
703
704 uninstall_man_docs:
705 @$(ECHO) "*** Uninstalling manpages"
706 $(PERL) $(SRCDIR)/util/process_docs.pl \
707 --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \
708 --remove
709
710 install_html_docs:
711 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
712 @$(ECHO) "*** Installing HTML manpages"
713 $(PERL) $(SRCDIR)/util/process_docs.pl \
714 --destdir=$(DESTDIR)$(HTMLDIR) --type=html
715
716 uninstall_html_docs:
717 @$(ECHO) "*** Uninstalling manpages"
718 $(PERL) $(SRCDIR)/util/process_docs.pl \
719 --destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove
720
721
722 # Developer targets (note: these are only available on Unix) #########
723
724 update: generate errors ordinals
725
726 generate: generate_apps generate_crypto_bn generate_crypto_objects \
727 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
728
729 .PHONY: doc-nits
730 doc-nits: build_generated
731 (cd $(SRCDIR); $(PERL) util/find-doc-nits -n -p -s ) >doc-nits
732 @if [ -s doc-nits ] ; then cat doc-nits ; exit 1; \
733 else echo 'doc-nits: no errors.'; rm doc-nits ; fi
734
735 # Test coverage is a good idea for the future
736 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
737 # ...
738
739 lint:
740 lint -DLINT $(INCLUDES) $(SRCS)
741
742 generate_apps:
743 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
744 < apps/openssl.cnf > apps/openssl-vms.cnf )
745 @ : {- output_off() if $disabled{apps}; "" -}
746 ( b=`pwd`; cd $(SRCDIR); \
747 $(PERL) -I$$b apps/progs.pl -H $(APPS_OPENSSL) > apps/progs.h )
748 ( b=`pwd`; cd $(SRCDIR); \
749 $(PERL) -I$$b apps/progs.pl -C $(APPS_OPENSSL) > apps/progs.c )
750 @ : {- output_on() if $disabled{apps}; "" -}
751
752 generate_crypto_bn:
753 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
754
755 generate_crypto_objects:
756 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \
757 crypto/objects/objects.txt \
758 crypto/objects/obj_mac.num \
759 > crypto/objects/obj_mac.new && \
760 mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num )
761 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
762 crypto/objects/objects.txt \
763 crypto/objects/obj_mac.num \
764 > include/openssl/obj_mac.h )
765 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
766 include/openssl/obj_mac.h \
767 > crypto/objects/obj_dat.h )
768 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
769 crypto/objects/obj_mac.num \
770 crypto/objects/obj_xref.txt \
771 > crypto/objects/obj_xref.h )
772
773 generate_crypto_conf:
774 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
775 > crypto/conf/conf_def.h )
776
777 generate_crypto_asn1:
778 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
779 > crypto/asn1/charmap.h )
780
781 generate_fuzz_oids:
782 ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \
783 crypto/objects/obj_dat.h \
784 > fuzz/oids.txt )
785
786 # Set to -force to force a rebuild
787 ERROR_REBUILD=
788 errors:
789 ( b=`pwd`; set -e; cd $(SRCDIR); \
790 $(PERL) util/ck_errf.pl -strict -internal; \
791 $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal )
792 ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \
793 for E in *.ec ; do \
794 $(PERL) ../util/ck_errf.pl -strict \
795 -conf $$E `basename $$E .ec`.c; \
796 $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \
797 -conf $$E `basename $$E .ec`.c ; \
798 done )
799
800 {- use File::Basename;
801
802 our @sslheaders =
803 qw( include/openssl/ssl.h
804 include/openssl/ssl2.h
805 include/openssl/ssl3.h
806 include/openssl/sslerr.h
807 include/openssl/tls1.h
808 include/openssl/dtls1.h
809 include/openssl/srtp.h );
810 our @cryptoheaders =
811 qw( include/internal/dso.h
812 include/internal/o_dir.h
813 include/internal/err.h
814 include/internal/sslconf.h );
815 our @cryptoskipheaders = ( @sslheaders,
816 qw( include/openssl/conf_api.h
817 include/openssl/ebcdic.h
818 include/openssl/opensslconf.h
819 include/openssl/symhacks.h ) );
820 foreach my $f ( glob(catfile($config{sourcedir},
821 'include','openssl','*.h')) ) {
822 my $fn = "include/openssl/" . basename($f);
823 push @cryptoheaders, $fn unless grep { $_ eq $fn } @cryptoskipheaders;
824 }
825 "";
826 -}
827 CRYPTOHEADERS={- join(" \\\n\t", sort @cryptoheaders) -}
828 SSLHEADERS={- join(" \\\n\t", sort @sslheaders) -}
829 ordinals:
830 ( cd $(SRCDIR); \
831 $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
832 --ordinals util/libcrypto.num \
833 --symhacks include/openssl/symhacks.h \
834 $(CRYPTOHEADERS) )
835 ( cd $(SRCDIR); \
836 $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
837 --ordinals util/libssl.num \
838 --symhacks include/openssl/symhacks.h \
839 $(SSLHEADERS))
840
841 test_ordinals:
842 ( cd test; \
843 SRCTOP=../$(SRCDIR) \
844 BLDTOP=../$(BLDDIR) \
845 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
846
847 tags TAGS: FORCE
848 rm -f TAGS tags
849 -ctags -R .
850 -etags `find . -name '*.[ch]' -o -name '*.pm'`
851
852 # Release targets (note: only available on Unix) #####################
853
854 tar:
855 (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
856
857 # Helper targets #####################################################
858
859 link-utils: $(BLDDIR)/util/opensslwrap.sh
860
861 $(BLDDIR)/util/opensslwrap.sh: configdata.pm
862 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
863 mkdir -p "$(BLDDIR)/util"; \
864 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
865 fi
866
867 FORCE:
868
869 # Building targets ###################################################
870
871 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // () } @{$unified_info{libraries}}) -}
872 libcrypto.pc:
873 @ ( echo 'prefix=$(INSTALLTOP)'; \
874 echo 'exec_prefix=$${prefix}'; \
875 if [ -n "$(LIBDIR)" ]; then \
876 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
877 else \
878 echo 'libdir=$(libdir)'; \
879 fi; \
880 echo 'includedir=$${prefix}/include'; \
881 echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \
882 echo ''; \
883 echo 'Name: OpenSSL-libcrypto'; \
884 echo 'Description: OpenSSL cryptography library'; \
885 echo 'Version: '$(VERSION); \
886 echo 'Libs: -L$${libdir} -lcrypto'; \
887 echo 'Libs.private: $(LIB_EX_LIBS)'; \
888 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
889
890 libssl.pc:
891 @ ( echo 'prefix=$(INSTALLTOP)'; \
892 echo 'exec_prefix=$${prefix}'; \
893 if [ -n "$(LIBDIR)" ]; then \
894 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
895 else \
896 echo 'libdir=$(libdir)'; \
897 fi; \
898 echo 'includedir=$${prefix}/include'; \
899 echo ''; \
900 echo 'Name: OpenSSL-libssl'; \
901 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
902 echo 'Version: '$(VERSION); \
903 echo 'Requires.private: libcrypto'; \
904 echo 'Libs: -L$${libdir} -lssl'; \
905 echo 'Cflags: -I$${includedir}' ) > libssl.pc
906
907 openssl.pc:
908 @ ( echo 'prefix=$(INSTALLTOP)'; \
909 echo 'exec_prefix=$${prefix}'; \
910 if [ -n "$(LIBDIR)" ]; then \
911 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
912 else \
913 echo 'libdir=$(libdir)'; \
914 fi; \
915 echo 'includedir=$${prefix}/include'; \
916 echo ''; \
917 echo 'Name: OpenSSL'; \
918 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
919 echo 'Version: '$(VERSION); \
920 echo 'Requires: libssl libcrypto' ) > openssl.pc
921
922 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
923 @echo "Detected changed: $?"
924 $(PERL) configdata.pm -r
925 @echo "**************************************************"
926 @echo "*** ***"
927 @echo "*** Please run the same make command again ***"
928 @echo "*** ***"
929 @echo "**************************************************"
930 @false
931
932 reconfigure reconf:
933 $(PERL) configdata.pm -r
934
935 {-
936 use File::Basename;
937 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
938
939 # Helper function to figure out dependencies on libraries
940 # It takes a list of library names and outputs a list of dependencies
941 sub compute_lib_depends {
942 # Depending on shared libraries:
943 # On Windows POSIX layers, we depend on {libname}.dll.a
944 # On Unix platforms, we depend on {shlibname}.so
945 return map { platform->sharedlib_simple($_) // platform->staticlib($_) } @_;
946 }
947
948 sub generatesrc {
949 my %args = @_;
950 my $generator = join(" ", @{$args{generator}});
951 my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
952 my $incs = join("", map { " -I".$_ } @{$args{incs}});
953 my $defs = join("", map { " -D".$_ } @{$args{defs}});
954 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
955
956 if (platform->isdef($args{src})) {
957 my $target = platform->def($args{src});
958 (my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
959 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
960 my $ord_name = $args{generator}->[1] || $args{product};
961 return <<"EOF";
962 $target: $args{generator}->[0] $deps \$(SRCDIR)/util/mkdef.pl
963 \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --ordinals $args{generator}->[0] --name $ord_name --OS $mkdef_os > $target
964 EOF
965 } elsif (!platform->isasm($args{src})) {
966 if ($args{generator}->[0] =~ m|^.*\.in$|) {
967 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
968 "util", "dofile.pl")),
969 rel2abs($config{builddir}));
970 return <<"EOF";
971 $args{src}: $args{generator}->[0] $deps
972 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
973 "-o$target{build_file}" $generator > \$@
974 EOF
975 } else {
976 return <<"EOF";
977 $args{src}: $args{generator}->[0] $deps
978 \$(PERL)$generator_incs $generator > \$@
979 EOF
980 }
981 } else {
982 if ($args{generator}->[0] =~ /\.pl$/) {
983 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator;
984 } elsif ($args{generator}->[0] =~ /\.m4$/) {
985 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
986 } elsif ($args{generator}->[0] =~ /\.S$/) {
987 $generator = undef;
988 } else {
989 die "Generator type for $args{src} unknown: $generator\n";
990 }
991
992 my $cppflags = {
993 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
994 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
995 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
996 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
997 } -> {$args{intent}};
998 if (defined($generator)) {
999 return <<"EOF";
1000 $args{src}: $args{generator}->[0] $deps
1001 $generator \$@
1002 EOF
1003 }
1004 return <<"EOF";
1005 $args{src}: $args{generator}->[0] $deps
1006 \$(CC) $incs $cppflags $defs -E $args{generator}->[0] | \\
1007 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
1008 EOF
1009 }
1010 }
1011
1012 # Should one wonder about the end of the Perl snippet, it's because this
1013 # second regexp eats up line endings as well, if the removed path is the
1014 # last in the line. We may therefore need to put back a line ending.
1015 sub src2obj {
1016 my %args = @_;
1017 my $obj = platform->obj($args{obj});
1018 my $dep = platform->dep($args{obj});
1019 my @srcs = @{$args{srcs}};
1020 my $srcs = join(" ", @srcs);
1021 my $deps = join(" ", @srcs, @{$args{deps}});
1022 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1023 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1024 my $cmd;
1025 my $cmdflags;
1026 my $cmdcompile;
1027 if (grep /\.rc$/, @srcs) {
1028 $cmd = '$(RC)';
1029 $cmdflags = '$(RCFLAGS)';
1030 $cmdcompile = '';
1031 } elsif (grep /\.(cc|cpp)$/, @srcs) {
1032 $cmd = '$(CXX)';
1033 $cmdcompile = ' -c';
1034 $cmdflags = {
1035 shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1036 lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1037 dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)',
1038 bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)'
1039 } -> {$args{intent}};
1040 } else {
1041 $cmd = '$(CC)';
1042 $cmdcompile = ' -c';
1043 $cmdflags = {
1044 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1045 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1046 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1047 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1048 } -> {$args{intent}};
1049 }
1050 my $recipe;
1051 # extension-specific rules
1052 if (grep /\.s$/, @srcs) {
1053 $recipe .= <<"EOF";
1054 $obj: $deps
1055 $cmd $cmdflags -c -o \$\@ $srcs
1056 EOF
1057 } elsif (grep /\.S$/, @srcs) {
1058 # Originally there was mutli-step rule with $(CC) -E file.S
1059 # followed by $(CC) -c file.s. It compensated for one of
1060 # legacy platform compiler's inability to handle .S files.
1061 # The platform is long discontinued by vendor so there is
1062 # hardly a point to drag it along...
1063 $recipe .= <<"EOF";
1064 $obj: $deps
1065 $cmd $incs $defs $cmdflags -c -o \$\@ $srcs
1066 EOF
1067 } elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/
1068 && !grep /\.rc$/, @srcs) {
1069 $recipe .= <<"EOF";
1070 $obj: $deps
1071 $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs
1072 \@touch $dep.tmp
1073 \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\
1074 rm -f $dep.tmp; \\
1075 else \\
1076 mv $dep.tmp $dep; \\
1077 fi
1078 EOF
1079 } else {
1080 $recipe .= <<"EOF";
1081 $obj: $deps
1082 $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs
1083 EOF
1084 if (defined $makedepprog && $makedepprog =~ /\/makedepend/) {
1085 $recipe .= <<"EOF";
1086 \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\
1087 > $dep
1088 EOF
1089 }
1090 }
1091 return $recipe;
1092 }
1093 # We *know* this routine is only called when we've configure 'shared'.
1094 sub obj2shlib {
1095 my %args = @_;
1096 my @linkdirs = ();
1097 foreach (@{args{deps}}) {
1098 my $d = dirname($_);
1099 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1100 }
1101 my $linkflags = join("", map { "-L$_ " } @linkdirs);
1102 my $linklibs = join("", map { my $f = basename($_);
1103 (my $l = $f) =~ s/^lib//;
1104 " -l$l" } @{$args{deps}});
1105 my @objs = map { platform->obj($_) }
1106 grep { !platform->isdef($_) }
1107 @{$args{objs}};
1108 my @defs = map { platform->def($_) }
1109 grep { platform->isdef($_) }
1110 @{$args{objs}};
1111 my @deps = compute_lib_depends(@{$args{deps}});
1112 die "More than one exported symbol map" if scalar @defs > 1;
1113 my $objs = join(" ", @objs);
1114 my $deps = join(" ", @objs, @defs, @deps);
1115 my $simple = platform->sharedlib_simple($args{lib});
1116 my $full = platform->sharedlib($args{lib});
1117 my $shared_soname = "";
1118 $shared_soname .= ' '.$target{shared_sonameflag}.basename($full)
1119 if defined $target{shared_sonameflag};
1120 my $shared_imp = "";
1121 $shared_imp .= ' '.$target{shared_impflag}.basename($simple)
1122 if defined $target{shared_impflag};
1123 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1124 my $recipe = <<"EOF";
1125 $simple: $full
1126 EOF
1127 if (sharedaix()) {
1128 $recipe .= <<"EOF";
1129 rm -f $simple && \\
1130 \$(AR) r $simple $full
1131 EOF
1132 } elsif ($simple ne $full) {
1133 $recipe .= <<"EOF";
1134 rm -f $simple && \\
1135 ln -s $full $simple
1136 EOF
1137 }
1138 $recipe .= <<"EOF";
1139 $full: $deps
1140 \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
1141 -o $full$shared_def $objs \\
1142 $linklibs \$(LIB_EX_LIBS)
1143 EOF
1144 if (windowsdll()) {
1145 $recipe .= <<"EOF";
1146 rm -f apps/$full
1147 rm -f test/$full
1148 rm -f fuzz/$full
1149 cp -p $full apps/
1150 cp -p $full test/
1151 cp -p $full fuzz/
1152 EOF
1153 }
1154 return $recipe;
1155 }
1156 sub obj2dso {
1157 my %args = @_;
1158 my $dso = platform->dso($args{lib});
1159 my @linkdirs = ();
1160 foreach (@{args{deps}}) {
1161 my $d = dirname($_);
1162 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1163 }
1164 my $linkflags = join("", map { "-L$_ " } @linkdirs);
1165 my $linklibs = join("", map { my $f = basename($_);
1166 (my $l = $f) =~ s/^lib//;
1167 " -l$l" } @{$args{deps}});
1168 my @objs = map { platform->obj($_) }
1169 grep { !platform->isdef($_) }
1170 @{$args{objs}};
1171 my @defs = map { platform->def($_) }
1172 grep { platform->isdef($_) }
1173 @{$args{objs}};
1174 my @deps = compute_lib_depends(@{$args{deps}});
1175 my $objs = join(" ", @objs);
1176 my $deps = join(" ", @objs, @defs, @deps);
1177 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1178 return <<"EOF";
1179 $dso: $deps
1180 \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
1181 -o $dso$shared_def $objs \\
1182 $linklibs \$(DSO_EX_LIBS)
1183 EOF
1184 }
1185 sub obj2lib {
1186 my %args = @_;
1187 my $lib = platform->staticlib($args{lib});
1188 my @objs = map { platform->obj($_) } @{$args{objs}};
1189 my $objs = join(" ", @objs);
1190 return <<"EOF";
1191 $lib: $objs
1192 \$(AR) \$(ARFLAGS) \$\@ \$\?
1193 \$(RANLIB) \$\@ || echo Never mind.
1194 EOF
1195 }
1196 sub obj2bin {
1197 my %args = @_;
1198 my $bin = platform->bin($args{bin});
1199 my $objs = join(" ", map { platform->obj($_) } @{$args{objs}});
1200 my $deps = join(" ", compute_lib_depends(@{$args{deps}}));
1201 my @linkdirs = ();
1202 foreach (@{args{deps}}) {
1203 next if $_ =~ /\.a$/;
1204 my $d = dirname($_);
1205 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1206 }
1207 my $linkflags = join("", map { "-L$_ " } @linkdirs);
1208 my $linklibs = join("", map { if ($_ =~ m/\.a$/) {
1209 " ".platform->staticlib($_);
1210 } else {
1211 my $f = basename($_);
1212 (my $l = $f) =~ s/^lib//;
1213 " -l$l"
1214 }
1215 } @{$args{deps}});
1216 my $cmd = '$(CC)';
1217 my $cmdflags = '$(BIN_CFLAGS)';
1218 if (grep /_cc\.o$/, @{$args{objs}}) {
1219 $cmd = '$(CXX)';
1220 $cmdflags = '$(BIN_CXXFLAGS)';
1221 }
1222 return <<"EOF";
1223 $bin: $objs $deps
1224 rm -f $bin
1225 \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
1226 -o $bin $objs \\
1227 $linklibs \$(BIN_EX_LIBS)
1228 EOF
1229 }
1230 sub in2script {
1231 my %args = @_;
1232 my $script = $args{script};
1233 my $sources = join(" ", @{$args{sources}});
1234 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1235 "util", "dofile.pl")),
1236 rel2abs($config{builddir}));
1237 return <<"EOF";
1238 $script: $sources
1239 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1240 "-o$target{build_file}" $sources > "$script"
1241 chmod a+x $script
1242 EOF
1243 }
1244 sub generatedir {
1245 my %args = @_;
1246 my $dir = $args{dir};
1247 my @deps = map { platform->convertext($_) } @{$args{deps}};
1248 my @actions = ();
1249 my %extinfo = ( dso => platform->dsoext(),
1250 lib => platform->libext(),
1251 bin => platform->binext() );
1252
1253 # We already have a 'test' target, and the top directory is just plain
1254 # silly
1255 return if $dir eq "test" || $dir eq ".";
1256
1257 foreach my $type (("dso", "lib", "bin", "script")) {
1258 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
1259 # For lib object files, we could update the library. However, it
1260 # was decided that it's enough to build the directory local object
1261 # files, so we don't need to add any actions, and the dependencies
1262 # are already taken care of.
1263 if ($type ne "lib") {
1264 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
1265 if (dirname($prod) eq $dir) {
1266 push @deps, $prod.$extinfo{$type};
1267 } else {
1268 push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1269 }
1270 }
1271 }
1272 }
1273
1274 my $deps = join(" ", @deps);
1275 my $actions = join("\n", "", @actions);
1276 return <<"EOF";
1277 $dir $dir/: $deps$actions
1278 EOF
1279 }
1280 "" # Important! This becomes part of the template result.
1281 -}