2
# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
# This code is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 2 only, as
7
# published by the Free Software Foundation. Oracle designates this
8
# particular file as subject to the "Classpath" exception as provided
9
# by Oracle in the LICENSE file that accompanied this code.
11
# This code is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
# version 2 for more details (a copy is included in the LICENSE file that
15
# accompanied this code).
17
# You should have received a copy of the GNU General Public License version
18
# 2 along with this work; if not, write to the Free Software Foundation,
19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
# or visit www.oracle.com if you need additional information or have any
26
################################################################################
27
# This is the main makefile containing most actual top level targets. It needs
28
# to be called with a SPEC file defined.
29
################################################################################
31
# Declare default target
34
ifeq ($(wildcard $(SPEC)),)
35
$(error Main.gmk needs SPEC set to a proper spec.gmk)
41
# Load the vital tools for all the makefiles.
42
include $(TOPDIR)/make/common/MakeBase.gmk
43
include $(TOPDIR)/make/common/Modules.gmk
44
include $(TOPDIR)/make/common/FindTests.gmk
46
include $(TOPDIR)/make/MainSupport.gmk
48
# Are we requested to ignore dependencies?
49
ifneq ($(findstring -only, $(MAKECMDGOALS)), )
53
# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
54
# valid top level targets. It's used to declare them all as PHONY and to
55
# generate the -only targets.
58
# Hook to include the corresponding custom file, if present.
59
$(eval $(call IncludeCustomExtension, Main.gmk))
61
# All modules for the current target platform.
62
ALL_MODULES := $(call FindAllModules)
64
################################################################################
65
################################################################################
67
# Recipes for all targets. Only recipes, dependencies are declared later.
69
################################################################################
71
################################################################################
72
# Interim/build tools targets, compiling tools used during the build
74
$(eval $(call SetupTarget, buildtools-langtools, \
75
MAKEFILE := ToolsLangtools, \
78
$(eval $(call SetupTarget, interim-langtools, \
79
MAKEFILE := CompileInterimLangtools, \
82
$(eval $(call SetupTarget, interim-tzdb, \
83
MAKEFILE := CopyInterimTZDB, \
86
$(eval $(call SetupTarget, buildtools-jdk, \
87
MAKEFILE := CompileToolsJdk, \
88
DEPS := interim-langtools interim-tzdb, \
91
$(eval $(call SetupTarget, buildtools-modules, \
92
MAKEFILE := CompileModuleTools, \
95
$(eval $(call SetupTarget, buildtools-hotspot, \
96
MAKEFILE := CompileToolsHotspot, \
99
################################################################################
100
# Gensrc targets, generating source before java compilation can be done
102
$(eval $(call DeclareRecipesForPhase, GENSRC, \
103
TARGET_SUFFIX := gensrc-src, \
104
FILE_PREFIX := Gensrc, \
105
CHECK_MODULES := $(ALL_MODULES), \
108
$(foreach m, $(GENSRC_MODULES), $(eval $m-gensrc: $m-gensrc-src))
110
LANGTOOLS_GENSRC_TARGETS := $(filter $(addsuffix -%, $(LANGTOOLS_MODULES)), $(GENSRC_TARGETS))
111
INTERIM_LANGTOOLS_GENSRC_TARGETS := $(filter $(addsuffix -%, \
112
$(INTERIM_LANGTOOLS_BASE_MODULES)), $(GENSRC_TARGETS))
113
HOTSPOT_GENSRC_TARGETS := $(filter $(addsuffix -%, $(HOTSPOT_MODULES)), $(GENSRC_TARGETS))
114
JDK_GENSRC_TARGETS := $(filter-out $(LANGTOOLS_GENSRC_TARGETS) \
115
$(HOTSPOT_GENSRC_TARGETS), $(GENSRC_TARGETS))
117
GENSRC_MODULEINFO_MODULES := $(ALL_MODULES)
118
GENSRC_MODULEINFO_TARGETS := $(addsuffix -gensrc-moduleinfo, \
119
$(GENSRC_MODULEINFO_MODULES))
121
GENSRC_MODULES := $(GENSRC_MODULEINFO_MODULES)
122
GENSRC_TARGETS += $(sort $(GENSRC_MODULEINFO_TARGETS) \
123
$(addsuffix -gensrc, $(GENSRC_MODULES)))
125
define DeclareModuleInfoRecipe
126
$1-gensrc-moduleinfo:
127
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
128
-f common/modules/GensrcModuleInfo.gmk MODULE=$1)
130
$1-gensrc: $1-gensrc-moduleinfo
133
$(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m)))
135
ALL_TARGETS += $(GENSRC_TARGETS)
137
################################################################################
138
# Generate data targets
139
$(eval $(call DeclareRecipesForPhase, GENDATA, \
140
TARGET_SUFFIX := gendata, \
141
FILE_PREFIX := Gendata, \
142
CHECK_MODULES := $(ALL_MODULES), \
145
ALL_TARGETS += $(GENDATA_TARGETS)
147
################################################################################
149
$(eval $(call DeclareRecipesForPhase, COPY, \
150
TARGET_SUFFIX := copy, \
151
FILE_PREFIX := Copy, \
152
CHECK_MODULES := $(ALL_MODULES), \
155
ALL_COPY_MODULES += $(COPY_MODULES)
156
ALL_COPY_TARGETS += $(COPY_TARGETS)
158
IMPORT_COPY_MODULES := $(call FindImportedModules)
159
IMPORT_COPY_TARGETS := $(addsuffix -copy, $(IMPORT_COPY_MODULES))
160
ALL_COPY_MODULES += $(IMPORT_COPY_MODULES)
161
ALL_COPY_TARGETS += $(IMPORT_COPY_TARGETS)
163
define DeclareImportCopyRecipe
165
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
166
-f CopyImportModules.gmk MODULE=$1)
169
$(foreach m, $(IMPORT_COPY_MODULES), $(eval $(call DeclareImportCopyRecipe,$m)))
171
ALL_TARGETS += $(ALL_COPY_TARGETS)
173
################################################################################
174
# Targets for compiling all java modules.
175
JAVA_MODULES := $(ALL_MODULES)
176
JAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))
178
define DeclareCompileJavaRecipe
180
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
181
$(patsubst %,-I%/modules/$1,$(PHASE_MAKEDIRS)) \
182
-f CompileJavaModules.gmk MODULE=$1)
185
$(foreach m, $(JAVA_MODULES), $(eval $(call DeclareCompileJavaRecipe,$m)))
187
ALL_TARGETS += $(JAVA_TARGETS)
189
################################################################################
190
# Targets for compiling native libraries
191
$(eval $(call DeclareRecipesForPhase, LIBS, \
192
TARGET_SUFFIX := libs, \
193
FILE_PREFIX := Lib, \
194
CHECK_MODULES := $(ALL_MODULES), \
197
ALL_TARGETS += $(LIBS_TARGETS)
199
################################################################################
200
# Targets for compiling static versions of certain native libraries. These do
201
# not end up in the jmods or the normal JDK image, but are instead bundled into
202
# a special deliverable.
203
$(eval $(call DeclareRecipesForPhase, STATIC_LIBS, \
204
TARGET_SUFFIX := static-libs, \
205
FILE_PREFIX := Lib, \
206
CHECK_MODULES := $(ALL_MODULES), \
207
EXTRA_ARGS := STATIC_LIBS=true, \
210
ALL_TARGETS += $(STATIC_LIBS_TARGETS)
212
################################################################################
213
# Targets for compiling native executables
214
$(eval $(call DeclareRecipesForPhase, LAUNCHER, \
215
TARGET_SUFFIX := launchers, \
216
FILE_PREFIX := Launcher, \
217
CHECK_MODULES := $(ALL_MODULES), \
220
ALL_TARGETS += $(LAUNCHER_TARGETS)
222
################################################################################
223
# Build hotspot target
225
HOTSPOT_VARIANT_TARGETS := $(addprefix hotspot-, $(JVM_VARIANTS))
226
HOTSPOT_VARIANT_GENSRC_TARGETS := $(addsuffix -gensrc, $(HOTSPOT_VARIANT_TARGETS))
227
HOTSPOT_VARIANT_LIBS_TARGETS := $(addsuffix -libs, $(HOTSPOT_VARIANT_TARGETS))
228
HOTSPOT_VARIANT_STATIC_LIBS_TARGETS := $(addsuffix -static-libs, $(HOTSPOT_VARIANT_TARGETS))
230
define DeclareHotspotGensrcRecipe
232
$$(call LogInfo, Building JVM variant '$1' with features '$(JVM_FEATURES_$1)')
233
+($(CD) $(TOPDIR)/make/hotspot && $(MAKE) $(MAKE_ARGS) -f gensrc/GenerateSources.gmk \
237
$(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotGensrcRecipe,$v)))
239
define DeclareHotspotLibsRecipe
241
+($(CD) $(TOPDIR)/make/hotspot && $(MAKE) $(MAKE_ARGS) -f lib/CompileLibraries.gmk \
245
$(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotLibsRecipe,$v)))
247
define DeclareHotspotStaticLibsRecipe
248
hotspot-$1-static-libs:
249
+($(CD) $(TOPDIR)/make/hotspot && $(MAKE) $(MAKE_ARGS) -f lib/CompileLibraries.gmk \
250
JVM_VARIANT=$1 STATIC_LIBS=true)
253
$(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotStaticLibsRecipe,$v)))
255
$(eval $(call SetupTarget, hotspot-ide-project, \
256
MAKEFILE := ide/visualstudio/hotspot/CreateVSProject, \
257
DEPS := hotspot exploded-image, \
258
ARGS := -I$(TOPDIR)/make/hotspot, \
261
$(eval $(call SetupTarget, eclipse-java-env, \
262
MAKEFILE := ide/eclipse/CreateWorkspace, \
263
ARGS := --always-make WORKSPACE=java, \
266
$(eval $(call SetupTarget, eclipse-hotspot-env, \
267
MAKEFILE := ide/eclipse/CreateWorkspace, \
268
ARGS := --always-make WORKSPACE=hotspot, \
271
$(eval $(call SetupTarget, eclipse-native-env, \
272
MAKEFILE := ide/eclipse/CreateWorkspace, \
273
ARGS := --always-make WORKSPACE=native, \
276
$(eval $(call SetupTarget, eclipse-mixed-env, \
277
MAKEFILE := ide/eclipse/CreateWorkspace, \
278
ARGS := --always-make, \
281
ALL_TARGETS += $(HOTSPOT_VARIANT_TARGETS) $(HOTSPOT_VARIANT_GENSRC_TARGETS) \
282
$(HOTSPOT_VARIANT_LIBS_TARGETS) $(HOTSPOT_VARIANT_STATIC_LIBS_TARGETS)
284
################################################################################
285
# Help and user support
287
$(eval $(call SetupTarget, doctor, \
288
MAKEFILE := Doctor, \
291
################################################################################
292
# Generate libs and launcher targets for creating compile_commands.json fragments
293
define DeclareCompileCommandsRecipe
295
$$(call LogInfo, Generating compile_commands.json fragments for $1)
296
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Main.gmk $1-only \
297
GENERATE_COMPILE_COMMANDS_ONLY=true)
299
COMPILE_COMMANDS_TARGETS_$2 += $1-compile-commands
302
$(foreach t, $(HOTSPOT_VARIANT_LIBS_TARGETS), \
303
$(eval $(call DeclareCompileCommandsRecipe,$t,HOTSPOT)) \
306
$(foreach t, $(LIBS_TARGETS) $(LAUNCHER_TARGETS), \
307
$(eval $(call DeclareCompileCommandsRecipe,$t,JDK)) \
310
$(eval $(call SetupTarget, compile-commands, \
311
MAKEFILE := CompileCommands, \
314
$(eval $(call SetupTarget, compile-commands-hotspot, \
315
MAKEFILE := CompileCommands, \
318
ALL_TARGETS += $(COMPILE_COMMANDS_TARGETS_HOTSPOT) $(COMPILE_COMMANDS_TARGETS_JDK)
320
################################################################################
323
$(eval $(call SetupTarget, vscode-project, \
324
MAKEFILE := ide/vscode/hotspot/CreateVSCodeProject, \
325
ARGS := VSCODE_INDEXER=cpptools, \
326
DEPS := compile-commands, \
329
$(eval $(call SetupTarget, vscode-project-clangd, \
330
MAKEFILE := ide/vscode/hotspot/CreateVSCodeProject, \
331
ARGS := VSCODE_INDEXER=clangd, \
332
DEPS := compile-commands, \
335
$(eval $(call SetupTarget, vscode-project-rtags, \
336
MAKEFILE := ide/vscode/hotspot/CreateVSCodeProject, \
337
ARGS := VSCODE_INDEXER=rtags, \
338
DEPS := compile-commands, \
341
$(eval $(call SetupTarget, vscode-project-ccls, \
342
MAKEFILE := ide/vscode/hotspot/CreateVSCodeProject, \
343
ARGS := VSCODE_INDEXER=ccls, \
344
DEPS := compile-commands, \
347
################################################################################
350
# The demos are currently linking to libjvm and libjava, just like all other
351
# jdk libs, even though they don't need to. To avoid warnings, make sure they
352
# aren't built until after libjava and libjvm are available to link to.
353
$(eval $(call SetupTarget, demos-jdk, \
354
MAKEFILE := CompileDemos, \
355
DEPS := java.base-libs exploded-image buildtools-jdk, \
358
$(eval $(call SetupTarget, test-image-demos-jdk, \
359
MAKEFILE := CompileDemos, \
364
################################################################################
365
# Jigsaw specific data and analysis targets.
367
$(eval $(call SetupTarget, generate-summary, \
368
MAKEFILE := GenerateModuleSummary, \
369
DEPS := jmods buildtools-modules runnable-buildjdk, \
372
################################################################################
375
JMOD_MODULES := $(ALL_MODULES)
376
JMOD_TARGETS := $(addsuffix -jmod, $(JMOD_MODULES))
378
define DeclareJmodRecipe
380
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
381
$(patsubst %,-I%/modules/$1,$(PHASE_MAKEDIRS)) \
382
-f CreateJmods.gmk MODULE=$1)
385
$(foreach m, $(JMOD_MODULES), $(eval $(call DeclareJmodRecipe,$m)))
387
ALL_TARGETS += $(JMOD_TARGETS)
389
################################################################################
392
$(eval $(call SetupTarget, store-source-revision, \
393
MAKEFILE := SourceRevision, \
394
TARGET := store-source-revision, \
397
$(eval $(call SetupTarget, create-source-revision-tracker, \
398
MAKEFILE := SourceRevision, \
399
TARGET := create-source-revision-tracker, \
402
BOOTCYCLE_TARGET := product-images
404
ifneq ($(COMPILE_TYPE), cross)
405
$(call LogWarn, Boot cycle build step 2: Building a new JDK image using previously built image)
406
$(call MakeDir, $(OUTPUTDIR)/bootcycle-build)
407
+$(MAKE) $(MAKE_ARGS) -f $(TOPDIR)/make/Init.gmk PARALLEL_TARGETS=$(BOOTCYCLE_TARGET) \
408
LOG_PREFIX="[bootcycle] " JOBS= SPEC=$(dir $(SPEC))bootcycle-spec.gmk main
410
$(call LogWarn, Boot cycle build disabled when cross compiling)
413
$(eval $(call SetupTarget, zip-security, \
414
MAKEFILE := ZipSecurity, \
415
DEPS := buildtools-jdk java.base-java java.security.jgss-java java.security.jgss-libs, \
418
$(eval $(call SetupTarget, zip-source, \
419
MAKEFILE := ZipSource, \
420
DEPS := buildtools-jdk gensrc, \
423
$(eval $(call SetupTarget, jrtfs-jar, \
424
MAKEFILE := JrtfsJar, \
425
DEPS := interim-langtools, \
428
$(eval $(call SetupTarget, jdk-image, \
429
MAKEFILE := Images, \
431
DEPS := jmods zip-source demos release-file, \
434
$(eval $(call SetupTarget, legacy-jre-image, \
435
MAKEFILE := Images, \
437
DEPS := jmods release-file, \
440
$(eval $(call SetupTarget, symbols-image, \
441
MAKEFILE := Images, \
445
$(eval $(call SetupTarget, static-libs-image, \
446
MAKEFILE := StaticLibsImage, \
447
TARGET := static-libs-image, \
450
$(eval $(call SetupTarget, static-libs-graal-image, \
451
MAKEFILE := StaticLibsImage, \
452
TARGET := static-libs-graal-image, \
455
$(eval $(call SetupTarget, mac-jdk-bundle, \
456
MAKEFILE := MacBundles, \
457
TARGET := jdk-bundle, \
461
$(eval $(call SetupTarget, mac-legacy-jre-bundle, \
462
MAKEFILE := MacBundles, \
463
TARGET := jre-bundle, \
464
DEPS := legacy-jre-image, \
467
$(eval $(call SetupTarget, release-file, \
468
MAKEFILE := ReleaseFile, \
469
DEPS := create-source-revision-tracker, \
472
$(eval $(call SetupTarget, exploded-image-optimize, \
473
MAKEFILE := ExplodedImageOptimize, \
474
DEPS := java copy gendata java.base-libs java.base-launchers \
475
buildtools-modules, \
478
$(eval $(call SetupTarget, graal-builder-image, \
479
MAKEFILE := GraalBuilderImage, \
480
DEPS := jdk-image static-libs-graal-image, \
483
ifeq ($(JCOV_ENABLED), true)
484
$(eval $(call SetupTarget, jcov-image, \
485
MAKEFILE := Coverage, \
486
TARGET := jcov-image, \
491
ALL_TARGETS += bootcycle-images
493
################################################################################
496
# If building full docs, to complete docs-*-api we need both the javadoc and
498
$(eval $(call SetupTarget, docs-jdk-api-javadoc, \
500
TARGET := docs-jdk-api-javadoc, \
503
$(eval $(call SetupTarget, docs-jdk-api-graphs, \
505
TARGET := docs-jdk-api-graphs, \
506
DEPS := buildtools-modules runnable-buildjdk, \
509
$(eval $(call SetupTarget, docs-javase-api-javadoc, \
511
TARGET := docs-javase-api-javadoc, \
514
$(eval $(call SetupTarget, docs-javase-api-graphs, \
516
TARGET := docs-javase-api-graphs, \
517
DEPS := buildtools-modules runnable-buildjdk, \
520
$(eval $(call SetupTarget, docs-reference-api-javadoc, \
522
TARGET := docs-reference-api-javadoc, \
525
$(eval $(call SetupTarget, docs-reference-api-graphs, \
527
TARGET := docs-reference-api-graphs, \
528
DEPS := buildtools-modules runnable-buildjdk, \
531
# The gensrc steps for jdk.jdi create html spec files.
532
$(eval $(call SetupTarget, docs-jdk-specs, \
534
TARGET := docs-jdk-specs, \
535
DEPS := buildtools-jdk jdk.jdi-gensrc docs-jdk-index, \
538
$(eval $(call SetupTarget, docs-jdk-index, \
540
TARGET := docs-jdk-index, \
543
$(eval $(call SetupTarget, docs-zip, \
545
TARGET := docs-zip, \
546
DEPS := docs-jdk buildtools-jdk, \
549
$(eval $(call SetupTarget, docs-specs-zip, \
551
TARGET := docs-specs-zip, \
552
DEPS := docs-jdk-specs buildtools-jdk, \
555
$(eval $(call SetupTarget, update-build-docs, \
556
MAKEFILE := UpdateBuildDocs, \
559
$(eval $(call SetupTarget, update-x11wrappers, \
560
MAKEFILE := UpdateX11Wrappers, \
561
DEPS := java.base-copy buildtools-jdk, \
564
ifneq ($(HSDIS_BACKEND), none)
565
$(eval $(call SetupTarget, build-hsdis, \
570
$(eval $(call SetupTarget, install-hsdis, \
577
################################################################################
578
# Cross compilation support
580
ifeq ($(CREATING_BUILDJDK), true)
581
# This target is only called by the recursive call below.
582
create-buildjdk-interim-image-helper: interim-image jdk.jlink-launchers \
583
java.base-copy jdk.jdeps-launchers jdk.compiler-launchers
586
BUILDJDK_MODULES := $(sort $(foreach m, jdk.jlink jdk.compiler \
587
$(INTERIM_IMAGE_MODULES), $(call FindTransitiveDepsForModule, $m) $m))
589
$(eval $(call SetupTarget, create-buildjdk-interim-image, \
591
TARGET := create-buildjdk-interim-image-helper, \
592
ARGS := SPEC=$(dir $(SPEC))buildjdk-spec.gmk \
593
HOTSPOT_SPEC=$(dir $(SPEC))buildjdk-spec.gmk \
594
CREATING_BUILDJDK=true \
595
LOG_PREFIX="[buildjdk] " \
596
JAVA_MODULES="$(BUILDJDK_MODULES)", \
599
################################################################################
600
# The interim-image is a small jlinked image that is used to generate artifacts
601
# at build time for use when linking the real images.
603
INTERIM_JMOD_TARGETS := $(addsuffix -interim-jmod, $(INTERIM_IMAGE_MODULES))
605
define DeclareInterimJmodRecipe
607
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CreateJmods.gmk \
609
JMODS_DIR=$(INTERIM_JMODS_DIR) \
610
JMODS_SUPPORT_DIR=$(INTERIM_JMODS_DIR)/support \
615
$(foreach m, $(INTERIM_IMAGE_MODULES), $(eval $(call DeclareInterimJmodRecipe,$m)))
617
$(eval $(call SetupTarget, interim-image, \
618
MAKEFILE := InterimImage, \
621
ifeq ($(ENABLE_GENERATE_CLASSLIST), true)
622
$(eval $(call SetupTarget, generate-link-opt-data, \
623
MAKEFILE := GenerateLinkOptData, \
627
################################################################################
628
# Generate test names for all JTReg test groups
631
define DeclareRunTestRecipe
633
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk \
637
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk \
638
TEST="$1" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR))
641
# ALL_NAMED_TESTS is defined in FindTests.gmk
642
$(foreach t, $(ALL_NAMED_TESTS), $(eval $(call DeclareRunTestRecipe,$t)))
643
ALL_TEST_TARGETS := $(addprefix test-, $(ALL_NAMED_TESTS))
645
# We only support the "exploded-test-gtest" shortcut
646
ALL_EXPLODED_TESTS := gtest
647
ALL_EXPLODED_TEST_TARGETS := $(addprefix exploded-test-, $(ALL_EXPLODED_TESTS))
649
ALL_TARGETS += $(ALL_TEST_TARGETS) $(ALL_EXPLODED_TEST_TARGETS)
651
################################################################################
652
# Build tests and microbenchmarks
655
$(eval $(call SetupTarget, prepare-test-image, \
656
MAKEFILE := TestImage, \
657
TARGET := prepare-test-image, \
660
$(eval $(call SetupTarget, build-test-hotspot-jtreg-native, \
661
MAKEFILE := test/JtregNativeHotspot, \
662
TARGET := build-test-hotspot-jtreg-native, \
663
DEPS := buildtools-jdk, \
666
$(eval $(call SetupTarget, test-image-hotspot-jtreg-native, \
667
MAKEFILE := test/JtregNativeHotspot, \
668
TARGET := test-image-hotspot-jtreg-native, \
669
DEPS := build-test-hotspot-jtreg-native, \
672
$(eval $(call SetupTarget, build-test-jdk-jtreg-native, \
673
MAKEFILE := test/JtregNativeJdk, \
674
TARGET := build-test-jdk-jtreg-native, \
675
DEPS := buildtools-jdk java.base-libs, \
678
$(eval $(call SetupTarget, test-image-jdk-jtreg-native, \
679
MAKEFILE := test/JtregNativeJdk, \
680
TARGET := test-image-jdk-jtreg-native, \
681
DEPS := build-test-jdk-jtreg-native, \
684
# Native files needed by the testlib
685
$(eval $(call SetupTarget, build-test-lib-native, \
686
MAKEFILE := test/BuildTestLibNative, \
687
TARGET := build-test-lib-native, \
688
DEPS := buildtools-jdk java.base-libs, \
691
$(eval $(call SetupTarget, test-image-lib-native, \
692
MAKEFILE := test/BuildTestLibNative, \
693
TARGET := test-image-lib-native, \
694
DEPS := build-test-lib-native, \
697
# Native files needed when testing the testlib itself
698
$(eval $(call SetupTarget, build-test-libtest-jtreg-native, \
699
MAKEFILE := test/JtregNativeLibTest, \
700
TARGET := build-test-libtest-jtreg-native, \
701
DEPS := buildtools-jdk, \
704
$(eval $(call SetupTarget, test-image-libtest-jtreg-native, \
705
MAKEFILE := test/JtregNativeLibTest, \
706
TARGET := test-image-libtest-jtreg-native, \
707
DEPS := build-test-libtest-jtreg-native, \
710
ifneq ($(GTEST_FRAMEWORK_SRC), )
711
$(eval $(call SetupTarget, test-image-hotspot-gtest, \
712
MAKEFILE := hotspot/test/GtestImage, \
717
$(eval $(call SetupTarget, build-test-lib, \
718
MAKEFILE := test/BuildTestLib, \
719
TARGET := build-test-lib, \
720
DEPS := exploded-image, \
723
$(eval $(call SetupTarget, test-image-lib, \
724
MAKEFILE := test/BuildTestLib, \
725
TARGET := test-image-lib, \
726
DEPS := build-test-lib, \
729
ifeq ($(BUILD_FAILURE_HANDLER), true)
730
# Builds the failure handler jtreg extension
731
$(eval $(call SetupTarget, build-test-failure-handler, \
732
MAKEFILE := test/BuildFailureHandler, \
734
DEPS := interim-langtools, \
737
# Copies the failure handler jtreg extension into the test image
738
$(eval $(call SetupTarget, test-image-failure-handler, \
739
MAKEFILE := test/BuildFailureHandler, \
741
DEPS := build-test-failure-handler, \
745
ifeq ($(BUILD_JTREG_TEST_THREAD_FACTORY), true)
746
# Builds the test thread factory jtreg extension
747
$(eval $(call SetupTarget, build-test-test-thread-factory, \
748
MAKEFILE := test/BuildJtregTestThreadFactory, \
750
DEPS := interim-langtools exploded-image, \
753
# Copies the jtreg test thread factory into the test image
754
$(eval $(call SetupTarget, test-image-test-thread-factory, \
755
MAKEFILE := test/BuildJtregTestThreadFactory, \
757
DEPS := build-test-test-thread-factory, \
761
$(eval $(call SetupTarget, build-microbenchmark, \
762
MAKEFILE := test/BuildMicrobenchmark, \
763
DEPS := interim-langtools exploded-image build-test-lib, \
766
################################################################################
769
$(eval $(call SetupTarget, test, \
770
MAKEFILE := RunTests, \
771
ARGS := TEST="$(TEST)", \
772
DEPS := jdk-image test-image, \
775
$(eval $(call SetupTarget, exploded-test, \
776
MAKEFILE := RunTests, \
777
ARGS := TEST="$(TEST)" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR), \
778
DEPS := exploded-image test-image, \
781
ifeq ($(JCOV_ENABLED), true)
782
$(eval $(call SetupTarget, jcov-test, \
783
MAKEFILE := RunTests, \
784
ARGS := TEST="$(TEST)" TEST_OPTS_JCOV=true, \
785
DEPS := jcov-image test-image, \
789
################################################################################
792
$(eval $(call SetupTarget, product-bundles, \
793
MAKEFILE := Bundles, \
794
TARGET := product-bundles, \
795
DEPS := product-images, \
798
$(eval $(call SetupTarget, legacy-bundles, \
799
MAKEFILE := Bundles, \
800
TARGET := legacy-bundles, \
801
DEPS := legacy-images, \
804
$(eval $(call SetupTarget, test-bundles, \
805
MAKEFILE := Bundles, \
806
TARGET := test-bundles, \
807
DEPS := test-image, \
810
$(eval $(call SetupTarget, docs-jdk-bundles, \
811
MAKEFILE := Bundles, \
812
TARGET := docs-jdk-bundles, \
813
DEPS := docs-image, \
816
$(eval $(call SetupTarget, docs-javase-bundles, \
817
MAKEFILE := Bundles, \
818
TARGET := docs-javase-bundles, \
819
DEPS := docs-javase-image, \
822
$(eval $(call SetupTarget, docs-reference-bundles, \
823
MAKEFILE := Bundles, \
824
TARGET := docs-reference-bundles, \
825
DEPS := docs-reference-image, \
828
$(eval $(call SetupTarget, static-libs-bundles, \
829
MAKEFILE := Bundles, \
830
TARGET := static-libs-bundles, \
831
DEPS := static-libs-image, \
834
$(eval $(call SetupTarget, static-libs-graal-bundles, \
835
MAKEFILE := Bundles, \
836
TARGET := static-libs-graal-bundles, \
837
DEPS := static-libs-graal-image, \
840
ifeq ($(JCOV_ENABLED), true)
841
$(eval $(call SetupTarget, jcov-bundles, \
842
MAKEFILE := Bundles, \
843
TARGET := jcov-bundles, \
844
DEPS := jcov-image, \
848
################################################################################
850
# Dependency declarations between targets.
852
# These are declared in two groups. First all dependencies between targets that
853
# have recipes above as these dependencies may be disabled. Then the aggregator
854
# targets that do not have recipes of their own, which will never have their
855
# dependencies disabled.
857
################################################################################
858
# Targets with recipes above
860
# If running an *-only target, parallel execution and dependencies between
861
# recipe targets are disabled. This makes it possible to run a select set of
862
# recipe targets in order. It's the responsibility of the user to make sure
863
# all prerequisites are fulfilled.
867
$(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
869
interim-langtools: $(INTERIM_LANGTOOLS_GENSRC_TARGETS)
871
$(HOTSPOT_GENSRC_TARGETS): interim-langtools buildtools-hotspot
873
$(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
875
$(GENSRC_MODULEINFO_TARGETS): buildtools-jdk
877
$(GENDATA_TARGETS): interim-langtools buildtools-jdk
879
$(JAVA_TARGETS): interim-langtools
881
# Declare dependencies between hotspot-<variant>* targets
882
$(foreach v, $(JVM_VARIANTS), \
883
$(eval hotspot-$v-gensrc: java.base-copy buildtools-hotspot) \
884
$(eval hotspot-$v-libs: hotspot-$v-gensrc java.base-copy) \
885
$(eval hotspot-$v-static-libs: hotspot-$v-gensrc java.base-copy) \
888
# If not already set, set the JVM variant target so that the JVM will be built.
889
JVM_MAIN_LIB_TARGETS ?= hotspot-$(JVM_VARIANT_MAIN)-libs
890
JVM_MAIN_GENSRC_TARGETS ?= hotspot-$(JVM_VARIANT_MAIN)-gensrc
892
# Building one JVM variant is enough to start building the other libs
893
$(LIBS_TARGETS): $(JVM_MAIN_LIB_TARGETS)
895
# Static libs depend on hotspot gensrc
896
$(STATIC_LIBS_TARGETS): $(JVM_MAIN_GENSRC_TARGETS)
898
$(LAUNCHER_TARGETS): java.base-libs
900
# Declare dependency from <module>-java to <module>-gensrc
901
$(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
903
# Declare dependencies between java modules
904
$(foreach m, $(JAVA_MODULES), \
905
$(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
906
$(call FindDepsForModule,$m)))))
907
# Declare dependencies between the module meta targets
908
$(foreach m, $(ALL_MODULES), $(eval $m: $(call FindDepsForModule,$m)))
910
# Declare dependencies from <module>-lib to <module>-java
911
# Skip modules that do not have java source.
912
$(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
914
# Declare dependencies from all other <module>-lib to java.base-lib
915
$(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
916
$(eval $t: java.base-libs))
918
ifeq ($(ENABLE_HSDIS_BUNDLING), true)
919
java.base-copy: build-hsdis
922
# On Windows, we need to copy tzmappings generated by gensrc
923
ifeq ($(call isTargetOs, windows), true)
924
java.base-copy: java.base-gensrc
927
# jdk.accessibility depends on java.desktop
928
jdk.accessibility-libs: java.desktop-libs
930
# This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
931
# header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
933
jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
935
# jdk.jfr-gendata uses TOOL_JFR_GEN from buildtools-hotspot
936
jdk.jfr-gendata: buildtools-hotspot
938
# The swing beans need to have java base properly generated to avoid errors
939
# in javadoc. The X11 wrappers need the java.base include files to have been
940
# copied and processed.
941
java.desktop-gensrc-src: java.base-gensrc java.base-copy
943
jdk.jdeps-gendata: java
945
# jdk.compiler gendata generates ct.sym, which requires all generated
946
# java source and compiled classes present.
947
jdk.compiler-gendata: $(JAVA_TARGETS)
949
# jdk.javadoc gendata generates element-list, which requires all java sources
950
# but not compiled classes.
951
jdk.javadoc-gendata: $(GENSRC_TARGETS)
953
# ct.sym and element-list generation also needs the BUILD_JDK. If the
954
# BUILD_JDK was supplied externally, no extra prerequisites are needed.
955
ifeq ($(CREATE_BUILDJDK), true)
956
ifneq ($(CREATING_BUILDJDK), true)
957
# When cross compiling and an external BUILD_JDK wasn't supplied, it's
958
# produced by the create-buildjdk target.
959
jdk.compiler-gendata: create-buildjdk
960
jdk.javadoc-gendata: create-buildjdk
962
else ifeq ($(EXTERNAL_BUILDJDK), false)
963
# When not cross compiling, the BUILD_JDK is the interim jdk image, and
964
# the javac launcher is needed.
965
jdk.compiler-gendata: jdk.compiler-launchers
966
jdk.javadoc-gendata: jdk.compiler-launchers
969
# Declare dependencies between jmod targets.
970
# java.base jmod needs jrt-fs.jar and access to the jmods for all non
971
# upgradeable modules and their transitive dependencies.
972
# When creating the BUILDJDK, we don't need to add hashes to java.base, thus
973
# we don't need to depend on all other jmods
974
ifneq ($(CREATING_BUILDJDK), true)
975
java.base-jmod: jrtfs-jar $(addsuffix -jmod, $(filter-out java.base, $(sort \
976
$(foreach m, $(filter-out $(call FindAllUpgradeableModules), $(JMOD_MODULES)), \
977
$m $(call FindTransitiveDepsForModules, $m) \
981
# If not already set, set the JVM target so that the JVM will be built.
982
JVM_MAIN_TARGETS ?= hotspot
984
# Building java.base-jmod requires all of VM (ie hotspot) to be built.
985
java.base-jmod: $(JVM_MAIN_TARGETS)
987
# Declare dependencies from <module>-jmod to all other module targets
988
$(foreach m, $(JAVA_MODULES), $(eval $m_JMOD_DEPS += $m-java))
989
$(foreach m, $(GENDATA_MODULES), $(eval $m_JMOD_DEPS += $m-gendata))
990
$(foreach m, $(LIBS_MODULES), $(eval $m_JMOD_DEPS += $m-libs))
991
$(foreach m, $(LAUNCHER_MODULES), $(eval $m_JMOD_DEPS += $m-launchers))
992
$(foreach m, $(COPY_MODULES), $(eval $m_JMOD_DEPS += $m-copy))
993
$(foreach m, $(ALL_MODULES), $(eval $m-jmod: $($(m)_JMOD_DEPS)))
994
$(foreach m, $(INTERIM_IMAGE_MODULES), $(eval $m-interim-jmod: $($(m)_JMOD_DEPS)))
996
# Setup the minimal set of generated native source dependencies for hotspot
997
$(foreach v, $(JVM_VARIANTS), \
998
$(eval hotspot-$v-libs-compile-commands: hotspot-$v-gensrc) \
999
$(foreach m, $(filter java.desktop jdk.hotspot.agent, $(GENSRC_MODULES)), \
1000
$(eval hotspot-$v-libs-compile-commands: $m-gensrc)) \
1003
# For the full JDK compile commands, create all possible generated sources
1004
$(foreach m, $(GENSRC_MODULES), $(eval $m-libs-compile-commands: $m-gensrc))
1005
$(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs-compile-commands: $m-java))
1007
$(COMPILE_COMMANDS_TARGETS_HOTSPOT): clean-compile-commands
1008
$(COMPILE_COMMANDS_TARGETS_JDK): clean-compile-commands
1009
compile-commands-hotspot: $(COMPILE_COMMANDS_TARGETS_HOTSPOT)
1010
compile-commands: $(COMPILE_COMMANDS_TARGETS_HOTSPOT) $(COMPILE_COMMANDS_TARGETS_JDK)
1012
# The -static-libs targets depend on -java as well as java.base-copy.
1013
$(foreach m, $(filter $(JAVA_MODULES), $(STATIC_LIBS_MODULES)), \
1014
$(eval $m-static-libs: $m-java java.base-copy))
1016
# Jmods cannot be created until we have the jmod tool ready to run. During
1017
# a normal build we run it from the exploded image, but when cross compiling
1018
# it's run from the buildjdk, which is either created at build time or user
1020
ifeq ($(CREATE_BUILDJDK), true)
1021
ifneq ($(CREATING_BUILDJDK), true)
1022
# When cross compiling and buildjdk is to be created, simply depend on
1023
# creating the buildjdk.
1024
$(JMOD_TARGETS): create-buildjdk
1025
buildtools-modules: create-buildjdk
1027
# While actually creating the buildjdk, we need to list the bare
1028
# minimum dependencies needed before running jmod, to avoid building
1029
# more than necessary. This includes:
1030
# * all java modules
1031
# * jdk.jlink-launchers
1032
# * copy jvm.cfg (done in java.base-copy)
1033
# * tzdb.dat (done in java.base-gendata)
1034
# Without all of these jimage, jlink and jmod won't start.
1035
$(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): java.base-libs java.base-copy \
1036
java.base-gendata jdk.jlink-launchers java
1038
else ifeq ($(EXTERNAL_BUILDJDK), false)
1039
# The normal non cross compilation usecase needs to wait for the full
1040
# exploded-image to avoid a race with the optimize target.
1041
$(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): exploded-image
1042
# The buildtools-modules are used for the exploded-image-optimize target,
1043
# but can be built either using the exploded-image or an external BUILDJDK.
1044
buildtools-modules: exploded-image-base
1047
# All modules include the main license files from java.base.
1048
$(JMOD_TARGETS): java.base-copy
1050
# jdk.javadoc uses an internal copy of the main license files from java.base.
1051
jdk.javadoc-copy: java.base-copy
1053
zip-security: $(filter jdk.crypto%, $(JAVA_TARGETS))
1055
ifeq ($(ENABLE_GENERATE_CLASSLIST), true)
1056
ifeq ($(CREATE_BUILDJDK), true)
1057
# If creating a buildjdk, the interim image needs to be based on that.
1058
generate-link-opt-data: create-buildjdk
1059
else ifeq ($(EXTERNAL_BUILDJDK), false)
1060
# If an external buildjdk has been provided, we skip generating an
1061
# interim-image and just use the external buildjdk for generating
1063
generate-link-opt-data: interim-image
1065
generate-link-opt-data: buildtools-jdk
1067
# The generated classlist needs to go into java.base-jmod.
1068
java.base-jmod jdk.jlink-jmod jdk-image legacy-jre-image: generate-link-opt-data
1071
symbols-image: $(LIBS_TARGETS) $(LAUNCHER_TARGETS)
1073
static-libs-image: hotspot-static-libs $(STATIC_LIBS_TARGETS)
1075
static-libs-graal-image: $(STATIC_LIBS_TARGETS)
1077
bootcycle-images: jdk-image
1079
docs-jdk-api-javadoc: $(GENSRC_TARGETS)
1081
docs-javase-api-javadoc: $(GENSRC_TARGETS)
1083
docs-reference-api-javadoc: $(GENSRC_TARGETS)
1085
# If not already set, then set the JVM specific docs targets
1086
JVM_DOCS_TARGETS ?= hotspot-$(JVM_VARIANT_MAIN)-gensrc
1088
# The gensrc steps for hotspot create html spec files.
1089
docs-jdk-specs: $(JVM_DOCS_TARGETS)
1092
test-make: clean-test-make compile-commands
1094
test-make-compile-commands: compile-commands
1096
# Declare dependency for all generated test targets
1097
$(foreach t, $(filter-out test-make%, $(ALL_TEST_TARGETS)), $(eval $t: jdk-image test-image))
1098
$(foreach t, $(ALL_EXPLODED_TEST_TARGETS), $(eval $t: exploded-image test-image))
1100
interim-image: $(INTERIM_JMOD_TARGETS)
1102
build-test-hotspot-jtreg-native: hotspot-$(JVM_VARIANT_MAIN)-libs
1103
build-test-libtest-jtreg-native: hotspot-$(JVM_VARIANT_MAIN)-libs
1107
################################################################################
1108
# Virtual targets without recipes
1110
# If not already set, set the JVM specific tools targets
1111
JVM_TOOLS_TARGETS ?= buildtools-hotspot
1112
buildtools: buildtools-langtools interim-langtools \
1113
buildtools-jdk $(JVM_TOOLS_TARGETS)
1115
# Declare dependencies from hotspot-<variant> targets
1116
$(foreach v, $(JVM_VARIANTS), \
1117
$(eval hotspot-$v: hotspot-$v-gensrc hotspot-$v-libs) \
1119
hotspot: $(HOTSPOT_VARIANT_TARGETS)
1121
# Create targets hotspot-libs and hotspot-gensrc.
1122
$(foreach v, $(JVM_VARIANTS), \
1123
$(eval hotspot-libs: hotspot-$v-libs) \
1124
$(eval hotspot-gensrc: hotspot-$v-gensrc) \
1125
$(eval hotspot-static-libs: hotspot-$v-static-libs) \
1128
gensrc: $(GENSRC_TARGETS)
1130
gendata: $(GENDATA_TARGETS)
1132
copy: $(ALL_COPY_TARGETS)
1134
java: $(JAVA_TARGETS)
1136
libs: $(LIBS_TARGETS)
1138
static-libs: $(STATIC_LIBS_TARGETS)
1140
launchers: $(LAUNCHER_TARGETS)
1142
jmods: $(JMOD_TARGETS)
1144
# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
1145
# is actually handled by jdk.jdi-gensrc
1146
jdk.jdwp.agent-gensrc: jdk.jdi-gensrc
1148
# Declare dependencies from <module> to all the individual targets specific
1149
# to that module <module>-*, that are needed for the exploded image.
1150
$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
1151
$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
1152
$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
1153
$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
1154
$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
1155
$(foreach m, $(ALL_COPY_MODULES), $(eval $m: $m-copy))
1157
# Building java.base includes building all of hotspot.
1158
java.base: $(JVM_MAIN_TARGETS)
1162
# The "exploded image" is a locally runnable JDK in $(OUTPUTDIR)/jdk.
1163
exploded-image-base: $(ALL_MODULES)
1164
exploded-image: exploded-image-base release-file
1165
# When cross compiling, no need to optimize the exploded image since it won't
1166
# be runnable on the host platform anyway.
1167
ifneq ($(COMPILE_TYPE), cross)
1168
exploded-image: exploded-image-optimize
1171
# The runnable-buildjdk target guarantees that the buildjdk is done
1172
# building and ready to be used. The exact set of dependencies it needs
1173
# depends on what kind of buildjdk is used for the current configuration.
1175
ifeq ($(CREATE_BUILDJDK), true)
1176
ifneq ($(CREATING_BUILDJDK), true)
1177
runnable-buildjdk: create-buildjdk
1179
else ifeq ($(EXTERNAL_BUILDJDK), false)
1180
runnable-buildjdk: exploded-image
1183
create-buildjdk: create-buildjdk-interim-image
1185
docs-jdk-api: docs-jdk-api-javadoc
1186
docs-javase-api: docs-javase-api-javadoc
1187
docs-reference-api: docs-reference-api-javadoc
1189
# If we're building full docs, we must also generate the module graphs to
1190
# get non-broken api documentation.
1191
ifeq ($(ENABLE_FULL_DOCS), true)
1192
docs-jdk-api: docs-jdk-api-graphs
1193
docs-javase-api: docs-javase-api-graphs
1194
docs-reference-api: docs-reference-api-graphs
1196
# We must generate javadoc first so we know what graphs are needed
1197
docs-jdk-api-graphs: docs-jdk-api-javadoc
1198
docs-javase-api-graphs: docs-javase-api-javadoc
1199
docs-reference-api-graphs: docs-reference-api-javadoc
1202
docs-jdk: docs-jdk-api docs-jdk-specs docs-jdk-index
1203
docs-javase: docs-javase-api
1204
docs-reference: docs-reference-api
1206
# alias for backwards compatibility
1207
docs-javadoc: docs-jdk-api
1209
mac-bundles: mac-jdk-bundle
1211
# The $(OUTPUTDIR)/images directory contain the resulting deliverables,
1212
# and in line with this, our targets for creating these are named *-image[s].
1214
# This target builds the product images, e.g. the JDK image
1215
# (and possibly other, more specific versions)
1216
product-images: jdk-image symbols-image exploded-image
1218
# This target builds the legacy images, e.g. the legacy JRE image
1219
legacy-images: legacy-jre-image
1221
# zip-security is actually a bundle, but for now it needs to be considered
1222
# an image until this can be cleaned up properly.
1223
product-images: zip-security
1225
# The module summary cannot be run when:
1226
# * Cross compiling and building a partial BUILDJDK for the build host
1227
# * An external buildjdk has been supplied since it may not match the
1228
# module selection of the target jdk
1229
ifneq ($(CREATE_BUILDJDK), true)
1230
ifeq ($(EXTERNAL_BUILDJDK), false)
1231
product-images: generate-summary
1235
ifeq ($(call isTargetOs, macosx), true)
1236
product-images: mac-jdk-bundle
1238
legacy-images: mac-legacy-jre-bundle
1241
# These targets build the various documentation images
1242
docs-jdk-image: docs-jdk
1243
docs-javase-image: docs-javase
1244
docs-reference-image: docs-reference
1245
# The docs-jdk-image is what most users expect to be built
1246
docs-image: docs-jdk-image
1247
all-docs-images: docs-jdk-image docs-javase-image docs-reference-image
1249
docs-bundles: docs-jdk-bundles
1250
all-docs-bundles: docs-jdk-bundles docs-javase-bundles docs-reference-bundles
1252
# This target builds the test image
1253
test-image: prepare-test-image test-image-jdk-jtreg-native \
1254
test-image-demos-jdk test-image-libtest-jtreg-native \
1255
test-image-lib test-image-lib-native
1257
ifneq ($(JVM_TEST_IMAGE_TARGETS), )
1258
# If JVM_TEST_IMAGE_TARGETS is externally defined, use it instead of the
1259
# standard hotspot set of tests.
1260
test-image: $(JVM_TEST_IMAGE_TARGETS)
1262
test-image: test-image-hotspot-jtreg-native
1263
ifneq ($(GTEST_FRAMEWORK_SRC), )
1264
test-image: test-image-hotspot-gtest
1268
ifeq ($(BUILD_FAILURE_HANDLER), true)
1269
test-image: test-image-failure-handler
1272
ifeq ($(BUILD_JTREG_TEST_THREAD_FACTORY), true)
1273
test-image: test-image-test-thread-factory
1276
ifneq ($(JMH_CORE_JAR), )
1277
test-image: build-microbenchmark
1280
################################################################################
1282
# all-images builds all our deliverables as images.
1283
all-images: product-images test-image all-docs-images
1285
# all-bundles packages all our deliverables as tar.gz bundles.
1286
all-bundles: product-bundles test-bundles docs-bundles static-libs-bundles
1288
ALL_TARGETS += buildtools hotspot hotspot-libs hotspot-static-libs \
1289
hotspot-gensrc gensrc gendata \
1290
copy java libs static-libs launchers jmods \
1291
jdk.jdwp.agent-gensrc $(ALL_MODULES) demos \
1292
exploded-image-base exploded-image runnable-buildjdk \
1293
create-buildjdk docs-jdk-api docs-javase-api docs-reference-api docs-jdk \
1294
docs-javase docs-reference docs-javadoc mac-bundles product-images legacy-images \
1295
docs-image docs-javase-image docs-reference-image all-docs-images \
1296
docs-bundles all-docs-bundles test-image all-images \
1299
################################################################################
1301
# Traditional targets typically run by users.
1302
# These can be considered aliases for the targets now named by a more
1303
# "modern" naming scheme.
1304
default: $(DEFAULT_MAKE_TARGET)
1306
images: product-images
1311
ALL_TARGETS += default jdk images docs bundles all
1313
# Aliases used for running tests.
1315
# Let "run-test" be an alias for "test"
1316
$(foreach t, $(ALL_NAMED_TESTS), $(eval run-test-$t: test-$t))
1317
RUN_TEST_TARGETS := $(addprefix run-test-, $(ALL_NAMED_TESTS))
1320
exploded-run-test: exploded-test
1322
# "make check" is a common idiom for running basic testing
1325
# Keep some old names as aliases
1326
test-hotspot-jtreg: test-hotspot_all
1327
test-hotspot-jtreg-native: test-hotspot_native_sanity
1328
test-hotspot-gtest: exploded-test-gtest
1329
test-jdk-jtreg-native: test-jdk_native_sanity
1331
ALL_TARGETS += $(RUN_TEST_TARGETS) run-test exploded-run-test check \
1332
test-hotspot-jtreg test-hotspot-jtreg-native test-hotspot-gtest \
1333
test-jdk-jtreg-native
1335
################################################################################
1336
################################################################################
1340
################################################################################
1341
# Clean targets are automatically run serially by the Makefile calling this
1344
CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
1345
images make-support test-make bundles buildjdk test-results test-support \
1347
CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
1348
CLEAN_SUPPORT_DIRS += demos
1349
CLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS))
1350
CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib
1351
CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS))
1352
CLEAN_PHASES := gensrc java native include
1353
CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
1354
CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
1355
# Construct targets of the form clean-$module-$phase
1356
CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
1357
$(addprefix $m-, $(CLEAN_PHASES))))
1359
# Remove everything, except the output from configure.
1360
clean: $(CLEAN_DIR_TARGETS)
1361
($(CD) $(OUTPUTDIR) && $(RM) -r build*.log* compile_commands.json)
1362
$(ECHO) Cleaned all build artifacts.
1367
clean-compile-commands:
1368
$(call CleanMakeSupportDir,compile-commands)
1370
$(CLEAN_DIR_TARGETS):
1371
$(call CleanDir,$(patsubst clean-%, %, $@))
1373
$(CLEAN_SUPPORT_DIR_TARGETS):
1374
$(call CleanSupportDir,$(patsubst clean-%, %, $@))
1376
$(CLEAN_TEST_TARGETS):
1377
$(call CleanTest,$(patsubst clean-test-%, %, $@))
1379
$(CLEAN_PHASE_TARGETS):
1380
$(call Clean-$(patsubst clean-%,%, $@))
1382
$(CLEAN_MODULE_TARGETS):
1383
$(call CleanModule,$(patsubst clean-%, %, $@))
1385
$(CLEAN_MODULE_PHASE_TARGETS):
1386
$(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
1387
$(word 2, $(subst -,$(SPACE),$@)))
1389
# When removing the support dir, we must also remove jdk. Building classes has
1390
# the side effect of generating native headers. The headers end up in support
1391
# while classes and touch files end up in jdk.
1392
clean-support: clean-jdk
1394
clean-test: clean-test-results clean-test-support
1396
# When cleaning images, also clean the support/images directory.
1397
clean-images: clean-support/images
1399
# Remove everything, including configure configuration. If the output
1400
# directory was created by configure and now becomes empty, remove it as well.
1402
($(CD) $(OUTPUTDIR) && \
1403
$(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide \
1404
configure.log* build.log*)
1405
$(if $(filter $(CONF_NAME),$(notdir $(OUTPUTDIR))), \
1406
if test "x`$(LS) $(OUTPUTDIR)`" != x; then \
1407
$(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
1409
($(CD) $(TOPDIR) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
1410
&& $(RM) -r $(OUTPUTDIR)) \
1413
$(ECHO) Cleaned everything, you will have to re-run configure.
1415
ALL_TARGETS += clean clean-docs clean-compile-commands dist-clean $(CLEAN_DIR_TARGETS) \
1416
$(CLEAN_SUPPORT_DIR_TARGETS) $(CLEAN_TEST_TARGETS) $(CLEAN_PHASE_TARGETS) \
1417
$(CLEAN_MODULE_TARGETS) $(CLEAN_MODULE_PHASE_TARGETS)
1419
################################################################################
1420
# Declare *-only targets for each normal target
1421
$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
1423
ALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS)))
1425
################################################################################
1427
# The following targets are intentionally not added to ALL_TARGETS since they
1428
# are internal only, to support Init.gmk.
1431
$(info $(subst $(SPACE),$(NEWLINE),$(sort $(ALL_TARGETS))))
1434
$(info $(subst $(SPACE),$(NEWLINE),$(sort $(ALL_MODULES))))
1437
$(info $(subst $(SPACE),$(NEWLINE),$(sort $(ALL_NAMED_TESTS))))
1439
create-main-targets-include:
1440
$(call LogInfo, Generating main target list)
1441
@$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
1442
$(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
1444
################################################################################
1445
# Hook to include the corresponding custom file, if present.
1446
$(eval $(call IncludeCustomExtension, Main-post.gmk))
1448
.PHONY: $(ALL_TARGETS)