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 -e )
734 # Test coverage is a good idea for the future
735 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
739 lint -DLINT $(INCLUDES) $(SRCS)
742 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
743 < apps/openssl.cnf > apps/openssl-vms.cnf )
744 @ : {- output_off() if $disabled{apps}; "" -}
745 ( b=`pwd`; cd $(SRCDIR); \
746 $(PERL) -I$$b apps/progs.pl -H $(APPS_OPENSSL) > apps/progs.h )
747 ( b=`pwd`; cd $(SRCDIR); \
748 $(PERL) -I$$b apps/progs.pl -C $(APPS_OPENSSL) > apps/progs.c )
749 @ : {- output_on() if $disabled{apps}; "" -}
752 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
754 generate_crypto_objects:
755 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \
756 crypto/objects/objects.txt \
757 crypto/objects/obj_mac.num \
758 > crypto/objects/obj_mac.new && \
759 mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num )
760 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
761 crypto/objects/objects.txt \
762 crypto/objects/obj_mac.num \
763 > include/openssl/obj_mac.h )
764 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
765 include/openssl/obj_mac.h \
766 > crypto/objects/obj_dat.h )
767 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
768 crypto/objects/obj_mac.num \
769 crypto/objects/obj_xref.txt \
770 > crypto/objects/obj_xref.h )
772 generate_crypto_conf:
773 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
774 > crypto/conf/conf_def.h )
776 generate_crypto_asn1:
777 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
778 > crypto/asn1/charmap.h )
781 ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \
782 crypto/objects/obj_dat.h \
785 # Set to -force to force a rebuild
788 ( b=`pwd`; set -e; cd $(SRCDIR); \
789 $(PERL) util/ck_errf.pl -strict -internal; \
790 $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal )
791 ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \
793 $(PERL) ../util/ck_errf.pl -strict \
794 -conf $$E `basename $$E .ec`.c; \
795 $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \
796 -conf $$E `basename $$E .ec`.c ; \
799 {- use File::Basename;
802 qw( include/openssl/ssl.h
803 include/openssl/ssl2.h
804 include/openssl/ssl3.h
805 include/openssl/sslerr.h
806 include/openssl/tls1.h
807 include/openssl/dtls1.h
808 include/openssl/srtp.h );
810 qw( include/internal/dso.h
811 include/internal/o_dir.h
812 include/internal/err.h
813 include/internal/sslconf.h );
814 our @cryptoskipheaders = ( @sslheaders,
815 qw( include/openssl/conf_api.h
816 include/openssl/ebcdic.h
817 include/openssl/opensslconf.h
818 include/openssl/symhacks.h ) );
819 foreach my $f ( glob(catfile($config{sourcedir},
820 'include','openssl','*.h')) ) {
821 my $fn = "include/openssl/" . basename($f);
822 push @cryptoheaders, $fn unless grep { $_ eq $fn } @cryptoskipheaders;
826 CRYPTOHEADERS={- join(" \\\n\t", sort @cryptoheaders) -}
827 SSLHEADERS={- join(" \\\n\t", sort @sslheaders) -}
830 $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
831 --ordinals util/libcrypto.num \
832 --symhacks include/openssl/symhacks.h \
835 $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
836 --ordinals util/libssl.num \
837 --symhacks include/openssl/symhacks.h \
842 SRCTOP=../$(SRCDIR) \
843 BLDTOP=../$(BLDDIR) \
844 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
849 -etags `find . -name '*.[ch]' -o -name '*.pm'`
851 # Release targets (note: only available on Unix) #####################
854 (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
856 # Helper targets #####################################################
858 link-utils: $(BLDDIR)/util/opensslwrap.sh
860 $(BLDDIR)/util/opensslwrap.sh: configdata.pm
861 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
862 mkdir -p "$(BLDDIR)/util"; \
863 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
868 # Building targets ###################################################
870 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // () } @{$unified_info{libraries}}) -}
872 @ ( echo 'prefix=$(INSTALLTOP)'; \
873 echo 'exec_prefix=$${prefix}'; \
874 if [ -n "$(LIBDIR)" ]; then \
875 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
877 echo 'libdir=$(libdir)'; \
879 echo 'includedir=$${prefix}/include'; \
880 echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \
882 echo 'Name: OpenSSL-libcrypto'; \
883 echo 'Description: OpenSSL cryptography library'; \
884 echo 'Version: '$(VERSION); \
885 echo 'Libs: -L$${libdir} -lcrypto'; \
886 echo 'Libs.private: $(LIB_EX_LIBS)'; \
887 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
890 @ ( echo 'prefix=$(INSTALLTOP)'; \
891 echo 'exec_prefix=$${prefix}'; \
892 if [ -n "$(LIBDIR)" ]; then \
893 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
895 echo 'libdir=$(libdir)'; \
897 echo 'includedir=$${prefix}/include'; \
899 echo 'Name: OpenSSL-libssl'; \
900 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
901 echo 'Version: '$(VERSION); \
902 echo 'Requires.private: libcrypto'; \
903 echo 'Libs: -L$${libdir} -lssl'; \
904 echo 'Cflags: -I$${includedir}' ) > libssl.pc
907 @ ( echo 'prefix=$(INSTALLTOP)'; \
908 echo 'exec_prefix=$${prefix}'; \
909 if [ -n "$(LIBDIR)" ]; then \
910 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
912 echo 'libdir=$(libdir)'; \
914 echo 'includedir=$${prefix}/include'; \
916 echo 'Name: OpenSSL'; \
917 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
918 echo 'Version: '$(VERSION); \
919 echo 'Requires: libssl libcrypto' ) > openssl.pc
921 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
922 @echo "Detected changed: $?"
923 $(PERL) configdata.pm -r
924 @echo "**************************************************"
926 @echo "*** Please run the same make command again ***"
928 @echo "**************************************************"
932 $(PERL) configdata.pm -r
936 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
938 # Helper function to figure out dependencies on libraries
939 # It takes a list of library names and outputs a list of dependencies
940 sub compute_lib_depends {
941 # Depending on shared libraries:
942 # On Windows POSIX layers, we depend on {libname}.dll.a
943 # On Unix platforms, we depend on {shlibname}.so
944 return map { platform->sharedlib_simple($_) // platform->staticlib($_) } @_;
949 my $generator = join(" ", @{$args{generator}});
950 my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
951 my $incs = join("", map { " -I".$_ } @{$args{incs}});
952 my $defs = join("", map { " -D".$_ } @{$args{defs}});
953 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
955 if (platform->isdef($args{src})) {
956 my $target = platform->def($args{src});
957 (my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
958 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
959 my $ord_name = $args{generator}->[1] || $args{product};
961 $target: $args{generator}->[0] $deps \$(SRCDIR)/util/mkdef.pl
962 \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --ordinals $args{generator}->[0] --name $ord_name --OS $mkdef_os > $target
964 } elsif (!platform->isasm($args{src})) {
965 if ($args{generator}->[0] =~ m|^.*\.in$|) {
966 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
967 "util", "dofile.pl")),
968 rel2abs($config{builddir}));
970 $args{src}: $args{generator}->[0] $deps
971 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
972 "-o$target{build_file}" $generator > \$@
976 $args{src}: $args{generator}->[0] $deps
977 \$(PERL)$generator_incs $generator > \$@
982 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
983 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
984 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
985 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
986 } -> {$args{intent}};
988 if ($args{generator}->[0] =~ /\.pl$/) {
989 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator
990 .' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSSOR)';
991 } elsif ($args{generator}->[0] =~ /\.m4$/) {
992 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
993 } elsif ($args{generator}->[0] =~ /\.S$/) {
996 die "Generator type for $args{src} unknown: $generator\n";
999 if (defined($generator)) {
1001 $args{src}: $args{generator}->[0] $deps
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' > \$@
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.
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}});
1028 if (grep /\.rc$/, @srcs) {
1030 $cmdflags = '$(RCFLAGS)';
1032 } elsif (grep /\.(cc|cpp)$/, @srcs) {
1034 $cmdcompile = ' -c';
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}};
1043 $cmdcompile = ' -c';
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}};
1052 # extension-specific rules
1053 if (grep /\.s$/, @srcs) {
1056 $cmd $cmdflags -c -o \$\@ $srcs
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...
1066 $cmd $incs $defs $cmdflags -c -o \$\@ $srcs
1068 } elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/
1069 && !grep /\.rc$/, @srcs) {
1072 $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs
1074 \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\
1077 mv $dep.tmp $dep; \\
1083 $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs
1085 if (defined $makedepprog && $makedepprog =~ /\/makedepend/) {
1087 \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\
1094 # We *know* this routine is only called when we've configure 'shared'.
1098 foreach (@{args{deps}}) {
1099 my $d = dirname($_);
1100 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
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($_) }
1109 my @defs = map { platform->def($_) }
1110 grep { platform->isdef($_) }
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";
1131 \$(AR) r $simple $full
1133 } elsif ($simple ne $full) {
1141 \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
1142 -o $full$shared_def $objs \\
1143 $linklibs \$(LIB_EX_LIBS)
1159 my $dso = platform->dso($args{lib});
1161 foreach (@{args{deps}}) {
1162 my $d = dirname($_);
1163 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
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($_) }
1172 my @defs = map { platform->def($_) }
1173 grep { platform->isdef($_) }
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);
1181 \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
1182 -o $dso$shared_def $objs \\
1183 $linklibs \$(DSO_EX_LIBS)
1188 my $lib = platform->staticlib($args{lib});
1189 my @objs = map { platform->obj($_) } @{$args{objs}};
1190 my $objs = join(" ", @objs);
1193 \$(AR) \$(ARFLAGS) \$\@ \$\?
1194 \$(RANLIB) \$\@ || echo Never mind.
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}}));
1203 foreach (@{args{deps}}) {
1204 next if $_ =~ /\.a$/;
1205 my $d = dirname($_);
1206 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1208 my $linkflags = join("", map { "-L$_ " } @linkdirs);
1209 my $linklibs = join("", map { if ($_ =~ m/\.a$/) {
1210 " ".platform->staticlib($_);
1212 my $f = basename($_);
1213 (my $l = $f) =~ s/^lib//;
1218 my $cmdflags = '$(BIN_CFLAGS)';
1219 if (grep /_cc\.o$/, @{$args{objs}}) {
1221 $cmdflags = '$(BIN_CXXFLAGS)';
1226 \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
1228 $linklibs \$(BIN_EX_LIBS)
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}));
1240 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1241 "-o$target{build_file}" $sources > "$script"
1247 my $dir = $args{dir};
1248 my @deps = map { platform->convertext($_) } @{$args{deps}};
1250 my %extinfo = ( dso => platform->dsoext(),
1251 lib => platform->libext(),
1252 bin => platform->binext() );
1254 # We already have a 'test' target, and the top directory is just plain
1256 return if $dir eq "test" || $dir eq ".";
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};
1269 push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1275 my $deps = join(" ", @deps);
1276 my $actions = join("\n", "", @actions);
1278 $dir $dir/: $deps$actions
1281 "" # Important! This becomes part of the template result.