This repository has been archived by the owner on Oct 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathOpenJ9.gmk
executable file
·477 lines (393 loc) · 17.1 KB
/
OpenJ9.gmk
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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
# ===========================================================================
# (c) Copyright IBM Corp. 2017, 2018 All Rights Reserved
# ===========================================================================
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code 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
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
# spec.gmk is generated by configure and contains many of the variable definitions used in this makefile
ifeq (,$(wildcard $(SPEC)))
$(error OpenJ9.gmk needs SPEC set to a proper spec.gmk)
endif
include $(SPEC)
include $(SRC_ROOT)/make/common/MakeBase.gmk
ifeq (,$(BUILD_ID))
BUILD_ID := 000000
endif
OPENJ9_SHA := $(shell git -C $(OPENJ9_TOPDIR) rev-parse --short HEAD)
ifeq (,$(OPENJ9_SHA))
$(error Could not determine OpenJ9 SHA)
endif
# Find OpenJ9 tag associated with current commit specified by OPENJ9_SHA
# (suppressing stderr in case there is no such tag).
OPENJ9_TAG := $(shell git -C $(OPENJ9_TOPDIR) describe --exact-match $(OPENJ9_SHA) 2>/dev/null)
ifeq (,$(OPENJ9_TAG))
OPENJ9_BRANCH := $(shell git -C $(OPENJ9_TOPDIR) rev-parse --abbrev-ref HEAD)
ifeq (,$(OPENJ9_BRANCH))
$(error Could not determine OpenJ9 Branch)
endif
OPENJ9_VERSION_STRING := $(OPENJ9_BRANCH)-$(OPENJ9_SHA)
else
OPENJ9_VERSION_STRING := $(OPENJ9_TAG)
endif
OPENJ9OMR_SHA := $(shell git -C $(OPENJ9OMR_TOPDIR) rev-parse --short HEAD)
ifeq (,$(OPENJ9OMR_SHA))
$(error Could not determine OMR SHA)
endif
OPENJ9_ALT_SHARED_LIBRARIES := \
jcl/cl_se9/$(LIBRARY_PREFIX)jclse9_29$(SHARED_LIBRARY_SUFFIX) \
j9vm_b156/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX) \
#
OPENJ9_SHARED_CLASSES_LIBRARIES := \
$(LIBRARY_PREFIX)j9shr29$(SHARED_LIBRARY_SUFFIX) \
#
OPENJ9_JAVA_BASE_LIBRARIES := \
$(LIBRARY_PREFIX)cuda4j29$(SHARED_LIBRARY_SUFFIX) \
$(LIBRARY_PREFIX)j9dmp29$(SHARED_LIBRARY_SUFFIX) \
$(LIBRARY_PREFIX)j9gc29$(SHARED_LIBRARY_SUFFIX) \
$(LIBRARY_PREFIX)j9gcchk29$(SHARED_LIBRARY_SUFFIX) \
$(LIBRARY_PREFIX)j9hookable29$(SHARED_LIBRARY_SUFFIX) \
$(LIBRARY_PREFIX)j9jit29$(SHARED_LIBRARY_SUFFIX) \
$(LIBRARY_PREFIX)j9jnichk29$(SHARED_LIBRARY_SUFFIX) \
$(LIBRARY_PREFIX)j9jvmti29$(SHARED_LIBRARY_SUFFIX) \
$(LIBRARY_PREFIX)j9prt29$(SHARED_LIBRARY_SUFFIX) \
$(LIBRARY_PREFIX)j9thr29$(SHARED_LIBRARY_SUFFIX) \
$(LIBRARY_PREFIX)j9trc29$(SHARED_LIBRARY_SUFFIX) \
$(LIBRARY_PREFIX)j9vm29$(SHARED_LIBRARY_SUFFIX) \
$(LIBRARY_PREFIX)j9vmchk29$(SHARED_LIBRARY_SUFFIX) \
$(LIBRARY_PREFIX)j9vrb29$(SHARED_LIBRARY_SUFFIX) \
$(LIBRARY_PREFIX)j9zlib29$(SHARED_LIBRARY_SUFFIX) \
$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX) \
$(LIBRARY_PREFIX)omrsig$(SHARED_LIBRARY_SUFFIX) \
$(OPENJ9_ALT_SHARED_LIBRARIES) \
#
OPENJ9_MANAGEMENT_LIBRARIES := \
$(LIBRARY_PREFIX)management$(SHARED_LIBRARY_SUFFIX) \
$(LIBRARY_PREFIX)management_ext$(SHARED_LIBRARY_SUFFIX) \
#
OPENJ9_ALL_LIBRARIES := \
$(wildcard $(OUTPUT_ROOT)/vm/$(LIBRARY_PREFIX)*$(SHARED_LIBRARY_SUFFIX))
OPENJ9_BUILD_LIBRARIES := \
$(filter-out \
$(notdir $(OPENJ9_ALT_SHARED_LIBRARIES)), \
$(notdir $(OPENJ9_ALL_LIBRARIES)))
OPENJ9_SHARED_LIBRARIES := \
$(filter-out \
$(notdir $(OPENJ9_ALT_SHARED_LIBRARIES) $(OPENJ9_JAVA_BASE_LIBRARIES) $(OPENJ9_SHARED_CLASSES_LIBRARIES)), \
$(notdir $(OPENJ9_ALL_LIBRARIES)))
OPENJ9_PROPERTY_FILES := \
$(notdir $(wildcard $(OUTPUT_ROOT)/vm/java*.properties))
OPENJ9_MISC_FILES := \
J9TraceFormat.dat \
OMRTraceFormat.dat \
options.default \
#
OPENJ9_NOTICE_FILES := openj9-notices.html
OPENJ9_REDIRECTOR := redirector/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX)
OPENJ9_DDR_FILES :=
ifeq (true,$(OPENJ9_ENABLE_DDR))
.PHONY : run-ddrgen
$(OUTPUT_ROOT)/vm/j9ddr.dat : run-ddrgen
run-ddrgen :
export OPENJDK_VERSION_NUMBER_FOUR_POSITIONS=$(VERSION_NUMBER_FOUR_POSITIONS) \
VERSION_MAJOR=9 \
$(EXPORT_MSVS_ENV_VARS) \
&& $(MAKE) -C $(OUTPUT_ROOT)/vm/ddr -f run_omrddrgen.mk \
CC="$(CC)" \
CXX="$(CXX)"
OPENJ9_DDR_FILES += j9ddr.dat
endif
MODULES_LIBS_DIR := $(OUTPUT_ROOT)/support/modules_libs
# openjdk makeflags don't work with openj9/omr native compiles; override with number of CPUs which openj9 and omr need supplied
override MAKEFLAGS := -j $(JOBS)
# honour the --disable-warnings-as-errors configure parameter during compilation of OMR
ifeq (false,$(WARNINGS_AS_ERRORS))
OMR_EXTRA_CONFIGURE_ARGS := --disable-warnings-as-errors
export UMA_SUPPRESS_WARNINGS_AS_ERRORS := 1
endif
ifeq (windows,$(OPENJDK_TARGET_OS))
# set Visual Studio environment
# wrap PATH in quotes as it contains spaces (unix path)
# INCLUDE, LIB are already wrapped in quotes (windows paths)
EXPORT_MSVS_ENV_VARS := PATH="$(PATH)" INCLUDE=$(INCLUDE) LIB=$(LIB)
# On Windows, the mingw compiler is used for certain files such as
# the bytecode interpreter.
# Uncomment the following line to use the default compiler throughout.
# EXPORT_NO_USE_MINGW := NO_USE_MINGW=true
# set the output directory for shared libraries
OPENJ9_LIBS_OUTPUT_DIR := bin
else
EXPORT_MSVS_ENV_VARS :=
EXPORT_NO_USE_MINGW :=
OPENJ9_LIBS_OUTPUT_DIR := lib
endif
.PHONY : \
build-j9 \
clean-j9 \
clean-j9-dist \
generate-j9jcl-sources \
openj9_build_jdk \
run-preprocessors-j9 \
stage-j9 \
stage-openj9-tools \
build-openj9-tools \
#
# generated_target_rules_build
# ----------------------------
# param 1 = The make goal
# param 2 = The jdk/jre directory to add openj9 content
define generated_target_rules_build
.PHONY : $1
$(foreach file,$(OPENJ9_ALT_SHARED_LIBRARIES) $(OPENJ9_BUILD_LIBRARIES), \
$(eval $(call openj9_copy_prereq,$1,$2/$(OPENJ9_LIBS_OUTPUT_DIR)/$(OPENJ9_LIBS_SUBDIR)/$(notdir $(file)),$(OUTPUT_ROOT)/vm/$(file))))
$(foreach file,$(OPENJ9_MISC_FILES) $(OPENJ9_PROPERTY_FILES), \
$(eval $(call openj9_copy_prereq,$1,$2/lib/$(file),$(OUTPUT_ROOT)/vm/$(file))))
$(foreach file,$(OPENJ9_NOTICE_FILES), \
$(eval $(call openj9_copy_prereq,$1,$2/$(file),$(SRC_ROOT)/$(file))))
$(foreach file,$(OPENJ9_REDIRECTOR), \
$(eval $(call openj9_copy_prereq,$1,$2/$(OPENJ9_LIBS_OUTPUT_DIR)/j9vm/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX),$(OUTPUT_ROOT)/vm/$(file))))
$(foreach file,$(OPENJ9_JAVA_BASE_LIBRARIES), \
$(eval $(call openj9_copy_prereq,$1,$(MODULES_LIBS_DIR)/java.base/$(OPENJ9_LIBS_SUBDIR)/$(notdir $(file)),$(OUTPUT_ROOT)/vm/$(file))))
$(foreach file,$(OPENJ9_SHARED_CLASSES_LIBRARIES), \
$(eval $(call openj9_copy_prereq,$1,$(MODULES_LIBS_DIR)/openj9.sharedclasses/$(OPENJ9_LIBS_SUBDIR)/$(file),$(OUTPUT_ROOT)/vm/$(file))))
$(foreach file,$(OPENJ9_MANAGEMENT_LIBRARIES), \
$(eval $(call openj9_copy_prereq,$1,$(MODULES_LIBS_DIR)/java.management/$(OPENJ9_LIBS_SUBDIR)/$(file),$(OUTPUT_ROOT)/vm/$(file))))
$(foreach file,$(OPENJ9_DDR_FILES), \
$(eval $(call openj9_copy_prereq,$1,$(MODULES_LIBS_DIR)/java.base/$(OPENJ9_LIBS_SUBDIR)/$(file),$(OUTPUT_ROOT)/vm/$(file))))
endef
# generated_target_rules
# ----------------------
# param 1 = The make goal
# param 2 = The jdk/jre directory to add openj9 content
define generated_target_rules
.PHONY : $1
$(foreach file,$(OPENJ9_SHARED_LIBRARIES), \
$(eval $(call openj9_copy_prereq,$1,$2/$(OPENJ9_LIBS_OUTPUT_DIR)/$(OPENJ9_LIBS_SUBDIR)/$(file),$(OUTPUT_ROOT)/vm/$(file))))
$(foreach file,$(OPENJ9_MISC_FILES) $(OPENJ9_PROPERTY_FILES), \
$(eval $(call openj9_copy_prereq,$1,$2/lib/$(file),$(OUTPUT_ROOT)/vm/$(file))))
$(foreach file,$(OPENJ9_NOTICE_FILES), \
$(eval $(call openj9_copy_prereq,$1,$2/$(file),$(SRC_ROOT)/$(file))))
$(foreach file,$(OPENJ9_REDIRECTOR), \
$(eval $(call openj9_copy_prereq,$1,$2/$(OPENJ9_LIBS_OUTPUT_DIR)/j9vm/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX),$(OUTPUT_ROOT)/vm/$(file))))
$(foreach file,$(OPENJ9_JAVA_BASE_LIBRARIES), \
$(eval $(call openj9_copy_prereq,$1,$2/$(OPENJ9_LIBS_OUTPUT_DIR)/$(OPENJ9_LIBS_SUBDIR)/$(notdir $(file)),$(OUTPUT_ROOT)/vm/$(file))))
$(foreach file,$(OPENJ9_SHARED_CLASSES_LIBRARIES), \
$(eval $(call openj9_copy_prereq,$1,$2/$(OPENJ9_LIBS_OUTPUT_DIR)/$(OPENJ9_LIBS_SUBDIR)/$(file),$(OUTPUT_ROOT)/vm/$(file))))
endef
# openj9_copy_prereq
# ------------------
# param 1 = The make goal.
# param 2 = The target file to create or update.
# parma 3 = The source file to copy.
define openj9_copy_prereq
$1 : $2
$2 : $3
@$(MKDIR) -p $$(@D)
@$(CP) $$< $$@
endef
# openj9_copy_tree
# ----------------
# param 1 = The target directory to create or update.
# param 2 = The source directory to copy.
define openj9_copy_tree
$(call openj9_copy_tree_impl,$(strip $(abspath $1)),$(strip $(abspath $2)))
endef
OPENJ9_MARKER_FILE := .up-to-date
# Use '-m' to update file modification times ('-m' is equivalent to '--touch' in some implementations of tar).
define openj9_copy_tree_impl
@$(MKDIR) -p $1
@$(TAR) --create --directory=$2 $(if $(wildcard $1/$(OPENJ9_MARKER_FILE)),--newer=$1/$(OPENJ9_MARKER_FILE)) --exclude=.git . \
| $(TAR) --extract --directory=$1 -m
@$(TOUCH) $1/$(OPENJ9_MARKER_FILE)
endef
openj9_build_jdk : build-j9
ifeq ($(BUILD_JDK),$(JDK_OUTPUTDIR))
+$(MAKE) -f $(SRC_ROOT)/closed/OpenJ9.gmk create_build_jdk
endif
# If we weren't given a BUILD_JDK, we must create one.
ifeq ($(BUILD_JDK),$(JDK_OUTPUTDIR))
$(eval $(call generated_target_rules_build,create_build_jdk,$(JDK_OUTPUTDIR)))
endif
$(eval $(call generated_target_rules,openj9_jdk_image,$(JDK_IMAGE_DIR)))
$(eval $(call generated_target_rules,openj9_jre_image,$(JRE_IMAGE_DIR)))
# Comments for stage-j9
# Currently there is a staged location where j9 is built. This is due to a number of reasons:
# 1. make currently leaves output file in current directory
# 2. generated source and header files
# 3. repo layout compared to source.zip layout
# See issue 49 for more information and actions to correct this action.
# Functions to generate sed program fragments.
# $1 - name of flag to be enabled or disabled.
SedDisable = -e '/"$(strip $1)"/s/"true"/"false"/g'
SedEnable = -e '/"$(strip $1)"/s/"false"/"true"/g'
# Adjust features based on our configuration.
ifeq (true,$(OPENJ9_ENABLE_CUDA))
FEATURE_SED_SCRIPT := $(call SedEnable,opt_cuda)
else
FEATURE_SED_SCRIPT := $(call SedDisable,opt_cuda)
endif
# Function to generate sed program fragment.
# $1 - name of make macro to use instead of a hard-coded tool reference.
# $2 - suffix of uma_make_cmd property name to be adjusted.
SedUmaCommand = -e '/<property name="uma_make_cmd_$(strip $2)"/s|value="[^"]*"|value="$($(strip $1))"|'
# Copy configured values to relevant UMA properties in .spec files.
SPEC_SED_SCRIPT := \
$(call SedUmaCommand, CC, cc) \
$(call SedUmaCommand, CXX, cxx) \
$(call SedUmaCommand, CXX, interp_gcc) \
$(call SedUmaCommand, CXX, ppc_gcc_cxx) \
#
# Adjust DDR enablement flags.
ifeq (true,$(OPENJ9_ENABLE_DDR))
FEATURE_SED_SCRIPT += $(call SedEnable,opt_useOmrDdr)
SPEC_SED_SCRIPT += $(call SedEnable,module_ddr)
else
FEATURE_SED_SCRIPT += $(call SedDisable,opt_useOmrDdr)
SPEC_SED_SCRIPT += $(call SedDisable,module_ddr)
endif
# Disable windows rebase.
SPEC_SED_SCRIPT += $(call SedDisable,uma_windowsRebase)
# openj9_stage_buildspec_file
# ---------------------------
# param 1 = The simple name of the file to copy.
define openj9_stage_buildspec_file
stage-j9 : $(OUTPUT_ROOT)/vm/buildspecs/$1
$(OUTPUT_ROOT)/vm/buildspecs/$1 : $(OPENJ9_TOPDIR)/buildspecs/$1
@$(MKDIR) -p $$(@D)
ifeq (.feature,$(suffix $1))
@$(SED) $(FEATURE_SED_SCRIPT) < $$< > $$@
else ifeq (.spec,$(suffix $1))
@$(SED) $(SPEC_SED_SCRIPT) < $$< > $$@
else
@$(CP) $$< $$@
endif
endef
$(foreach file, \
$(notdir $(wildcard $(OPENJ9_TOPDIR)/buildspecs/*)), \
$(eval $(call openj9_stage_buildspec_file,$(file))))
stage-openj9-tools :
@$(ECHO) Staging OpenJ9 sourcetools in $(OUTPUT_ROOT)/vm
$(call openj9_copy_tree,$(OUTPUT_ROOT)/vm/sourcetools,$(OPENJ9_TOPDIR)/sourcetools)
build-openj9-tools : stage-openj9-tools
@$(ECHO) Building OpenJ9 tools
$(MAKE) -C $(OUTPUT_ROOT)/vm/sourcetools $(MAKEFLAGS) -f buildj9tools.mk \
JAVA_HOME=$(BOOT_JDK) lib/jpp.jar
stage-j9 : stage-openj9-tools
@$(ECHO) Staging OpenJ9 debugtools in $(OUTPUT_ROOT)/vm
$(call openj9_copy_tree,$(OUTPUT_ROOT)/vm/debugtools,$(OPENJ9_TOPDIR)/debugtools)
@$(ECHO) Staging OpenJ9 jcl in $(OUTPUT_ROOT)/vm
$(call openj9_copy_tree,$(OUTPUT_ROOT)/vm/jcl,$(OPENJ9_TOPDIR)/jcl)
@$(ECHO) Staging OpenJ9 runtime in $(OUTPUT_ROOT)/vm
$(call openj9_copy_tree,$(OUTPUT_ROOT)/vm,$(OPENJ9_TOPDIR)/runtime)
@$(ECHO) Staging OpenJ9 OMR in $(OUTPUT_ROOT)/vm
$(call openj9_copy_tree,$(OUTPUT_ROOT)/vm/omr,$(OPENJ9OMR_TOPDIR))
OPENJ9_VERSION_VARS := \
COMPILER_VERSION_STRING \
HOTSPOT_TARGET_OS \
OPENJ9_TAG \
OPENJ9_VERSION_STRING \
OPENJDK_SHA \
OPENJDK_TAG \
OPENJDK_TARGET_CPU_BITS \
OPENJDK_TARGET_CPU_OSARCH \
PRODUCT_NAME \
USERNAME \
VERSION_STRING \
#
OPENJ9_VERSION_SCRIPT := \
$(foreach var,$(OPENJ9_VERSION_VARS),-e 's|@${var}@|$(value $(var))|g')
$(OUTPUT_ROOT)/vm/include/openj9_version_info.h : $(SRC_ROOT)/closed/openj9_version_info.h.in
@$(MKDIR) -p $(@D)
@$(SED) $(OPENJ9_VERSION_SCRIPT) > $@ < $<
# capture values for use with DependOnVariable
OPENJ9_VERSION_MAP := $(foreach var,$(sort $(OPENJ9_VERSION_VARS)),$(var)='$(value $(var))')
# update if the map changes
$(OUTPUT_ROOT)/vm/include/openj9_version_info.h : $(call DependOnVariable,OPENJ9_VERSION_MAP)
# Only update version files when the SHAs change.
$(OUTPUT_ROOT)/vm/compiler/jit.version : $(call DependOnVariable, OPENJ9_SHA)
@$(MKDIR) -p $(@D)
$(ECHO) '#define TR_LEVEL_NAME "$(OPENJ9_SHA)"' > $@
$(OUTPUT_ROOT)/vm/omr/OMR_VERSION_STRING : $(call DependOnVariable, OPENJ9OMR_SHA)
@$(MKDIR) -p $(@D)
$(ECHO) '#define OMR_VERSION_STRING "$(OPENJ9OMR_SHA)"' > $@
run-preprocessors-j9 : stage-j9 \
$(OUTPUT_ROOT)/vm/omr/OMR_VERSION_STRING \
$(OUTPUT_ROOT)/vm/compiler/jit.version \
$(OUTPUT_ROOT)/vm/include/openj9_version_info.h
@$(ECHO) Running OpenJ9 preprocessors with OPENJ9_BUILDSPEC: $(OPENJ9_BUILDSPEC)
export BOOT_JDK=$(BOOT_JDK) $(EXPORT_MSVS_ENV_VARS) \
&& $(MAKE) -C $(OUTPUT_ROOT)/vm $(MAKEFLAGS) -f buildtools.mk \
BUILD_ID=$(BUILD_ID) \
CMAKE=$(CMAKE) \
EXTRA_CONFIGURE_ARGS=$(OMR_EXTRA_CONFIGURE_ARGS) \
FREEMARKER_JAR="$(FREEMARKER_JAR)" \
J9VM_SHA=$(OPENJ9_SHA) \
JAVA_HOME=$(BOOT_JDK) \
OMR_DIR=$(OUTPUT_ROOT)/vm/omr \
OPENJ9_BUILD=true \
SPEC=$(OPENJ9_BUILDSPEC) \
UMA_OPTIONS_EXTRA="-buildDate $(shell date +'%Y%m%d')" \
tools
build-j9 : run-preprocessors-j9
@$(ECHO) Compiling OpenJ9 in $(OUTPUT_ROOT)/vm
ifeq (true,$(OPENJ9_ENABLE_CMAKE))
export OPENJ9_BUILD=true $(EXPORT_MSVS_ENV_VARS) \
&& $(MAKE) -C $(OUTPUT_ROOT)/vm/build $(MAKEFLAGS) install
else
export OPENJ9_BUILD=true $(EXPORT_NO_USE_MINGW) $(EXPORT_MSVS_ENV_VARS) \
&& $(MAKE) -C $(OUTPUT_ROOT)/vm $(MAKEFLAGS) all
endif
@$(ECHO) OpenJ9 compile complete
@$(MKDIR) -p $(MODULES_LIBS_DIR)/java.base
@$(CP) -p \
$(addprefix $(OUTPUT_ROOT)/vm/, \
J9TraceFormat.dat \
java*.properties \
OMRTraceFormat.dat \
options.default) \
$(MODULES_LIBS_DIR)/java.base/
# jvm is required for compiling other java.base support natives
@$(ECHO) "Creating support/modules_libs/java.base/*/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX) from J9 sources"
@$(MKDIR) -p $(MODULES_LIBS_DIR)/java.base/j9vm
@$(CP) -p $(OUTPUT_ROOT)/vm/redirector/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX) $(MODULES_LIBS_DIR)/java.base/j9vm/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX)
@$(MKDIR) -p $(MODULES_LIBS_DIR)/java.base/server
@$(CP) -p $(OUTPUT_ROOT)/vm/redirector/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX) $(MODULES_LIBS_DIR)/java.base/server/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX)
J9JCL_SOURCES_DONEFILE := $(MAKESUPPORT_OUTPUTDIR)/j9jcl_sources.done
recur_wildcard = $(foreach dir,$(wildcard $1/*),$(call recur_wildcard,$(dir),$2) $(filter $(subst *,%,$2),$(dir)))
AllJclSource = $(call recur_wildcard,$(OPENJ9_TOPDIR)/jcl/src,*.java)
JPP_BASE_DIR := $(call FixPath,$(OPENJ9_TOPDIR))
JPP_DEST := $(call FixPath,$(SUPPORT_OUTPUTDIR)/j9jcl_sources)
JPP_JAR := $(call FixPath,$(OUTPUT_ROOT)/vm/sourcetools/lib/jpp.jar)
$(J9JCL_SOURCES_DONEFILE) : $(AllJclSource)
@$(ECHO) Generating J9JCL sources
@$(MKDIR) -p $(SUPPORT_OUTPUTDIR)/j9jcl_sources
@$(BOOT_JDK)/bin/java \
-cp "$(JPP_JAR)" \
-Dfile.encoding=US-ASCII \
com.ibm.jpp.commandline.CommandlineBuilder \
-verdict \
-baseDir "$(JPP_BASE_DIR)/" \
-config SIDECAR19-SE-OPENJ9 \
-srcRoot jcl/ \
-xml jpp_configuration.xml \
-dest "$(JPP_DEST)" \
-macro:define "com.ibm.oti.vm.library.version=29" \
-tag:define "PLATFORM-$(OPENJ9_PLATFORM_CODE)"
@$(MKDIR) -p $(@D)
@$(TOUCH) $@
generate-j9jcl-sources : $(J9JCL_SOURCES_DONEFILE)
clean-j9 : clean-openj9-thirdparty-binaries
$(MAKE) -C $(OUTPUT_ROOT)/vm clean
clean-j9-dist : clean-openj9-thirdparty-binaries
$(RM) -fdr $(OUTPUT_ROOT)/vm
clean-openj9-thirdparty-binaries :
$(RM) -f $(OPENJ9_STAGED_THIRDPARTY_BINARIES) $(patsubst %.jar,%.tar.gz,$(OPENJ9_STAGED_THIRDPARTY_BINARIES))