Skip to content

Commit

Permalink
Build in 'build' instead of 'OSTYPE-MACHINETYPE'.
Browse files Browse the repository at this point in the history
  • Loading branch information
brianwalenz committed Jul 22, 2020
1 parent ff5d6f7 commit afcb34f
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 38 deletions.
18 changes: 14 additions & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,9 @@ DIR_STACK :=
INCDIRS :=
TGT_STACK :=

# Discover our OS and architecture. These are used to set the BUILD_DIR and TARGET_DIR to
# something more useful than 'build' and '.'.
# Discover our OS and architecture. These were previously used to set
# BUILD_DIR and TARGET_DIR to allow multi-platform builds. DESTDIR will do
# that for us too.

OSTYPE := $(shell echo `uname`)
OSVERSION := $(shell echo `uname -r`)
Expand All @@ -384,6 +385,16 @@ ifeq (${OSTYPE}, SunOS)
endif
endif

# Set paths for building and installing. If DESTDIR doesn't exist, use the
# directory just above us.

ifeq "$(strip ${DESTDIR})" ""
BUILD_DIR := $(realpath ..)/build/obj
TARGET_DIR := $(realpath ..)/build
else
BUILD_DIR := $(DESTDIR)/canu/build/obj
TARGET_DIR := $(DESTDIR)/canu/build
endif

#
# Set compiler and flags based on discovered hardware
Expand All @@ -402,7 +413,6 @@ endif
# BUILDJEMALLOC will enable jemalloc library support.
#


ifeq ($(origin CXXFLAGS), undefined)
ifeq ($(BUILDOPTIMIZED), 1)
else
Expand Down Expand Up @@ -830,7 +840,7 @@ $(shell mkdir -p ${TARGET_DIR}/lib/site_perl/canu)
$(shell mkdir -p ${TARGET_DIR}/share/java/classes)
$(shell mkdir -p ${TARGET_DIR}/bin)
$(info For '${OSTYPE}' '${OSVERSION}' as '${MACHINETYPE}' into '${DESTDIR}${PREFIX}/$(OSTYPE)-$(MACHINETYPE)/{bin,obj}'.)
$(info For '${OSTYPE}' '${OSVERSION}' as '${MACHINETYPE}' into '${TARGET_DIR}/{bin,obj}'.)
$(info Using '$(shell which ${CXX})' version '${GXX_VV}'.)
ifneq ($(origin CXXFLAGSUSER), undefined)
$(info Using user-supplied CXXFLAGS '${CXXFLAGSUSER}'.)
Expand Down
50 changes: 19 additions & 31 deletions src/pipelines/canu/Execution.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ require Exporter;
resetIteration
touch
makeExecutable
getInstallDirectory
getJobIDShellCode
getLimitShellCode
getBinDirectory
Expand Down Expand Up @@ -295,15 +294,15 @@ sub resetIteration ($) {
#
# To make it more trouble, shell scripts need to do all this by themselves.
#
sub getInstallDirectory () {
my $installDir = $FindBin::RealBin;

if ($installDir =~ m!^(.*)/\w+-\w+/bin$!) {
$installDir = $1;
}

return($installDir);
}
#sub getInstallDirectory () {
# my $installDir = ;
#
# if ($installDir =~ m!^(.*)/\w+-\w+/bin$!) {
# $installDir = $1;
# }
#
# return($installDir);
#}


# Emits a block of shell code to parse the grid task id and offset.
Expand Down Expand Up @@ -384,26 +383,22 @@ sub getLimitShellCode () {
# Used inside canu to find where binaries are located.
#
sub getBinDirectory () {
my $installDir = getInstallDirectory();

my $syst = `uname -s`; chomp $syst; # OS implementation
my $arch = `uname -m | sed s/x86_64/amd64/`; chomp $arch; # Hardware platform

my $path = "$installDir/$syst-$arch/bin";
return($FindBin::RealBin);

if (! -d "$path") {
$path = $installDir;
}

return($path);
#my $idir = getInstallDirectory();
#my $path = $idir;
#
#$path = "$idir/bin" if (-d "$idir/bin");
#
#return($path);
}


# Emits a block of shell code to locate binaries during shell scripts. See comments on
# getBinDirectory.
#
sub getBinDirectoryShellCode () {
my $installDir = getInstallDirectory();
my $idir = $FindBin::RealBin;
my $string;

# First, run any preExec command that might exist.
Expand All @@ -418,19 +413,12 @@ sub getBinDirectoryShellCode () {
# Then, setup and report paths.

my $javaPath = getGlobal("java");
my $canu = "\$bin/" . basename($0);
my $canu = "\$bin/" . basename($0); # NOTE: $bin decided at script run time

$string .= "\n";
$string .= "# Path to Canu.\n";
$string .= "\n";
$string .= "syst=`uname -s`\n";
$string .= "arch=`uname -m | sed s/x86_64/amd64/`\n";
$string .= "\n";
$string .= "bin=\"$installDir/\$syst-\$arch/bin\"\n";
$string .= "\n";
$string .= "if [ ! -d \"\$bin\" ] ; then\n";
$string .= " bin=\"$installDir\"\n";
$string .= "fi\n";
$string .= "bin=\"$idir\"\n";
$string .= "\n";
$string .= "# Report paths.\n";
$string .= "\n";
Expand Down
2 changes: 1 addition & 1 deletion src/seqrequester
2 changes: 1 addition & 1 deletion src/utility

0 comments on commit afcb34f

Please sign in to comment.