SHLIB_INFO={- join(" \\\n" . ' ' x 11,
fill_lines(" ", $COLUMNS - 11,
map { my $x = platform->sharedlib($_);
- my $y = platform->sharedlib_simple($_);
- $x ? "\"$x;$y\"" : () }
+ my $y = platform->sharedlib_simple($_) // '';
+ my $z = platform->sharedlib_import($_) // '';
+ $x ? "\"$x;$y;$z\"" : () }
@{$unified_info{libraries}})) -}
MODULES={- join(" \\\n" . ' ' x 8,
fill_lines(" ", $COLUMNS - 8,
map { platform->dso($_) }
@{$unified_info{modules}})) -}
+FIPSMODULENAME={- # We do some extra checking here, as there should be only one
+ my @fipsmodules =
+ grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
+ && $unified_info{attributes}->{modules}->{$_}->{fips} }
+ @{$unified_info{modules}};
+ die "More that one FIPS module" if scalar @fipsmodules > 1;
+ join(" ", map { basename platform->dso($_) } @fipsmodules) -}
+
PROGRAMS={- join(" \\\n" . ' ' x 9,
fill_lines(" ", $COLUMNS - 9,
map { platform->bin($_) }
GENERATED_MANDATORY={- join(" \\\n" . ' ' x 20,
fill_lines(" ", $COLUMNS - 20,
@{$unified_info{depends}->{""}})) -}
+GENERATED_PODS={- # common0.tmpl provides @generated
+ join(" \\\n" . ' ' x 15,
+ fill_lines(" ", $COLUMNS - 15,
+ map { my $x = $_;
+ (
+ grep {
+ $unified_info{attributes}->{depends}
+ ->{$x}->{$_}->{pod} // 0
+ }
+ keys %{$unified_info{attributes}->{depends}->{$x}}
+ ) ? $x : ();
+ }
+ @generated)) -}
GENERATED={- # common0.tmpl provides @generated
join(" \\\n" . ' ' x 5,
fill_lines(" ", $COLUMNS - 5,
join(" \\\n" . ' ' x 19,
fill_lines(" ", $COLUMNS - 19,
map { my $x = platform->sharedlib($_);
- my $y = platform->sharedlib_simple($_);
- $x ? "\"$x;$y\"" : () }
+ my $y = platform->sharedlib_simple($_) // '';
+ my $z = platform->sharedlib_import($_) // '';
+ $x ? "\"$x;$y;$z\"" : () }
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
@{$unified_info{libraries}}))
-}
-}
HTMLDOCS1={-
join(" \\\n" . ' ' x 10,
- fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
+ fill_lines(" ", $COLUMNS - 10,
@{$unified_info{htmldocs}->{man1}})) -}
HTMLDOCS3={-
join(" \\\n" . ' ' x 10,
- fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
+ fill_lines(" ", $COLUMNS - 10,
@{$unified_info{htmldocs}->{man3}})) -}
HTMLDOCS5={-
join(" \\\n" . ' ' x 10,
- fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
+ fill_lines(" ", $COLUMNS - 10,
@{$unified_info{htmldocs}->{man5}})) -}
HTMLDOCS7={-
join(" \\\n" . ' ' x 10,
- fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
+ fill_lines(" ", $COLUMNS - 10,
@{$unified_info{htmldocs}->{man7}})) -}
MANDOCS1={-
join(" \\\n" . ' ' x 9,
- fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
+ fill_lines(" ", $COLUMNS - 9,
@{$unified_info{mandocs}->{man1}})) -}
MANDOCS3={-
join(" \\\n" . ' ' x 9,
- fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
+ fill_lines(" ", $COLUMNS - 9,
@{$unified_info{mandocs}->{man3}})) -}
MANDOCS5={-
join(" \\\n" . ' ' x 9,
- fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
+ fill_lines(" ", $COLUMNS - 9,
@{$unified_info{mandocs}->{man5}})) -}
MANDOCS7={-
join(" \\\n" . ' ' x 9,
- fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
+ fill_lines(" ", $COLUMNS - 9,
@{$unified_info{mandocs}->{man7}})) -}
APPS_OPENSSL="{- use File::Spec::Functions;
{- dependmagic('build_modules'); -}: build_modules_nodep
{- dependmagic('build_programs'); -}: build_programs_nodep
+build_generated_pods: $(GENERATED_PODS)
build_docs: build_man_docs build_html_docs
build_man_docs: $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7)
build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
if [ "$$s" = ";" ]; then continue; fi; \
s1=`echo "$$s" | cut -f1 -d";"`; \
s2=`echo "$$s" | cut -f2 -d";"`; \
+ s3=`echo "$$s" | cut -f3 -d";"`; \
$(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\
$(RM) apps/$$s1; \
$(RM) test/$$s1; \
$(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\
$(RM) $$s1; \
- if [ "$$s1" != "$$s2" ]; then \
+ if [ "$$s2" != "" ]; then \
$(ECHO) $(RM) $$s2; \
$(RM) $$s2; \
fi; \
+ if [ "$$s3" != "" ]; then \
+ $(ECHO) $(RM) $$s3; \
+ $(RM) $$s3; \
+ fi; \
done
$(RM) $(LIBS)
$(RM) *{- platform->defext() -}
$(RM) $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7)
$(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(SCRIPTS)
$(RM) $(GENERATED_MANDATORY) $(GENERATED)
- -$(RM) `find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -print`
- -$(RM) `find . -name '*{- platform->objext() -}' \! -name '.*' \! -type d -print`
+ -find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -exec $(RM) {} \;
+ -find . -name '*{- platform->objext() -}' \! -name '.*' \! -type d -exec $(RM) {} \;
$(RM) core
$(RM) tags TAGS doc-nits cmd-nits md-nits
$(RM) -r test/test-runs
$(RM) openssl.pc libcrypto.pc libssl.pc
- -$(RM) `find . -type l \! -name '.*' -print`
+ -find . -type l \! -name '.*' -exec $(RM) {} \;
$(RM) $(TARFILE)
distclean: clean
uninstall_docs: uninstall_man_docs uninstall_html_docs
$(RM) -r $(DESTDIR)$(DOCDIR)
+install_fips: install_sw
+ @$(ECHO) "*** Installing FIPS module configuration"
+ @$(ECHO) "fipsinstall $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf"
+ @openssl fipsinstall -module $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME) \
+ -out $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf \
+ -macopt 'key:$(FIPSKEY)'
+
+uninstall_fips: uninstall_sw
+ @$(ECHO) "*** Uninstalling FIPS module configuration"
+ @$(ECHO) "$(RM) $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf"
+ @$(RM) $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf
+
install_ssldirs:
@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
@set -e; for s in $(INSTALL_SHLIB_INFO); do \
s1=`echo "$$s" | cut -f1 -d";"`; \
s2=`echo "$$s" | cut -f2 -d";"`; \
- fn1=`basename $$s1`; \
- fn2=`basename $$s2`; \
+ s3=`echo "$$s" | cut -f3 -d";"`; \
+ fn1=`basename "$$s1"`; \
+ fn2=`basename "$$s2"`; \
+ fn3=`basename "$$s3"`; \
: {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \
- if [ "$$fn1" != "$$fn2" ]; then \
+ if [ "$$fn2" != "" ]; then \
$(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \
ln -sf $$fn1 $(DESTDIR)$(libdir)/$$fn2; \
fi; \
: {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \
- $(ECHO) "install $$s2 -> $(DESTDIR)$(libdir)/$$fn2"; \
- cp $$s2 $(DESTDIR)$(libdir)/$$fn2.new; \
- chmod 755 $(DESTDIR)$(libdir)/$$fn2.new; \
- mv -f $(DESTDIR)$(libdir)/$$fn2.new \
- $(DESTDIR)$(libdir)/$$fn2; \
+ if [ "$$fn3" != "" ]; then \
+ $(ECHO) "install $$s3 -> $(DESTDIR)$(libdir)/$$fn3"; \
+ cp $$s3 $(DESTDIR)$(libdir)/$$fn3.new; \
+ chmod 755 $(DESTDIR)$(libdir)/$$fn3.new; \
+ mv -f $(DESTDIR)$(libdir)/$$fn3.new \
+ $(DESTDIR)$(libdir)/$$fn3; \
+ fi; \
: {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \
a=$(DESTDIR)$(libdir)/$$fn2; \
$(ECHO) "install $$s1 -> $$a"; \
@set -e; for s in $(INSTALL_SHLIB_INFO); do \
s1=`echo "$$s" | cut -f1 -d";"`; \
s2=`echo "$$s" | cut -f2 -d";"`; \
- fn1=`basename $$s1`; \
- fn2=`basename $$s2`; \
+ s3=`echo "$$s" | cut -f3 -d";"`; \
+ fn1=`basename "$$s1"`; \
+ fn2=`basename "$$s2"`; \
+ fn3=`basename "$$s3"`; \
: {- output_off() if windowsdll(); "" -}; \
- $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
- $(RM) $(DESTDIR)$(libdir)/$$fn2; \
- if [ "$$fn1" != "$$fn2" -a -f "$(DESTDIR)$(libdir)/$$fn1" ]; then \
- $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \
- $(RM) $(DESTDIR)$(libdir)/$$fn1; \
+ $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \
+ $(RM) $(DESTDIR)$(libdir)/$$fn1; \
+ if [ -n "$$fn2" ]; then \
+ $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
+ $(RM) $(DESTDIR)$(libdir)/$$fn2; \
fi; \
: {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
- $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
- $(RM) $(DESTDIR)$(libdir)/$$fn2; \
+ if [ -n "$$fn3" ]; then \
+ $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn3"; \
+ $(RM) $(DESTDIR)$(libdir)/$$fn3; \
+ fi; \
: {- output_on() unless windowsdll(); "" -}; \
done
@ : {- output_on() if $disabled{shared}; "" -}
@set -e; for e in dummy $(INSTALL_ENGINES); do \
if [ "$$e" = "dummy" ]; then continue; fi; \
fn=`basename $$e`; \
- if [ "$$fn" = '{- platform->dso("ossltest") -}' ]; then \
- continue; \
- fi; \
$(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
done
@set -e; for e in dummy $(INSTALL_MODULES); do \
if [ "$$e" = "dummy" ]; then continue; fi; \
fn=`basename $$e`; \
- if [ "$$fn" = '{- platform->dso("ossltest") -}' ]; then \
- continue; \
- fi; \
$(ECHO) "$(RM) $(DESTDIR)$(MODULESDIR)/$$fn"; \
$(RM) $(DESTDIR)$(MODULESDIR)/$$fn; \
done
fn=`basename $$x`; \
$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
cp $$x $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \
- chmod 755 $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \
+ chmod 644 $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \
done
@set -e; for x in dummy $(MANDOCS3); do \
if [ "$$x" = "dummy" ]; then continue; fi; \
fn=`basename $$x`; \
$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
cp $$x $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \
- chmod 755 $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \
+ chmod 644 $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \
done
@set -e; for x in dummy $(MANDOCS5); do \
if [ "$$x" = "dummy" ]; then continue; fi; \
fn=`basename $$x`; \
$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
cp $$x $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \
- chmod 755 $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \
+ chmod 644 $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \
done
@set -e; for x in dummy $(MANDOCS7); do \
if [ "$$x" = "dummy" ]; then continue; fi; \
fn=`basename $$x`; \
$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
cp $$x $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \
- chmod 755 $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \
+ chmod 644 $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \
done
uninstall_man_docs:
fn=`basename $$x`; \
$(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
cp $$x $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
- chmod 755 $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
+ chmod 644 $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
done
@set -e; for x in dummy $(HTMLDOCS3); do \
if [ "$$x" = "dummy" ]; then continue; fi; \
fn=`basename $$x`; \
$(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
cp $$x $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
- chmod 755 $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
+ chmod 644 $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
done
@set -e; for x in dummy $(HTMLDOCS5); do \
if [ "$$x" = "dummy" ]; then continue; fi; \
fn=`basename $$x`; \
$(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
cp $$x $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
- chmod 755 $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
+ chmod 644 $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
done
@set -e; for x in dummy $(HTMLDOCS7); do \
if [ "$$x" = "dummy" ]; then continue; fi; \
fn=`basename $$x`; \
$(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
cp $$x $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
- chmod 755 $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
+ chmod 644 $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
done
uninstall_html_docs:
# Developer targets (note: these are only available on Unix) #########
-update: generate errors ordinals
+# It's important that generate_buildinfo comes after ordinals, as ordinals
+# is sensitive to build.info changes.
+update: generate errors ordinals generate_buildinfo
generate: generate_apps generate_crypto_bn generate_crypto_objects \
generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
+generate_buildinfo: generate_doc_buildinfo
+
.PHONY: doc-nits cmd-nits md-nits
-doc-nits: build_generated
+doc-nits: build_generated_pods
$(PERL) $(SRCDIR)/util/find-doc-nits -n -l -e
-cmd-nits: build_generated apps/openssl
+cmd-nits: build_generated apps/openssl build_generated_pods
$(PERL) $(SRCDIR)/util/find-doc-nits -c
# This uses "mdl", the markdownlint application, which is written in ruby.
crypto/objects/obj_dat.h \
> fuzz/oids.txt )
+generate_doc_buildinfo:
+ ( $(PERL) -I$(BLDDIR) -Mconfigdata \
+ $(SRCDIR)/util/dofile.pl -o Makefile \
+ $(SRCDIR)/doc/build.info.in > $(SRCDIR)/doc/build.info )
+
# Set to -force to force a rebuild
ERROR_REBUILD=
errors:
{- use File::Basename;
- our @sslheaders =
+ my @sslheaders_tmpl =
qw( include/openssl/ssl.h
include/openssl/ssl2.h
include/openssl/ssl3.h
include/openssl/sslerr.h
include/openssl/tls1.h
include/openssl/dtls1.h
- include/openssl/srtp.h );
- our @cryptoheaders =
+ include/openssl/srtp.h
+ include/openssl/sslerr_legacy.h );
+ my @cryptoheaders_tmpl =
qw( include/internal/dso.h
include/internal/o_dir.h
include/internal/err.h
include/internal/evp.h
+ include/internal/pem.h
+ include/internal/asn1.h
include/internal/sslconf.h );
- our @cryptoskipheaders = ( @sslheaders,
+ my @cryptoskipheaders = ( @sslheaders_tmpl,
qw( include/openssl/conf_api.h
include/openssl/ebcdic.h
include/openssl/opensslconf.h
include/openssl/symhacks.h ) );
- foreach my $f ( glob(catfile($config{sourcedir},
- 'include','openssl','*.h')) ) {
- my $fn = "include/openssl/" . basename($f);
- push @cryptoheaders, $fn unless grep { $_ eq $fn } @cryptoskipheaders;
+ our %cryptoheaders = ();
+ our %sslheaders = ();
+ foreach my $d ( qw( include/openssl include/internal ) ) {
+ my @header_patterns =
+ map { catfile($config{sourcedir}, $d, $_) } ( '*.h', '*.h.in' );
+ foreach my $f ( map { glob($_) } @header_patterns ) {
+ my $base = basename($f);
+ my $base_in = basename($f, '.in');
+ my $dir = catfile($config{sourcedir}, $d);
+ if ($base ne $base_in) {
+ # We have a .h.in file, which means the header file is in the
+ # build tree.
+ $base = $base_in;
+ $dir = catfile($config{builddir}, $d);
+ }
+ my $new_f = catfile($dir, $base);
+ my $fn = "$d/$base";
+ # The logic to add files to @cryptoheaders is a bit complex. The
+ # file to be added must be either in the public header directory
+ # or one of the pre-declared internal headers, and must under no
+ # circumstances be one of those that must be skipped.
+ $cryptoheaders{$new_f} = 1
+ if (($d eq 'include/openssl'
+ || ( grep { $_ eq $fn } @cryptoheaders_tmpl ))
+ && !( grep { $_ eq $fn } @cryptoskipheaders ));
+ # The logic to add files to @sslheaders is much simpler...
+ $sslheaders{$new_f} = 1 if grep { $_ eq $fn } @sslheaders_tmpl;
+ }
}
"";
-}
CRYPTOHEADERS={- join(" \\\n" . ' ' x 14,
- fill_lines(" ", $COLUMNS - 14, sort @cryptoheaders)) -}
+ fill_lines(" ", $COLUMNS - 14, sort keys %cryptoheaders)) -}
SSLHEADERS={- join(" \\\n" . ' ' x 11,
- fill_lines(" ", $COLUMNS - 11, sort @sslheaders)) -}
-ordinals:
- ( cd $(SRCDIR); \
- $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
- --ordinals util/libcrypto.num \
- --symhacks include/openssl/symhacks.h \
- $(CRYPTOHEADERS) )
- ( cd $(SRCDIR); \
- $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
- --ordinals util/libssl.num \
- --symhacks include/openssl/symhacks.h \
- $(SSLHEADERS))
+ fill_lines(" ", $COLUMNS - 11, sort keys %sslheaders)) -}
+ordinals: build_generated
+ $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION) --no-warnings \
+ --ordinals $(SRCDIR)/util/libcrypto.num \
+ --symhacks $(SRCDIR)/include/openssl/symhacks.h \
+ $(CRYPTOHEADERS)
+ $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION) --no-warnings \
+ --ordinals $(SRCDIR)/util/libssl.num \
+ --symhacks $(SRCDIR)/include/openssl/symhacks.h \
+ $(SSLHEADERS)
test_ordinals:
( cd test; \
# Building targets ###################################################
-libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // () } @{$unified_info{libraries}}) -}
+libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // platform->sharedlib_import($_) // () } @{$unified_info{libraries}}) -}
libcrypto.pc:
@ ( echo 'prefix=$(INSTALLTOP)'; \
echo 'exec_prefix=$${prefix}'; \
# Depending on shared libraries:
# On Windows POSIX layers, we depend on {libname}.dll.a
# On Unix platforms, we depend on {shlibname}.so
- return map { platform->sharedlib_simple($_) // platform->staticlib($_) } @_;
+ return map { platform->sharedlib_simple($_)
+ // platform->sharedlib_import($_)
+ // platform->staticlib($_)
+ } @_;
}
sub generatesrc {
my @deps = compute_lib_depends(@{$args{deps}});
die "More than one exported symbol map" if scalar @defs > 1;
- my $simple = platform->sharedlib_simple($args{lib});
my $full = platform->sharedlib($args{lib});
+ # $import is for Windows and subsystems thereof, where static import
+ # libraries for DLLs are a thing. On platforms that have this mechanism,
+ # $import has the name of this import library. On platforms that don't
+ # have this mechanism, $import will be |undef|.
+ my $import = platform->sharedlib_import($args{lib});
+ # $simple is for platforms where full shared library names include the
+ # shared library version, and there's a simpler name that doesn't include
+ # that version. On such platforms, $simple has the simpler name. On
+ # other platforms, it will be |undef|.
+ my $simple = platform->sharedlib_simple($args{lib});
+
+ my $argfile = defined $target{shared_argfileflag} ? $full.".args" : undef;
my $shared_soname = "";
$shared_soname .= ' '.$target{shared_sonameflag}.basename($full)
if defined $target{shared_sonameflag};
my $shared_imp = "";
- $shared_imp .= ' '.$target{shared_impflag}.basename($simple)
- if defined $target{shared_impflag};
+ $shared_imp .= ' '.$target{shared_impflag}.basename($import)
+ if defined $target{shared_impflag} && defined $import;
my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
- my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
- my $deps = join(" \\\n" . ' ' x (length($full) + 2),
- fill_lines(' ', $COLUMNS - length($full) - 2,
- @objs, @defs, @deps));
-
- my $recipe = <<"EOF";
+ # There is at least one platform where the compiler-as-linker needs to
+ # have one object file directly on the command line. That won't hurt
+ # any other platform, so we do that for everyone when there's an argfile
+ # to be had. This depends heavily on splice, which removes elements from
+ # the given array, and returns them so they can be captured.
+ my @argfileobjs = $argfile
+ ? splice(@objs, 1)
+ : ();
+ my $argfilecmds = $argfile
+ ? join("\n\t", map { "echo $_ >> $argfile" } @argfileobjs)
+ : undef;
+ my $argfiledeps = $argfile
+ ? join(" \\\n" . ' ' x (length($argfile) + 2),
+ fill_lines(' ', $COLUMNS - length($full) - 2, @argfileobjs))
+ : undef;
+ my @fulldeps = (@objs, ($argfile ? $argfile : ()), @defs, @deps);
+ my @fullobjs = (
+ @objs,
+ ($argfile ? $target{shared_argfileflag}.$argfile : ())
+ );
+ my $fulldeps =
+ join(" \\\n" . ' ' x (length($full) + 2),
+ fill_lines(' ', $COLUMNS - length($full) - 2, @fulldeps));
+ my $fullobjs =
+ join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @fullobjs));
+
+ my $recipe = '';
+
+ if (defined $simple) {
+ if (sharedaix()) {
+ $recipe .= <<"EOF";
$simple: $full
-EOF
- if (sharedaix()) {
- $recipe .= <<"EOF";
rm -f $simple && \\
\$(AR) r $simple $full
EOF
- } elsif ($simple ne $full) {
- $recipe .= <<"EOF";
+ } else {
+ $recipe .= <<"EOF";
+$simple: $full
rm -f $simple && \\
ln -s $full $simple
+EOF
+ }
+ }
+ if (defined $import) {
+ $recipe .= <<"EOF";
+$import: $full
EOF
}
$recipe .= <<"EOF";
-$full: $deps
+$full: $fulldeps
\$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
-o $full$shared_def \\
- $objs \\
+ $fullobjs \\
$linklibs \$(LIB_EX_LIBS)
EOF
if (windowsdll()) {
$recipe .= <<"EOF";
rm -f apps/$full
- rm -f test/$full
rm -f fuzz/$full
cp -p $full apps/
- cp -p $full test/
cp -p $full fuzz/
EOF
+ if (!$disabled{tests}) {
+ $recipe .= <<"EOF";
+ rm -f test/$full
+ cp -p $full test/
+EOF
+ }
}
+ $recipe .= <<"EOF" if defined $argfile;
+$argfile: $argfiledeps
+ \$(RM) $argfile
+ $argfilecmds
+EOF
return $recipe;
}
sub obj2dso {
my %args = @_;
my $lib = platform->staticlib($args{lib});
my @objs = map { platform->obj($_) } @{$args{objs}};
- my $objs = join(" \\\n" . ' ' x (length($lib) + 2),
+ my $deps = join(" \\\n" . ' ' x (length($lib) + 2),
fill_lines(' ', $COLUMNS - length($lib) - 2, @objs));
+ my $max_per_call = 500;
+ my @objs_grouped;
+ push @objs_grouped, join(" ", splice @objs, 0, $max_per_call) while @objs;
+ my $fill_lib =
+ join("\n\t", (map { "\$(AR) \$(ARFLAGS) $lib $_" } @objs_grouped));
return <<"EOF";
-$lib: $objs
- \$(AR) \$(ARFLAGS) \$\@ \$\?
+$lib: $deps
+ \$(RM) $lib
+ $fill_lib
\$(RANLIB) \$\@ || echo Never mind.
EOF
}