diff --git a/src/Allwmake b/src/Allwmake index f3c927a490..58ad2e09a3 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -30,19 +30,19 @@ Mingw*) # 2nd pass: link Pstream.dll against libOpenFOAM.dll Pstream/Allwmake $targetType $* - # Relink libOpenFOAM.dll against libPstream.dll - wrmo OpenFOAM/global/global.o 2>/dev/null - wmake $targetType OpenFOAM + # Force relink libOpenFOAM.dll against libPstream.dll + OpenFOAM/Alltouch 2>/dev/null ;; *) Pstream/Allwmake $targetType $* - # Trigger update of version info (as required) - wmakeBuildInfo -check || wrmo OpenFOAM/global/global.o 2>/dev/null - wmake $targetType OpenFOAM + # Update version info (as required) + OpenFOAM/Alltouch -check 2>/dev/null ;; esac +wmake $targetType OpenFOAM + wmake $targetType fileFormats wmake $targetType surfMesh wmake $targetType meshTools diff --git a/src/OpenFOAM/Alltouch b/src/OpenFOAM/Alltouch new file mode 100755 index 0000000000..d5e62df883 --- /dev/null +++ b/src/OpenFOAM/Alltouch @@ -0,0 +1,24 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +#------------------------------------------------------------------------------ +touch=true + +case "$1" in +-check) + if wmakeBuildInfo -check + then + unset touch + fi +;; +esac + +if [ -n "$touch" ] +then + # Triggers update of version info + wrmo global/global.Cver 2>/dev/null +fi + +exit 0 # clean exit + +#------------------------------------------------------------------------------ diff --git a/wmake/wmakeBuildInfo b/wmake/wmakeBuildInfo index cb86b267d0..106840eb4c 100755 --- a/wmake/wmakeBuildInfo +++ b/wmake/wmakeBuildInfo @@ -55,9 +55,9 @@ options: -diff Display differences between make and meta information (exit code 0 for no changes) -dry-run In combination with -update + -filter FILE Filter @API@, @BUILD@ tags in file with make information + -remove Remove meta-info build information and exit -update Update meta-info from make information - -filter FILE Filter/replace @API@, @BUILD@ tags in specified file - with corresponding make information -query Report make-info and meta-info -query-make Report make-info values (api, branch, build) -query-meta Report meta-info values (api, branch, build) @@ -105,6 +105,10 @@ do -dry-run) optDryRun=true ;; + -remove) + optUpdate=remove + break # Stop now + ;; -update) optUpdate=true ;; @@ -132,10 +136,31 @@ do shift done +# Check environment variables +[ -d "$WM_PROJECT_DIR" ] || \ + die "Bad or unset environment variable: \$WM_PROJECT_DIR" + +[ -d "$WM_PROJECT_DIR/META-INFO" ] || \ + die "No META-INFO/ directory for project" + + #------------------------------------------------------------------------------ -if [ "$optFilter" = true ] +if [ "$optUpdate" = remove ] then + + if [ -f "$metaInfoDir/build-info" ] + then + echo "Removing project META-INFO/build-info" 1>&2 + rm -f "$metaInfoDir/build-info" 2>/dev/null + else + echo "Already removed project META-INFO/build-info" 1>&2 + fi + exit 0 + +elif [ "$optFilter" = true ] +then + [ -f "$1" ] || { echo "Error in ${0##*/}: file not found '$1'" 1>&2 exit 2 @@ -143,7 +168,9 @@ then # Disable other methods that generate output to stdout unset optCheck optQuery + else + [ "$#" -eq 0 ] || die "Unexpected option/arguments $@" # Nothing specified? Default to -query-make @@ -151,6 +178,7 @@ else then optQuery="make" fi + fi diff --git a/wmake/wrmdep b/wmake/wrmdep index 68c7076101..a9ecc37686 100755 --- a/wmake/wrmdep +++ b/wmake/wrmdep @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # | Copyright (C) 2015-2016 OpenFOAM Foundation @@ -65,9 +65,9 @@ Usage: $Script [-a | -all | all] [file1 [..fileN]] - Remove all .dep files or remove .dep files referring to - With the -a/-all/all option the .dep files are removed for all - platforms rather than just the current platform ($WM_OPTIONS). + Remove all .dep files or remove .dep files referring to . + With the 'all' option the .dep files are removed for all platforms + rather than just the current platform ($WM_OPTIONS). $Script [-o | -old] [dir1 [..dirN]] @@ -79,9 +79,9 @@ $Script [-o | -old] [dir1 [..dirN]] $Script -update - Search all the "src" and "application" directories of the project for - broken symbolic links for source code files and then remove all .dep - files that relate to files that no longer exist. + Search "src" and "application" directories of the project for broken + symbolic links for source code files and remove all .dep files related + to files that no longer exist. Must be executed in the project top-level directory: $WM_PROJECT_DIR @@ -98,27 +98,22 @@ USAGE rmdepMode=files # Default to processing only the current platform -unset all +unset platform while [ "$#" -gt 0 ] do case "$1" in - # Print help -h | -help*) usage ;; - # All platforms - -a | -all | all) - all=all - shift + -a | -all | all) # All platforms + platform=all ;; -o | -old) rmdepMode=oldFolders - shift ;; -update) rmdepMode=updateMode - shift ;; -*) usage "unknown option: '$1'" @@ -127,13 +122,14 @@ do break ;; esac + shift done -#------------------------------------------------------------------------------ # Check environment variables checkEnv +#------------------------------------------------------------------------------ case "$rmdepMode" in files) @@ -143,22 +139,21 @@ files) objectsDir=$(findObjectDir .) || exit 1 # Fatal - # With the -a/-all option replace the current platform with a wildcard - if [ "$all" = all ] + # With -a/-all option: replace the current platform with a wildcard + if [ "$platform" = all ] then - objectsDir=$(echo $objectsDir | sed s%$WM_OPTIONS%*% ) + objectsDir=$(echo "$objectsDir" | sed "s%$WM_OPTIONS%*%") fi if [ "$#" -eq 0 ] then - echo "removing all .dep files ..." - find $objectsDir -name '*.dep' -type f -delete -print + echo "Removing all .dep files ..." 1>&2 + find "$objectsDir" -name '*.dep' -type f -delete -print else - echo "removing .o files corresponding to" - echo " $@ ..." + echo "Removing .dep files for: $*" 1>&2 for file do - find $objectsDir -name '*.dep' -type f \ + find "$objectsDir" -name '*.dep' -type f \ -exec grep -q "$file" {} \; -delete -print done fi @@ -168,29 +163,29 @@ oldFolders) # Default is the current directory [ "$#" -gt 0 ] || set -- . - echo "Removing dep files that refer to source files that no longer exist..." + echo "Removing dep files for non-existent source files ..." 1>&2 for checkDir do - objectsDir=$(findObjectDir $checkDir) + objectsDir=$(findObjectDir "$checkDir") if [ -d "$objectsDir" ] then - echo " searching: $objectsDir" + echo " searching: $objectsDir" 1>&2 else - echo " skipping non-dir: $objectsDir" + echo " skipping non-dir: $objectsDir" 1>&2 continue fi - find $objectsDir -name '*.dep' -type f -print | while read depFile + find "$objectsDir" -name '*.dep' -type f -print | while read depFile do - sourceFile=$(depToSource $depFile) + sourceFile=$(depToSource "$depFile") # Check C++ or Flex source file exists if [ ! -r "$sourceFile" ] then - echo " rm $depFile" - rm -f $depFile 2>/dev/null + echo " rm $depFile" 1>&2 + rm -f "$depFile" 2>/dev/null fi done done @@ -199,24 +194,24 @@ oldFolders) updateMode) if [ "$PWD" != "$WM_PROJECT_DIR" ] then - echo "Cannot 'update', not in the project top-level directory" 1>&2 + echo "Cannot 'update', not in project top-level directory" 1>&2 exit 1 fi - echo "Removing dep files corresponding to source files that no longer exist..." + echo "Removing dep files for non-existent source files ..." 1>&2 fileNameList=$(find -L src applications -name '*.[CHL]' -type l) for filePathAndName in $fileNameList do - fileName=$(basename $filePathAndName) + fileName=$(basename "$filePathAndName") for subdir in src applications do - echo " '$subdir': $fileName" - (cd $subdir && $Script -a $fileName) + echo " '$subdir': $fileName" 1>&2 + (cd $subdir && $Script -all "$fileName") done # Just in case, remove the symbolic link as the last step - unlink $filePathAndName + unlink "$filePathAndName" done ;; diff --git a/wmake/wrmo b/wmake/wrmo index 6f1dccbd15..ec9a006239 100755 --- a/wmake/wrmo +++ b/wmake/wrmo @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # | Copyright (C) 2015 OpenFOAM Foundation @@ -47,7 +47,7 @@ usage() { Usage: $Script [OPTION] [file1 [... fileN]] options: - -a | -all All platforms (current: $WM_OPTIONS) + -a | -all | all All platforms (current: $WM_OPTIONS) -h | -help Print the usage Remove all .o files or remove .o file corresponding to @@ -70,10 +70,8 @@ do -h | -help*) usage ;; - # All platforms - -a | -all | all) + -a | -all | all) # All platforms platform=all - shift ;; -*) usage "unknown option: '$1'" @@ -82,6 +80,7 @@ do break ;; esac + shift done # Check environment variables @@ -94,22 +93,21 @@ checkEnv objectsDir=$(findObjectDir .) || exit 1 # Fatal -# With the -a/-all option replace the current platform with a wildcard +# With -a/-all option: replace the current platform with a wildcard if [ "$platform" = all ] then - objectsDir=$(echo $objectsDir | sed s%$WM_OPTIONS%*% ) + objectsDir=$(echo "$objectsDir" | sed "s%$WM_OPTIONS%*%") fi if [ "$#" -eq 0 ] then - echo "removing all .o files ..." - find $objectsDir -name '*.o' -type f -delete + echo "Removing all .o files ..." 1>&2 + find "$objectsDir" -name '*.o' -type f -delete else - echo "removing .o files corresponding to" - echo " $@ ..." + echo "Removing .o files for: $*" 1>&2 for file do - rm $objectsDir/${file%%.*}.o + rm -f "$objectsDir/${file%%.*}.o" 2>/dev/null done fi