mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-08-07 03:37:02 +00:00
.github
DEMSystems
benchmarks
cmake
doc
solvers
src
thirdParty
Zoltan
SampleCmakeScripts
SampleConfigurationScripts
cmake
config
ax_f90_module_case.m4
ax_f90_module_flag.m4
compile
config.guess
config.sub
depcomp
generate-makeoptions.pl
install-sh
missing
replace-install-prefix.pl
string-replace.pl
strip_dup_incl_paths.pl
strip_dup_libs.pl
tac_arg_check_mpi.m4
tac_arg_config_mpi.m4
tac_arg_enable_export-makefiles.m4
tac_arg_enable_feature.m4
tac_arg_enable_feature_sub.m4
tac_arg_enable_feature_sub_check.m4
tac_arg_enable_option.m4
tac_arg_with_3pl_sub.m4
tac_arg_with_ar.m4
tac_arg_with_flags.m4
tac_arg_with_incdirs.m4
tac_arg_with_libdirs.m4
tac_arg_with_libs.m4
tac_arg_with_package.m4
tac_arg_with_perl.m4
token-replace.pl
wk_fc_get_vendor.m4
zac_arg_config_mpi.m4
zac_arg_with_id.m4
doc
docs
example
siMPI
src
test
CMakeLists.txt
COPYRIGHT_AND_LICENSE
Disclaimer
Known_Problems
Makefile.am
Makefile.export.zoltan.in
Makefile.in
README
README.developer
README.md
ReleaseNotes.txt
VERSION
bootstrap-local
buildlib
configure
configure.ac
siMPI_README.txt
README.md
tutorials
utilities
.gitignore
CMakeLists.txt
LICENSE
README.md
phasicFlowConfig.H.in
70 lines
1.3 KiB
Perl
Executable File
70 lines
1.3 KiB
Perl
Executable File
#!/usr/bin/perl -w
|
|
# This perl script removes duplicate libraries from the right to the left and
|
|
# removes duplicate -L library paths from the left to the right
|
|
use strict;
|
|
|
|
my @all_libs = @ARGV;
|
|
#
|
|
# Move from left to right and remove duplicate -l libraries
|
|
#
|
|
my @cleaned_up_libs_first;
|
|
foreach( reverse @all_libs ) {
|
|
$_ = remove_rel_paths($_);
|
|
if( $_=~/-L/ ) {
|
|
unshift @cleaned_up_libs_first, $_;
|
|
}
|
|
else {
|
|
if( !entry_exists($_,\@cleaned_up_libs_first) ) {
|
|
unshift @cleaned_up_libs_first, $_;
|
|
}
|
|
}
|
|
}
|
|
|
|
#
|
|
# Move from right to left and remove duplicate -L library paths
|
|
#
|
|
my @cleaned_up_libs;
|
|
foreach( @cleaned_up_libs_first ) {
|
|
$_ = remove_rel_paths($_);
|
|
if( !($_=~/-L/) ) {
|
|
push @cleaned_up_libs, $_;
|
|
}
|
|
elsif( !entry_exists($_,\@cleaned_up_libs) ) {
|
|
push @cleaned_up_libs, $_;
|
|
}
|
|
}
|
|
#
|
|
# Print the new list of libraries and paths
|
|
#
|
|
print join( " ", @cleaned_up_libs );
|
|
|
|
#
|
|
# Subroutines
|
|
#
|
|
sub entry_exists {
|
|
my $entry = shift; # String
|
|
my $list = shift; # Reference to an array
|
|
foreach( @$list ) {
|
|
if( $entry eq $_ ) { return 1; }
|
|
}
|
|
return 0;
|
|
}
|
|
#
|
|
sub remove_rel_paths {
|
|
my $entry_in = shift;
|
|
if ($entry_in=~/-L\.\./) {
|
|
return $entry_in;
|
|
}
|
|
my @paths = split("/",$entry_in);
|
|
my @new_paths;
|
|
foreach( @paths ) {
|
|
if( !($_=~/\.\./) ) {
|
|
push @new_paths, $_;
|
|
}
|
|
else {
|
|
pop @new_paths
|
|
}
|
|
}
|
|
return join("/",@new_paths);
|
|
}
|