mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
wmakeCollect: Create the makefiles in the platforms directory
This commit is contained in:
@ -349,7 +349,7 @@ if [ "$all" = "queue" ]
|
||||
then
|
||||
( \
|
||||
wmakeLnIncludeAll -j$WM_NCOMPPROCS \
|
||||
&& WM_ID=${PWD////_}.$WM_OPTIONS \
|
||||
&& WM_COLLECT_DIR=$WM_PROJECT_DIR/platforms/${WM_OPTIONS}/${PWD////_} \
|
||||
WM_SCHEDULER=$scheduler \
|
||||
trap '$scheduler -kill' TERM INT; \
|
||||
$scheduler -clean \
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user