Commit af5e1cc4 authored by Henry Weller's avatar Henry Weller
Browse files

wmakeCollect: Create the makefiles in the platforms directory

parent 26764000
......@@ -347,14 +347,14 @@ scheduler="wmakeCollect"
if [ "$all" = "queue" ]
then
( \
wmakeLnIncludeAll -j$WM_NCOMPPROCS \
&& WM_ID=${PWD////_}.$WM_OPTIONS \
WM_SCHEDULER=$scheduler \
trap '$scheduler -kill' TERM INT; \
$scheduler -clean \
&& wmake -all objects \
&& $scheduler \
( \
wmakeLnIncludeAll -j$WM_NCOMPPROCS \
&& WM_COLLECT_DIR=$WM_PROJECT_DIR/platforms/${WM_OPTIONS}/${PWD////_} \
WM_SCHEDULER=$scheduler \
trap '$scheduler -kill' TERM INT; \
$scheduler -clean \
&& wmake -all objects \
&& $scheduler \
) && wmake -all
exit $?
fi
......
......@@ -50,11 +50,11 @@ Collecting scheduler for fast parallel compilation of large numbers of object
files. Can be used in compiling OpenFOAM by setting the WM_SCHEDULER variable.
When called with a compilation command it is written into a file in the
directory ~.\$WM_PROJECT/.collect/$WM_ID.
directory $WM_COLLECT_DIR.
When called without a command the files in the ~.\$WM_PROJECT/.collect/$WM_ID
are combined into a single Makefile which is passed to make to compile all of
the object files in parallel.
When called without a command the files in the $WM_COLLECT_DIR directory are
combined into a single Makefile which is passed to make to compile all of the
object files efficiently in parallel.
Typical usage for compiling OpenFOAM:
......@@ -92,29 +92,21 @@ do
done
if [ -z "$WM_ID" ]
if [ -z "$WM_COLLECT_DIR" ]
then
echo "$Script error: build ID variable WM_ID not set"
echo "$Script error: WM_COLLECT_DIR not set"
exit 1
fi
# Location of the wmakeCollect makefiles
wmakeCollectDir=$HOME/.$WM_PROJECT/.collect
# Make sure directories exist
mkdir -p $wmakeCollectDir
# Location of the wmakeCollect makefiles for this build
collectDir=$wmakeCollectDir/$WM_ID
# Collected makefile for this build
makefile="$wmakeCollectDir/Makefile.$WM_ID"
makefile="$WM_COLLECT_DIR.Makefile"
# Clean-up files and exit
if [ -n "$cleanup" ]
then
rm -rf $collectDir
rm -rf $WM_COLLECT_DIR
rm -f $makefile
exit 0
fi
......@@ -123,13 +115,13 @@ fi
if [ "$#" -gt 0 ]
then
# Make sure directories exist
mkdir -p $collectDir
mkdir -p $WM_COLLECT_DIR
# The current target
object="${@: -1:1}"
# Create a unique name for the makefile from the object path
file=$collectDir/${object////_}
file=$WM_COLLECT_DIR/${object////_}
# Add the current target to the list of objects
echo "OBJECTS += $object" >> $file
......@@ -140,16 +132,16 @@ then
echo -e "\t${@:1:($#-1)} $object" >> $file
echo >> $file
else
if [ -d $collectDir ]
if [ -d $WM_COLLECT_DIR ]
then
# Collect all the makefiles into a single makefiles for this build
cat $collectDir/* > $makefile
cat $WM_COLLECT_DIR/* > $makefile
# Add a build rule for all of the targets
echo 'all: $(OBJECTS)' >> $makefile
# Clear out all of the target makefiles
rm -rf $collectDir
rm -rf $WM_COLLECT_DIR
# Run make on the collected makefile
make -j $WM_NCOMPPROCS -f $makefile all
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment