Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
e3-require
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
Anders Lindh Olsson
e3-require
Commits
611aefef
Commit
611aefef
authored
3 years ago
by
Simon Rose
Browse files
Options
Downloads
Patches
Plain Diff
Refactor and rearrange
parent
3ab8e59e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
require-ess/tools/driver.makefile
+17
-11
17 additions, 11 deletions
require-ess/tools/driver.makefile
with
17 additions
and
11 deletions
require-ess/tools/driver.makefile
+
17
−
11
View file @
611aefef
...
@@ -425,41 +425,47 @@ ifeq ($(filter O.%,$(notdir ${CURDIR})),)
...
@@ -425,41 +425,47 @@ ifeq ($(filter O.%,$(notdir ${CURDIR})),)
# Still in source directory, third run.
# Still in source directory, third run.
# First, sort out all of the dependencies. This is done recursively using tools from https://github.com/markpiffer/gmtt.git
# First, sort out all of the dependencies. This is done recursively using tools from https://github.com/markpiffer/gmtt.git
space
:=
$(
strip
)
$(
strip
)
#
space
:=
$(
strip
)
$(
strip
)
#
comma
:=
,#
comma
:=
,#
list2param
=
$(
subst
$(
space
)
,
$(
comma
)
,
$(
strip
$1
))
list2param
=
$(
subst
$(
space
)
,
$(
comma
)
,
$(
strip
$1
))
exec
=
$(
eval
-exec
=
$1
)$(
eval
-exec
:
=
$$(
call
-exec
,
$(
call list2param,
$2
)))$(
-exec
)
exec
=
$(
eval
-exec
=
$1
)$(
eval
-exec
:
=
$$(
call
-exec
,
$(
call list2param,
$2
)))$(
-exec
)
while
=
$(
if
$(
call
exec
,
$1
)
,
$(
eval
$2
)$(
call
while
,
$1
,
$2
,
$3
)
,
$(
eval
$3
))
while
=
$(
if
$(
call
exec
,
$1
)
,
$(
eval
$2
)$(
call
while
,
$1
,
$2
,
$3
)
,
$(
eval
$3
))
# Used to select from table-like data; syntax is SELECT what FROM where WHEN condition. This has been tailored to parse .dep files.
select
=
$(
strip
$(
call
-select
,
$(
strip
$2
)
,
$1
,
$3
))
select
=
$(
strip
$(
call
-select
,
$(
strip
$2
)
,
$1
,
$3
))
-select
=
$(
if
$1
,
$(
if
$(
call
exec
,
$3
,
$(
call list2param,
$(
wordlist 1,2,
$1
)))
,
$(
word
$2
,
$1
))$(
call
-select
,
$(
wordlist 3,2147483647,
$1
)
,
$2
,
$3
))
-select
=
$(
if
$1
,
$(
if
$(
call
exec
,
$3
,
$(
call list2param,
$(
wordlist 1,2,
$1
)))
,
$(
word
$2
,
$1
))$(
call
-select
,
$(
wordlist 3,2147483647,
$1
)
,
$2
,
$3
))
str-eq
=
$(
if
$(
subst x
$1
,,x
$2
)
,,t
)
str-eq
=
$(
if
$(
subst x
$1
,,x
$2
)
,,t
)
_MODULES
:=
REQUIRED
:=
# Converts all of the X_DEP_VERSIONs to x_VERSION and records them
define
fetch_module_versions
_lm
:=
$$(
shell
echo
$1
|
tr
'[:upper:]'
'[:lower:]'
)
$$(_lm)_VERSION
:=
$(
$1_DEP_VERSION
)
_MODULES
+=
$$(
_lm
)
endef
$(
foreach
m,
$(
patsubst %_DEP_VERSION,%,
$(
filter %_DEP_VERSION,
$(
.VARIABLES
)))
,
$(
eval
$(
call fetch_module_versions,
$m
)))
# Fetches the data from .dep files to be parsed by the above
define
fetch_deps
define
fetch_deps
$(
shell
cat
$(
E3_SITEMODS_PATH
)
/
$1
/
$(
$1_VERSION
)
/lib/
$(
T_A
)
/
$1
.dep |
sed
'1d'
)
$(
shell
cat
$(
E3_SITEMODS_PATH
)
/
$1
/
$(
$1_VERSION
)
/lib/
$(
T_A
)
/
$1
.dep |
sed
'1d'
)
endef
endef
# Used to recurse through versions: updates REQUIRED and fetches all of the dependencies from the given module
define
update_dep_versions
define
update_dep_versions
m
:=
$$(
firstword
$$(
_MODULES
))
m
:=
$$(
firstword
$$(
_MODULES
))
REQUIRED
+=
$$
m
REQUIRED
+=
$$
m
$$m_TBL
:=
$$(
call fetch_deps,
$$
m
)
$$m_TBL
:=
$$(
call fetch_deps,
$$
m
)
$$m_DEPS
:=
$$(
call
select
,1,
$$(
$$
m_TBL
)
,1
)
$$m_DEPS
:=
$$(
call
select
,1,
$$(
$$
m_TBL
)
,1
)
_MODULES
:=
$$(
filter-out
$$(
REQUIRED
)
,
$$(
_MODULES
)
$$(
$$
m_DEPS
))
_MODULES
:=
$$(
filter-out
$$(
REQUIRED
)
,
$$(
_MODULES
)
$$(
$$
m_DEPS
))
$$(foreach mm,$$($$m_DEPS),$$(eval
export
$$(mm)_VERSION
:
= $$(call select
,
2
,
$$($$m_TBL)
,
$$$$(call str-eq
,
$$$$1
,
$$(mm)))))
$$(foreach mm,$$($$m_DEPS),$$(eval $$(mm)_VERSION
:
= $$(call select
,
2
,
$$($$m_TBL)
,
$$$$(call str-eq
,
$$$$1
,
$$(mm)))))
endef
endef
# Convert (for example) ASYN_DEP_VERSION to asyn_VERSION and add asyn to the list of modules
_MODULES
:=
REQUIRED
:=
$(
foreach
m,
$(
patsubst %_DEP_VERSION,%,
$(
filter %_DEP_VERSION,
$(
.VARIABLES
)))
,
\
$(
eval
_lm :
=
$(
shell
echo
$m
|
tr
'[:upper:]'
'[:lower:]'
))
\
$(
eval export
$(
_lm
)
_VERSION :
=
$(
$m_DEP_VERSION
))
\
$(
eval
_MODULES +
=
$(
_lm
)))
$(
call
while
,
$$(
_MODULES
)
,
$(
update_dep_versions
))
$(
call
while
,
$$(
_MODULES
)
,
$(
update_dep_versions
))
$(
foreach
m,
$(
REQUIRED
)
,
$(
eval export
$m_VERSION
))
debug
::
debug
::
@
echo
"===================== Pass 3: T_A =
$(
T_A
)
====================="
@
echo
"===================== Pass 3: T_A =
$(
T_A
)
====================="
@
echo
"BINS =
$(
BINS
)
"
@
echo
"BINS =
$(
BINS
)
"
...
...
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