diff --git a/wmake/scripts/dirToString b/wmake/scripts/dirToString
new file mode 100755
index 0000000000..bf8f5b9093
--- /dev/null
+++ b/wmake/scripts/dirToString
@@ -0,0 +1,90 @@
+#!/bin/sh
+#------------------------------------------------------------------------------
+# ========= |
+# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+# \\ / O peration |
+# \\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
+# \\/ M anipulation |
+#-------------------------------------------------------------------------------
+# License
+# This file is part of OpenFOAM, licensed under GNU General Public License
+# .
+#
+# Script
+# dirToString
+#
+# Usage
+# dirToString path/to/file
+#
+# Description
+# Converts a directory path into a camelCase string.
+# Leading [./] characters are stripped by default.
+#
+# For example,
+# input: dir1/dir2/dir3
+# output: dir1Dir2Dir3
+#
+#------------------------------------------------------------------------------
+usage() {
+ exec 1>&2
+ while [ "$#" -ge 1 ]; do echo "$1"; shift; done
+ cat<1) {$0=toupper(substr($0,1,1))substr($0,2)}} 1')
+
+echo "$dirName"
+
+#------------------------------------------------------------------------------
diff --git a/wmake/scripts/makeFiles b/wmake/scripts/makeFiles
index ec21af1a6e..33203310d9 100755
--- a/wmake/scripts/makeFiles
+++ b/wmake/scripts/makeFiles
@@ -33,7 +33,8 @@
# Usage : makeFiles
#
#------------------------------------------------------------------------------
-dirToString="${WM_DIR:-$WM_PROJECT_DIR/wmake}/platforms/$WM_ARCH$WM_COMPILER/dirToString"
+scriptDir="${0%/*}" # The script dir
+dirToString="$scriptDir/dirToString"
if [ -r Make/files ]
then
@@ -60,7 +61,7 @@ do
# Skip special directories
;;
*)
- echo "$(echo $dir | $dirToString -strip) = ${dir#./}"
+ echo "$($dirToString "$dir") = ${dir#./}"
;;
esac
done > Make/files
@@ -68,7 +69,7 @@ done > Make/files
for file in $(find . -name "*.[cCylLfF]" -type f -print)
do
- pathName=$(echo ${file%/*} | $dirToString -strip)
+ pathName="$($dirToString "${file%/*}")"
if [ -n "$pathName" ]
then
diff --git a/wmake/src/Makefile b/wmake/src/Makefile
index 1f2e2fe198..feb4bb248e 100644
--- a/wmake/src/Makefile
+++ b/wmake/src/Makefile
@@ -2,7 +2,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
-# \\ / A nd |
+# \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# | Copyright (C) 2011-2016 OpenFOAM Foundation
@@ -62,8 +62,6 @@ include $(GENERAL_RULES)/general
.PHONY: all clean
all: \
- $(WMAKE_BIN)/dirToString$(EXT_EXE) \
- $(WMAKE_BIN)/wmkdep$(EXT_EXE) \
$(WMAKE_BIN)/wmkdepend$(EXT_EXE)
@echo "built wmake-bin for $(WM_ARCH)$(WM_COMPILER)"
@@ -72,11 +70,6 @@ clean:
@rm -rf $(WMAKE_BIN) 2>/dev/null
@rmdir $(shell dirname $(WMAKE_BIN)) 2>/dev/null || true
-$(WMAKE_BIN)/dirToString$(EXT_EXE): dirToString.c
- @mkdir -p $(WMAKE_BIN)
- $(call QUIET_MESSAGE,compile,$(.
-
-Application
- dirToString
-
-Description
- Converts a directory path into a camelCase string.
- e.g. dir1/dir2/dir3 becomes dir1Dir2Dir3
-
-Usage
- echo dirName | dirToString
-
- e.g.
- using sh
- baseDirName=$(echo $dir | $bin/dirToString -strip)
-
- using csh
- set baseDirName=`echo $dir | $bin/dirToString -strip`
-
-\*----------------------------------------------------------------------------*/
-
-#include
-#include
-#include
-#include
-
-/* The executable name (for messages), without requiring access to argv[] */
-#define EXENAME "dirToString"
-
-int main(int argc, char* argv[])
-{
- int c;
-
- if (argc > 1)
- {
- if (!strncmp(argv[1], "-h", 2))
- {
- /* Option: -h, -help */
-
- fputs
- (
- "\nUsage: " EXENAME
- " [-strip]\n\n"
- " -strip ignore leading [./] characters.\n\n"
- "Converts a directory path into a camelCase string\n\n",
- stderr
- );
- return 0;
- }
-
- if (!strcmp(argv[1], "-s") || !strcmp(argv[1], "-strip"))
- {
- /* Option: -s, -strip */
-
- while ((c=getchar()) != EOF && (c == '.' || c == '/'))
- {
- /* nop */
- }
-
- if (c == EOF)
- {
- return 0;
- }
-
- putchar(c);
- }
- }
-
-
- int nextUpper = 0;
- while ((c = getchar()) != EOF)
- {
- if (c == '/')
- {
- nextUpper = 1;
- }
- else if (nextUpper)
- {
- putchar(toupper(c));
- nextUpper = 0;
- }
- else
- {
- putchar(c);
- }
- }
-
- return 0;
-}
-
-
-/*****************************************************************************/