diff --git a/wmake/wmake b/wmake/wmake index 08f62e1375c2f07e4da5807ac0982a44afda0fde..40afa34cf318befb613cc97a070e8bb989943cc3 100755 --- a/wmake/wmake +++ b/wmake/wmake @@ -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 diff --git a/wmake/wmakeCollect b/wmake/wmakeCollect index 99c7413ae701523eb8eb01da0083fbab263fa01e..5f9c095f78cf765a364948564e07c3ec087978f9 100755 --- a/wmake/wmakeCollect +++ b/wmake/wmakeCollect @@ -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