2 ## Makefile for OpenSSL
4 ## {- join("\n## ", @autowarntext) -}
6 our $makedepprog = platform->makedepprog();
8 sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ }
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/ }
14 our $sover_dirname = platform->shlib_version_as_filename();
16 # This makes sure things get built in the order they need
21 return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target";
25 PLATFORM={- $config{target} -}
26 OPTIONS={- $config{options} -}
27 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
28 SRCDIR={- $config{sourcedir} -}
29 BLDDIR={- $config{builddir} -}
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} -}
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 ) -}
56 join(" ", map { platform->staticlib($_) // () }
57 grep { !$unified_info{attributes}->{$_}->{noinst} }
58 @{$unified_info{libraries}})
61 join(" ", map { platform->sharedlib($_) // () }
62 grep { !$unified_info{attributes}->{$_}->{noinst} }
63 @{$unified_info{libraries}})
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}})
73 join(" ", map { platform->dso($_) }
74 grep { !$unified_info{attributes}->{$_}->{noinst}
75 && $unified_info{attributes}->{$_}->{engine} }
76 @{$unified_info{modules}})
79 join(" ", map { platform->bin($_) }
80 grep { !$unified_info{attributes}->{$_}->{noinst} }
81 @{$unified_info{programs}})
84 join(" ", map { my $x = $unified_info{attributes}->{$_}->{linkname};
86 grep { !$unified_info{attributes}->{$_}->{noinst}
87 && !$unified_info{attributes}->{$_}->{misc} }
88 @{$unified_info{scripts}})
91 join(" ", map { my $x = $unified_info{attributes}->{$_}->{linkname};
93 grep { !$unified_info{attributes}->{$_}->{noinst}
94 && $unified_info{attributes}->{$_}->{misc} }
95 @{$unified_info{scripts}})
98 APPS_OPENSSL={- use File::Spec::Functions;
99 catfile("apps","openssl") -}
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.
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
110 our $prefix = $config{prefix} || "/usr/local";
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.
121 use File::Spec::Functions;
123 $config{openssldir} ?
124 (file_name_is_absolute($config{openssldir}) ?
126 : catdir($prefix, $config{openssldir}))
127 : catdir($prefix, "ssl");
129 LIBDIR={- our $libdir = $config{libdir};
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...
137 -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
138 $libdir = "lib$multilib";
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
147 # Convenience variable for those who want to set the rpath in shared
148 # libraries and applications
151 MANDIR=$(INSTALLTOP)/share/man
152 DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
153 HTMLDIR=$(DOCDIR)/html
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.
161 # For "optional" echo messages, to get "real" silence
164 ##### User defined commands and flags ################################
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.
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}}) -}
185 MAKEDEPEND={- $config{makedepprog} -}
187 PERL={- $config{PERL} -}
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} -}
197 TAR= {- $target{TAR} || "tar" -}
198 TARFLAGS= {- $target{TARFLAGS} -}
201 NAME= $(BASENAME)-$(VERSION)
202 # Relative to $(SRCDIR)
203 TARFILE= ../$(NAME).tar
205 ##### Project flags ##################################################
207 # Variables starting with CNF_ are common variables for all product types
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}}) -}
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
231 LIB_CPPFLAGS={- our $lib_cppflags =
232 join(' ', $target{lib_cppflags} || (),
233 $target{shared_cppflag} || (),
235 @{$config{lib_defines} || ()},
236 @{$config{shared_defines} || ()}),
237 @{$config{lib_cppflags}},
238 @{$config{shared_cppflag}});
239 join(' ', $lib_cppflags,
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} || (),
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)
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 || (),
305 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
307 # For x86 assembler: Set PROCESSOR to 386 if you want to support
309 PROCESSOR= {- $config{processor} -}
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...
320 # The main targets ###################################################
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
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)
332 # Kept around for backward compatibility
333 build_apps build_tests: build_programs
335 # Convenience target to prebuild all generated files, not just the mandatory
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}; "" -}
345 {- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep link-utils
346 @ : {- output_off() if $disabled{tests}; "" -}
348 mkdir -p test-runs; \
349 SRCTOP=../$(SRCDIR) \
350 BLDTOP=../$(BLDDIR) \
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}; "" -}
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}; "" -}
370 install: install_sw install_ssldirs install_docs
372 uninstall: uninstall_docs uninstall_sw
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(); "" -}\
382 $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\
384 if [ "$$s1" != "$$s2" ]; then \
385 $(ECHO) $(RM) $$s2; \
390 $(RM) *{- platform->defext() -}
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`
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`
408 # We check if any depfile is newer than Makefile and decide to
409 # concatenate only if that is true.
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}; "" -}
417 # Install helper targets #############################################
419 install_sw: install_dev install_engines install_runtime
421 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
423 install_docs: install_man_docs install_html_docs
425 uninstall_docs: uninstall_man_docs uninstall_html_docs
426 $(RM) -r $(DESTDIR)$(DOCDIR)
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(); "" -}; \
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; \
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; \
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 \
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; \
489 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
490 @set -e; for l in $(INSTALL_LIBS); do \
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; \
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; \
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.$$$$; \
522 for so in `$(AR) t $$a`; do \
525 strip -X32_64 -e $$so; \
526 $(AR) r $$a.new $$so; \
529 $(AR) r $$a.new $$s1; \
531 : {- output_off() if sharedaix(); output_on(); "" -}; \
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
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 \
554 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
555 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
557 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
558 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
559 @set -e; for l in $(INSTALL_LIBS); do \
561 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \
562 $(RM) $(DESTDIR)$(libdir)/$$fn; \
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; \
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(); "" -}; \
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)
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; \
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; \
604 @$(ECHO) "*** Uninstalling ENGINE modules"
605 @set -e; for e in dummy $(INSTALL_ENGINES); do \
606 if [ "$$e" = "dummy" ]; then continue; fi; \
608 if [ "$$fn" = '{- platform->dso("ossltest") -}' ]; then \
611 $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
612 $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
614 -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
616 install_runtime: install_programs
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; \
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(); "" -}; \
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; \
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; \
657 @set -e; for x in dummy $(BIN_SCRIPTS); do \
658 if [ "$$x" = "dummy" ]; then continue; fi; \
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; \
667 uninstall_runtime: uninstall_programs uninstall_runtime_libs
670 @$(ECHO) "*** Uninstalling runtime programs"
671 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
673 if [ "$$x" = "dummy" ]; then continue; fi; \
675 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
676 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
678 @set -e; for x in dummy $(BIN_SCRIPTS); \
680 if [ "$$x" = "dummy" ]; then continue; fi; \
682 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
683 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
685 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
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; \
693 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
694 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
696 @ : {- output_on() unless windowsdll(); "" -}
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)
706 @$(ECHO) "*** Uninstalling manpages"
707 $(PERL) $(SRCDIR)/util/process_docs.pl \
708 --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \
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
718 @$(ECHO) "*** Uninstalling manpages"
719 $(PERL) $(SRCDIR)/util/process_docs.pl \
720 --destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove
723 # Developer targets (note: these are only available on Unix) #########
725 update: generate errors ordinals
727 generate: generate_apps generate_crypto_bn generate_crypto_objects \
728 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
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
736 # Test coverage is a good idea for the future
737 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
741 lint -DLINT $(INCLUDES) $(SRCS)
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}; "" -}
754 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
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 )
774 generate_crypto_conf:
775 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
776 > crypto/conf/conf_def.h )
778 generate_crypto_asn1:
779 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
780 > crypto/asn1/charmap.h )
783 ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \
784 crypto/objects/obj_dat.h \
787 # Set to -force to force a rebuild
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; \
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 ; \
801 {- use File::Basename;
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 );
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;
828 CRYPTOHEADERS={- join(" \\\n\t", sort @cryptoheaders) -}
829 SSLHEADERS={- join(" \\\n\t", sort @sslheaders) -}
832 $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
833 --ordinals util/libcrypto.num \
834 --symhacks include/openssl/symhacks.h \
837 $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
838 --ordinals util/libssl.num \
839 --symhacks include/openssl/symhacks.h \
844 SRCTOP=../$(SRCDIR) \
845 BLDTOP=../$(BLDDIR) \
846 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
851 -etags `find . -name '*.[ch]' -o -name '*.pm'`
853 # Release targets (note: only available on Unix) #####################
856 (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
858 # Helper targets #####################################################
860 link-utils: $(BLDDIR)/util/opensslwrap.sh
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"; \
870 # Building targets ###################################################
872 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // () } @{$unified_info{libraries}}) -}
874 @ ( echo 'prefix=$(INSTALLTOP)'; \
875 echo 'exec_prefix=$${prefix}'; \
876 if [ -n "$(LIBDIR)" ]; then \
877 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
879 echo 'libdir=$(libdir)'; \
881 echo 'includedir=$${prefix}/include'; \
882 echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \
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
892 @ ( echo 'prefix=$(INSTALLTOP)'; \
893 echo 'exec_prefix=$${prefix}'; \
894 if [ -n "$(LIBDIR)" ]; then \
895 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
897 echo 'libdir=$(libdir)'; \
899 echo 'includedir=$${prefix}/include'; \
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
909 @ ( echo 'prefix=$(INSTALLTOP)'; \
910 echo 'exec_prefix=$${prefix}'; \
911 if [ -n "$(LIBDIR)" ]; then \
912 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
914 echo 'libdir=$(libdir)'; \
916 echo 'includedir=$${prefix}/include'; \
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
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 "**************************************************"
928 @echo "*** Please run the same make command again ***"
930 @echo "**************************************************"
934 $(PERL) configdata.pm -r
938 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
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($_) } @_;
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}});
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};
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
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}));
972 $args{src}: $args{generator}->[0] $deps
973 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
974 "-o$target{build_file}" $generator > \$@
978 $args{src}: $args{generator}->[0] $deps
979 \$(PERL)$generator_incs $generator > \$@
984 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
985 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
986 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
987 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
988 } -> {$args{intent}};
990 if ($args{generator}->[0] =~ /\.pl$/) {
991 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator
992 .' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSSOR)';
993 } elsif ($args{generator}->[0] =~ /\.m4$/) {
994 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
995 } elsif ($args{generator}->[0] =~ /\.S$/) {
998 die "Generator type for $args{src} unknown: $generator\n";
1001 if (defined($generator)) {
1003 $args{src}: $args{generator}->[0] $deps
1008 $args{src}: $args{generator}->[0] $deps
1009 \$(CC) $incs $cppflags $defs -E $args{generator}->[0] | \\
1010 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
1015 # Should one wonder about the end of the Perl snippet, it's because this
1016 # second regexp eats up line endings as well, if the removed path is the
1017 # last in the line. We may therefore need to put back a line ending.
1020 my $obj = platform->obj($args{obj});
1021 my $dep = platform->dep($args{obj});
1022 my @srcs = @{$args{srcs}};
1023 my $srcs = join(" ", @srcs);
1024 my $deps = join(" ", @srcs, @{$args{deps}});
1025 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1026 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1030 if (grep /\.rc$/, @srcs) {
1032 $cmdflags = '$(RCFLAGS)';
1034 } elsif (grep /\.(cc|cpp)$/, @srcs) {
1036 $cmdcompile = ' -c';
1038 shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1039 lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1040 dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)',
1041 bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)'
1042 } -> {$args{intent}};
1045 $cmdcompile = ' -c';
1047 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1048 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1049 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1050 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1051 } -> {$args{intent}};
1054 # extension-specific rules
1055 if (grep /\.s$/, @srcs) {
1058 $cmd $cmdflags -c -o \$\@ $srcs
1060 } elsif (grep /\.S$/, @srcs) {
1061 # Originally there was mutli-step rule with $(CC) -E file.S
1062 # followed by $(CC) -c file.s. It compensated for one of
1063 # legacy platform compiler's inability to handle .S files.
1064 # The platform is long discontinued by vendor so there is
1065 # hardly a point to drag it along...
1068 $cmd $incs $defs $cmdflags -c -o \$\@ $srcs
1070 } elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/
1071 && !grep /\.rc$/, @srcs) {
1074 $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs
1076 \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\
1079 mv $dep.tmp $dep; \\
1085 $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs
1087 if (defined $makedepprog && $makedepprog =~ /\/makedepend/) {
1089 \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\
1096 # We *know* this routine is only called when we've configure 'shared'.
1100 foreach (@{args{deps}}) {
1101 my $d = dirname($_);
1102 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1104 my $linkflags = join("", map { "-L$_ " } @linkdirs);
1105 my $linklibs = join("", map { my $f = basename($_);
1106 (my $l = $f) =~ s/^lib//;
1107 " -l$l" } @{$args{deps}});
1108 my @objs = map { platform->obj($_) }
1109 grep { !platform->isdef($_) }
1111 my @defs = map { platform->def($_) }
1112 grep { platform->isdef($_) }
1114 my @deps = compute_lib_depends(@{$args{deps}});
1115 die "More than one exported symbol map" if scalar @defs > 1;
1116 my $objs = join(" ", @objs);
1117 my $deps = join(" ", @objs, @defs, @deps);
1118 my $simple = platform->sharedlib_simple($args{lib});
1119 my $full = platform->sharedlib($args{lib});
1120 my $shared_soname = "";
1121 $shared_soname .= ' '.$target{shared_sonameflag}.basename($full)
1122 if defined $target{shared_sonameflag};
1123 my $shared_imp = "";
1124 $shared_imp .= ' '.$target{shared_impflag}.basename($simple)
1125 if defined $target{shared_impflag};
1126 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1127 my $recipe = <<"EOF";
1133 \$(AR) r $simple $full
1135 } elsif ($simple ne $full) {
1143 \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
1144 -o $full$shared_def $objs \\
1145 $linklibs \$(LIB_EX_LIBS)
1161 my $dso = platform->dso($args{lib});
1163 foreach (@{args{deps}}) {
1164 my $d = dirname($_);
1165 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1167 my $linkflags = join("", map { "-L$_ " } @linkdirs);
1168 my $linklibs = join("", map { my $f = basename($_);
1169 (my $l = $f) =~ s/^lib//;
1170 " -l$l" } @{$args{deps}});
1171 my @objs = map { platform->obj($_) }
1172 grep { !platform->isdef($_) }
1174 my @defs = map { platform->def($_) }
1175 grep { platform->isdef($_) }
1177 my @deps = compute_lib_depends(@{$args{deps}});
1178 my $objs = join(" ", @objs);
1179 my $deps = join(" ", @objs, @defs, @deps);
1180 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1183 \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
1184 -o $dso$shared_def $objs \\
1185 $linklibs \$(DSO_EX_LIBS)
1190 my $lib = platform->staticlib($args{lib});
1191 my @objs = map { platform->obj($_) } @{$args{objs}};
1192 my $objs = join(" ", @objs);
1195 \$(AR) \$(ARFLAGS) \$\@ \$\?
1196 \$(RANLIB) \$\@ || echo Never mind.
1201 my $bin = platform->bin($args{bin});
1202 my $objs = join(" ", map { platform->obj($_) } @{$args{objs}});
1203 my $deps = join(" ", compute_lib_depends(@{$args{deps}}));
1205 foreach (@{args{deps}}) {
1206 next if $_ =~ /\.a$/;
1207 my $d = dirname($_);
1208 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1210 my $linkflags = join("", map { "-L$_ " } @linkdirs);
1211 my $linklibs = join("", map { if ($_ =~ m/\.a$/) {
1212 " ".platform->staticlib($_);
1214 my $f = basename($_);
1215 (my $l = $f) =~ s/^lib//;
1220 my $cmdflags = '$(BIN_CFLAGS)';
1221 if (grep /_cc\.o$/, @{$args{objs}}) {
1223 $cmdflags = '$(BIN_CXXFLAGS)';
1228 \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
1230 $linklibs \$(BIN_EX_LIBS)
1235 my $script = $args{script};
1236 my $sources = join(" ", @{$args{sources}});
1237 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1238 "util", "dofile.pl")),
1239 rel2abs($config{builddir}));
1242 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1243 "-o$target{build_file}" $sources > "$script"
1249 my $dir = $args{dir};
1250 my @deps = map { platform->convertext($_) } @{$args{deps}};
1252 my %extinfo = ( dso => platform->dsoext(),
1253 lib => platform->libext(),
1254 bin => platform->binext() );
1256 # We already have a 'test' target, and the top directory is just plain
1258 return if $dir eq "test" || $dir eq ".";
1260 foreach my $type (("dso", "lib", "bin", "script")) {
1261 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
1262 # For lib object files, we could update the library. However, it
1263 # was decided that it's enough to build the directory local object
1264 # files, so we don't need to add any actions, and the dependencies
1265 # are already taken care of.
1266 if ($type ne "lib") {
1267 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
1268 if (dirname($prod) eq $dir) {
1269 push @deps, $prod.$extinfo{$type};
1271 push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1277 my $deps = join(" ", @deps);
1278 my $actions = join("\n", "", @actions);
1280 $dir $dir/: $deps$actions
1283 "" # Important! This becomes part of the template result.