BUGFIX: 552fd5fd requires calculation of deflated geometry
[foam-extend-3.2.git] / wmake / wclean
blob15e4e2c467b1232ce044b12ce51d2a07a79a6ee8
1 #!/bin/sh
2 #------------------------------------------------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright held by original author
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 # wclean
29 # Description
30 # Clean up the wmake control directory Make and remove the include
31 # directories generated for libraries.
33 #------------------------------------------------------------------------------
34 Script=${0##*/}
36 usage() {
37 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
38 cat<<USAGE
39 usage: $Script [dir]
40 $Script target [dir [MakeDir]]
42 Clean up the wmake control directory Make and remove the include
43 directories generated for libraries.
45 The targets correspond to a subset of the 'wmake' special targets:
46 all all subdirectories
47 exe cleans dir/Make
48 lib cleans dir/Make and dir/lnInclude
49 libso cleans dir/Make and dir/lnInclude
50 libo cleans dir/Make and dir/lnInclude
52 USAGE
53 exit 1
56 # provide immediate help
57 if [ "$1" = "-h" -o "$1" = "-help" ]
58 then
59 usage
63 #------------------------------------------------------------------------------
64 # check arguments and change to the directory in which to run wmake
65 #------------------------------------------------------------------------------
67 unset dir makeOption
68 MakeDir=Make
70 if [ $# -ge 1 ]
71 then
73 if [ -d "$1" ]
74 then
75 dir=$1
76 else
77 makeOption=$1
80 if [ $# -ge 2 ]
81 then
82 dir=$2
85 # alternative name for the Make sub-directory
86 if [ $# -ge 3 ]
87 then
88 MakeDir=$3
91 if [ "$dir" ]
92 then
93 cd $dir 2>/dev/null || {
94 echo "$Script error: could not change to directory '$dir'" 1>&2
95 exit 1
99 # provide some feedback
100 echo "$Script ${dir:-./}"
103 #------------------------------------------------------------------------------
104 # Recurse the directories tree
105 #------------------------------------------------------------------------------
107 if [ "$makeOption" = all ]
108 then
109 if [ -e Allclean ]
110 then
111 ./Allclean
112 exit $?
113 elif [ ! -d $MakeDir ]
114 then
115 for dir in `find . \( -type d -a -name Make \) -printf "%h "`
117 $0 $dir
118 done
119 exit 0
122 # This is the end of the recursion down the application directories tree
123 # so remove the "all" option so that the call to make builds the application
124 makeOption=
127 #------------------------------------------------------------------------------
128 # Check the existance of the Make directory
129 #------------------------------------------------------------------------------
131 if [ ! -d $MakeDir ]
132 then
133 echo "$Script error: '$MakeDir' directory does not exist" 1>&2
134 exit 1
137 # -----------------------------------------------------------------------------
139 rm -rf $MakeDir/$WM_OPTIONS $MakeDir/classes 2>/dev/null
141 find . -name "*.dep" -exec rm {} \;
143 case "$makeOption" in
144 lib | libso | libo )
145 rm -rf lnInclude 2>/dev/null
147 esac
149 rm -rf ii_files Templates.DB 2>/dev/null
150 rm -f so_locations
152 #------------------------------------------------------------------------------