Skip to content
Snippets Groups Projects
Commit bbc43dd6 authored by Henry Weller's avatar Henry Weller
Browse files

wmakeCollect: Create the makefiles in the platforms directory

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