aboutsummaryrefslogtreecommitdiff
path: root/Configurations
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2016-03-12 09:38:20 +0100
committerRichard Levitte <levitte@openssl.org>2016-03-13 00:02:55 +0100
commitbbd9a50fa8e371927c290170ab6b8ac2597e5ff9 (patch)
tree79e06f0a95a5a3269bffa04c124d6572375f0f52 /Configurations
parent8cab4e9bc73a66b64aae179db86493fd28c39b64 (diff)
downloadopenssl-bbd9a50fa8e371927c290170ab6b8ac2597e5ff9.zip
openssl-bbd9a50fa8e371927c290170ab6b8ac2597e5ff9.tar.gz
openssl-bbd9a50fa8e371927c290170ab6b8ac2597e5ff9.tar.bz2
Harmonize Unix Makefile template with Windows dito
The variable SHARED_CFLAGS and SHARD_LDFLAGS were used in the Unix template because they normally contain options used when building "shared". The Windows template, on the other hand, uses LIB_CFLAGS, to express the intended use of those flags rather than their content. The Windows template still used SHARED_LDFLAGS, which seems inconsistent. To harmonize the two, any SHARED_CFLAGS gets renamed to LIB_CFLAGS and SHARED_LDFLAGS to LIB_LDFLAGS. That makes the intent consistent along with BIN_{C,LD}FLAGS and DSO_{C,LD}FLAGS. Finally, make sure to pass down $(LIB_CFLAGS) or $(DSO_CFLAGS) along with $(CFLAGS) when using Makefile.shared. Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'Configurations')
-rw-r--r--Configurations/unix-Makefile.tmpl51
-rw-r--r--Configurations/windows-makefile.tmpl4
2 files changed, 28 insertions, 27 deletions
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index ffe7551..6e023b7 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -151,23 +151,24 @@ CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -}
LDFLAGS= {- $target{lflags} -}
PLIB_LDFLAGS= {- $target{plib_lflags} -}
EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -}
-SHARED_CFLAGS={- $target{shared_cflag} || "" -}
-SHARED_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag}
- # Unlike other OSes (like Solaris, Linux, Tru64,
- # IRIX) BSD run-time linkers (tested OpenBSD, NetBSD
- # and FreeBSD) "demand" RPATH set on .so objects.
- # Apparently application RPATH is not global and
- # does not apply to .so linked with other .so.
- # Problem manifests itself when libssl.so fails to
- # load libcrypto.so. One can argue that we should
- # engrave this into Makefile.shared rules or into
- # BSD-* config lines above. Meanwhile let's try to
- # be cautious and pass -rpath to linker only when
- # $prefix is not /usr.
- . ($config{target} =~ m|^BSD-| && $prefix !~ m|^/usr/.*$|
- ? " -Wl,-rpath,\$\$(LIBRPATH)" : "") -}
-SHARED_RCFLAGS={- $target{shared_rcflag} -}
+LIB_CFLAGS={- $target{shared_cflag} || "" -}
+LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag}
+ # Unlike other OSes (like Solaris, Linux, Tru64,
+ # IRIX) BSD run-time linkers (tested OpenBSD, NetBSD
+ # and FreeBSD) "demand" RPATH set on .so objects.
+ # Apparently application RPATH is not global and
+ # does not apply to .so linked with other .so.
+ # Problem manifests itself when libssl.so fails to
+ # load libcrypto.so. One can argue that we should
+ # engrave this into Makefile.shared rules or into
+ # BSD-* config lines above. Meanwhile let's try to
+ # be cautious and pass -rpath to linker only when
+ # $prefix is not /usr.
+ . ($config{target} =~ m|^BSD-| && $prefix !~ m|^/usr/.*$|
+ ? " -Wl,-rpath,\$\$(LIBRPATH)" : "") -}
+RCFLAGS={- $target{shared_rcflag} -}
DSO_CFLAGS={- $target{shared_cflag} || "" -}
+DSO_LDFLAGS=$(LIB_LDFLAGS)
BIN_CFLAGS={- "" -}
PERL={- $config{perl} -}
@@ -878,7 +879,7 @@ EOF
my $srcs = join(" ", @srcs);
my $deps = join(" ", @srcs, @{$args{deps}});
my $incs = join("", map { " -I".$_ } @{$args{incs}});
- my $ecflags = { lib => '$(SHARED_CFLAGS)',
+ my $ecflags = { lib => '$(LIB_CFLAGS)',
dso => '$(DSO_CFLAGS)',
bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
my $makedepprog = $config{makedepprog};
@@ -954,10 +955,10 @@ $target: $lib$libext $deps $ordinalsfile
LIBDEPS="\$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS)" \\
LIBNAME=$libname LIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\
LIBCOMPATVERSIONS=";\$(SHLIB_VERSION_HISTORY)" \\
- CC="\$(CC)" CFLAGS="\$(CFLAGS)" LDFLAGS="\$(LDFLAGS)" \\
- CROSS_COMPILE="\$(CROSS_COMPILE)" \\
- SHARED_LDFLAGS="\$(SHARED_LDFLAGS)" SHLIB_EXT=$shlibext \\
- SHARED_RCFLAGS="\$(SHARED_RCFLAGS)" \\
+ CC="\$(CC)" CFLAGS="\$(CFLAGS) \$(LIB_CFLAGS)" \\
+ CROSS_COMPILE="\$(CROSS_COMPILE)" LDFLAGS="\$(LDFLAGS)" \\
+ SHARED_LDFLAGS="\$(LIB_LDFLAGS)" SHLIB_EXT=$shlibext \\
+ SHARED_RCFLAGS="\$(RCFLAGS)" \\
link_shlib.$shlib_target
EOF
. (windowsdll() ? <<"EOF" : "");
@@ -988,8 +989,8 @@ $target: $objs $deps
PERL=\$(PERL) SRCDIR="\$(SRCDIR)" DSTDIR="$libd" \\
LIBDEPS="\$(PLIB_LDFLAGS) $shlibdeps \$(EX_LIBS)" \\
LIBNAME=$libname LDFLAGS="\$(LDFLAGS)" \\
- CC="\$(CC)" CFLAGS="\$(CFLAGS)" \\
- SHARED_LDFLAGS="\$(SHARED_LDFLAGS)" \\
+ CC="\$(CC)" CFLAGS="\$(CFLAGS) \$(DSO_CFLAGS)" \\
+ SHARED_LDFLAGS="\$(DSO_LDFLAGS)" \\
SHLIB_EXT=$dsoext \\
LIBEXTRAS="$objs" \\
link_dso.$shlib_target
@@ -1025,8 +1026,8 @@ $bin$exeext: $objs $deps
PERL=\$(PERL) SRCDIR=\$(SRCDIR) \\
APPNAME=$bin$exeext OBJECTS="$objs" \\
LIBDEPS="\$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS)" \\
- CC="\$(CC)" CFLAGS="\$(CFLAGS)" LDFLAGS="\$(LDFLAGS)" \\
- LIBRPATH="\$(INSTALLTOP)/\$(LIBDIR)" \\
+ CC="\$(CC)" CFLAGS="\$(CFLAGS) \$(BIN_CFLAGS)" \\
+ LDFLAGS="\$(LDFLAGS)" LIBRPATH="\$(INSTALLTOP)/\$(LIBDIR)" \\
link_app.$shlib_target
EOF
}
diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
index 2871283..cb1b4e6 100644
--- a/Configurations/windows-makefile.tmpl
+++ b/Configurations/windows-makefile.tmpl
@@ -96,7 +96,7 @@ LDFLAGS={- $target{lflags} -}
LDOUTFLAG={- $target{loutflag} || "/out:" -}
EX_LIBS={- $target{ex_libs} -}
LIB_CFLAGS={- join(" ", $target{lib_cflags}, $target{shared_cflag}) || "" -}
-SHARED_LDFLAGS={- $target{shared_ldflag} || "" -}
+LIB_LDFLAGS={- $target{shared_ldflag} || "" -}
DSO_CFLAGS={- join(" ", $target{dso_cflags}, $target{shared_cflag}) || "" -}
DSO_LDFLAGS={- join(" ", $target{dso_lflags}, $target{shared_ldflag}) || "" -}
BIN_CFLAGS={- $target{bin_cflags} -}
@@ -284,7 +284,7 @@ EOF
return <<"EOF"
$target: $deps $ordinalsfile
\$(PERL) $mkdef_pl "$mkdef_key" 32 > $shlib.def
- \$(LD) \$(LDFLAGS) \$(SHARED_LDFLAGS) \\
+ \$(LD) \$(LDFLAGS) \$(LIB_LDFLAGS) \\
/implib:$target \$(LDOUTFLAG)$shlib$shlibext /def:$shlib.def @<<
$objs$linklibs \$(EX_LIBS)
<<