forked from eclipse-omr/omr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GNUmakefile
312 lines (247 loc) · 7.19 KB
/
GNUmakefile
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
###############################################################################
# Copyright (c) 2015, 2016 IBM Corp. and others
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License 2.0 which accompanies this
# distribution and is available at https://www.eclipse.org/legal/epl-2.0/
# or the Apache License, Version 2.0 which accompanies this distribution and
# is available at https://www.apache.org/licenses/LICENSE-2.0.
#
# This Source Code may also be made available under the following
# Secondary Licenses when the conditions for such availability set
# forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
# General Public License, version 2 with the GNU Classpath
# Exception [1] and GNU General Public License, version 2 with the
# OpenJDK Assembly Exception [2].
#
# [1] https://www.gnu.org/software/classpath/license.html
# [2] http://openjdk.java.net/legal/assembly-exception.html
#
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
###############################################################################
top_srcdir:=.
include $(top_srcdir)/omrmakefiles/configure.mk
###
### Global targets
###
all: postbuild
.DEFAULT: all
clean:
.PHONY: all clean
help:
@echo "help Display this help message."
@echo "all Build OMR."
@echo "clean Clean OMR build artifacts."
@echo "test Run functional verification tests."
@echo "lint Run the OMR linter."
.PHONY: help
###
### Tracegen
###
ifeq (yes,$(ENABLE_TRACEGEN))
define TRACEGEN_COMMAND
cd $(exe_output_dir) && ./tracegen -treatWarningAsError -generatecfiles -threshold 1 -root $(top_srcdir)
endef
define TRACEMERGE_COMMAND
cd $(exe_output_dir) && ./tracemerge -majorversion 5 -minorversion 1 -root $(top_srcdir)
endef
else
define TRACEGEN_COMMAND
@echo Skipping tracegen
endef
define TRACEMERGE_COMMAND
@echo Skipping tracemerge
endef
endif
# ASCII To EBCDIC Targets
ifeq (zos,$(OMR_HOST_OS))
tool_targets += util/a2e
endif
tool_targets += tools/hookgen
# convert Cygwin path to Windows path with regular slashes
ifneq (,$(findstring CYGWIN,$(shell uname -s)))
convertPath = $(shell cygpath -m $1)
else
convertPath = $1
endif
HOOK_DEFINITION_FILES = $(call convertPath,$(abspath ./gc/base/omrmmprivate.hdf ./gc/include/omrmm.hdf ./fvtest/algotest/hooksample.hdf))
HOOK_DEFINITION_SENTINEL = $(patsubst %.hdf,%.sentinel, $(HOOK_DEFINITION_FILES))
define HOOKGEN_COMMAND
cd $(exe_output_dir) && ./hookgen $<
endef
# Trace Build Tools
ifeq (yes,$(ENABLE_TRACEGEN))
tool_targets += tools/tracegen
main_targets += tools/tracemerge
endif
# FVTest Helper Libraries
test_prereqs := third_party/pugixml-1.5 fvtest/util fvtest/omrGtestGlue
test_targets += $(test_prereqs)
# Utility Libraries
main_targets += util/omrutil util/pool util/avl util/hashtable util/hookable
test_targets += \
fvtest/algotest \
fvtest/utiltest
# Thread Targets
ifeq (1,$(OMR_THREAD))
main_targets += thread
test_targets += fvtest/threadtest
test_targets += fvtest/threadextendedtest
endif
# OMR GLue Target
main_targets += omr_glue_static_lib
# Garbage Collection Targets
ifeq (1,$(OMR_GC))
main_targets += \
gc/base \
gc/base/standard \
gc/startup \
gc/stats \
gc/structs \
gc/verbose \
gc/verbose/handler_standard
test_targets += fvtest/gctest
test_targets += perftest/gctest
endif
# Omrsig Targets
ifeq (1,$(OMR_OMRSIG))
main_targets += omrsigcompat
test_targets += fvtest/sigtest
endif
# Portlibrary Targets
ifeq (1,$(OMR_PORT))
main_targets += port
test_targets += fvtest/porttest
test_targets += fvtest/porttest/sltestlib
ifeq (aix,$(OMR_HOST_OS))
test_targets += fvtest/porttest/aixbaddep
endif
endif
# RAS Libraries
main_targets += omrtrace
# OMR Startup
main_targets += omr omr/startup
# RAS Tests
test_targets += fvtest/rastest
# OMR Example Targets
ifeq (1,$(OMR_EXAMPLE))
test_targets += example
endif
# VM Tests
test_targets += fvtest/vmtest
# Test Compiler
ifeq (1,$(OMR_TEST_COMPILER))
main_targets += fvtest/compilertest
endif
# JitBuilder
ifeq (1,$(OMR_JITBUILDER))
main_targets += jitbuilder
test_targets += fvtest/jitbuildertest jitbuilder/release
endif
ifeq (yes,$(ENABLE_DDR))
postbuild_targets += ddr
ddr:: staticlib
endif
DO_TEST_TARGET := yes
# ENABLE_FVTEST_AGENT forces rastest to build, even if fvtests are disabled.
ifeq (no,$(ENABLE_FVTEST))
DO_TEST_TARGET := no
ifeq (yes,$(ENABLE_FVTEST_AGENT))
DO_TEST_TARGET := yes
test_targets := $(test_prereqs)
test_targets += fvtest/rastest fvtest/util
endif
endif
postbuild_targets += tests
# Remove duplicates
main_targets := $(sort $(main_targets))
test_targets := $(sort $(test_targets))
targets += $(tool_targets) $(prebuild_targets) $(main_targets) omr_static_lib $(test_targets) ddr
targets_clean := $(addsuffix _clean,$(targets))
targets_ddrgen := $(addsuffix _ddrgen,$(filter-out omr_static_lib jitbuilder/% fvtest/% perftest/% third_party/% tools/% ddr ddr/% example/%,$(targets)))
###
### Rules
###
postbuild: $(postbuild_targets)
$(TRACEMERGE_COMMAND)
tests: staticlib
ifeq (yes,$(DO_TEST_TARGET))
@$(MAKE) -f GNUmakefile $(test_targets)
endif
staticlib: mainbuild
@$(MAKE) -f GNUmakefile omr_static_lib
mainbuild: prebuild
@$(MAKE) -f GNUmakefile $(main_targets)
prebuild: tools
@$(MAKE) -f GNUmakefile $(prebuild_targets) $(HOOK_DEFINITION_SENTINEL)
$(TRACEGEN_COMMAND)
tools:
@$(MAKE) -f GNUmakefile $(tool_targets)
.PHONY: tools prebuild mainbuild staticbuild tests postbuild
###
### Inter-target Dependencies
###
# These rules must be specified before $(targets)::
# If a prereq directory is not also defined in $(targets),
# then we won't execute 'make' in the prereq directory.
ifeq (zos,$(OMR_HOST_OS))
tools/tracegen:: util/a2e
tools/tracemerge:: util/a2e
tools/hookgen:: util/a2e
endif
$(HOOK_DEFINITION_SENTINEL): $(exe_output_dir)/hookgen$(EXEEXT)
%.sentinel: %.hdf
$(HOOKGEN_COMMAND)
touch $@
hook_definition_sentinel_clean:
rm -f $(HOOK_DEFINITION_SENTINEL)
omrsigcompat:: util/omrutil
example:: $(test_prereqs)
fvtest/algotest::$(test_prereqs)
fvtest/gctest:: $(test_prereqs)
fvtest/jitbuildertest:: $(test_prereqs)
fvtest/porttest:: $(test_prereqs)
fvtest/rastest:: $(test_prereqs)
fvtest/sigtest:: $(test_prereqs)
fvtest/threadextendedtest:: $(test_prereqs)
fvtest/threadtest:: $(test_prereqs)
fvtest/utiltest:: $(test_prereqs)
fvtest/vmtest:: $(test_prereqs)
perftest/gctest:: $(test_prereqs)
###
### Targets
###
$(targets)::
$(MAKE) -C $@ all
.PHONY: $(targets)
%:
@echo Error, No rule to build target $@
@exit -1
clean: $(targets_clean) hook_definition_sentinel_clean
$(targets_clean)::
$(MAKE) -C $(patsubst %_clean,%,$@) clean
.PHONY: $(targets_clean)
lint:
$(MAKE) -C fvtest/compilertest -f linter.mk
.PHONY: lint
test:
ifeq (yes,$(ENABLE_FVTEST))
$(MAKE) -f fvtest/omrtest.mk test
else
@echo Functional verification tests are disabled.
@echo Enable by configuring with --enable-fvtest
endif
.PHONY: test
# preprocess ddrgen-annotated source code
ddrgen:
$(MAKE) -f GNUmakefile $(targets_ddrgen)
$(targets_ddrgen):
$(MAKE) -C $(patsubst %_ddrgen,%,$@) ddrgen
.PHONY: ddrgen $(targets_ddrgen)
# Rerunning configure
configure.mk: config.status configure.mk.in
config.status
config.status: $(top_srcdir)/configure
$(top_srcdir)/configure -C
$(top_srcdir)/configure: $(top_srcdir)/configure.ac
cd $(top_srcdir) && autoconf