inherit_from => [ "BASE_common" ],
template => 1,
+ lflags =>
+ sub { $withargs{zlib_lib} ? "-L".$withargs{zlib_lib} : () },
ex_libs =>
- sub {
- unless ($disabled{zlib}) {
- if (defined($disabled{"zlib-dynamic"})) {
- if (defined($withargs{zlib_lib})) {
- return "-L".$withargs{zlib_lib}." -lz";
- } else {
- return "-lz";
- }
- }
- }
- return (); },
+ sub { !defined($disabled{zlib})
+ && defined($disabled{"zlib-dynamic"})
+ ? "-lz" : () },
build_scheme => [ "unified", "unix" ],
build_file => "Makefile",
release => "-O3"),
thread_scheme => "(unknown)",
sys_id => "VOS",
- lflags => "-Wl,-map",
+ lflags => add("-Wl,-map"),
bn_ops => "BN_LLONG",
shared_extension => ".so",
},
cc => "gcc",
cflags => "-D_ENDIAN -DBN_DIV2W -O3 -D_POSIX_SOURCE -D_SOCKET_SOURCE -I/SYSLOG/PUB",
sys_id => "MPE",
- ex_libs => add("-L/SYSLOG/PUB -lsyslog -lsocket -lcurses"),
+ lflags => add("-L/SYSLOG/PUB"),
+ ex_libs => add("-lsyslog -lsocket -lcurses"),
thread_scheme => "(unknown)",
bn_ops => "BN_LLONG",
},
: " /MC"; }),
debug => "/Od -DDEBUG -D_DEBUG",
release => "/O1i"),
- lflags => combine("/nologo /opt:ref",
- sub { vc_wince_info()->{lflags}; },
- sub { defined(env('PORTSDK_LIBPATH'))
- ? "/entry:mainCRTstartup" : (); }),
+ lflags => add(combine("/nologo /opt:ref",
+ sub { vc_wince_info()->{lflags}; },
+ sub { defined(env('PORTSDK_LIBPATH'))
+ ? "/entry:mainCRTstartup" : (); })),
sys_id => "WINCE",
bn_ops => "BN_LLONG EXPORT_VAR_AS_FN",
ex_libs => add(sub {
cc => "ccppc",
cflags => "-D_REENTRANT -mrtp -mhard-float -mstrict-align -fno-implicit-fp -DPPC32_fp60x -O2 -fstrength-reduce -fno-builtin -fno-strict-aliasing -Wall -DCPU=PPC32 -DTOOL_FAMILY=gnu -DTOOL=gnu -I\$(WIND_BASE)/target/usr/h -I\$(WIND_BASE)/target/usr/h/wrn/coreip",
sys_id => "VXWORKS",
- ex_libs => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000 -L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/common"),
+ lflags => add("-L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/common"),
+ ex_libs => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000"),
},
"vxworks-ppcgen" => {
inherit_from => [ "BASE_unix" ],
cc => "ccppc",
cflags => "-D_REENTRANT -mrtp -msoft-float -mstrict-align -O1 -fno-builtin -fno-strict-aliasing -Wall -DCPU=PPC32 -DTOOL_FAMILY=gnu -DTOOL=gnu -I\$(WIND_BASE)/target/usr/h -I\$(WIND_BASE)/target/usr/h/wrn/coreip",
sys_id => "VXWORKS",
- ex_libs => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000 -L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/sfcommon"),
+ lflags => add("-L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/sfcommon"),
+ ex_libs => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000"),
},
"vxworks-ppc405" => {
inherit_from => [ "BASE_unix" ],
cc => "ccppc",
cflags => "-g -msoft-float -mlongcall -DCPU=PPC405 -I\$(WIND_BASE)/target/h",
sys_id => "VXWORKS",
- lflags => "-r",
+ lflags => add("-r"),
},
"vxworks-ppc750" => {
inherit_from => [ "BASE_unix" ],
cc => "ccppc",
cflags => "-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h \$(DEBUG_FLAG)",
sys_id => "VXWORKS",
- lflags => "-r",
+ lflags => add("-r"),
},
"vxworks-ppc750-debug" => {
inherit_from => [ "BASE_unix" ],
cc => "ccppc",
cflags => "-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h -DPEDANTIC -DDEBUG -g",
sys_id => "VXWORKS",
- lflags => "-r",
+ lflags => add("-r"),
},
"vxworks-ppc860" => {
inherit_from => [ "BASE_unix" ],
cc => "ccppc",
cflags => "-nostdinc -msoft-float -DCPU=PPC860 -DNO_STRINGS_H -I\$(WIND_BASE)/target/h",
sys_id => "VXWORKS",
- lflags => "-r",
+ lflags => add("-r"),
},
"vxworks-simlinux" => {
inherit_from => [ "BASE_unix" ],
cc => "ccpentium",
cflags => "-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\" -DL_ENDIAN -DCPU=SIMLINUX -DTOOL_FAMILY=gnu -DTOOL=gnu -fno-builtin -fno-defer-pop -DNO_STRINGS_H -I\$(WIND_BASE)/target/h -I\$(WIND_BASE)/target/h/wrn/coreip -DOPENSSL_NO_HW_PADLOCK",
sys_id => "VXWORKS",
- lflags => "-r",
+ lflags => add("-r"),
ranlib => "ranlibpentium",
},
"vxworks-mips" => {
cflags => combine("-mrtp -mips2 -O -G 0 -B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\" -DCPU=MIPS32 -msoft-float -mno-branch-likely -DTOOL_FAMILY=gnu -DTOOL=gnu -fno-builtin -fno-defer-pop -DNO_STRINGS_H -I\$(WIND_BASE)/target/usr/h -I\$(WIND_BASE)/target/h/wrn/coreip",
threads("-D_REENTRANT")),
sys_id => "VXWORKS",
- ex_libs => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000 -L \$(WIND_BASE)/target/usr/lib/mips/MIPSI32/sfcommon"),
+ lflags => add("-L \$(WIND_BASE)/target/usr/lib/mips/MIPSI32/sfcommon"),
+ ex_libs => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000"),
thread_scheme => "pthreads",
perlasm_scheme => "o32",
ranlib => "ranlibmips",
cc => "gcc",
cflags => "-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall",
sys_id => "MSDOS",
- ex_libs => add("-L/dev/env/WATT_ROOT/lib -lwatt"),
+ lflags => add("-L/dev/env/WATT_ROOT/lib"),
+ ex_libs => add("-lwatt"),
bn_ops => "BN_LLONG",
perlasm_scheme => "a.out",
},
CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -}
CXX= $(CROSS_COMPILE){- $target{cxx} -}
CXXFLAGS={- our $cxxflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cxxflags} -} {- $config{cxxflags} -} -std=c++11
-LDFLAGS= {- $target{lflags} -}
+LDFLAGS= {- $config{lflags} -} {- $target{lflags} -}
PLIB_LDFLAGS= {- $target{plib_lflags} -}
EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -}
LIB_CFLAGS={- $target{shared_cflag} || "" -}
my $libd = dirname($lib);
my $libn = basename($lib);
(my $libname = $libn) =~ s/^lib//;
- my $linklibs = join("", map { my $d = dirname($_);
- my $f = basename($_);
+ my @linkdirs = ();
+ foreach (@{args{deps}}) {
+ my $d = dirname($_);
+ push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
+ }
+ my $linkflags = join("", map { "-L$_ " } @linkdirs);
+ my $linklibs = join("", map { my $f = basename($_);
(my $l = $f) =~ s/^lib//;
- " -L$d -l$l" } @{$args{deps}});
+ " -l$l" } @{$args{deps}});
my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x }
grep { $_ =~ m|\.o$| }
@{$args{objs}};
# simplest, {libname}\$(SHLIB_EXT_IMPORT) for Windows POSIX layers and
# {libname}\$(SHLIB_EXT_SIMPLE) for the Unix platforms.
$target: $deps
- \$(CC) \$(CFLAGS) \$(LIB_CFLAGS) \$(LIB_LDFLAGS)$shared_soname$shared_imp \\
+ \$(CC) \$(CFLAGS) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
-o $target_full$shared_def $objs \\
\$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS)
EOF
my $dso = $args{lib};
my $dsod = dirname($dso);
my $dson = basename($dso);
- my $linklibs = join("", map { my $d = dirname($_);
- my $f = basename($_);
+ my @linkdirs = ();
+ foreach (@{args{deps}}) {
+ my $d = dirname($_);
+ push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
+ }
+ my $linkflags = join("", map { "-L$_ " } @linkdirs);
+ my $linklibs = join("", map { my $f = basename($_);
(my $l = $f) =~ s/^lib//;
- " -L$d -l$l" } @{$args{deps}});
+ " -l$l" } @{$args{deps}});
my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } @{$args{objs}};
my @deps = compute_lib_depends(@{$args{deps}});
my $objs = join(" ", @objs);
my $target = dso($dso);
return <<"EOF";
$target: $objs $deps
- \$(CC) \$(CFLAGS) \$(DSO_CFLAGS) \$(DSO_LDFLAGS) \\
+ \$(CC) \$(CFLAGS) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
-o $target $objs \\
\$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS)
EOF
my $objs = join(" ", map { (my $x = $_) =~ s|\.o$|$objext|; $x }
@{$args{objs}});
my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
+ my @linkdirs = ();
+ foreach (@{args{deps}}) {
+ next if $_ =~ /\.a$/;
+ my $d = dirname($_);
+ push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
+ }
+ my $linkflags = join("", map { "-L$_ " } @linkdirs);
my $linklibs = join("", map { if ($_ =~ /\.a$/) {
" $_";
} else {
- my $d = dirname($_);
my $f = basename($_);
- $d = "." if $d eq $f;
(my $l = $f) =~ s/^lib//;
- " -L$d -l$l"
+ " -l$l"
}
} @{$args{deps}});
my $cmd = '$(CC)';
return <<"EOF";
$bin$exeext: $objs $deps
rm -f $bin$exeext
- \$\${LDCMD:-$cmd} $cmdflags \$(LDFLAGS) \$(BIN_LDFLAGS) -o $bin$exeext $objs \\
+ \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(LDFLAGS) \$(BIN_LDFLAGS) \\
+ -o $bin$exeext $objs \\
\$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS)
EOF
}
$config{openssl_thread_defines}=[];
$config{openssl_sys_defines}=[];
$config{openssl_other_defines}=[];
+my $ldflags="";
my $libs="";
my $target="";
$config{options}="";
{
read_config $1;
}
- elsif (/^-[lL](.*)$/ or /^-Wl,/)
+ elsif (/^-L(.*)$/)
+ {
+ $ldflags.=$_." ";
+ }
+ elsif (/^-l(.*)$/ or /^-Wl,/)
{
$libs.=$_." ";
}
$config{defines} = [];
$config{cflags} = "";
$config{cxxflags} = "";
+$config{lflags} = "";
$config{ex_libs} = "";
$config{shared_ldflag} = "";
}
$config{ex_libs}="$libs$config{ex_libs}" if ($libs ne "");
+$config{lflags}="$config{lflags}$ldflags" if ($ldflags ne "");
# If threads aren't disabled, check how possible they are
unless ($disabled{threads}) {
#print "RANLIB =", $target{ranlib} eq '$(CROSS_COMPILE)ranlib' ?
# "$config{cross_compile_prefix}ranlib" :
# "$target{ranlib}", "\n";
+print "LDFLAGS =$config{lflags} $target{lflags}\n";
print "EX_LIBS =$target{ex_libs} $config{ex_libs}\n";
my %builders = (