Merge branch 'master' of ssh://opencfd@repo.or.cz/srv/git/OpenFOAM-1.6.x
[OpenFOAM-1.6.x.git] / wmake / wmakeLnIncludeAll
blob07d7df7c5963dc33ca01abf0a434052747c7df28
1 #!/bin/sh
2 #------------------------------------------------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright (C) 1991-2009 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 the
14 # Free Software Foundation; either version 2 of the License, or (at your
15 # 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, write to the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 # Script
27 # wmakeLnIncludeAll
29 # Description
30 # Find directories with a 'Make/files' that contains a 'LIB =' directive
31 # and execute 'wmakeLnInclude -f' for each one
33 #------------------------------------------------------------------------------
34 usage() {
35 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
36 cat<<USAGE
38 usage: ${0##*/} [dir1 .. dirN]
40 Find directories with a 'Make/files' that contains a 'LIB =' directive
41 and execute 'wmakeLnInclude -f' for each one
43 USAGE
44 exit 1
47 #------------------------------------------------------------------------------
48 findName=lnInclude
50 # simple parse options
51 while [ "$#" -gt 0 ]
53 case "$1" in
54 -h | -help) # provide immediate help
55 usage
57 -*)
58 usage "unknown option: '$*'"
61 break
63 esac
64 done
67 # default to searching from pwd
68 [ "$#" -gt 0 ] || set -- .
70 for checkDir
72 if [ -d $checkDir ]
73 then
74 echo "searching: $checkDir for 'Make' directories"
75 echo "---------"
76 else
77 echo "skipping non-dir: $checkDir"
78 echo "----------------"
79 continue
82 find $checkDir -depth -type d -name Make -print | while read makeDir
84 topDir=${makeDir%/Make} # trim /Make from the end
85 if [ -d "$topDir" ]
86 then
87 if grep -e '^ *LIB *=' "$makeDir/files" >/dev/null 2>&1
88 then
89 wmakeLnInclude -f $topDir
90 elif [ -d "$topDir/lnInclude" ]
91 then
92 echo "removing spurious $topDir/lnInclude"
93 rm -rf "$topDir/lnInclude"
96 done
97 done
99 #------------------------------------------------------------------------------