STYLE: date
[OpenFOAM-2.0.x.git] / bin / tools / foamListBinDirs
blobda2f4d4a374544aa061af01072b3a6bc18bc8d70
1 #!/bin/sh
2 #------------------------------------------------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
7 # \\/ M anipulation |
8 #-------------------------------------------------------------------------------
9 # License
10 # This file is part of OpenFOAM.
12 # OpenFOAM is free software: you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by
14 # the Free Software Foundation, either version 3 of the License, or
15 # (at your option) any later version.
17 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
18 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 # for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 # Script
26 # foamListBinDirs <directory> [archOptions]
28 # Description
29 # Lists directories containing binary files of OpenFOAM
31 # Note
32 # Not normally called directly by the user.
33 #------------------------------------------------------------------------------
34 toolsDir="${0%/*}" # this script is already located in the tools/ directory
36 [ $# -eq 1 -o $# -eq 2 ] || {
37 cat <<USAGE 1>&2
38 Usage : ${0##*/} <packDir> [archOptions]
40 * Lists directories containing binary files for OpenFOAM
42 The value of 'archOptions' normally corresponds to \$WM_OPTIONS
43 The current value of \$WM_OPTIONS = $WM_OPTIONS
45 USAGE
46 exit 1
49 #------------------------------------------------------------------------------
50 packDir="$1"
52 # default to same as $WM_OPTIONS - eg, 'linux64GccDPOpt'
53 archOptions="${2:-$WM_OPTIONS}"
55 [ -n "$archOptions" ] || {
56 echo "Error: no archOptions specified" 1>&2
57 exit 1
60 # base arch (w/o precision, optimization, etc)
61 # same as "$WM_ARCH$WM_COMPILER"
62 archCompiler=$(echo "$archOptions" | sed -e 's@[DS]P.*$@@')
64 # same as $WM_ARCH - eg, 'linux64'
65 # TODO: only works for Gcc, Icc, Clang
66 archOS=$(echo "$archOptions" | sed -e 's@[GI]cc.*$@@' -e 's@Clang.*$@@')
68 # links for 32-bit version, eg convert linux64 -> linux-64
69 arch3264=$(echo "$archOS" | sed -e 's@64@-64@')
72 #------------------------------------------------------------------------------
73 # check for essential directories
74 for dir in \
75 $packDir \
76 $packDir/platforms/$archOptions/bin \
77 $packDir/platforms/$archOptions/lib \
80 [ -d $dir ] || {
81 echo "Error: directory $dir does not exist" 1>&2
82 exit 1
84 done
86 #------------------------------------------------------------------------------
87 # list of directories
88 dirList=$(
89 for dir in \
90 $packDir/platforms/$archOptions/bin \
91 $packDir/platforms/$archOptions/lib \
92 $packDir/wmake/platforms/$archCompiler \
93 $packDir/wmake/platforms/$archOS \
94 $packDir/wmake/rules/General \
95 $packDir/wmake/rules/$archCompiler \
96 $packDir/wmake/rules/$archOS \
99 [ -d $dir ] && echo $dir
100 done
104 cat <<INFO 1>&2
105 -------------------------------------------------------------------------------
106 Packing $archOptions ($archCompiler) port of $packDir
107 archOS = $archOS
108 32bit archOS = $arch3264
110 dirs:
111 $(echo ${dirList:-NONE})
113 INFO
115 echo "$dirList"
117 #------------------------------------------------------------------------------