Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
ed3c6bcb
Commit
ed3c6bcb
authored
5 years ago
by
Mark OLESEN
Browse files
Options
Downloads
Patches
Plain Diff
COMP: only use Project/build if Project directory is writable (#1693)
parent
d4e31093
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wmake/scripts/wmakeFunctions
+36
-32
36 additions, 32 deletions
wmake/scripts/wmakeFunctions
wmake/wmake
+19
-9
19 additions, 9 deletions
wmake/wmake
with
55 additions
and
41 deletions
wmake/scripts/wmakeFunctions
+
36
−
32
View file @
ed3c6bcb
...
@@ -69,7 +69,7 @@ expandPath()
...
@@ -69,7 +69,7 @@ expandPath()
(
cd
"
$1
"
&&
pwd
-P
)
(
cd
"
$1
"
&&
pwd
-P
)
elif
[
-n
"
$1
"
]
elif
[
-n
"
$1
"
]
then
then
(
cd
$(
dirname
"
$1
"
)
&&
pwd
-P
)
(
cd
"
$(
dirname
"
$1
"
)
"
&&
pwd
-P
)
else
else
pwd
-P
pwd
-P
fi
fi
...
@@ -89,15 +89,15 @@ expandPath()
...
@@ -89,15 +89,15 @@ expandPath()
# - WM_PROJECT_DIR, HOME
# - WM_PROJECT_DIR, HOME
findTarget
()
findTarget
()
{
{
local
project
=
$(
expandPath
$WM_PROJECT_DIR
)
local
project
=
$(
expandPath
"
$WM_PROJECT_DIR
"
)
local
home
=
$(
expandPath
$HOME
)
local
home
=
$(
expandPath
"
$HOME
"
)
local
reldir
=
"
${
1
:-
.
}
"
local
reldir
=
"
${
1
:-
.
}
"
local
absdir
=
$(
expandPath
$reldir
)
local
absdir
=
$(
expandPath
"
$reldir
"
)
while
[
-n
"
$absdir
"
]
while
[
-n
"
$absdir
"
]
do
do
case
"
$absdir
"
in
case
"
$absdir
"
in
(
$project
|
$home
|
/
)
(
"
$project
"
|
"
$home
"
|
/
)
break
break
;;
;;
esac
esac
...
@@ -113,7 +113,7 @@ findTarget()
...
@@ -113,7 +113,7 @@ findTarget()
fi
fi
done
done
echo
"Error: no Make directory for
$(
expandPath
$1
)
"
1>&2
echo
"Error: no Make directory for
$(
expandPath
"
$1
"
)
"
1>&2
echo
1>&2
echo
1>&2
return
1
return
1
}
}
...
@@ -133,14 +133,14 @@ cdSource()
...
@@ -133,14 +133,14 @@ cdSource()
echo
" Searching up directories tree for Make directory"
1>&2
echo
" Searching up directories tree for Make directory"
1>&2
dir
=
$(
findTarget .
)
||
exit
1
# Fatal
dir
=
$(
findTarget .
)
||
exit
1
# Fatal
cd
$dir
2>/dev/null
||
{
cd
"
$dir
"
2>/dev/null
||
{
echo
"
$Script
error: could not change to directory '
$dir
'"
1>&2
echo
"
$Script
error: could not change to directory '
$dir
'"
1>&2
exit
1
exit
1
}
}
unset
targetType
unset
targetType
fi
fi
[
-r
$MakeDir
/files
]
||
{
[
-r
"
$MakeDir
"
/files
]
||
{
echo
"
$Script
error: file '
$MakeDir
/files' does not exist in
$PWD
"
1>&2
echo
"
$Script
error: file '
$MakeDir
/files' does not exist in
$PWD
"
1>&2
exit
1
exit
1
}
}
...
@@ -158,23 +158,29 @@ cdSource()
...
@@ -158,23 +158,29 @@ cdSource()
# - WM_PROJECT_DIR, WM_OPTIONS
# - WM_PROJECT_DIR, WM_OPTIONS
findObjectDir
()
findObjectDir
()
{
{
local
project
=
$(
expandPath
$WM_PROJECT_DIR
)
local
project
=
"
$(
expandPath
"
$WM_PROJECT_DIR
"
)
"
local
absdir
=
$(
expandPath
${
1
:-
.
}
)
local
absdir
=
"
$(
expandPath
"
${
1
:-
.
}
"
)
"
local
objectsDir
local
appDir relativeDir objectsDir
# Treat project/ builds as out-of-source
relativeDir
=
"
${
absdir
#
${
project
}
/
}
"
if
[
"
$relativeDir
"
!=
"
$absdir
"
]
then
[
-w
"
$WM_PROJECT_DIR
"
]
&&
\
objectsDir
=
"
${
WM_PROJECT_DIR
}
/build/
${
WM_OPTIONS
}
/
${
relativeDir
}
"
fi
case
"
$absdir
"
in
# Default (local) build directory
(
"
$project
"
/
*
)
if
[
-z
"
$objectsDir
"
]
local
buildPath
=
$WM_PROJECT_DIR
/build/
${
WM_OPTIONS
}
then
objectsDir
=
$buildPath
$(
echo
$absdir
|
sed
s%
$project
%%
)
relativeDir
=
"
$absdir
"
;;
appDir
=
.
(
*
)
local
path
=
$absdir
local
appDir
=
.
[
-d
Make
]
||
appDir
=
$(
findTarget .
)
||
exit
1
# Fatal
[
-d
Make
]
||
appDir
=
$(
findTarget .
)
||
exit
1
# Fatal
absdir
=
$(
expandPath
$appDir
/.
)
absdir
=
$(
expandPath
"
$appDir
"
/.
)
objectsDir
=
$appDir
/Make/
${
WM_OPTIONS
}
$(
echo
$path
|
sed
s%
$absdir
%%
)
;;
relativeDir
=
"
${
relativeDir
#
${
absdir
}}
"
esac
objectsDir
=
"
${
appDir
}
/Make/
${
WM_OPTIONS
}${
relativeDir
}
"
fi
echo
"
$objectsDir
"
echo
"
$objectsDir
"
}
}
...
@@ -191,7 +197,7 @@ findObjectDir()
...
@@ -191,7 +197,7 @@ findObjectDir()
# - WM_PROJECT_DIR, WM_OPTIONS
# - WM_PROJECT_DIR, WM_OPTIONS
removeObjectDir
()
removeObjectDir
()
{
{
local
objectsDir
=
$(
findObjectDir
${
1
:-
.
}
)
local
objectsDir
=
"
$(
findObjectDir
"
${
1
:-
.
}
"
)
"
if
[
-d
"
$objectsDir
"
]
if
[
-d
"
$objectsDir
"
]
then
then
rm
-rf
"
$objectsDir
"
2>/dev/null
rm
-rf
"
$objectsDir
"
2>/dev/null
...
@@ -344,7 +350,7 @@ if [ -n "$BASH_VERSION" ]
...
@@ -344,7 +350,7 @@ if [ -n "$BASH_VERSION" ]
then
then
depToSource
()
depToSource
()
{
{
local
sourceFile
=
${
1
%.dep
}
local
sourceFile
=
"
${
1
%.dep
}
"
sourceFile
=
"
${
sourceFile
/build\/
${
WM_OPTIONS
}
\//
}
"
sourceFile
=
"
${
sourceFile
/build\/
${
WM_OPTIONS
}
\//
}
"
sourceFile
=
"
${
sourceFile
/build\/
${
WM_OPTIONS
}${
WM_MPLIB
}
\//
}
"
sourceFile
=
"
${
sourceFile
/build\/
${
WM_OPTIONS
}${
WM_MPLIB
}
\//
}
"
sourceFile
=
"
${
sourceFile
/Make\/
${
WM_OPTIONS
}
\//
}
"
sourceFile
=
"
${
sourceFile
/Make\/
${
WM_OPTIONS
}
\//
}
"
...
@@ -355,13 +361,11 @@ then
...
@@ -355,13 +361,11 @@ then
else
else
depToSource
()
depToSource
()
{
{
local
sourceFile
=
$(
echo
${
1
%.dep
}
|
\
echo
"
${
1
%.dep
}
"
|
sed
\
sed
-e
s%build/
${
WM_OPTIONS
}
/%%
\
-e
"s%build/
${
WM_OPTIONS
}
/%%"
\
-e
s%build/
${
WM_OPTIONS
}${
WM_MPLIB
}
/%%
\
-e
"s%build/
${
WM_OPTIONS
}${
WM_MPLIB
}
/%%"
\
-e
s%Make/
${
WM_OPTIONS
}
/%%
\
-e
"s%Make/
${
WM_OPTIONS
}
/%%"
\
-e
s%Make/
${
WM_OPTIONS
}${
WM_MPLIB
}
/%%
)
-e
"s%Make/
${
WM_OPTIONS
}${
WM_MPLIB
}
/%%"
echo
"
$sourceFile
"
}
}
fi
fi
...
...
This diff is collapsed.
Click to expand it.
wmake/wmake
+
19
−
9
View file @
ed3c6bcb
...
@@ -558,22 +558,32 @@ fi
...
@@ -558,22 +558,32 @@ fi
# files and options being built in parallel
# files and options being built in parallel
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
objectsDir
=
"
$MakeDir
/
$WM_OPTIONS
"
# Mini-version of findObjectDir
case
"
$PWD
"
in
unset
objectsDir
(
"
$WM_PROJECT_DIR
"
/
*
)
buildPath
=
"
$WM_PROJECT_DIR
/build/
${
WM_OPTIONS
}
"
# Handle project/{applications,src} as out-of-source build
objectsDir
=
$buildPath
$(
echo
$PWD
|
sed
s%
$WM_PROJECT_DIR
%%
)
relativeDir
=
"
${
PWD
#
${
WM_PROJECT_DIR
}
/
}
"
;;
if
[
"
$relativeDir
"
!=
"
$PWD
"
]
esac
then
[
-w
"
$WM_PROJECT_DIR
"
]
&&
\
objectsDir
=
"
${
WM_PROJECT_DIR
}
/build/
${
WM_OPTIONS
}
/
${
relativeDir
}
"
fi
# Default (local) build directory
if
[
-z
"
$objectsDir
"
]
then
objectsDir
=
"
$MakeDir
/
$WM_OPTIONS
"
fi
(
(
unset
MAKEFLAGS
unset
MAKEFLAGS
mkdir
-p
$objectsDir
mkdir
-p
"
$objectsDir
"
# Pre-build the $WM_OPTIONS/options file
# Pre-build the $WM_OPTIONS/options file
# which is included when building the $WM_OPTIONS/files file
# which is included when building the $WM_OPTIONS/files file
$make
-s
-f
$WM_DIR
/makefiles/files
\
$make
-s
-f
$WM_DIR
/makefiles/files
\
MAKE_DIR
=
$MakeDir
OBJECTS_DIR
=
$objectsDir
$objectsDir
/options
MAKE_DIR
=
"
$MakeDir
"
OBJECTS_DIR
=
"
$objectsDir
"
"
$objectsDir
"
/options
$make
-s
-f
$WM_DIR
/makefiles/files
\
$make
-s
-f
$WM_DIR
/makefiles/files
\
MAKE_DIR
=
$MakeDir
OBJECTS_DIR
=
$objectsDir
MAKE_DIR
=
$MakeDir
OBJECTS_DIR
=
$objectsDir
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment