mirror of
https://github.com/gnustep/tools-make.git
synced 2025-04-23 22:33:28 +00:00
Config/make fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@4353 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b720fd5957
commit
1d1bdf47c7
7 changed files with 378 additions and 236 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
1999-06-03 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* ctool.make: New file for making C tools.
|
||||
* GNUmakefile.in: Install it.
|
||||
* whichlib.pl.in: Bug fixes.
|
||||
* GNUstep.csh.in: Fix up PATHPREFIX expansion
|
||||
(patches and files from from Helge Hess <hh@mdlink.de>)
|
||||
|
||||
* GNustep.sh.in: Insert GNUstep path before PATH.
|
||||
|
||||
1999-06-01 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* executable.template.in: New file to be used as shell script
|
||||
|
|
|
@ -89,7 +89,7 @@ install: all
|
|||
$(INSTALL_PROGRAM) -m 755 opentool $(tooldir); \
|
||||
for f in aggregate.make application.make bundle.make service.make \
|
||||
common.make brain.make library.make rules.make target.make \
|
||||
tool.make test-library.make names.make objc.make \
|
||||
tool.make ctool.make test-library.make names.make objc.make \
|
||||
test-application.make test-tool.make subproject.make \
|
||||
documentation.make MediaBook.func executable.template; do \
|
||||
$(INSTALL_DATA) $$f $(makedir); \
|
||||
|
@ -112,7 +112,7 @@ uninstall:
|
|||
rm -f $(tooldir)/opentool; \
|
||||
for f in aggregate.make application.make bundle.make \
|
||||
common.make brain.make library.make rules.make target.make \
|
||||
tool.make test-library.make names.make objc.make \
|
||||
tool.make ctool.make test-library.make names.make objc.make \
|
||||
test-application.make test-tool.make subproject.make \
|
||||
documentation.make MediaBook.func executable.template; do \
|
||||
rm -f $(makedir)/$$f; \
|
||||
|
|
|
@ -63,9 +63,12 @@ if ( ! ${?GNUSTEP_BUILD_ROOT} ) then
|
|||
if ( ! ${?GNUSTEP_PATHPREFIX_LIST} ) then
|
||||
setenv GNUSTEP_PATHPREFIX_LIST ${GNUSTEP_USER_ROOT}:${GNUSTEP_LOCAL_ROOT}:${GNUSTEP_SYSTEM_ROOT}
|
||||
endif
|
||||
foreach dir $GNUSTEP_PATHPREFIX_LIST
|
||||
setenv PATH $PATH:$dir/Tools
|
||||
set tp = ""
|
||||
foreach dir ( `/bin/sh -c 'IFS=:; for i in ${GNUSTEP_PATHPREFIX_LIST};
|
||||
do echo $i; done'` )
|
||||
set tp=${tp}${dir}/Tools:
|
||||
end
|
||||
setenv PATH ${tp}${PATH}
|
||||
|
||||
source ${GNUSTEP_SYSTEM_ROOT}/Makefiles/ld_lib_path.csh
|
||||
|
||||
|
|
|
@ -68,9 +68,11 @@ if [ -z "$GNUSTEP_PATHPREFIX_LIST" ]; then
|
|||
export GNUSTEP_PATHPREFIX_LIST
|
||||
fi
|
||||
IFS=:
|
||||
temp_path=
|
||||
for dir in $GNUSTEP_PATHPREFIX_LIST; do
|
||||
PATH=$PATH:$dir/Tools
|
||||
temp_path=$temp_path$dir/Tools:
|
||||
done
|
||||
PATH=$temp_path$PATH
|
||||
|
||||
. $GNUSTEP_MAKEFILES/ld_lib_path.sh
|
||||
|
||||
|
|
13
README
13
README
|
@ -70,7 +70,18 @@ upon system startup; add lines similar to these:
|
|||
. /usr/GNUstep/Makefiles/GNUstep.sh
|
||||
|
||||
This will source in the GNUstep.sh file and set the environment
|
||||
variables; thus making them available for all users.
|
||||
variables; thus making them available for all users. Before executing
|
||||
this script, you can setup a default path for searching for tools
|
||||
and apps by defining the variable GNUSTEP_PATHPREFIX_LIST (and exporting
|
||||
it). By defualt, it's set to
|
||||
|
||||
$GNUSTEP_USER_ROOT:$GNUSTEP_LOCAL_ROOT:$GNUSTEP_SYSTEM_ROOT
|
||||
|
||||
which might look something like this:
|
||||
|
||||
~/GNUstep:/usr/GNUstep/Local:/usr/GNUstep
|
||||
|
||||
when all is done.
|
||||
|
||||
Setting up the GNUstep environment for a single user
|
||||
====================================================
|
||||
|
|
116
ctool.make
Normal file
116
ctool.make
Normal file
|
@ -0,0 +1,116 @@
|
|||
#
|
||||
# ctool.make
|
||||
#
|
||||
# Makefile rules to build GNUstep-based command line ctools.
|
||||
#
|
||||
# Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
#
|
||||
# Author: Scott Christley <scottc@net-community.com>
|
||||
#
|
||||
# This file is part of the GNUstep Makefile Package.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this library; see the file COPYING.LIB.
|
||||
# If not, write to the Free Software Foundation,
|
||||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#
|
||||
# The name of the ctools is in the CTOOL_NAME variable.
|
||||
#
|
||||
# xxx We need to prefix the target name when cross-compiling
|
||||
#
|
||||
|
||||
# prevent multiple inclusions
|
||||
ifeq ($(CTOOL_MAKE_LOADED),)
|
||||
CTOOL_MAKE_LOADED=yes
|
||||
|
||||
CTOOL_NAME:=$(strip $(CTOOL_NAME))
|
||||
|
||||
#
|
||||
# Include in the common makefile rules
|
||||
#
|
||||
include $(GNUSTEP_MAKEFILES)/rules.make
|
||||
|
||||
# This is the directory where the ctools get installed. If you don't specify a
|
||||
# directory they will get installed in the GNUstep system root.
|
||||
ifeq ($(TOOL_INSTALLATION_DIR),)
|
||||
TOOL_INSTALLATION_DIR = \
|
||||
$(GNUSTEP_INSTALLATION_DIR)/Tools/$(GNUSTEP_TARGET_DIR)/$(LIBRARY_COMBO)
|
||||
endif
|
||||
|
||||
ifeq ($(INTERNAL_ctool_NAME),)
|
||||
|
||||
internal-all:: $(CTOOL_NAME:=.all.ctool.variables)
|
||||
|
||||
internal-install:: $(CTOOL_NAME:=.install.ctool.variables)
|
||||
|
||||
internal-uninstall:: $(CTOOL_NAME:=.uninstall.ctool.variables)
|
||||
|
||||
internal-clean:: $(CTOOL_NAME:=.clean.ctool.variables)
|
||||
|
||||
internal-distclean:: $(CTOOL_NAME:=.distclean.ctool.variables)
|
||||
|
||||
$(CTOOL_NAME):
|
||||
@$(MAKE) -f $(MAKEFILE_NAME) --no-print-directory --no-keep-going $@.all.ctool.variables
|
||||
|
||||
else
|
||||
|
||||
ALL_TOOL_LIBS = $(ADDITIONAL_TOOL_LIBS) $(AUXILIARY_TOOL_LIBS) \
|
||||
$(TARGET_SYSTEM_LIBS)
|
||||
|
||||
ALL_TOOL_LIBS := \
|
||||
$(shell $(WHICH_LIB_SCRIPT) $(LIB_DIRS_NO_SYSTEM) $(ALL_TOOL_LIBS) \
|
||||
debug=$(debug) profile=$(profile) shared=$(shared) libext=$(LIBEXT) \
|
||||
shared_libext=$(SHARED_LIBEXT))
|
||||
|
||||
#
|
||||
# Compilation targets
|
||||
#
|
||||
internal-ctool-all:: before-$(TARGET)-all $(GNUSTEP_OBJ_DIR) \
|
||||
$(GNUSTEP_OBJ_DIR)/$(INTERNAL_ctool_NAME)$(EXEEXT) after-$(TARGET)-all
|
||||
|
||||
$(GNUSTEP_OBJ_DIR)/$(INTERNAL_ctool_NAME)$(EXEEXT): $(C_OBJ_FILES) $(SUBPROJECT_OBJ_FILES)
|
||||
$(LD) $(ALL_LDFLAGS) $(LDOUT)$@ \
|
||||
$(C_OBJ_FILES) $(SUBPROJECT_OBJ_FILES) \
|
||||
$(ALL_LIB_DIRS) $(ALL_TOOL_LIBS)
|
||||
|
||||
before-$(TARGET)-all::
|
||||
|
||||
after-$(TARGET)-all::
|
||||
|
||||
internal-ctool-install:: internal-ctool-all internal-install-dirs install-ctool
|
||||
|
||||
internal-install-dirs::
|
||||
$(MKDIRS) $(TOOL_INSTALLATION_DIR)
|
||||
|
||||
install-ctool::
|
||||
$(INSTALL_PROGRAM) -m 0755 $(GNUSTEP_OBJ_DIR)/$(INTERNAL_ctool_NAME)$(EXEEXT) \
|
||||
$(TOOL_INSTALLATION_DIR);
|
||||
|
||||
internal-ctool-uninstall::
|
||||
rm -f $(TOOL_INSTALLATION_DIR)/$(INTERNAL_ctool_NAME)$(EXEEXT)
|
||||
|
||||
#
|
||||
# Cleaning targets
|
||||
#
|
||||
internal-ctool-clean::
|
||||
rm -rf $(GNUSTEP_OBJ_DIR)
|
||||
|
||||
internal-ctool-distclean::
|
||||
rm -rf shared_obj static_obj shared_debug_obj shared_profile_obj \
|
||||
static_debug_obj static_profile_obj shared_profile_debug_obj \
|
||||
static_profile_debug_obj
|
||||
|
||||
endif
|
||||
|
||||
endif
|
||||
# ctool.make loaded
|
||||
|
||||
## Local variables:
|
||||
## mode: makefile
|
||||
## End:
|
460
which_lib.pl.in
460
which_lib.pl.in
|
@ -1,230 +1,230 @@
|
|||
#!@PERL@
|
||||
|
||||
$| = 1;
|
||||
|
||||
$shared_extension = "so";
|
||||
$lib_extension = "a";
|
||||
|
||||
@L = ();
|
||||
@l = ();
|
||||
|
||||
%option = (
|
||||
'shared', 1,
|
||||
'debug', 0,
|
||||
'profile', 0,
|
||||
'gc', 0
|
||||
);
|
||||
|
||||
if($ARGV[0] eq "-h" || $ARGV[0] eq '') {
|
||||
print "usage: which_lib.pl -xdebug [-Lpath ...] -llibrary shared=yes|no ";
|
||||
print "debug=yes|no profile=yes|no gc=yes|no\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
for $i (0..$#ARGV) {
|
||||
$arg = $ARGV[$i];
|
||||
# print "ARGUMENT: $arg\n";
|
||||
if ($arg =~ /^-x/) {
|
||||
$arg = substr($arg,2);
|
||||
print "setting debuglevel $arg\n" if $arg > 8;
|
||||
$debug = $arg;
|
||||
}
|
||||
elsif ($arg =~ /^-L/) {
|
||||
$arg = substr($arg,2);
|
||||
print "adding library path $arg\n" if $debug > 8;
|
||||
push(@L, $arg);
|
||||
}
|
||||
elsif ($arg =~ /^-l/) {
|
||||
$arg = substr($arg,2);
|
||||
print "adding lib $arg\n" if $debug > 8;
|
||||
push(@l, $arg);
|
||||
}
|
||||
elsif ($arg =~ /=/ ) {
|
||||
print "parsing option $arg\n" if $debug > 8;
|
||||
|
||||
($key, $value) = split(/=/, $arg);
|
||||
if ($key eq "shared" || $key eq "debug" || $key eq "profile" || $key eq "gc") {
|
||||
if ($value =~ /[yY][eE][sS]/) {
|
||||
$option{$key} = 1;
|
||||
}
|
||||
elsif ($value =~ /[nN][oO]/) {
|
||||
$option{$key} = 0;
|
||||
}
|
||||
else {
|
||||
$option{$key} = 0;
|
||||
# die "unknown value $value for option $key\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
print "usage: which_lib -xdebug [-Lpath ...] -llibrary shared=yes|no ";
|
||||
print "debug=yes|no profile=yes|no\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ($debug > 1) {
|
||||
print "looking for\n", join("\n", @l), "\nin\n", join("\n", @L), "\n\n";
|
||||
print "using options:\n";
|
||||
print " shared: $option{'shared'}\n";
|
||||
print " debug: $option{'debug'}\n";
|
||||
print " profile: $option{'profile'}\n";
|
||||
print " gc: $option{'gc'}\n";
|
||||
}
|
||||
|
||||
foreach $j (0..$#l) {
|
||||
|
||||
$l = $l[$j];
|
||||
|
||||
@possible_libs = ();
|
||||
%pathes = ();
|
||||
|
||||
$preferedlib = '';
|
||||
|
||||
foreach $i (0..$#L) {
|
||||
local($L) = $L[$i];
|
||||
if (!opendir(DIR, $L)) {
|
||||
next;
|
||||
}
|
||||
local(@filenames) = readdir(DIR);
|
||||
closedir(DIR);
|
||||
|
||||
for (@filenames) {
|
||||
next if $_ eq '.';
|
||||
next if $_ eq '..';
|
||||
local ($file) = $_;
|
||||
|
||||
if ($file =~ /\.$shared_extension$/) {
|
||||
$file =~ s/\.$shared_extension$//;
|
||||
}
|
||||
elsif ($file =~ /\.$lib_extension$/) {
|
||||
$file =~ s/\.$lib_extension$//;
|
||||
}
|
||||
else {
|
||||
next; # file is no lib
|
||||
}
|
||||
|
||||
local ($file2) = $file;
|
||||
local ($k) = index($file, '_');
|
||||
|
||||
if ($k != -1) {
|
||||
# startindex to be justified for libraries not starting with 'lib'
|
||||
$file2 = substr($file, 3, $k - 3);
|
||||
}
|
||||
if ($file2 ne $l) { next; }
|
||||
|
||||
if ($file =~ /$l/) {
|
||||
# print "lib $l file $file file2 $file2\n";
|
||||
|
||||
if ($pathes{$file} eq '') {
|
||||
$pathes{$file} = $L;
|
||||
push(@possible_libs, $file);
|
||||
print "found $file in $pathes{$file}\n" if $debug > 1;
|
||||
}
|
||||
else {
|
||||
print "\nWARNING: $file found in \n$pathes{$file} and \n$L \nusing \n$pathes{$file}\n\n" if $debug > 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
print ":$file: don't match :$l:\n" if $debug > 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sharedflag = 'null';
|
||||
$debugflag = 'null';
|
||||
$profileflag = 'null';
|
||||
$gcflag = 'null';
|
||||
|
||||
$preferedlib = '';
|
||||
|
||||
for (@possible_libs) {
|
||||
$mypossiblelib = $_;
|
||||
$myflags = $mypossiblelib;
|
||||
$myflags =~ /([_dpsg]{0,5})$/;
|
||||
$myflags = $1;
|
||||
|
||||
$mysharedflag = 1;
|
||||
$mysharedflag = 0 if $myflags =~ /s/;
|
||||
|
||||
$mydebugflag = 0;
|
||||
$mydebugflag = 1 if $myflags =~ /d/;
|
||||
|
||||
$myprofileflag = 0;
|
||||
$myprofileflag = 1 if $myflags =~ /p/;
|
||||
|
||||
$mygcflag = 0;
|
||||
$mygcflag = 1 if $myflags =~ /g/;
|
||||
|
||||
|
||||
print "flags found in $mypossiblelib: shared=$mysharedflag, debug=$mydebugflag, profile=$myprofileflag, gc=$mygcflag\n" if $debug > 5;
|
||||
|
||||
if($option{'gc'} == mygcflag) {
|
||||
|
||||
if ($preferedlib eq '') {
|
||||
$preferedlib = $mypossiblelib;
|
||||
$sharedflag = $mysharedflag;
|
||||
$debugflag = $mydebugflag;
|
||||
$profileflag = $myprofileflag;
|
||||
$gcflag = $mygcflag;
|
||||
print "set prefered lib to $preferedlib because it was first found\n" if $debug > 0;
|
||||
}
|
||||
|
||||
if($option{'shared'} && $mysharedflag && !$sharedflag) {
|
||||
$preferedlib = $mypossiblelib; $sharedflag = $mysharedflag;
|
||||
$debugflag = $mydebugflag; $profileflag = $myprofileflag;
|
||||
print "set prefered lib to $preferedlib because its first dynamic lib found\n"
|
||||
if $debug > 0;
|
||||
}
|
||||
if(!$option{'shared'} && !$mysharedflag && $sharedflag) {
|
||||
$preferedlib = $mypossiblelib; $sharedflag = $mysharedflag;
|
||||
$debugflag = $mydebugflag; $profileflag = $myprofileflag;
|
||||
print "set prefered lib to $preferedlib because its first static lib found\n"
|
||||
if $debug > 0;
|
||||
}
|
||||
|
||||
if($option{'debug'} && $mydebugflag && !$debugflag) {
|
||||
if(($option{'shared'} ne 'null') && ($mysharedflag == $option{'shared'})) {
|
||||
$preferedlib = $mypossiblelib; $sharedflag = $mysharedflag;
|
||||
$debugflag = $mydebugflag; $profileflag = $myprofileflag;
|
||||
print "set prefered lib to $preferedlib (add debugging)\n" if $debug > 0;
|
||||
}
|
||||
}
|
||||
if(!$option{'debug'} && !$mydebugflag && $debugflag) {
|
||||
if(($option{'shared'} ne 'null') && ($mysharedflag == $option{'shared'})) {
|
||||
$preferedlib = $mypossiblelib; $sharedflag = $mysharedflag;
|
||||
$debugflag = $mydebugflag; $profileflag = $myprofileflag;
|
||||
print "set prefered lib to $preferedlib (disable debugging)\n" if $debug > 0;
|
||||
}
|
||||
}
|
||||
|
||||
if($option{'profile'} && $myprofileflag && !$profileflag) {
|
||||
if(($option{'shared'} ne 'null') && ($mysharedflag == $option{'shared'})) {
|
||||
$preferedlib = $mypossiblelib; $sharedflag = $mysharedflag;
|
||||
$debugflag = $mydebugflag; $profileflag = $myprofileflag;
|
||||
print "set prefered lib to $preferedlib (add profiling)\n" if $debug > 0;
|
||||
}
|
||||
}
|
||||
if(!$option{'profile'} && !$myprofileflag && $profileflag) {
|
||||
if(($option{'shared'} ne 'null') && ($mysharedflag == $option{'shared'})) {
|
||||
$preferedlib = $mypossiblelib; $sharedflag = $mysharedflag;
|
||||
$debugflag = $mydebugflag; $profileflag = $myprofileflag;
|
||||
print "set prefered lib to $preferedlib (disable profiling)\n" if $debug > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
print "$mypossiblelib gc flag not matched.\n" if $debug > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$preferedlib =~ s/^lib//;
|
||||
if ($preferedlib eq '') {
|
||||
print "-l$l\n";
|
||||
}
|
||||
else {
|
||||
print "-l$preferedlib\n";
|
||||
}
|
||||
}
|
||||
|
||||
#!@PERL@
|
||||
|
||||
$| = 1;
|
||||
|
||||
$shared_extension = "so";
|
||||
$lib_extension = "a";
|
||||
|
||||
@L = ();
|
||||
@l = ();
|
||||
|
||||
%option = (
|
||||
'shared', 1,
|
||||
'debug', 0,
|
||||
'profile', 0,
|
||||
'gc', 0
|
||||
);
|
||||
|
||||
if($ARGV[0] eq "-h" || $ARGV[0] eq '') {
|
||||
print "usage: which_lib.pl -xdebug [-Lpath ...] -llibrary shared=yes|no ";
|
||||
print "debug=yes|no profile=yes|no gc=yes|no\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
for $i (0..$#ARGV) {
|
||||
$arg = $ARGV[$i];
|
||||
# print "ARGUMENT: $arg\n";
|
||||
if ($arg =~ /^-x/) {
|
||||
$arg = substr($arg,2);
|
||||
print "setting debuglevel $arg\n" if $arg > 8;
|
||||
$debug = $arg;
|
||||
}
|
||||
elsif ($arg =~ /^-L/) {
|
||||
$arg = substr($arg,2);
|
||||
print "adding library path $arg\n" if $debug > 8;
|
||||
push(@L, $arg);
|
||||
}
|
||||
elsif ($arg =~ /^-l/) {
|
||||
$arg = substr($arg,2);
|
||||
print "adding lib $arg\n" if $debug > 8;
|
||||
push(@l, $arg);
|
||||
}
|
||||
elsif ($arg =~ /=/ ) {
|
||||
print "parsing option $arg\n" if $debug > 8;
|
||||
|
||||
($key, $value) = split(/=/, $arg);
|
||||
if ($key eq "shared" || $key eq "debug" || $key eq "profile" || $key eq "gc") {
|
||||
if ($value =~ /[yY][eE][sS]/) {
|
||||
$option{$key} = 1;
|
||||
}
|
||||
elsif ($value =~ /[nN][oO]/) {
|
||||
$option{$key} = 0;
|
||||
}
|
||||
else {
|
||||
$option{$key} = 0;
|
||||
# die "unknown value $value for option $key\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
print "usage: which_lib -xdebug [-Lpath ...] -llibrary shared=yes|no ";
|
||||
print "debug=yes|no profile=yes|no\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ($debug > 1) {
|
||||
print "looking for\n", join("\n", @l), "\nin\n", join("\n", @L), "\n\n";
|
||||
print "using options:\n";
|
||||
print " shared: $option{'shared'}\n";
|
||||
print " debug: $option{'debug'}\n";
|
||||
print " profile: $option{'profile'}\n";
|
||||
print " gc: $option{'gc'}\n";
|
||||
}
|
||||
|
||||
foreach $j (0..$#l) {
|
||||
|
||||
$l = $l[$j];
|
||||
|
||||
@possible_libs = ();
|
||||
%pathes = ();
|
||||
|
||||
$preferedlib = '';
|
||||
|
||||
foreach $i (0..$#L) {
|
||||
local($L) = $L[$i];
|
||||
if (!opendir(DIR, $L)) {
|
||||
next;
|
||||
}
|
||||
local(@filenames) = readdir(DIR);
|
||||
closedir(DIR);
|
||||
|
||||
for (@filenames) {
|
||||
next if $_ eq '.';
|
||||
next if $_ eq '..';
|
||||
local ($file) = $_;
|
||||
|
||||
if ($file =~ /\.$shared_extension$/) {
|
||||
$file =~ s/\.$shared_extension$//;
|
||||
}
|
||||
elsif ($file =~ /\.$lib_extension$/) {
|
||||
$file =~ s/\.$lib_extension$//;
|
||||
}
|
||||
else {
|
||||
next; # file is no lib
|
||||
}
|
||||
|
||||
local ($file2) = $file;
|
||||
local ($k) = index($file, '_');
|
||||
|
||||
if ($k != -1) {
|
||||
# startindex to be justified for libraries not starting with 'lib'
|
||||
$file2 = substr($file, 3, $k - 3);
|
||||
}
|
||||
if ($file2 ne $l) { next; }
|
||||
|
||||
if ($file =~ /$l/) {
|
||||
# print "lib $l file $file file2 $file2\n";
|
||||
|
||||
if ($pathes{$file} eq '') {
|
||||
$pathes{$file} = $L;
|
||||
push(@possible_libs, $file);
|
||||
print "found $file in $pathes{$file}\n" if $debug > 1;
|
||||
}
|
||||
else {
|
||||
print "\nWARNING: $file found in \n$pathes{$file} and \n$L \nusing \n$pathes{$file}\n\n" if $debug > 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
print ":$file: don't match :$l:\n" if $debug > 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sharedflag = 'null';
|
||||
$debugflag = 'null';
|
||||
$profileflag = 'null';
|
||||
$gcflag = 'null';
|
||||
|
||||
$preferedlib = '';
|
||||
|
||||
for (@possible_libs) {
|
||||
$mypossiblelib = $_;
|
||||
$myflags = $mypossiblelib;
|
||||
$myflags =~ /_([dpsg]{0,5})$/;
|
||||
$myflags = $1;
|
||||
|
||||
$mysharedflag = 1;
|
||||
$mysharedflag = 0 if $myflags =~ /s/;
|
||||
|
||||
$mydebugflag = 0;
|
||||
$mydebugflag = 1 if $myflags =~ /d/;
|
||||
|
||||
$myprofileflag = 0;
|
||||
$myprofileflag = 1 if $myflags =~ /p/;
|
||||
|
||||
$mygcflag = 0;
|
||||
$mygcflag = 1 if $myflags =~ /g/;
|
||||
|
||||
|
||||
print "flags found $myflags in $mypossiblelib: shared=$mysharedflag, debug=$mydebugflag, profile=$myprofileflag, gc=$mygcflag\n" if $debug > 5;
|
||||
|
||||
if($option{'gc'} == mygcflag) {
|
||||
|
||||
if ($preferedlib eq '') {
|
||||
$preferedlib = $mypossiblelib;
|
||||
$sharedflag = $mysharedflag;
|
||||
$debugflag = $mydebugflag;
|
||||
$profileflag = $myprofileflag;
|
||||
$gcflag = $mygcflag;
|
||||
print "set prefered lib to $preferedlib because it was first found\n" if $debug > 0;
|
||||
}
|
||||
|
||||
if($option{'shared'} && $mysharedflag && !$sharedflag) {
|
||||
$preferedlib = $mypossiblelib; $sharedflag = $mysharedflag;
|
||||
$debugflag = $mydebugflag; $profileflag = $myprofileflag;
|
||||
print "set prefered lib to $preferedlib because its first dynamic lib found\n"
|
||||
if $debug > 0;
|
||||
}
|
||||
if(!$option{'shared'} && !$mysharedflag && $sharedflag) {
|
||||
$preferedlib = $mypossiblelib; $sharedflag = $mysharedflag;
|
||||
$debugflag = $mydebugflag; $profileflag = $myprofileflag;
|
||||
print "set prefered lib to $preferedlib because its first static lib found\n"
|
||||
if $debug > 0;
|
||||
}
|
||||
|
||||
if($option{'debug'} && $mydebugflag && !$debugflag) {
|
||||
if(($option{'shared'} ne 'null') && ($mysharedflag == $option{'shared'})) {
|
||||
$preferedlib = $mypossiblelib; $sharedflag = $mysharedflag;
|
||||
$debugflag = $mydebugflag; $profileflag = $myprofileflag;
|
||||
print "set prefered lib to $preferedlib (add debugging)\n" if $debug > 0;
|
||||
}
|
||||
}
|
||||
if(!$option{'debug'} && !$mydebugflag && $debugflag) {
|
||||
if(($option{'shared'} ne 'null') && ($mysharedflag == $option{'shared'})) {
|
||||
$preferedlib = $mypossiblelib; $sharedflag = $mysharedflag;
|
||||
$debugflag = $mydebugflag; $profileflag = $myprofileflag;
|
||||
print "set prefered lib to $preferedlib (disable debugging)\n" if $debug > 0;
|
||||
}
|
||||
}
|
||||
|
||||
if($option{'profile'} && $myprofileflag && !$profileflag) {
|
||||
if(($option{'shared'} ne 'null') && ($mysharedflag == $option{'shared'})) {
|
||||
$preferedlib = $mypossiblelib; $sharedflag = $mysharedflag;
|
||||
$debugflag = $mydebugflag; $profileflag = $myprofileflag;
|
||||
print "set prefered lib to $preferedlib (add profiling)\n" if $debug > 0;
|
||||
}
|
||||
}
|
||||
if(!$option{'profile'} && !$myprofileflag && $profileflag) {
|
||||
if(($option{'shared'} ne 'null') && ($mysharedflag == $option{'shared'})) {
|
||||
$preferedlib = $mypossiblelib; $sharedflag = $mysharedflag;
|
||||
$debugflag = $mydebugflag; $profileflag = $myprofileflag;
|
||||
print "set prefered lib to $preferedlib (disable profiling)\n" if $debug > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
print "$mypossiblelib gc flag not matched.\n" if $debug > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$preferedlib =~ s/^lib//;
|
||||
if ($preferedlib eq '') {
|
||||
print "-l$l\n";
|
||||
}
|
||||
else {
|
||||
print "-l$preferedlib\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue