wmake: General cleanup to improve consistency and maintainability

The Makefiles are now in the makefiles sub-directory

The "-f | -force" option in wmakeLnInclude is now "-u | -update" for
consistency with the other scripts.

The "Usage" entry in the headers is now consistently formatted in all
scripts.
This commit is contained in:
Henry Weller 2015-12-16 18:31:02 +00:00
parent 2647d178fa
commit 5355dbc5fe
19 changed files with 92 additions and 263 deletions

View File

@ -2,7 +2,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
# \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
@ -22,7 +22,7 @@
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# File
# MakefileApps
# wmake/makefiles/apps
#
# Description
# Makefile used by

View File

@ -22,7 +22,7 @@
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# File
# MakefileFiles
# wmake/makefiles/files
#
# Description
# A Makefile for the 'options' and 'files' files, used by wmake

View File

@ -2,7 +2,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
# \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
@ -22,10 +22,10 @@
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# File
# Makefile
# wmake/makefiles/general
#
# Description
# A generic Makefile, used by wmake
# Makefile used by wmake to make dependency files and libs and applications
#
#------------------------------------------------------------------------------

View File

@ -25,6 +25,10 @@
# Script
# wclean
#
# Usage
# wclean [OPTION] [dir]
# wclean [OPTION] target [dir [MakeDir]]
#
# Description
# Clean up the wmake control directory Make/\$WM_OPTIONS and remove the
# lnInclude directories generated for libraries.

View File

@ -1,96 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# wcleanAll
#
# Description
# Deprecated: replaced by wcleanPlatform -all
#
# Search all the directories below the current for the object file
# directories of all machines and delete them.
#
#------------------------------------------------------------------------------
Script=${0##*/}
usage() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
Deprecated: replaced by wcleanPlatform -all
Usage: $Script
Remove all object and related files
USAGE
exit 1
}
#------------------------------------------------------------------------------
# Parse arguments and options
#------------------------------------------------------------------------------
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
*)
usage "unknown option/argument: '$*'"
;;
esac
done
[ "$PWD" = "$WM_PROJECT_DIR" ] \
|| usage "Not in the project top-level directory"
echo "Removing platforms/sub-directories"
rm -rf platforms/*
echo "Cleaning Make sub-directories"
find . -depth \( -name Make -o -name "Make.[A-Za-z]*" \) -type d -print | \
xargs -I {} find '{}' -mindepth 1 -maxdepth 1 -type d -print | \
xargs rm -rf
echo "Removing lnInclude directories"
find . -depth -type d \( -name lnInclude \) -exec rm -rf {} \;
echo "Removing misc files"
find . \( -name exe -o -name log \) -exec rm {} \;
tutorials/Allclean
#------------------------------------------------------------------------------
# Cleanup local variables and functions
#------------------------------------------------------------------------------
unset Script usage
#------------------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
# \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
@ -25,10 +25,13 @@
# Script
# wcleanLnIncludeAll
#
# Usage
# wcleanLnIncludeAll [dir1] .. [dirN]
#
# Description
# Delete all the lnInclude directories in the tree.
#
#------------------------------------------------------------------------------
##------------------------------------------------------------------------------
Script=${0##*/}
# Default to the CWD

View File

@ -1,103 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# wcleanMachine
#
# Description
#
# Deprecated: replaced by wcleanPlatform
#
# Searches the directory tree starting at the current directory for the
# object file directories of the specified machine type(s) and deletes them.
# If a machine type is not provided the current machine type is assumed.
#
# Usage: wcleanMachine [ -current ]
# wcleanMachine <machineType> [ .. <machineTypeN> ]
#
#------------------------------------------------------------------------------
Script=${0##*/}
usage() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
Deprecated: replaced by wcleanPlatform
Usage: $Script machineType [... machineTypeN] [ -current ]
Searches the directory tree starting at the current directory for the
object file directories of the specified machine type(s) and deletes them.
If either -current or no machine type is specified then the current type
is assumed (from $WM_OPTIONS).
USAGE
exit 1
}
# Print help message
if [ "$1" = "-h" -o "$1" = "-help" ]
then
usage
fi
# Get the machines from the arguments
machines="$@"
# If no arguments are provided default to current machine type
if [ "$#" -lt 1 ]
then
machines="-current"
fi
# Loop over all the machine types specified and delete the object directories
for machType in $machines
do
if [ "$machType" = "-current" ]
then
machType="$WM_OPTIONS"
echo "Current machine type: $machType"
[ -n "$machType" ] || continue
fi
echo "Cleaning machine type: $machType"
find . -depth \( -name Make -o -name "Make.[A-Za-z]*" \) -type d -print | \
xargs -I {} find '{}' -mindepth 1 -maxdepth 1 \
\( -type d -name "*$machType" -o -name "*$machType$WM_MPLIB" \) \
-print | xargs rm -rf
rm -rf platforms/${machType}*
done
#------------------------------------------------------------------------------
# Cleanup local variables and functions
#------------------------------------------------------------------------------
unset Script machines
#------------------------------------------------------------------------------

View File

@ -25,24 +25,26 @@
# Script
# wcleanPlatform
#
# Usage
# wcleanPlatform [ -current | -all ]
# wcleanPlatform <platform> [ ... <platformN> ]
#
# Description
# Deletes the specified platforms object files directories from the
# the project top-level platforms directory $WM_PROJECT_DIR.
#
# You need to be in the project top-level directory to run this script.
#
# Options
# -current: clean the current platform
# -all: clean all platforms
#
# If either -current or no platform is specified then the current platform
# $WM_OPTIONS is deleted.
#
# If the -all option is specified all platforms and lnInclude directories
# are deleted
#
# Usage: wcleanPlatform [ -current | -all ]
# wcleanPlatform <platform> [ ... <platformN> ]
#
# -current: clean the current platform
# -all: clean all platforms
#
#------------------------------------------------------------------------------
Script=${0##*/}

View File

@ -23,6 +23,9 @@
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# wdep
#
# Usage
# wdep <file>
# cat `wdep <file>`
#

View File

@ -230,7 +230,7 @@ then
then
# Compile all applications in sub-directories
$make ${WM_CONTINUE_ON_ERROR:+-k} \
-f $WM_DIR/MakefileApps \
-f $WM_DIR/makefiles/apps \
TARGET="$targetType" FOAM_APPS="$FOAM_APPS"
fi
# If the current directory contains a 'Make' directory continue
@ -335,10 +335,11 @@ fi
# Pre-build the $WM_OPTIONS/options file
# which is included when building the $WM_OPTIONS/files file
$make -s -f $WM_DIR/MakefileFiles MAKE_DIR=$MakeDir OBJECTS_DIR=$objectsDir\
$objectsDir/options
$make -s -f $WM_DIR/makefiles/files MAKE_DIR=$MakeDir \
OBJECTS_DIR=$objectsDir $objectsDir/options
$make -s -f $WM_DIR/MakefileFiles MAKE_DIR=$MakeDir OBJECTS_DIR=$objectsDir
$make -s -f $WM_DIR/makefiles/files MAKE_DIR=$MakeDir \
OBJECTS_DIR=$objectsDir
)
@ -363,7 +364,7 @@ case "$targetType" in
# ... but only if 'LIB' is declared in 'Make/files'
if grep -e '^ *LIB *=' "$MakeDir/files" >/dev/null 2>&1
then
$make -s -f $WM_DIR/Makefile MAKE_DIR=$MakeDir \
$make -s -f $WM_DIR/makefiles/general MAKE_DIR=$MakeDir \
OBJECTS_DIR=$objectsDir lnInclude
fi
;;
@ -374,8 +375,8 @@ esac
# Make the dependency files or object files and link
#------------------------------------------------------------------------------
exec $make -f $WM_DIR/Makefile MAKE_DIR=$MakeDir OBJECTS_DIR=$objectsDir \
$targetType
exec $make -f $WM_DIR/makefiles/general MAKE_DIR=$MakeDir \
OBJECTS_DIR=$objectsDir $targetType
#------------------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
# \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
@ -23,6 +23,9 @@
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# wmakeCheckPwd
#
# Usage
# wmakeCheckPwd <dir>
#
# Description

View File

@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
# \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
@ -25,12 +25,13 @@
# Script
# wmakeFilesAndOptions
#
# Usage
# wmakeFilesAndOptions
#
# Description
# Scan current directory for directories and source files
# and construct Make/files and Make/options
#
# Usage : wmakeFilesAndOptions
#
#------------------------------------------------------------------------------
Script=${0##*/}

View File

@ -25,17 +25,17 @@
# Script
# wmakeLnInclude
#
# Usage
# wmakeLnInclude [-u | -update] [-s | -silent] <dir>
#
# Description
# Link all the source files in the <dir> directory into <dir>/lnInclude
#
# Usage: wmakeLnInclude [-f] <dir>
#
# The desired source files:
# *.C *.H *.h *.cpp *.cxx *.hpp *.hxx
#
# Avoid
# *.c (C source)
# .#* (cvs recovered files)
#
#------------------------------------------------------------------------------
Script=${0##*/}
@ -48,14 +48,14 @@ usage() {
Usage: $Script [OPTION] dir
options:
-f | -force force update
-u | -update update
-s | -silent use 'silent' mode (do not echo command)
-help print the usage
Link all the source files in the <dir> into <dir>/lnInclude
Note
The '-f' option forces an update when the lnInclude directory already exists
The '-u' option forces an update when the lnInclude directory already exists
and changes the default linking from 'ln -s' to 'ln -sf'.
USAGE
@ -73,7 +73,7 @@ unset findOpt
# Default 'ln' option
lnOpt="-s"
unset forceUpdate silentOpt
unset update silentOpt
while [ "$#" -gt 0 ]
do
@ -81,8 +81,8 @@ do
-h | -help) # provide immediate help
usage
;;
-f | -force)
forceUpdate=true
-u | -update)
update=true
lnOpt="-sf"
shift
;;
@ -126,7 +126,7 @@ incDir=$baseDir/lnInclude
if [ -d $incDir ]
then
[ "$forceUpdate" = true ] || {
[ "$update" = true ] || {
# echo "$Script error: include directory $incDir already exists" 1>&2
exit 0
}
@ -150,7 +150,7 @@ fi
#------------------------------------------------------------------------------
# Remove any broken links first (this helps when file locations have moved)
#------------------------------------------------------------------------------
find -L . -type l | xargs rm
find -L . -type l | xargs rm -f
#------------------------------------------------------------------------------

View File

@ -25,9 +25,12 @@
# Script
# wmakeLnIncludeAll
#
# Usage
# wmakeLnIncludeAll [dir1 .. dirN]
#
# Description
# Find directories with a 'Make/files' that contains a 'LIB =' directive
# and execute 'wmakeLnInclude -f' for each one
# and execute 'wmakeLnInclude -update' for each one
#
#------------------------------------------------------------------------------
Script=${0##*/}
@ -39,7 +42,7 @@ usage() {
Usage: $Script [dir1 .. dirN]
Find directories with a 'Make/files' that contains a 'LIB =' directive
and execute 'wmakeLnInclude -f' for each one
and execute 'wmakeLnInclude -update' for each one
USAGE
exit 1
@ -90,7 +93,7 @@ do
then
if grep -e '^ *LIB *=' "$MakeDir/files" >/dev/null 2>&1
then
wmakeLnInclude -f $topDir
wmakeLnInclude -update $topDir
elif [ -d "$topDir/lnInclude" ]
then
echo "removing spurious $topDir/lnInclude"

View File

@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
# \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
@ -25,6 +25,9 @@
# Script
# wmakePrintBuild
#
# Usage
# wmakePrintBuild [OPTION]
#
# Description
# Print the version used when building the project
#

View File

@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
# \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
@ -25,20 +25,6 @@
# Script
# wmakeScheduler
#
# Description
# Scheduler for network distributed compilations using wmake.
# - WM_HOSTS contains a list of hosts and number of concurrent processes
# eg,
# export WM_HOSTS="hostA:1 hostB:2 hostC:1"
# - WM_COLOURS contains a list of colours to cycle through
# export WM_COLOURS="black blue green cyan red magenta yellow"
#
# Sources the relevant cshrc/bashrc if not set.
#
# WM_PROJECT_DIR, WM_PROJECT and WM_PROJECT_VERSION will have been set
# before calling this routine.
# FOAM_INST_DIR may possibly have been set (to find installation)
#
# Usage
# wmakeScheduler COMMAND
# run 'COMMAND' on one of the slots listed in WM_HOSTS
@ -47,6 +33,20 @@
# count the total number of slots available in WM_HOSTS
# eg, export WM_NCOMPPROCS=$(wmakeScheduler -count)
#
# Description
# Scheduler for network distributed compilations using wmake.
# - WM_HOSTS contains a list of hosts and number of concurrent processes
# eg,
# export WM_HOSTS="hostA:1 hostB:2 hostC:1"
# - WM_COLOURS contains a list of colours to cycle through
# export WM_COLOURS="black blue green cyan red magenta yellow"
#
# Sources the relevant cshrc/bashrc if not set.
#
# WM_PROJECT_DIR, WM_PROJECT and WM_PROJECT_VERSION will have been set
# before calling this routine.
# FOAM_INST_DIR may possibly have been set (to find installation)
#
#-------------------------------------------------------------------------------
Script=${0##*/}

View File

@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
# \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
@ -25,6 +25,14 @@
# Script
# wmakeSchedulerUptime
#
# Usage
# wmakeSchedulerUptime COMMAND
# run 'COMMAND' on one of the slots listed in WM_HOSTS
#
# wmakeScheduler -count
# count the total number of slots available in WM_HOSTS
# eg, export WM_NCOMPPROCS=$(wmakeScheduler -count)
#
# Description
# Scheduler for network distributed compilations using wmake.
# - WM_HOSTS contains a list of hosts and number of concurrent processes
@ -39,14 +47,6 @@
# before calling this routine.
# FOAM_INST_DIR may possibly have been set (to find installation)
#
# Usage
# wmakeSchedulerUptime COMMAND
# run 'COMMAND' on one of the slots listed in WM_HOSTS
#
# wmakeScheduler -count
# count the total number of slots available in WM_HOSTS
# eg, export WM_NCOMPPROCS=$(wmakeScheduler -count)
#
#-------------------------------------------------------------------------------
Script=${0##*/}

View File

@ -22,7 +22,9 @@
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# Script wrmdep
#
# Usage
# wrmdep [-a | -all | all] [file]
# wrmdep [-o | -old] [dir1 .. dirN]
# wrmdep -update

View File

@ -23,6 +23,9 @@
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# wrmo
#
# Usage
# wrmo [-a | -all | all] [file]
#
# Description