Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
1dd7362a
Commit
1dd7362a
authored
Jan 18, 2019
by
Mark OLESEN
Browse files
ENH: wmakeRoot for locating the root directory
parent
3c81aec0
Changes
4
Hide whitespace changes
Inline
Side-by-side
etc/codeTemplates/source/foamNewSource
View file @
1dd7362a
...
...
@@ -91,7 +91,7 @@ shift 2
if
[
"
${
printOpt
:-
false
}
"
=
true
]
then
cat
$Template$subType$Type
cat
"
$Template$subType$Type
"
else
fileName
=
"
$className$Type
"
...
...
@@ -106,11 +106,11 @@ else
# process class name
sed
-e
"s/CLASSNAME/
$className
/g"
\
-e
"s/YEAR/
$(
date
+%Y
)
/g"
\
$Template$subType$Type
>
$fileName
"
$Template$subType$Type
"
>
"
$fileName
"
if
[
"
$subType
"
=
App
-a
!
-d
Make
]
then
wmakeFilesAndOptions
"
${
WM_DIR
:-
$WM_PROJECT_DIR
/wmake
}
/
wmakeFilesAndOptions
"
fi
fi
...
...
wmake/scripts/makeFiles
View file @
1dd7362a
...
...
@@ -31,7 +31,7 @@
# Usage : makeFiles
#
#------------------------------------------------------------------------------
dirToString
=
"
$WM_DIR
/platforms/
$WM_ARCH$WM_COMPILER
"
/dirToString
dirToString
=
"
$
{
WM_DIR
:-
$WM_PROJECT_DIR
/wmake
}
/platforms/
$WM_ARCH$WM_COMPILER
/dirToString
"
if
[
-r
Make/files
]
then
...
...
@@ -46,8 +46,10 @@ fi
[
-d
Make
]
||
mkdir
Make
rm
-f
Make/files
#------------------------------------------------------------------------------
echo
"Creating Make/files"
echo
"Creating Make/files ..."
for
dir
in
$(
find
.
-mindepth
1
-type
d
-print
)
do
...
...
@@ -68,7 +70,7 @@ do
if
[
-n
"
$pathName
"
]
then
echo
'$('
$pathName
')/'
"
${
file
##*/
}
"
echo
'$('
"
$pathName
"
')/'
"
${
file
##*/
}
"
else
echo
"
${
file
##*/
}
"
fi
...
...
wmake/scripts/makeOptions
View file @
1dd7362a
...
...
@@ -40,7 +40,9 @@ fi
[
-d
Make
]
||
mkdir
Make
rm
-f
Make/options
#------------------------------------------------------------------------------
echo
"Creating Make/options"
echo
'EXE_INC = \
...
...
wmake/wmakeRoot
0 → 100755
View file @
1dd7362a
#!/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.
#
# OpenFOAM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# wmakeRoot
#
# Description
# Locate the root directory that has a Make/ directory.
#
# See Also
# wmake
#
#------------------------------------------------------------------------------
Script
=
"
${
0
##*/
}
"
# Use 'Script' for error messages in wmakeFunctions
.
"
${
0
%/*
}
/scripts/wmakeFunctions"
# Source wmake functions
usage
()
{
exec
1>&2
while
[
"$#"
-ge
1
]
;
do
echo
"
$1
"
;
shift
;
done
cat
<<
USAGE
Usage:
$Script
[OPTION] [dir]
options:
-h | -help Print the usage
Locate the root directory that has a Make/ directory.
USAGE
exit
1
}
#------------------------------------------------------------------------------
# Parse arguments and options
#------------------------------------------------------------------------------
while
[
"$#"
-gt
0
]
do
case
"
$1
"
in
-h
|
-help
*
)
usage
;;
--
)
shift
break
;;
-
*
)
usage
"unknown option: '
$1
'"
;;
*
)
break
;;
esac
shift
done
#------------------------------------------------------------------------------
unset dir
if
[
$#
-ge
1
]
then
if
[
-d
"
$1
"
]
then
dir
=
"
${
1
%/
}
"
elif
[
-f
"
$1
"
]
then
dir
=
"
${
1
%/*
}
"
:
"
${
dir
:
=.
}
"
else
echo
"
$Script
error: not a file or directory"
1>&2
exit
1
fi
cd
"
$dir
"
2>/dev/null
||
{
echo
"
$Script
error: could not change to directory '
$dir
'"
1>&2
exit
1
}
fi
# Locate target with Make/ directory
if
dir
=
"
$(
findTarget .
)
"
then
(
cd
"
$dir
"
&&
pwd
-L
)
else
exit
2
fi
#------------------------------------------------------------------------------
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment