From 0e51d263d095bbe2d192989cfb1f5ef635a557fc Mon Sep 17 00:00:00 2001 From: Henry Date: Sun, 11 Jan 2015 13:14:55 +0000 Subject: [PATCH] wrmdepold: Updated rmdepold to handle out-of-tree .dep and .o files --- wmake/wmakeFunctions | 18 +++++++---- bin/rmdepold => wmake/wrmdepold | 54 ++++++++++++++++++++++++--------- 2 files changed, 52 insertions(+), 20 deletions(-) rename bin/rmdepold => wmake/wrmdepold (69%) diff --git a/wmake/wmakeFunctions b/wmake/wmakeFunctions index 2007467ae..c011519b8 100755 --- a/wmake/wmakeFunctions +++ b/wmake/wmakeFunctions @@ -26,7 +26,7 @@ # wdepFunctions # # Description -# Functions to check wmake environment and find dep files +# Functions to check wmake environment and find .dep and .o files #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -51,11 +51,12 @@ checkEnv() expandPath() { - dir=$(dirname $1) - cwd=$PWD - cd $dir - exPath=$PWD - cd $cwd + if [ -d "$1" ] + then + exPath=$(cd "$1" && pwd -P) + else + exPath=$(cd $(dirname "$1") && pwd -P) + fi } findTarget() @@ -97,5 +98,10 @@ findObjectDir() fi } +depToSource() +{ + sourceFile=$(echo ${depFile%.dep} | \ + sed -e s%platforms/${WM_OPTIONS}/%% -e s%Make/${WM_OPTIONS}/%% ) +} #------------------------------------------------------------------------------ diff --git a/bin/rmdepold b/wmake/wrmdepold similarity index 69% rename from bin/rmdepold rename to wmake/wrmdepold index cd0b80f7f..b52a18bce 100755 --- a/bin/rmdepold +++ b/wmake/wrmdepold @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -23,21 +23,28 @@ # along with OpenFOAM. If not, see . # # Script -# rmdepold +# wrmdepold # # Description -# Usage: rmdepold [dir1 .. dirN] +# Usage: wrmdepold [dir1 .. dirN] # -# Remove *.dep files that are without a corresponding .C or .L file. +# Remove *.dep files that are without a corresponding .C or .L source file. # This often occurs when a directory has been moved. # - print questionable directory and the *.dep file # - optionally remove empty directories #------------------------------------------------------------------------------ +Script=${0##*/} + +# Source the wdep functions +. ${0%/*}/wmakeFunctions + +set -x + usage() { exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat</dev/null fi done - # remove empty dirs + # Remove empty dirs if [ "$optRmdir" ] then # get subdirs ourselves so we can avoid particular directories - for dir in $(find $checkDir -mindepth 1 -maxdepth 1 -type d \( -name .git -prune -o -print \) ) + for dir in $(find $objectsDir -mindepth 1 -maxdepth 1 -type d \( -name .git -prune -o -print \) ) do echo "check dir: $dir" find $dir -depth -type d -empty -exec rmdir {} \; -print done fi done + + # -----------------------------------------------------------------------------