sicortex
[OpenFOAM-1.5.x.git] / etc / bashrc
blobdecc342bcaffa43c36e9e4a5631d8e59b597dce4
1 #----------------------------------*-sh-*--------------------------------------
2 # =========                 |
3 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4 #  \\    /   O peration     |
5 #   \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6 #    \\/     M anipulation  |
7 #------------------------------------------------------------------------------
8 # License
9 #     This file is part of OpenFOAM.
11 #     OpenFOAM is free software; you can redistribute it and/or modify it
12 #     under the terms of the GNU General Public License as published by the
13 #     Free Software Foundation; either version 2 of the License, or (at your
14 #     option) any later version.
16 #     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 #     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 #     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19 #     for more details.
21 #     You should have received a copy of the GNU General Public License
22 #     along with OpenFOAM; if not, write to the Free Software Foundation,
23 #     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 # Script
26 #     etc/bashrc
28 # Description
29 #     Startup file for OpenFOAM
30 #     Sourced from ~/.profile or ~/.bashrc
31 #     Should be usable by any POSIX-compliant shell (eg, ksh)
33 #------------------------------------------------------------------------------
35 export WM_PROJECT=OpenFOAM
36 #export WM_PROJECT_VERSION=1.5.x
37 : ${WM_PROJECT_VERSION:=dev}; export WM_PROJECT_VERSION
40 #!!User:
41 #    either set $FOAM_INST_DIR before sourcing this file or set
42 #    $foamInstall below to where OpenFOAM is installed
44 # Location of FOAM installation
45 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46 foamInstall=$HOME/$WM_PROJECT
47 # foamInstall=~$WM_PROJECT
48 # foamInstall=/usr/local/$WM_PROJECT
49 # foamInstall=/opt/$WM_PROJECT
51 : ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR
54 # Location of site/user files
55 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~
56 export WM_PROJECT_INST_DIR=$FOAM_INST_DIR
57 export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
58 export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
61 # Location of third-party software
62 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63 export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty
66 # Operating System/Platform from Unix or MSWindows
67 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 # WM_OS = Unix | MSWindows
69 : ${WM_OS:=Unix}; export WM_OS
72 # Compiler: set to Gcc, Gcc43 or Icc (for Intel's icc)
73 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74 : ${WM_COMPILER:=Gcc}; export WM_COMPILER
76 export WM_COMPILER_ARCH=
77 export WM_COMPILER_LIB_ARCH=
80 # Compilation options (architecture, precision, optimised, debug or profiling)
81 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
82 # WM_ARCH_OPTION = 32 | 64
83 : ${WM_ARCH_OPTION:=64}; export WM_ARCH_OPTION
85 # WM_PRECISION_OPTION = DP | SP
86 : ${WM_PRECISION_OPTION:=DP}; export WM_PRECISION_OPTION
88 # WM_COMPILE_OPTION = Opt | Debug | Prof
89 : ${WM_COMPILE_OPTION:=Opt}; export WM_COMPILE_OPTION
91 # WM_JAVAC_OPTION = Opt | Debug
92 : ${WM_JAVAC_OPTION:=Opt}; export WM_JAVAC_OPTION
94 # WM_MPLIB = | OPENMPI| LAM | MPICH | MPICH-GM | HPMPI | GAMMA | MPI
95 : ${WM_MPLIB:=OPENMPI}; export WM_MPLIB
98 # Run options (floating-point signal handling and memory initialisation)
99 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
100 export FOAM_SIGFPE=
101 # export FOAM_SETNAN=
104 # Detect system type and set environment variables appropriately
105 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106 export WM_ARCH=`uname -s`
108 case $WM_ARCH in
109 Linux)
110     WM_ARCH=linux
112     # compiler specifics
113     case `uname -m` in
114     i686)
115         ;;
117     x86_64)
118         case $WM_ARCH_OPTION in
119         32)
120             export WM_COMPILER_ARCH='-64'
121             export WM_CC='gcc'
122             export WM_CXX='g++'
123             export WM_CFLAGS='-m32 -fPIC'
124             export WM_CXXFLAGS='-m32 -fPIC'
125             export WM_LDFLAGS='-m32'
126             ;;
127         64)
128             WM_ARCH=linux64
129             export WM_COMPILER_LIB_ARCH=64
130             export WM_CC='gcc'
131             export WM_CXX='g++'
132             export WM_CFLAGS='-m64 -fPIC'
133             export WM_CXXFLAGS='-m64 -fPIC'
134             export WM_LDFLAGS='-m64'
135             ;;
136         *)
137             echo Unknown WM_ARCH_OPTION $WM_ARCH_OPTION, should be 32 or 64
138             ;;
139         esac
140         ;;
141     ia64)
142         WM_ARCH=linuxIA64
143         export WM_COMPILER=I64
144         ;;
145     mips64)
146         WM_ARCH=SiCortex64
147         export WM_COMPILER_LIB_ARCH=64
148         export WM_CC='gcc'
149         export WM_CXX='g++'
150         export WM_CFLAGS='-mabi=64 -fPIC'
151         export WM_CXXFLAGS='-mabi=64 -fPIC'
152         export WM_LDFLAGS='-mabi=64 -G0'
153         export WM_MPLIB=MPI
154         ;;
155     *)
156         echo Unknown processor type `uname -m` for Linux
157         ;;
158     esac
159     ;;
161 *)      # an unsupported operating system
162     cat <<USAGE
164     Your "$WM_ARCH" operating system is not supported by this release
165     of OpenFOAM. For further assistance, please contact www.openfoam.org
167 USAGE
168     ;;
169 esac
172 # Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH)
173 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
174 cleanProg=$WM_PROJECT_DIR/bin/foamCleanPath
176 # Remove anything under top-level foam directory
177 wildCards="$WM_PROJECT_INST_DIR $HOME/$WM_PROJECT/$USER"
179 #- Clean path/PATH
180 cleanPath=`$cleanProg "$PATH" "$wildCards"` && PATH="$cleanPath"
182 #- Clean LD_LIBRARY_PATH
183 cleanPath=`$cleanProg "$LD_LIBRARY_PATH" "$wildCards"` && LD_LIBRARY_PATH="$cleanPath"
185 #- Clean MANPATH
186 cleanPath=`$cleanProg "$MANPATH" "$wildCards"` && MANPATH="$cleanPath"
188 export PATH LD_LIBRARY_PATH MANPATH
190 # Source project setup files
191 # ~~~~~~~~~~~~~~~~~~~~~~~~~~
192 _foamSource()
194    while [ $# -ge 1 ]
195    do
196       [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1"
197       . $1
198       shift
199    done
203 _foamSource $WM_PROJECT_DIR/etc/settings.sh
204 _foamSource $WM_PROJECT_DIR/etc/aliases.sh
207 # Source user setup files for optional packages
208 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
209 # _foamSource $WM_PROJECT_DIR/etc/apps/paraview/bashrc
210 _foamSource $WM_PROJECT_DIR/etc/apps/paraview3/bashrc
211 # _foamSource $WM_PROJECT_DIR/etc/apps/ensightFoam/bashrc
212 _foamSource $WM_PROJECT_DIR/etc/apps/cint/bashrc
215 # Again clean environment (path, PATH, MANPATH, LD_LIBRARY_PATH)
216 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
217 #- Clean path/PATH. Only remove duplicates
218 cleanPath=`$cleanProg "$PATH"` && PATH="$cleanPath"
220 #- Clean LD_LIBRARY_PATH
221 cleanPath=`$cleanProg "$LD_LIBRARY_PATH"` && LD_LIBRARY_PATH="$cleanPath"
223 #- Clean MANPATH
224 cleanPath=`$cleanProg "$MANPATH"` && MANPATH="$cleanPath"
226 export PATH LD_LIBRARY_PATH MANPATH
228 #- Clean LD_PRELOAD
229 if [ "$LD_PRELOAD" != "" ]; then
230     cleanPath=`$cleanProg "$LD_PRELOAD"` && LD_PRELOAD="$cleanPath"
231     export LD_PRELOAD
235 # cleanup environment:
236 # ~~~~~~~~~~~~~~~~~~~~
237 unset cleanPath cleanProg foamInstall
238 unset _foamSource
240 # -----------------------------------------------------------------------------