forked from eclipse/cloe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.all
212 lines (184 loc) · 7.53 KB
/
Makefile.all
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# Makefile.all
#
# This file defines all packages available for building and defines their
# dependencies, so that make can build them in parallel effectively.
#
# Each package that can be built by conan contains a `conanfile.py`
# and a Makefile that includes `Makefile.package`.
# By default all plugin packages are built.
#
# Use WITHOUT_PKGS variable on the command line to opt-out of specific
# packages:
#
# make WITHOUT_PKGS="plugins/demo_printer" package
#
# This extends the UNSELECT_PKGS variable. Set this variable directly
# to override default omitted packages. Use make help to see which
# these are. For example, if you want to export all vendor packages:
#
# make UNSELECT_VENDOR= export-vendor
#
# Use WITH_PKGS variable on the command line to include specific by-default
# unselected packages:
#
# make PLUGIN_PKGS= WITH_PKGS="plugins/minimator" package
#
# This extends the SELECT_PKGS variable. Set this variable directly
# to explicitely specify exactly which packages are considered. Use make help
# to see what these are.
#
include Makefile.help
# Make configuration:
SHELL := /bin/bash
GNUMAKEFLAGS := --no-print-directory
SUBMAKEFLAGS :=
META_PKG := cloe
PLUGIN_PKGS := $(wildcard plugins/*)
ALL_PKGS := fable runtime models oak engine ${PLUGIN_PKGS} ${META_PKG}
WITHOUT_PKGS :=
UNSELECT_PKGS := ${WITHOUT_PKGS}
WITH_PKGS :=
SELECT_PKGS := $(call uniq, $(filter-out ${UNSELECT_PKGS}, ${ALL_PKGS}) ${WITH_PKGS})
.PHONY: ${ALL_PKGS}
## VENDOR PACKAGE SELECTION
##
## Functions analogously to normal package selection.
##
ALL_VENDOR :=
WITHOUT_VENDOR :=
UNSELECT_VENDOR := ${WITHOUT_VENDOR}
WITH_VENDOR :=
SELECT_VENDOR := $(call uniq, $(filter-out ${UNSELECT_VENDOR}, ${ALL_VENDOR}) ${WITH_VENDOR})
.PHONY: ${ALL_VENDOR}
# Specify dependencies:
fable:
runtime: fable
models: runtime
oak: runtime
engine: models oak
${PLUGIN_PKGS}: runtime models
## BUILD_POLICY
## Usage: make BUILD_POLICY="missing"
## Default: "outdated"
##
## This variable contains the default Conan build policy for package targets.
##
BUILD_POLICY := outdated
## CONAN_OPTIONS
## Usage: make CONAN_OPTIONS="..."
## Default: ""
##
## This variable contains options that are passed on to the following Conan
## commands:
##
## conan create
## for the package and package-outdated targets.
## conan install
## for all other targets.
##
## So see conan create --help and conan install --help for which options
## are valid in these contexts.
##
CONAN_OPTIONS :=
# --------------------------------------------------------------------------- #
# Usage: $(call _make_target_rule, TARGET-NAME, MAKE-TARGET, HELP-DESCRIPTION, MAKE-ARGUMENTS)
define _make_target_rule
${1}:
$(call print_header, "Proceeding to $(call unquote, ${3})")
${MAKE} ${SUBMAKEFLAGS} ${4} ${2}
endef
# Usage: $(call _make_target_rules, TARGET-NAME, HELP-DESCRIPTION, HELP-CATEGORY, PACKAGE-DIRS)
define _make_target_rules
help::
$(call print_help_target, ${1}, ${2}, ${3})
$(call _make_target_rule,${1},${1}-each,${2},-f Makefile.all)
${1}-each: ${4}
endef
REGEX_TARGET := 's/(-vendor|-select)?-each//'
$(filter-out ${META_PKG}, ${ALL_PKGS} ${ALL_VENDOR}):
${MAKE} -C $@ $(shell echo ${MAKECMDGOALS} | sed -re ${REGEX_TARGET})
# Re-define ${META_PKG} target to use Makefile.package, and only run for targets
# where it makes sense, since "${META_PKG}" is a Conan meta-package.
${META_PKG}:
for case in export package package-outdated list purge clean smoketest smoketest-deps; do \
if [ "$$(echo '${MAKECMDGOALS}' | sed -re ${REGEX_TARGET})" == "$${case}" ]; then \
${MAKE} -f Makefile.package CONAN_OPTIONS="${CONAN_OPTIONS}" $${case} || exit 1; \
fi \
done
# Usage: $(call make_vendor_target, TARGET-NAME, HELP-DESCRIPTION, HELP-CATEGORY)
# define make_vendor_target
# $(eval $(call _make_target_rules,${1},${2},${3},${SELECT_VENDOR}))
# endef
# Usage: $(call make_every_target, TARGET-NAME, HELP-DESCRIPTION, HELP-CATEGORY)
define make_every_target
$(eval $(call _make_target_rules,${1},${2},${3},${ALL_PKGS}))
endef
# Usage: $(call make_select_target, TARGET-NAME, HELP-DESCRIPTION, HELP-CATEGORY)
define make_select_target
$(eval $(call _make_target_rules,${1},${2},${3},${SELECT_PKGS}))
endef
# --------------------------------------------------------------------------- #
.DEFAULT_GOAL := help
.PHONY: help
.SILENT: help
help::
$(call print_help_section, "Available build targets")
# $(call make_vendor_target, export-vendor, "export all vendor packages", "[conan-cache]")
# $(call make_vendor_target, package-vendor, "create all vendor packages", "[conan-cache]")
# $(call make_vendor_target, download-vendor, "download or build vendor packages", "[conan-cache]")
help::
echo
$(call make_every_target, export, "export all package recipes", "[conan-cache]")
help::
$(call print_help_target, package, "create ${META_PKG} package and plugins", "[conan-cache]")
echo
$(call make_select_target, export-select, "export selected packages", "[conan-cache]")
$(call make_select_target, package-select, "create selected packages with policy", "[conan-cache]")
$(call make_select_target, list-select, "list selected package install files", "[conan-cache]")
$(call make_select_target, purge-select, "remove selected packages from cache", "[conan-cache]")
$(call make_select_target, smoketest-select, "run tests for selected packages", "[conan-cache]")
$(call make_select_target, smoketest-deps-select, "build test deps for selected packages", "[conan-cache]")
help::
echo
$(call make_select_target, editable-select, "toggle [in-source] build for selected packages", "")
$(call make_select_target, uneditable-select, "toggle [conan-cache] build for selected packages", "")
help::
echo
$(call make_select_target, all-select, "build selected packages", "[in-source]")
$(call make_select_target, configure-select, "install dependencies and configure packages", "[in-source]")
$(call make_select_target, test-select, "run CMake tests if they are available", "[in-source]")
$(call make_select_target, export-pkg-select, "export build artifacts to Conan cache", "[in-source]")
$(call make_select_target, clean-select, "remove build artifacts", "[in-source]")
help::
echo
$(call print_help_subsection, "Options")
# $(call print_help_option, WITH_VENDOR, "", "include optional vendor packages from ${_grn}UNSELECT_VENDOR${_rst}")
$(call print_help_option, WITH_PKGS, "", "include optional packages from ${_grn}UNSELECT_PKGS${_rst}")
$(call print_help_option, LOCKFILE_SOURCE, "", "use specified conanfile as lockfile source for build")
echo
$(call print_help_subsection, "Defines")
$(call print_help_option, BUILD_POLICY, ${BUILD_POLICY})
$(call print_help_define, CONAN_OPTIONS, ${CONAN_OPTIONS})
# $(call print_help_define_lines, UNSELECT_VENDOR, ${UNSELECT_VENDOR})
# $(call print_help_define_lines, SELECT_VENDOR, ${SELECT_VENDOR})
$(call print_help_define_lines, UNSELECT_PKGS, ${UNSELECT_PKGS})
$(call print_help_define_lines, SELECT_PKGS, ${SELECT_PKGS})
echo
.PHONY: package
package: export-select
# Build cloe with all targets and options together.
#
# This is different from the package target in that it always builds the
# packages from this workspace, the ones in SELECT_PKGS.
# This is different from the package-select target in that it builds them
# all together and thereby uses the correct dependency resolution with
# overrides and options.
TARGETS=$$( \
for pkg in ${SELECT_PKGS}; do \
if [ ! -d $${pkg} ]; then \
continue; \
fi; \
echo -n "--build=$$(make --no-print-directory -C $${pkg} info-name) "; \
done; \
) && \
${MAKE} -f Makefile.package CONAN_OPTIONS="${CONAN_OPTIONS} $$TARGETS" package