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 ENGINES={- join(" ", map { platform->dso($_) } @{$unified_info{engines}}) -}
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{engines}})
78 join(" ", map { platform->bin($_) }
79 grep { !$unified_info{attributes}->{$_}->{noinst} }
80 @{$unified_info{programs}})
82 {- output_off() if $disabled{apps}; "" -}
83 BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash
84 MISC_SCRIPTS=$(BLDDIR)/apps/CA.pl $(BLDDIR)/apps/tsget.pl:tsget
85 {- output_on() if $disabled{apps}; "" -}
87 APPS_OPENSSL={- use File::Spec::Functions;
88 catfile("apps","openssl") -}
90 # DESTDIR is for package builders so that they can configure for, say,
91 # /usr/ and yet have everything installed to /tmp/somedir/usr/.
92 # Normally it is left empty.
95 # Do not edit these manually. Use Configure with --prefix or --openssldir
96 # to change this! Short explanation in the top comment in Configure
97 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
99 our $prefix = $config{prefix} || "/usr/local";
102 # The logic here is that if no --openssldir was given,
103 # OPENSSLDIR will get the value from $prefix plus "/ssl".
104 # If --openssldir was given and the value is an absolute
105 # path, OPENSSLDIR will get its value without change.
106 # If the value from --openssldir is a relative path,
107 # OPENSSLDIR will get $prefix with the --openssldir
108 # value appended as a subdirectory.
110 use File::Spec::Functions;
112 $config{openssldir} ?
113 (file_name_is_absolute($config{openssldir}) ?
115 : catdir($prefix, $config{openssldir}))
116 : catdir($prefix, "ssl");
118 LIBDIR={- our $libdir = $config{libdir};
121 # if $prefix/lib$target{multilib} is not an existing
122 # directory, then assume that it's not searched by linker
123 # automatically, in which case adding $target{multilib} suffix
124 # causes more grief than we're ready to tolerate, so don't...
126 -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
127 $libdir = "lib$multilib";
129 file_name_is_absolute($libdir) ? "" : $libdir -}
130 # $(libdir) is chosen to be compatible with the GNU coding standards
131 libdir={- file_name_is_absolute($libdir)
132 ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -}
133 ENGINESDIR=$(libdir)/engines-{- $sover_dirname -}
135 # Convenience variable for those who want to set the rpath in shared
136 # libraries and applications
139 MANDIR=$(INSTALLTOP)/share/man
140 DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
141 HTMLDIR=$(DOCDIR)/html
143 # MANSUFFIX is for the benefit of anyone who may want to have a suffix
144 # appended after the manpage file section number. "ssl" is popular,
145 # resulting in files such as config.5ssl rather than config.5.
149 # For "optional" echo messages, to get "real" silence
152 ##### User defined commands and flags ################################
154 # We let the C compiler driver to take care of .s files. This is done in
155 # order to be excused from maintaining a separate set of architecture
156 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
157 # gcc, then the driver will automatically translate it to -xarch=v8plus
158 # and pass it down to assembler. In any case, we do not define AS or
159 # ASFLAGS for this reason.
161 CROSS_COMPILE={- $config{CROSS_COMPILE} -}
162 CC=$(CROSS_COMPILE){- $config{CC} -}
163 CXX={- $config{CXX} ? "\$(CROSS_COMPILE)$config{CXX}" : '' -}
164 CPPFLAGS={- our $cppflags1 = join(" ",
165 (map { "-D".$_} @{$config{CPPDEFINES}}),
166 (map { "-I".$_} @{$config{CPPINCLUDES}}),
167 @{$config{CPPFLAGS}}) -}
168 CFLAGS={- join(' ', @{$config{CFLAGS}}) -}
169 CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -}
170 LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -}
171 EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -}
173 MAKEDEPEND={- $config{makedepprog} -}
175 PERL={- $config{PERL} -}
177 AR=$(CROSS_COMPILE){- $config{AR} -}
178 ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -}
179 RANLIB={- $config{RANLIB} ? "\$(CROSS_COMPILE)$config{RANLIB}" : "true"; -}
180 RC= $(CROSS_COMPILE){- $config{RC} -}
181 RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} {- $target{shared_rcflag} -}
185 TAR= {- $target{TAR} || "tar" -}
186 TARFLAGS= {- $target{TARFLAGS} -}
189 NAME= $(BASENAME)-$(VERSION)
190 # Relative to $(SRCDIR)
191 TARFILE= ../$(NAME).tar
193 ##### Project flags ##################################################
195 # Variables starting with CNF_ are common variables for all product types
197 CNF_CPPFLAGS={- our $cppflags2 =
198 join(' ', $target{cppflags} || (),
199 (map { "-D".$_} @{$target{defines}},
200 @{$config{defines}}),
201 (map { "-I".$_} @{$target{includes}},
202 @{$config{includes}}),
203 @{$config{cppflags}}) -}
204 CNF_CFLAGS={- join(' ', $target{cflags} || (),
205 @{$config{cflags}}) -}
206 CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (),
207 @{$config{cxxflags}}) -}
208 CNF_LDFLAGS={- join(' ', $target{lflags} || (),
209 @{$config{lflags}}) -}
210 CNF_EX_LIBS={- join(' ', $target{ex_libs} || (),
211 @{$config{ex_libs}}) -}
213 # Variables starting with LIB_ are used to build library object files
214 # and shared libraries.
215 # Variables starting with DSO_ are used to build DSOs and their object files.
216 # Variables starting with BIN_ are used to build programs and their object
219 LIB_CPPFLAGS={- our $lib_cppflags =
220 join(' ', $target{lib_cppflags} || (),
221 $target{shared_cppflag} || (),
223 @{$config{lib_defines}},
224 @{$config{shared_defines}}),
225 @{$config{lib_cppflags}},
226 @{$config{shared_cppflag}});
227 join(' ', $lib_cppflags,
229 'OPENSSLDIR="\"$(OPENSSLDIR)\""',
230 'ENGINESDIR="\"$(ENGINESDIR)\""'),
231 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
232 LIB_CFLAGS={- join(' ', $target{lib_cflags} || (),
233 $target{shared_cflag} || (),
234 @{$config{lib_cflags}},
235 @{$config{shared_cflag}},
236 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
237 LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (),
238 $target{shared_cxxflag} || (),
239 @{$config{lib_cxxflags}},
240 @{$config{shared_cxxflag}},
241 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
242 LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (),
243 $config{shared_ldflag} || (),
244 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
245 LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
246 DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (),
247 $target{module_cppflags} || (),
248 @{$config{dso_cppflags}},
249 @{$config{module_cppflags}},
250 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
251 DSO_CFLAGS={- join(' ', $target{dso_cflags} || (),
252 $target{module_cflags} || (),
253 @{$config{dso_cflags}},
254 @{$config{module_cflags}},
255 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
256 DSO_CXXFLAGS={- join(' ', $target{dso_cxxflags} || (),
257 $target{module_cxxflags} || (),
258 @{$config{dso_cxxflags}},
259 @{$config{module_cxxflag}},
260 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
261 DSO_LDFLAGS={- join(' ', $target{dso_ldflags} || (),
262 $target{module_ldflags} || (),
263 @{$config{dso_ldflags}},
264 @{$config{module_ldflags}},
265 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
266 DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
267 BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (),
268 @{$config{bin_cppflags}},
269 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
270 BIN_CFLAGS={- join(' ', $target{bin_cflags} || (),
271 @{$config{bin_cflags}},
272 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
273 BIN_CXXFLAGS={- join(' ', $target{bin_cxxflags} || (),
274 @{$config{bin_cxxflags}},
275 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
276 BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
277 @{$config{bin_lflags}},
278 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
279 BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
281 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
282 CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
283 $cppflags2 =~ s|([\\"])|\\$1|g;
284 $lib_cppflags =~ s|([\\"])|\\$1|g;
285 join(' ', $lib_cppflags || (), $cppflags2 || (),
288 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
290 # For x86 assembler: Set PROCESSOR to 386 if you want to support
292 PROCESSOR= {- $config{processor} -}
294 # We want error [and other] messages in English. Trouble is that make(1)
295 # doesn't pass macros down as environment variables unless there already
296 # was corresponding variable originally set. In other words we can only
297 # reassign environment variables, but not set new ones, not in portable
298 # manner that is. That's why we reassign several, just to be sure...
303 # The main targets ###################################################
305 {- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_programs_nodep link-utils
306 {- dependmagic('build_libs'); -}: build_libs_nodep
307 {- dependmagic('build_engines'); -}: build_engines_nodep
308 {- dependmagic('build_programs'); -}: build_programs_nodep
310 build_generated: $(GENERATED_MANDATORY)
311 build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
312 build_engines_nodep: $(ENGINES)
313 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
315 # Kept around for backward compatibility
316 build_apps build_tests: build_programs
318 # Convenience target to prebuild all generated files, not just the mandatory
320 build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
321 @ : {- output_off() if $disabled{makedepend}; "" -}
322 @echo "Warning: consider configuring with no-makedepend, because if"
323 @echo " target system doesn't have $(PERL),"
324 @echo " then make will fail..."
325 @ : {- output_on() if $disabled{makedepend}; "" -}
328 {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep link-utils
329 @ : {- output_off() if $disabled{tests}; "" -}
331 mkdir -p test-runs; \
332 SRCTOP=../$(SRCDIR) \
333 BLDTOP=../$(BLDDIR) \
336 EXE_EXT={- platform->binext() -} \
337 OPENSSL_ENGINES=`cd ../$(BLDDIR)/engines 2>/dev/null && pwd` \
338 OPENSSL_DEBUG_MEMORY=on \
339 $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
340 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
341 @echo "Tests are not supported with your chosen Configure options"
342 @ : {- output_on() if !$disabled{tests}; "" -}
345 @ : {- output_off() if $disabled{tests}; "" -}
346 @SRCTOP="$(SRCDIR)" \
347 $(PERL) $(SRCDIR)/test/run_tests.pl list
348 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
349 @echo "Tests are not supported with your chosen Configure options"
350 @ : {- output_on() if !$disabled{tests}; "" -}
352 install: install_sw install_ssldirs install_docs
354 uninstall: uninstall_docs uninstall_sw
357 @set -e; for s in $(SHLIB_INFO); do \
358 if [ "$$s" = ";" ]; then continue; fi; \
359 s1=`echo "$$s" | cut -f1 -d";"`; \
360 s2=`echo "$$s" | cut -f2 -d";"`; \
361 $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\
364 $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\
366 if [ "$$s1" != "$$s2" ]; then \
367 $(ECHO) $(RM) $$s2; \
372 $(RM) *{- platform->defext() -}
375 $(RM) $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS)
376 $(RM) $(GENERATED_MANDATORY) $(GENERATED)
377 -$(RM) `find . -name .git -prune -o -name '*{- platform->depext() -}' -print`
378 -$(RM) `find . -name .git -prune -o -name '*{- platform->objext() -}' -print`
380 $(RM) tags TAGS doc-nits
381 $(RM) -r test/test-runs
382 $(RM) openssl.pc libcrypto.pc libssl.pc
383 -$(RM) `find . -name .git -prune -o -type l -print`
390 # We check if any depfile is newer than Makefile and decide to
391 # concatenate only if that is true.
393 @: {- output_off() if $disabled{makedepend}; "" -}
394 @$(PERL) $(SRCDIR)/util/add-depends.pl {-
395 defined $makedepprog && $makedepprog =~ /\/makedepend/
396 ? 'makedepend' : 'gcc' -}
397 @: {- output_on() if $disabled{makedepend}; "" -}
399 # Install helper targets #############################################
401 install_sw: install_dev install_engines install_runtime
403 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
405 install_docs: install_man_docs install_html_docs
407 uninstall_docs: uninstall_man_docs uninstall_html_docs
408 $(RM) -r -v $(DESTDIR)$(DOCDIR)
411 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
412 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
413 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
414 @set -e; for x in dummy $(MISC_SCRIPTS); do \
415 if [ "$$x" = "dummy" ]; then continue; fi; \
416 x1=`echo "$$x" | cut -f1 -d:`; \
417 x2=`echo "$$x" | cut -f2 -d:`; \
418 fn=`basename $$x1`; \
419 $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
420 cp $$x1 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
421 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
422 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
423 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
424 if [ "$$x1" != "$$x2" ]; then \
425 ln=`basename "$$x2"`; \
426 : {- output_off() unless windowsdll(); "" -}; \
427 $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
428 cp $(DESTDIR)$(OPENSSLDIR)/misc/$$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
429 : {- output_on() unless windowsdll();
430 output_off() if windowsdll(); "" -}; \
431 $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
432 ln -sf $$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
433 : {- output_on() if windowsdll(); "" -}; \
436 @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
437 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
438 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
439 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist
440 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
441 $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
442 cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
443 chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
445 @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
446 @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
447 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
448 @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist
449 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \
450 $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
451 cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
452 chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
455 install_dev: install_runtime_libs
456 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
457 @$(ECHO) "*** Installing development files"
458 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
459 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
460 @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
461 @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
462 @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
463 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
464 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
465 $(BLDDIR)/include/openssl/*.h; do \
467 $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
468 cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
469 chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
471 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
472 @set -e; for l in $(INSTALL_LIBS); do \
474 $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \
475 cp $$l $(DESTDIR)$(libdir)/$$fn.new; \
476 $(RANLIB) $(DESTDIR)$(libdir)/$$fn.new; \
477 chmod 644 $(DESTDIR)$(libdir)/$$fn.new; \
478 mv -f $(DESTDIR)$(libdir)/$$fn.new \
479 $(DESTDIR)$(libdir)/$$fn; \
481 @ : {- output_off() if $disabled{shared}; "" -}
482 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
483 s1=`echo "$$s" | cut -f1 -d";"`; \
484 s2=`echo "$$s" | cut -f2 -d";"`; \
485 fn1=`basename $$s1`; \
486 fn2=`basename $$s2`; \
487 : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \
488 if [ "$$fn1" != "$$fn2" ]; then \
489 $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \
490 ln -sf $$fn1 $(DESTDIR)$(libdir)/$$fn2; \
492 : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \
493 $(ECHO) "install $$s2 -> $(DESTDIR)$(libdir)/$$fn2"; \
494 cp $$s2 $(DESTDIR)$(libdir)/$$fn2.new; \
495 chmod 755 $(DESTDIR)$(libdir)/$$fn2.new; \
496 mv -f $(DESTDIR)$(libdir)/$$fn2.new \
497 $(DESTDIR)$(libdir)/$$fn2; \
498 : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \
499 a=$(DESTDIR)$(libdir)/$$fn2; \
500 $(ECHO) "install $$s1 -> $$a"; \
501 if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \
502 mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \
504 for so in `$(AR) t $$a`; do \
507 strip -X32_64 -e $$so; \
508 $(AR) r $$a.new $$so; \
511 $(AR) r $$a.new $$s1; \
513 : {- output_off() if sharedaix(); output_on(); "" -}; \
515 @ : {- output_on() if $disabled{shared}; "" -}
516 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)/pkgconfig
517 @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc"
518 @cp libcrypto.pc $(DESTDIR)$(libdir)/pkgconfig
519 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
520 @$(ECHO) "install libssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/libssl.pc"
521 @cp libssl.pc $(DESTDIR)$(libdir)/pkgconfig
522 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
523 @$(ECHO) "install openssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/openssl.pc"
524 @cp openssl.pc $(DESTDIR)$(libdir)/pkgconfig
525 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
527 uninstall_dev: uninstall_runtime_libs
528 @$(ECHO) "*** Uninstalling development files"
529 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
530 @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
531 @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
532 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
533 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
534 $(BLDDIR)/include/openssl/*.h; do \
536 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
537 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
539 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
540 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
541 @set -e; for l in $(INSTALL_LIBS); do \
543 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \
544 $(RM) $(DESTDIR)$(libdir)/$$fn; \
546 @ : {- output_off() if $disabled{shared}; "" -}
547 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
548 s1=`echo "$$s" | cut -f1 -d";"`; \
549 s2=`echo "$$s" | cut -f2 -d";"`; \
550 fn1=`basename $$s1`; \
551 fn2=`basename $$s2`; \
552 : {- output_off() if windowsdll(); "" -}; \
553 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
554 $(RM) $(DESTDIR)$(libdir)/$$fn2; \
555 if [ "$$fn1" != "$$fn2" -a -f "$(DESTDIR)$(libdir)/$$fn1" ]; then \
556 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \
557 $(RM) $(DESTDIR)$(libdir)/$$fn1; \
559 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
560 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
561 $(RM) $(DESTDIR)$(libdir)/$$fn2; \
562 : {- output_on() unless windowsdll(); "" -}; \
564 @ : {- output_on() if $disabled{shared}; "" -}
565 $(RM) $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
566 $(RM) $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
567 $(RM) $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
568 -$(RMDIR) $(DESTDIR)$(libdir)/pkgconfig
569 -$(RMDIR) $(DESTDIR)$(libdir)
571 install_engines: install_runtime_libs build_engines
572 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
573 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
574 @$(ECHO) "*** Installing engines"
575 @set -e; for e in dummy $(INSTALL_ENGINES); do \
576 if [ "$$e" = "dummy" ]; then continue; fi; \
578 $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
579 cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
580 chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
581 mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \
582 $(DESTDIR)$(ENGINESDIR)/$$fn; \
586 @$(ECHO) "*** Uninstalling engines"
587 @set -e; for e in dummy $(INSTALL_ENGINES); do \
588 if [ "$$e" = "dummy" ]; then continue; fi; \
590 if [ "$$fn" = '{- platform->dso("ossltest") -}' ]; then \
593 $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
594 $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
596 -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
598 install_runtime: install_programs
600 install_runtime_libs: build_libs
601 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
602 @ : {- output_off() if windowsdll(); "" -}
603 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
604 @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -}
605 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
606 @ : {- output_on() unless windowsdll(); "" -}
607 @$(ECHO) "*** Installing runtime libraries"
608 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
609 if [ "$$s" = "dummy" ]; then continue; fi; \
611 : {- output_off() unless windowsdll(); "" -}; \
612 $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
613 cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
614 chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
615 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
616 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
617 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
618 $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \
619 cp $$s $(DESTDIR)$(libdir)/$$fn.new; \
620 chmod 755 $(DESTDIR)$(libdir)/$$fn.new; \
621 mv -f $(DESTDIR)$(libdir)/$$fn.new \
622 $(DESTDIR)$(libdir)/$$fn; \
623 : {- output_on() if windowsdll(); "" -}; \
626 install_programs: install_runtime_libs build_programs
627 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
628 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
629 @$(ECHO) "*** Installing runtime programs"
630 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
631 if [ "$$x" = "dummy" ]; then continue; fi; \
633 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
634 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
635 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
636 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
637 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
639 @set -e; for x in dummy $(BIN_SCRIPTS); do \
640 if [ "$$x" = "dummy" ]; then continue; fi; \
642 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
643 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
644 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
645 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
646 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
649 uninstall_runtime: uninstall_programs uninstall_runtime_libs
652 @$(ECHO) "*** Uninstalling runtime programs"
653 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
655 if [ "$$x" = "dummy" ]; then continue; fi; \
657 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
658 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
660 @set -e; for x in dummy $(BIN_SCRIPTS); \
662 if [ "$$x" = "dummy" ]; then continue; fi; \
664 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
665 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
667 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
669 uninstall_runtime_libs:
670 @$(ECHO) "*** Uninstalling runtime libraries"
671 @ : {- output_off() unless windowsdll(); "" -}
672 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
673 if [ "$$s" = "dummy" ]; then continue; fi; \
675 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
676 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
678 @ : {- output_on() unless windowsdll(); "" -}
682 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
683 @$(ECHO) "*** Installing manpages"
684 $(PERL) $(SRCDIR)/util/process_docs.pl \
685 --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX)
688 @$(ECHO) "*** Uninstalling manpages"
689 $(PERL) $(SRCDIR)/util/process_docs.pl \
690 --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \
694 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
695 @$(ECHO) "*** Installing HTML manpages"
696 $(PERL) $(SRCDIR)/util/process_docs.pl \
697 --destdir=$(DESTDIR)$(HTMLDIR) --type=html
700 @$(ECHO) "*** Uninstalling manpages"
701 $(PERL) $(SRCDIR)/util/process_docs.pl \
702 --destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove
705 # Developer targets (note: these are only available on Unix) #########
707 update: generate errors ordinals
709 generate: generate_apps generate_crypto_bn generate_crypto_objects \
710 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
714 (cd $(SRCDIR); $(PERL) util/find-doc-nits -n -p ) >doc-nits
715 @if [ -s doc-nits ] ; then cat doc-nits ; exit 1; \
716 else echo 'doc-nits: no errors.'; rm doc-nits ; fi
718 # Test coverage is a good idea for the future
719 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
723 lint -DLINT $(INCLUDES) $(SRCS)
726 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
727 < apps/openssl.cnf > apps/openssl-vms.cnf )
730 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
732 generate_crypto_objects:
733 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \
734 crypto/objects/objects.txt \
735 crypto/objects/obj_mac.num \
736 > crypto/objects/obj_mac.new && \
737 mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num )
738 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
739 crypto/objects/objects.txt \
740 crypto/objects/obj_mac.num \
741 > include/openssl/obj_mac.h )
742 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
743 include/openssl/obj_mac.h \
744 > crypto/objects/obj_dat.h )
745 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
746 crypto/objects/obj_mac.num \
747 crypto/objects/obj_xref.txt \
748 > crypto/objects/obj_xref.h )
750 generate_crypto_conf:
751 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
752 > crypto/conf/conf_def.h )
754 generate_crypto_asn1:
755 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
756 > crypto/asn1/charmap.h )
759 ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \
760 crypto/objects/obj_dat.h \
763 # Set to -force to force a rebuild
766 ( b=`pwd`; set -e; cd $(SRCDIR); \
767 $(PERL) util/ck_errf.pl -strict -internal; \
768 $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal )
769 ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \
771 $(PERL) ../util/ck_errf.pl -strict \
772 -conf $$E `basename $$E .ec`.c; \
773 $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \
774 -conf $$E `basename $$E .ec`.c ; \
777 {- use File::Basename;
780 qw( include/openssl/ssl.h
781 include/openssl/ssl2.h
782 include/openssl/ssl3.h
783 include/openssl/sslerr.h
784 include/openssl/tls1.h
785 include/openssl/dtls1.h
786 include/openssl/srtp.h );
788 qw( include/internal/dso.h
789 include/internal/o_dir.h
790 include/internal/o_str.h
791 include/internal/err.h
792 include/internal/sslconf.h );
793 our @cryptoskipheaders = ( @sslheaders,
794 qw( include/openssl/conf_api.h
795 include/openssl/ebcdic.h
796 include/openssl/opensslconf.h
797 include/openssl/symhacks.h ) );
798 foreach my $f ( glob(catfile($config{sourcedir},
799 'include','openssl','*.h')) ) {
800 my $fn = "include/openssl/" . basename($f);
801 push @cryptoheaders, $fn unless grep { $_ eq $fn } @cryptoskipheaders;
805 CRYPTOHEADERS={- join(" \\\n\t", sort @cryptoheaders) -}
806 SSLHEADERS={- join(" \\\n\t", sort @sslheaders) -}
809 $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
810 --ordinals util/libcrypto.num \
811 --symhacks include/openssl/symhacks.h \
814 $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
815 --ordinals util/libssl.num \
816 --symhacks include/openssl/symhacks.h \
821 SRCTOP=../$(SRCDIR) \
822 BLDTOP=../$(BLDDIR) \
823 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
828 -etags `find . -name '*.[ch]' -o -name '*.pm'`
830 # Release targets (note: only available on Unix) #####################
833 (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
835 # Helper targets #####################################################
837 link-utils: $(BLDDIR)/util/opensslwrap.sh
839 $(BLDDIR)/util/opensslwrap.sh: configdata.pm
840 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
841 mkdir -p "$(BLDDIR)/util"; \
842 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
847 # Building targets ###################################################
849 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // () } @{$unified_info{libraries}}) -}
851 @ ( echo 'prefix=$(INSTALLTOP)'; \
852 echo 'exec_prefix=$${prefix}'; \
853 if [ -n "$(LIBDIR)" ]; then \
854 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
856 echo 'libdir=$(libdir)'; \
858 echo 'includedir=$${prefix}/include'; \
859 echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \
861 echo 'Name: OpenSSL-libcrypto'; \
862 echo 'Description: OpenSSL cryptography library'; \
863 echo 'Version: '$(VERSION); \
864 echo 'Libs: -L$${libdir} -lcrypto'; \
865 echo 'Libs.private: $(LIB_EX_LIBS)'; \
866 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
869 @ ( echo 'prefix=$(INSTALLTOP)'; \
870 echo 'exec_prefix=$${prefix}'; \
871 if [ -n "$(LIBDIR)" ]; then \
872 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
874 echo 'libdir=$(libdir)'; \
876 echo 'includedir=$${prefix}/include'; \
878 echo 'Name: OpenSSL-libssl'; \
879 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
880 echo 'Version: '$(VERSION); \
881 echo 'Requires.private: libcrypto'; \
882 echo 'Libs: -L$${libdir} -lssl'; \
883 echo 'Cflags: -I$${includedir}' ) > libssl.pc
886 @ ( echo 'prefix=$(INSTALLTOP)'; \
887 echo 'exec_prefix=$${prefix}'; \
888 if [ -n "$(LIBDIR)" ]; then \
889 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
891 echo 'libdir=$(libdir)'; \
893 echo 'includedir=$${prefix}/include'; \
895 echo 'Name: OpenSSL'; \
896 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
897 echo 'Version: '$(VERSION); \
898 echo 'Requires: libssl libcrypto' ) > openssl.pc
900 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
901 @echo "Detected changed: $?"
902 $(PERL) configdata.pm -r
903 @echo "**************************************************"
905 @echo "*** Please run the same make command again ***"
907 @echo "**************************************************"
911 $(PERL) configdata.pm -r
915 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
917 # Helper function to figure out dependencies on libraries
918 # It takes a list of library names and outputs a list of dependencies
919 sub compute_lib_depends {
920 # Depending on shared libraries:
921 # On Windows POSIX layers, we depend on {libname}.dll.a
922 # On Unix platforms, we depend on {shlibname}.so
923 return map { platform->sharedlib_simple($_) // platform->staticlib($_) } @_;
928 my $generator = join(" ", @{$args{generator}});
929 my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
930 my $incs = join("", map { " -I".$_ } @{$args{incs}});
931 my $defs = join("", map { " -D".$_ } @{$args{defs}});
932 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
934 if (platform->isdef($args{src})) {
935 my $target = platform->def($args{src});
936 (my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
937 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
938 my $ord_name = $args{generator}->[1] || $args{product};
940 $target: $args{generator}->[0] $deps \$(SRCDIR)/util/mkdef.pl
941 \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --ordinals $args{generator}->[0] --name $ord_name --OS $mkdef_os > $target
943 } elsif (!platform->isasm($args{src})) {
944 if ($args{generator}->[0] =~ m|^.*\.in$|) {
945 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
946 "util", "dofile.pl")),
947 rel2abs($config{builddir}));
949 $args{src}: $args{generator}->[0] $deps
950 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
951 "-o$target{build_file}" $generator > \$@
955 $args{src}: $args{generator}->[0] $deps
956 \$(PERL)$generator_incs $generator > \$@
960 if ($args{generator}->[0] =~ /\.pl$/) {
961 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator;
962 } elsif ($args{generator}->[0] =~ /\.m4$/) {
963 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
964 } elsif ($args{generator}->[0] =~ /\.S$/) {
967 die "Generator type for $args{src} unknown: $generator\n";
971 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
972 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
973 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
974 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
975 } -> {$args{intent}};
976 if (defined($generator)) {
978 $args{src}: $args{generator}->[0] $deps
983 $args{src}: $args{generator}->[0] $deps
984 \$(CC) $incs $cppflags $defs -E $args{generator}->[0] | \\
985 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
990 # Should one wonder about the end of the Perl snippet, it's because this
991 # second regexp eats up line endings as well, if the removed path is the
992 # last in the line. We may therefore need to put back a line ending.
995 my $obj = platform->obj($args{obj});
996 my $dep = platform->dep($args{obj});
997 my @srcs = @{$args{srcs}};
998 my $srcs = join(" ", @srcs);
999 my $deps = join(" ", @srcs, @{$args{deps}});
1000 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1001 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1005 if (grep /\.rc$/, @srcs) {
1007 $cmdflags = '$(RCFLAGS)';
1009 } elsif (grep /\.(cc|cpp)$/, @srcs) {
1011 $cmdcompile = ' -c';
1013 shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1014 lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1015 dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)',
1016 bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)'
1017 } -> {$args{intent}};
1020 $cmdcompile = ' -c';
1022 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1023 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1024 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1025 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1026 } -> {$args{intent}};
1029 # extension-specific rules
1030 if (grep /\.s$/, @srcs) {
1033 $cmd $cmdflags -c -o \$\@ $srcs
1035 } elsif (grep /\.S$/, @srcs) {
1036 # Originally there was mutli-step rule with $(CC) -E file.S
1037 # followed by $(CC) -c file.s. It compensated for one of
1038 # legacy platform compiler's inability to handle .S files.
1039 # The platform is long discontinued by vendor so there is
1040 # hardly a point to drag it along...
1043 $cmd $incs $defs $cmdflags -c -o \$\@ $srcs
1045 } elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/
1046 && !grep /\.rc$/, @srcs) {
1049 $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs
1051 \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\
1054 mv $dep.tmp $dep; \\
1060 $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs
1062 if (defined $makedepprog && $makedepprog =~ /\/makedepend/) {
1064 \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\
1071 # We *know* this routine is only called when we've configure 'shared'.
1075 foreach (@{args{deps}}) {
1076 my $d = dirname($_);
1077 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1079 my $linkflags = join("", map { "-L$_ " } @linkdirs);
1080 my $linklibs = join("", map { my $f = basename($_);
1081 (my $l = $f) =~ s/^lib//;
1082 " -l$l" } @{$args{deps}});
1083 my @objs = map { platform->obj($_) }
1084 grep { !platform->isdef($_) }
1086 my @defs = map { platform->def($_) }
1087 grep { platform->isdef($_) }
1089 my @deps = compute_lib_depends(@{$args{deps}});
1090 die "More than one exported symbol map" if scalar @defs > 1;
1091 my $objs = join(" ", @objs);
1092 my $deps = join(" ", @objs, @defs, @deps);
1093 my $simple = platform->sharedlib_simple($args{lib});
1094 my $full = platform->sharedlib($args{lib});
1095 my $shared_soname = "";
1096 $shared_soname .= ' '.$target{shared_sonameflag}.basename($full)
1097 if defined $target{shared_sonameflag};
1098 my $shared_imp = "";
1099 $shared_imp .= ' '.$target{shared_impflag}.basename($simple)
1100 if defined $target{shared_impflag};
1101 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1102 my $recipe = <<"EOF";
1108 \$(AR) r $simple $full
1110 } elsif ($simple ne $full) {
1118 \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
1119 -o $full$shared_def $objs \\
1120 $linklibs \$(LIB_EX_LIBS)
1136 my $dso = platform->dso($args{lib});
1138 foreach (@{args{deps}}) {
1139 my $d = dirname($_);
1140 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1142 my $linkflags = join("", map { "-L$_ " } @linkdirs);
1143 my $linklibs = join("", map { my $f = basename($_);
1144 (my $l = $f) =~ s/^lib//;
1145 " -l$l" } @{$args{deps}});
1146 my @objs = map { platform->obj($_) }
1147 grep { !platform->isdef($_) }
1149 my @defs = map { platform->def($_) }
1150 grep { platform->isdef($_) }
1152 my @deps = compute_lib_depends(@{$args{deps}});
1153 my $objs = join(" ", @objs);
1154 my $deps = join(" ", @objs, @defs, @deps);
1155 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1158 \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
1159 -o $dso$shared_def $objs \\
1160 $linklibs \$(DSO_EX_LIBS)
1165 my $lib = platform->staticlib($args{lib});
1166 my @objs = map { platform->obj($_) } @{$args{objs}};
1167 my $objs = join(" ", @objs);
1170 \$(AR) \$(ARFLAGS) \$\@ \$\?
1171 \$(RANLIB) \$\@ || echo Never mind.
1176 my $bin = platform->bin($args{bin});
1177 my $objs = join(" ", map { platform->obj($_) } @{$args{objs}});
1178 my $deps = join(" ", compute_lib_depends(@{$args{deps}}));
1180 foreach (@{args{deps}}) {
1181 next if $_ =~ /\.a$/;
1182 my $d = dirname($_);
1183 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1185 my $linkflags = join("", map { "-L$_ " } @linkdirs);
1186 my $linklibs = join("", map { if ($_ =~ s/\.a$//) {
1187 " ".platform->staticlib($_);
1189 my $f = basename($_);
1190 (my $l = $f) =~ s/^lib//;
1195 my $cmdflags = '$(BIN_CFLAGS)';
1196 if (grep /_cc\.o$/, @{$args{objs}}) {
1198 $cmdflags = '$(BIN_CXXFLAGS)';
1203 \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
1205 $linklibs \$(BIN_EX_LIBS)
1210 my $script = $args{script};
1211 my $sources = join(" ", @{$args{sources}});
1212 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1213 "util", "dofile.pl")),
1214 rel2abs($config{builddir}));
1217 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1218 "-o$target{build_file}" $sources > "$script"
1224 my $dir = $args{dir};
1225 my @deps = map { platform->convertext($_) } @{$args{deps}};
1227 my %extinfo = ( dso => platform->dsoext(),
1228 lib => platform->libext(),
1229 bin => platform->binext() );
1231 # We already have a 'test' target, and the top directory is just plain
1233 return if $dir eq "test" || $dir eq ".";
1235 foreach my $type (("dso", "lib", "bin", "script")) {
1236 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
1237 # For lib object files, we could update the library. However, it
1238 # was decided that it's enough to build the directory local object
1239 # files, so we don't need to add any actions, and the dependencies
1240 # are already taken care of.
1241 if ($type ne "lib") {
1242 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
1243 if (dirname($prod) eq $dir) {
1244 push @deps, $prod.$extinfo{$type};
1246 push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1252 my $deps = join(" ", @deps);
1253 my $actions = join("\n", "", @actions);
1255 $dir $dir/: $deps$actions
1258 "" # Important! This becomes part of the template result.