summaryrefslogtreecommitdiff
path: root/make/unit-cc.pl
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2016-09-11 21:19:28 +0100
committerPeter Powell <petpow@saberuk.com>2016-09-16 04:23:56 +0100
commit806e57433a38193ae14942ee60f573fe47f4b643 (patch)
treed02a60dca483d429505f77d74fb349552f57f7ff /make/unit-cc.pl
parent6c98c2987402d9e9310cad9af1bab523bd60cb51 (diff)
Rewrite the build system directive parser.
Diffstat (limited to 'make/unit-cc.pl')
-rwxr-xr-xmake/unit-cc.pl18
1 files changed, 11 insertions, 7 deletions
diff --git a/make/unit-cc.pl b/make/unit-cc.pl
index f04423ce3..1cf6cf866 100755
--- a/make/unit-cc.pl
+++ b/make/unit-cc.pl
@@ -29,16 +29,14 @@ use warnings FATAL => qw(all);
use File::Spec::Functions qw(abs2rel);
-use make::configure;
use make::console;
+use make::directive;
chdir $ENV{BUILDPATH};
my $type = shift;
my $out = shift;
-our %config = read_configure_cache();
-
if ($type eq 'gen-ld') {
do_static_find(@ARGV);
} elsif ($type eq 'static-ld') {
@@ -67,10 +65,16 @@ sub message($$$) {
}
}
+sub rpath($) {
+ my $message = shift;
+ $message =~ s/-L(\S+)/-Wl,-rpath,$1 -L$1/g unless defined $ENV{INSPIRCD_DISABLE_RPATH};
+ return $message;
+}
+
sub do_static_find {
my @flags;
for my $file (@ARGV) {
- push @flags, get_property($file, 'LinkerFlags');
+ push @flags, rpath(get_directive($file, 'LinkerFlags', ''));
}
open F, '>', $out;
print F join ' ', @flags;
@@ -106,7 +110,7 @@ sub do_core_link {
sub do_link_dir {
my ($dir, $link_flags) = (shift, '');
for my $file (<$dir/*.cpp>) {
- $link_flags .= get_property($file, 'LinkerFlags') . ' ';
+ $link_flags .= rpath(get_directive($file, 'LinkerFlags', '')) . ' ';
}
my $execstr = "$ENV{CXX} -o $out $ENV{PICLDFLAGS} $link_flags @_";
message 'LINK', $out, $execstr;
@@ -119,7 +123,7 @@ sub do_compile {
my $flags = '';
my $libs = '';
if ($do_compile) {
- $flags = $ENV{CORECXXFLAGS} . ' ' . get_property($file, 'CompileFlags');
+ $flags = $ENV{CORECXXFLAGS} . ' ' . get_directive($file, 'CompilerFlags', '');
if ($file =~ m#(?:^|/)((?:m|core)_[^/. ]+)(?:\.cpp|/.*\.cpp)$#) {
$flags .= ' -DMODNAME=\\"'.$1.'\\"';
@@ -128,7 +132,7 @@ sub do_compile {
if ($do_link) {
$flags = join ' ', $flags, $ENV{PICLDFLAGS};
- $libs = get_property($file, 'LinkerFlags');
+ $libs = rpath(get_directive($file, 'LinkerFlags', ''));
} else {
$flags .= ' -c';
}