cleanup wmake scripts

- match comments to names of scripts
  - remove comments about using C-shell (not true anymore)
  - use 'assert' style syntax in places instead of if/then/fi
  - wcleanMachine supports multiple arguments
This commit is contained in:
Mark Olesen 2008-07-18 15:32:10 +02:00
parent fbf250af65
commit 7f9631634d
12 changed files with 90 additions and 132 deletions

View File

@ -23,7 +23,7 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# MakefileFiles
# MakefileOptions
#
# Description
# General, easy to use make system for multi-platform development.

View File

@ -27,10 +27,13 @@
# makeWmake
#
# Description
# Script to build all the system specific parts of wmake
# Script to build all the system-specific parts of wmake
#
#------------------------------------------------------------------------------
# run from this directory only
cd ${0%/*} || exit 1
( cd src && make )
#------------------------------------------------------------------------------

View File

@ -28,8 +28,6 @@
#
# Description
# Cleans up the dependency list and add the compilation statement.
# It has to be written in the C-shell rather than the Bourne shell
# because it uses file name manipulators.
#
# Usage: wmkdep <fileName> | addCompile <fileName>
#
@ -52,11 +50,11 @@ if [ "$WM_PROJECT_DIR" ]
then
sed -e s%$WM_PROJECT_DIR%'$(WM_PROJECT_DIR)'% > $depName
else
cat > $depName
cat > $depName
fi
if [ "$sub" = "java" ]
if [ "$sub" = java ]
then
sed -e s%"\(.*\).class.*:"%'$(CLASSES_DIR)/'"\1.class\:"% \

View File

@ -28,43 +28,36 @@
#
# Description
# Scan the current directory for source files and construct Make/files
# It has to be written in the C-shell rather than the Bourne shell
# because it uses file name manipulators.
#
# Usage : makeFiles
#
#------------------------------------------------------------------------------
if [ -r "Make/files" ]
if [ -r Make/files ]
then
echo "makeFiles: Make/files already exists, exiting"
exit 1
fi
if [ ! -d "Make" ]
then
mkdir Make
echo "makeFiles: Make/files already exists, exiting"
exit 1
fi
rulesPath=$WM_DIR/rules/$WM_ARCH$WM_COMPILER
[ -d Make ] || mkdir Make
rm -f Make/files
dirs=`find . -name "*" -type d -print`
for dir in $dirs
do
if [ $dir != "." ]
then
baseDirName=`echo $dir | sed 's%^\./%%' | $rulesPath/dirToString`
baseDir=`echo $dir | sed 's%^\./%%'`
if [ $dir != . ]
then
baseDirName=`echo $dir | sed 's%^\./%%' | $rulesPath/dirToString`
baseDir=`echo $dir | sed 's%^\./%%'`
if [ $baseDirName != "Make" ]
then
echo $baseDirName " = " $baseDir >> Make/files
fi
fi
if [ $baseDirName != Make ]
then
echo $baseDirName " = " $baseDir >> Make/files
fi
fi
done
echo >> Make/files
@ -86,7 +79,6 @@ done
echo >> Make/files
pwd=`pwd`
echo 'EXE = $(FOAM_APPBIN)/'${pwd##*/} >> Make/files
echo 'EXE = $(FOAM_APPBIN)/'${PWD##*/} >> Make/files
#------------------------------------------------------------------------------

View File

@ -28,26 +28,18 @@
#
# Description
# Scan the current directory for options and construct Make/options
# It has to be written in the C-shell rather than the Bourne shell
# because it uses file name manipulators.
#
# Usage : makeOptions
#
#------------------------------------------------------------------------------
if [ -r "Make/options" ]
if [ -r Make/options ]
then
echo "makeOptions: Make/options already exists, exiting"
exit 1
echo "makeOptions: Make/options already exists, exiting"
exit 1
fi
if [ ! -d "Make" ]
then
mkdir Make
fi
rulesPath=$WM_DIR/rules/$WM_ARCH
[ -d Make ] || mkdir Make
rm -f Make/options

View File

@ -27,15 +27,13 @@
# mkObjectDir
#
# Description
# Makes a directory hierachy for the given object file
# It has to be written in the C-shell rather than the Bourne shell
# because it uses file name manipulators.
# Makes a directory hierarchy for the given object file
#
# Usage: mkObjectDir <directory>
#
#------------------------------------------------------------------------------
if [ $# = 1 ]
if [ $# -eq 1 ]
then
if [ ! -d ${1%/*} -a $1 != ${1%/*} ]
then

View File

@ -54,7 +54,8 @@ USAGE
}
# provide immediate help
if [ "$1" = "-h" -o "$1" = "-help" ]; then
if [ "$1" = "-h" -o "$1" = "-help" ]
then
usage
fi

View File

@ -24,7 +24,7 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# wmakeAll
# wcleanAll
#
# Description
# script that searches all the directories below the current for the
@ -32,19 +32,14 @@
#
#------------------------------------------------------------------------------
if [ ! -d bin -o ! -d src ]
then
echo $0: not in the project top level directory !
[ -d bin -a -d src ] || {
echo "${0##*/}: not in the project top level directory"
exit 1
fi
}
for dir in lib applications/bin
do
if [ -d $dir ]
then
rm -rf $dir/*
fi
[ -d $dir ] && rm -rf $dir/*
done
( cd tutorials && ./Allclean )

View File

@ -32,18 +32,14 @@
#
#------------------------------------------------------------------------------
if [ ! -d bin -o ! -d src ]
then
echo $0: not in the project top level directory !
[ -d bin -a -d src ] || {
echo "${0##*/}: not in the project top level directory"
exit 1
fi
}
for dir in lib applications/bin
do
if [ -d $dir ]
rm -rf $dir/*
fi
[ -d $dir ] && rm -rf $dir/*
done
( cd tutorials && ./Allclean )

View File

@ -27,44 +27,39 @@
# wcleanMachine
#
# Description
# Searches all the directories below the current for the
# object file directories of the specified machine and then deletes them.
# Searches the directories below the current directory for the object
# file directories of the specified machine type(s) and deletes them
#
# Usage: wcleanMachine <machineType>
# Usage: wcleanMachine <machineType> [ .. <machineTypeN> ]
#
#------------------------------------------------------------------------------
if [ $# = 0 ]
if [ $# -eq 0 ]
then
echo $0: wcleanMachine : Machine type expected, exiting !
echo "${0##*/}: Machine type(s) expected, exiting !"
exit 1
fi
if [ ! -d lib -o ! -d src ]
then
echo $0: not in the project top level directory !
[ -d lib -a -d src ] || {
echo "${0##*/}: not in the project top level directory !"
exit 1
fi
find `find . -depth \( -name "Make.[A-Za-z]*" -o -name "Make" \) -type d -print` \
-depth \( -type d -name "*$1" -o -name "*$1$WM_MPLIB" \) -exec rm -r {} \;
#find . -depth -type d \( -name ii_files -o -name Templates.DB \) -exec rm -rf {} \;
}
if [ -d lib/$1 ]
then
rm -r lib/$1
fi
for machType
do
echo "Cleaning machine type: $machType"
if [ applications/bin ]
then
if [ -d applications/bin/$1 ]
then
rm -r applications/bin/$1
fi
fi
find `find . -depth \( -name "Make.[A-Za-z]*" -o -name "Make" \) -type d -print` \
-depth \( -type d -name "*$machType" -o -name "*$machType$WM_MPLIB" \) -exec rm -r {} \;
# find . -depth -type d \( -name ii_files -o -name Templates.DB \) -exec rm -rf {} \;
for dir in lib/$machType applications/bin/$machType
do
[ -d $dir ] && rm -r $dir
done
done
#------------------------------------------------------------------------------

View File

@ -32,14 +32,17 @@
#
#------------------------------------------------------------------------------
if [ ! -d $WM_OPTIONS ]
if [ ! -d "$WM_OPTIONS" ]
then
echo The $WM_OPTIONS directory does not exist, exiting \!
echo "The $WM_OPTIONS directory does not exist, exiting"
exit 1
fi
# change to the $WM_OPTIONS directory
cd $WM_OPTIONS
cd $WM_OPTIONS 2>/dev/null || {
echo "Could not change to directory '$WM_OPTIONS'"
exit 1
}
# Find and keep macro definitions in files list
grep "=" files > filesMacros
@ -141,5 +144,4 @@ rm files.$$
cd ..
#------------------------------------------------------------------------------

View File

@ -35,48 +35,34 @@
#------------------------------------------------------------------------------
Script=${0##*/}
if [ ! "$WM_OPTIONS" ]
#
# check environment variables
#
for check in WM_OPTIONS WM_LINK_LANGUAGE WM_DIR
do
eval test "\$$check" || {
echo "$Script error"
echo " environment variable \$$check not set"
exit 1
}
done
if [ -d Make ]
then
echo "$Script: environment variable $WM_OPTIONS not set, exiting!"
exit 1
fi
if [ ! "$WM_DIR" ]
then
echo "$Script: environment variable $WM_DIR not set"
exit 1
fi
if [ ! "$WM_LINK_LANGUAGE" ]
then
echo "$Script: environment variable $WM_LINK_LANGUAGE not set"
exit 1
fi
if [ -d "Make" ]
then
echo "$Script: Make directory already exists"
exit 1
echo "$Script: Make directory already exists"
exit 1
else
mkdir Make
mkdir Make
fi
[ -e Make/files ] || {
echo "$Script: Creating files"
$WM_DIR/scripts/makeFiles
}
if [ ! -e "Make/files" ]
then
echo "$Script: Creating files"
$WM_DIR/scripts/makeFiles
fi
if [ ! -e "Make/options" ]
then
echo "$Script: Creating options"
$WM_DIR/scripts/makeOptions
fi
[ -e Make/options ] || {
echo "$Script: Creating options"
$WM_DIR/scripts/makeOptions
}
#------------------------------------------------------------------------------