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:
parent
fbf250af65
commit
7f9631634d
@ -23,7 +23,7 @@
|
|||||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#
|
#
|
||||||
# Script
|
# Script
|
||||||
# MakefileFiles
|
# MakefileOptions
|
||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
# General, easy to use make system for multi-platform development.
|
# General, easy to use make system for multi-platform development.
|
||||||
|
@ -27,10 +27,13 @@
|
|||||||
# makeWmake
|
# makeWmake
|
||||||
#
|
#
|
||||||
# Description
|
# 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 )
|
( cd src && make )
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
@ -28,8 +28,6 @@
|
|||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
# Cleans up the dependency list and add the compilation statement.
|
# 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>
|
# Usage: wmkdep <fileName> | addCompile <fileName>
|
||||||
#
|
#
|
||||||
@ -52,11 +50,11 @@ if [ "$WM_PROJECT_DIR" ]
|
|||||||
then
|
then
|
||||||
sed -e s%$WM_PROJECT_DIR%'$(WM_PROJECT_DIR)'% > $depName
|
sed -e s%$WM_PROJECT_DIR%'$(WM_PROJECT_DIR)'% > $depName
|
||||||
else
|
else
|
||||||
cat > $depName
|
cat > $depName
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$sub" = "java" ]
|
if [ "$sub" = java ]
|
||||||
then
|
then
|
||||||
|
|
||||||
sed -e s%"\(.*\).class.*:"%'$(CLASSES_DIR)/'"\1.class\:"% \
|
sed -e s%"\(.*\).class.*:"%'$(CLASSES_DIR)/'"\1.class\:"% \
|
||||||
|
@ -28,43 +28,36 @@
|
|||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
# Scan the current directory for source files and construct Make/files
|
# 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
|
# Usage : makeFiles
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
if [ -r "Make/files" ]
|
if [ -r Make/files ]
|
||||||
then
|
then
|
||||||
echo "makeFiles: Make/files already exists, exiting"
|
echo "makeFiles: Make/files already exists, exiting"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if [ ! -d "Make" ]
|
|
||||||
then
|
|
||||||
mkdir Make
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rulesPath=$WM_DIR/rules/$WM_ARCH$WM_COMPILER
|
rulesPath=$WM_DIR/rules/$WM_ARCH$WM_COMPILER
|
||||||
|
|
||||||
|
[ -d Make ] || mkdir Make
|
||||||
rm -f Make/files
|
rm -f Make/files
|
||||||
|
|
||||||
dirs=`find . -name "*" -type d -print`
|
dirs=`find . -name "*" -type d -print`
|
||||||
|
|
||||||
for dir in $dirs
|
for dir in $dirs
|
||||||
do
|
do
|
||||||
if [ $dir != "." ]
|
if [ $dir != . ]
|
||||||
then
|
then
|
||||||
baseDirName=`echo $dir | sed 's%^\./%%' | $rulesPath/dirToString`
|
baseDirName=`echo $dir | sed 's%^\./%%' | $rulesPath/dirToString`
|
||||||
baseDir=`echo $dir | sed 's%^\./%%'`
|
baseDir=`echo $dir | sed 's%^\./%%'`
|
||||||
|
|
||||||
if [ $baseDirName != "Make" ]
|
if [ $baseDirName != Make ]
|
||||||
then
|
then
|
||||||
echo $baseDirName " = " $baseDir >> Make/files
|
echo $baseDirName " = " $baseDir >> Make/files
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo >> Make/files
|
echo >> Make/files
|
||||||
@ -86,7 +79,6 @@ done
|
|||||||
|
|
||||||
echo >> Make/files
|
echo >> Make/files
|
||||||
|
|
||||||
pwd=`pwd`
|
echo 'EXE = $(FOAM_APPBIN)/'${PWD##*/} >> Make/files
|
||||||
echo 'EXE = $(FOAM_APPBIN)/'${pwd##*/} >> Make/files
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
@ -28,26 +28,18 @@
|
|||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
# Scan the current directory for options and construct Make/options
|
# 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
|
# Usage : makeOptions
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
if [ -r "Make/options" ]
|
if [ -r Make/options ]
|
||||||
then
|
then
|
||||||
echo "makeOptions: Make/options already exists, exiting"
|
echo "makeOptions: Make/options already exists, exiting"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[ -d Make ] || mkdir Make
|
||||||
if [ ! -d "Make" ]
|
|
||||||
then
|
|
||||||
mkdir Make
|
|
||||||
fi
|
|
||||||
|
|
||||||
rulesPath=$WM_DIR/rules/$WM_ARCH
|
|
||||||
|
|
||||||
rm -f Make/options
|
rm -f Make/options
|
||||||
|
|
||||||
|
@ -27,15 +27,13 @@
|
|||||||
# mkObjectDir
|
# mkObjectDir
|
||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
# Makes a directory hierachy for the given object file
|
# Makes a directory hierarchy 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.
|
|
||||||
#
|
#
|
||||||
# Usage: mkObjectDir <directory>
|
# Usage: mkObjectDir <directory>
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
if [ $# = 1 ]
|
if [ $# -eq 1 ]
|
||||||
then
|
then
|
||||||
if [ ! -d ${1%/*} -a $1 != ${1%/*} ]
|
if [ ! -d ${1%/*} -a $1 != ${1%/*} ]
|
||||||
then
|
then
|
||||||
|
@ -54,7 +54,8 @@ USAGE
|
|||||||
}
|
}
|
||||||
|
|
||||||
# provide immediate help
|
# provide immediate help
|
||||||
if [ "$1" = "-h" -o "$1" = "-help" ]; then
|
if [ "$1" = "-h" -o "$1" = "-help" ]
|
||||||
|
then
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#
|
#
|
||||||
# Script
|
# Script
|
||||||
# wmakeAll
|
# wcleanAll
|
||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
# script that searches all the directories below the current for the
|
# script that searches all the directories below the current for the
|
||||||
@ -32,19 +32,14 @@
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
if [ ! -d bin -o ! -d src ]
|
[ -d bin -a -d src ] || {
|
||||||
then
|
echo "${0##*/}: not in the project top level directory"
|
||||||
echo $0: not in the project top level directory !
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
}
|
||||||
|
|
||||||
|
|
||||||
for dir in lib applications/bin
|
for dir in lib applications/bin
|
||||||
do
|
do
|
||||||
if [ -d $dir ]
|
[ -d $dir ] && rm -rf $dir/*
|
||||||
then
|
|
||||||
rm -rf $dir/*
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
( cd tutorials && ./Allclean )
|
( cd tutorials && ./Allclean )
|
||||||
|
@ -32,18 +32,14 @@
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
if [ ! -d bin -o ! -d src ]
|
[ -d bin -a -d src ] || {
|
||||||
then
|
echo "${0##*/}: not in the project top level directory"
|
||||||
echo $0: not in the project top level directory !
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
}
|
||||||
|
|
||||||
|
|
||||||
for dir in lib applications/bin
|
for dir in lib applications/bin
|
||||||
do
|
do
|
||||||
if [ -d $dir ]
|
[ -d $dir ] && rm -rf $dir/*
|
||||||
rm -rf $dir/*
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
( cd tutorials && ./Allclean )
|
( cd tutorials && ./Allclean )
|
||||||
|
@ -27,44 +27,39 @@
|
|||||||
# wcleanMachine
|
# wcleanMachine
|
||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
# Searches all the directories below the current for the
|
# Searches the directories below the current directory for the object
|
||||||
# object file directories of the specified machine and then deletes them.
|
# file directories of the specified machine type(s) and deletes them
|
||||||
#
|
#
|
||||||
# Usage: wcleanMachine <machineType>
|
# Usage: wcleanMachine <machineType> [ .. <machineTypeN> ]
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
if [ $# = 0 ]
|
if [ $# -eq 0 ]
|
||||||
then
|
then
|
||||||
echo $0: wcleanMachine : Machine type expected, exiting !
|
echo "${0##*/}: Machine type(s) expected, exiting !"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[ -d lib -a -d src ] || {
|
||||||
if [ ! -d lib -o ! -d src ]
|
echo "${0##*/}: not in the project top level directory !"
|
||||||
then
|
|
||||||
echo $0: not in the project top level directory !
|
|
||||||
exit 1
|
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 ]
|
for machType
|
||||||
then
|
do
|
||||||
rm -r lib/$1
|
echo "Cleaning machine type: $machType"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ applications/bin ]
|
find `find . -depth \( -name "Make.[A-Za-z]*" -o -name "Make" \) -type d -print` \
|
||||||
then
|
-depth \( -type d -name "*$machType" -o -name "*$machType$WM_MPLIB" \) -exec rm -r {} \;
|
||||||
if [ -d applications/bin/$1 ]
|
|
||||||
then
|
|
||||||
rm -r applications/bin/$1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
@ -32,14 +32,17 @@
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
if [ ! -d $WM_OPTIONS ]
|
if [ ! -d "$WM_OPTIONS" ]
|
||||||
then
|
then
|
||||||
echo The $WM_OPTIONS directory does not exist, exiting \!
|
echo "The $WM_OPTIONS directory does not exist, exiting"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# change to the $WM_OPTIONS directory
|
# 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
|
# Find and keep macro definitions in files list
|
||||||
grep "=" files > filesMacros
|
grep "=" files > filesMacros
|
||||||
@ -141,5 +144,4 @@ rm files.$$
|
|||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
@ -35,48 +35,34 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
Script=${0##*/}
|
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
|
then
|
||||||
echo "$Script: environment variable $WM_OPTIONS not set, exiting!"
|
echo "$Script: Make directory already exists"
|
||||||
exit 1
|
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
|
|
||||||
else
|
else
|
||||||
mkdir Make
|
mkdir Make
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[ -e Make/files ] || {
|
||||||
|
echo "$Script: Creating files"
|
||||||
|
$WM_DIR/scripts/makeFiles
|
||||||
|
}
|
||||||
|
|
||||||
if [ ! -e "Make/files" ]
|
[ -e Make/options ] || {
|
||||||
then
|
echo "$Script: Creating options"
|
||||||
echo "$Script: Creating files"
|
$WM_DIR/scripts/makeOptions
|
||||||
$WM_DIR/scripts/makeFiles
|
}
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if [ ! -e "Make/options" ]
|
|
||||||
then
|
|
||||||
echo "$Script: Creating options"
|
|
||||||
$WM_DIR/scripts/makeOptions
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user