2 #------------------------------------------------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
8 #-------------------------------------------------------------------------------
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
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/>.
29 # Clean up the wmake control directory Make/\$WM_OPTIONS and remove the
30 # lnInclude directories generated for libraries.
32 #------------------------------------------------------------------------------
36 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
39 Usage: $Script [OPTION] [dir]
40 $Script [OPTION] target [dir [MakeDir]]
43 -s | -silent ignored - for compatibility with wmake
46 Clean up the wmake control directory Make/\$WM_OPTIONS and remove the
47 lnInclude directories generated for libraries.
49 The targets correspond to a subset of the 'wmake' special targets:
50 all all subdirectories, uses any Allwclean or Allclean
52 exe | lib | libo | libso
53 clean Make, any *.dep files and lnInclude directories
67 -s |
-silent) # ignored - for compatibility with wmake
71 usage
"unknown option: '$*'"
80 #------------------------------------------------------------------------------
81 # check arguments and change to the directory in which to run wclean
82 #------------------------------------------------------------------------------
97 # specified directory name:
98 [ $# -ge 2 ] && dir
=$2
100 # specified alternative name for the Make sub-directory:
101 [ $# -ge 3 ] && MakeDir
=$3
105 cd $dir 2>/dev
/null ||
{
106 echo "$Script error: could not change to directory '$dir'" 1>&2
111 # provide some feedback
112 echo "$Script ${dir:-./}"
115 #------------------------------------------------------------------------------
116 # Recurse the directories tree
117 #------------------------------------------------------------------------------
119 if [ "$makeType" = all
]
121 if [ -e Allwclean
] # consistent with Allwmake
125 elif [ -e Allclean
] # often used for tutorial cases
129 elif [ ! -d $MakeDir ]
131 for dir
in `find . \( -type d -a -name Make \)`
133 $0 ${dir%/Make} # parent directory - trim /Make from the end
139 # makeType is not needed beyond this point
143 #------------------------------------------------------------------------------
144 # Require the existence of the 'Make' directory
145 #------------------------------------------------------------------------------
148 echo "$Script error: '$MakeDir' directory does not exist" 1>&2
153 # -----------------------------------------------------------------------------
155 rm -rf $MakeDir/$WM_OPTIONS $MakeDir/classes
2>/dev
/null
157 find .
-name "*.dep" -exec rm {} \
;
159 # always safe to remove lnInclude
160 rm -rf lnInclude
2>/dev
/null
162 rm -rf ii_files Templates.DB
2>/dev
/null
163 rm -f so_locations
2>/dev
/null
165 #------------------------------------------------------------------------------