1 #
2 # Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
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.
10 #
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).
16 #
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.
20 #
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
23 # questions.
24 #
25
26 ################################################################################
27 # This is the main makefile containing most actual top level targets.
28 ################################################################################
29
30 # Declare ALL_TARGETS as an immediate variable. This variable is a list of all
31 # valid top level targets. It's used to declare them all as PHONY and to
32 # generate the -only targets.
33
34 ALL_TARGETS :=
35
36 DEFAULT_TARGET := default-target
37
38 include MakeFileStart.gmk
39
40 ################################################################################
41
42 include $(TOPDIR)/make/MainSupport.gmk
43
44 include FindTests.gmk
45
46 ifeq ($(UPDATE_MODULE_DEPS), true)
47 # Update module-deps.gmk if requested. This is read in Modules.gmk.
48 GENERATE_MODULE_DEPS_FILE := true
49 endif
50
51 include Modules.gmk
52
53 # Are we requested to ignore dependencies?
54 ifneq ($(findstring -only, $(MAKECMDGOALS)), )
55 DEPS := none
56 endif
57
58
59 # All modules for the current target platform.
60 ALL_MODULES := $(call FindAllModules)
61
62 ################################################################################
63 #
64 # Recipes for all targets. Only recipes, dependencies are declared later.
65 #
66 ################################################################################
67
68 ################################################################################
69 # Interim/build tools targets, compiling tools used during the build
70
71 $(eval $(call SetupTarget, buildtools-langtools, \
72 MAKEFILE := ToolsLangtools, \
73 ))
74
75 $(eval $(call SetupTarget, interim-langtools, \
76 MAKEFILE := CompileInterimLangtools, \
77 ))
78
79 $(eval $(call SetupTarget, interim-tzdb, \
80 MAKEFILE := CopyInterimTZDB, \
81 ))
82
83 $(eval $(call SetupTarget, buildtools-jdk, \
84 MAKEFILE := CompileToolsJdk, \
85 DEPS := interim-langtools interim-tzdb, \
86 ))
87
88 $(eval $(call SetupTarget, buildtools-modules, \
89 MAKEFILE := CompileModuleTools, \
90 ))
91
92 $(eval $(call SetupTarget, buildtools-hotspot, \
93 MAKEFILE := CompileToolsHotspot, \
94 ))
95
96 ################################################################################
97 # Gensrc targets, generating source before java compilation can be done
98 #
99 $(eval $(call DeclareRecipesForPhase, GENSRC, \
100 TARGET_SUFFIX := gensrc-src, \
101 FILE_PREFIX := Gensrc, \
102 CHECK_MODULES := $(ALL_MODULES), \
103 ))
104
105 $(foreach m, $(GENSRC_MODULES), $(eval $m-gensrc: $m-gensrc-src))
106
107 LANGTOOLS_GENSRC_TARGETS := $(filter $(addsuffix -%, $(LANGTOOLS_MODULES)), $(GENSRC_TARGETS))
108 INTERIM_LANGTOOLS_GENSRC_TARGETS := $(filter $(addsuffix -%, \
109 $(INTERIM_LANGTOOLS_BASE_MODULES)), $(GENSRC_TARGETS))
110 HOTSPOT_GENSRC_TARGETS := $(filter $(addsuffix -%, $(HOTSPOT_MODULES)), $(GENSRC_TARGETS))
111 JDK_GENSRC_TARGETS := $(filter-out $(LANGTOOLS_GENSRC_TARGETS) \
112 $(HOTSPOT_GENSRC_TARGETS), $(GENSRC_TARGETS))
113
114 GENSRC_MODULEINFO_MODULES := $(ALL_MODULES)
115 GENSRC_MODULEINFO_TARGETS := $(addsuffix -gensrc-moduleinfo, \
116 $(GENSRC_MODULEINFO_MODULES))
117
118 GENSRC_MODULES := $(GENSRC_MODULEINFO_MODULES)
119 GENSRC_TARGETS += $(sort $(GENSRC_MODULEINFO_TARGETS) \
120 $(addsuffix -gensrc, $(GENSRC_MODULES)))
121
122 define DeclareModuleInfoRecipe
123 $1-gensrc-moduleinfo:
124 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
125 -f common/modules/GensrcModuleInfo.gmk MODULE=$1)
126
127 $1-gensrc: $1-gensrc-moduleinfo
128 endef
129
130 $(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m)))
131
132 ALL_TARGETS += $(GENSRC_TARGETS)
133
134 ################################################################################
135 # Generate data targets
136 $(eval $(call DeclareRecipesForPhase, GENDATA, \
137 TARGET_SUFFIX := gendata, \
138 FILE_PREFIX := Gendata, \
139 CHECK_MODULES := $(ALL_MODULES), \
140 ))
141
142 ALL_TARGETS += $(GENDATA_TARGETS)
143
144 ################################################################################
145 # Copy files targets
146 $(eval $(call DeclareRecipesForPhase, COPY, \
147 TARGET_SUFFIX := copy, \
148 FILE_PREFIX := Copy, \
149 CHECK_MODULES := $(ALL_MODULES), \
150 ))
151
152 ALL_COPY_MODULES += $(COPY_MODULES)
153 ALL_COPY_TARGETS += $(COPY_TARGETS)
154
155 IMPORT_COPY_MODULES := $(call FindImportedModules)
156 IMPORT_COPY_TARGETS := $(addsuffix -copy, $(IMPORT_COPY_MODULES))
157 ALL_COPY_MODULES += $(IMPORT_COPY_MODULES)
158 ALL_COPY_TARGETS += $(IMPORT_COPY_TARGETS)
159
160 define DeclareImportCopyRecipe
161 $1-copy:
162 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
163 -f CopyImportModules.gmk MODULE=$1)
164 endef
165
166 $(foreach m, $(IMPORT_COPY_MODULES), $(eval $(call DeclareImportCopyRecipe,$m)))
167
168 ALL_TARGETS += $(ALL_COPY_TARGETS)
169
170 ################################################################################
171 # Targets for compiling all java modules.
172 JAVA_MODULES := $(ALL_MODULES)
173 JAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))
174
175 define DeclareCompileJavaRecipe
176 $1-java:
177 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
178 $(patsubst %,-I%/modules/$1,$(PHASE_MAKEDIRS)) \
179 -f CompileJavaModules.gmk MODULE=$1)
180 endef
181
182 $(foreach m, $(JAVA_MODULES), $(eval $(call DeclareCompileJavaRecipe,$m)))
183
184 ALL_TARGETS += $(JAVA_TARGETS)
185
186 ################################################################################
187 # Targets for compiling native libraries
188 $(eval $(call DeclareRecipesForPhase, LIBS, \
189 TARGET_SUFFIX := libs, \
190 FILE_PREFIX := Lib, \
191 CHECK_MODULES := $(ALL_MODULES), \
192 ))
193
194 ALL_TARGETS += $(LIBS_TARGETS)
195
196 ################################################################################
197 # Targets for compiling static versions of certain native libraries. These do
198 # not end up in the jmods or the normal JDK image, but are instead bundled into
199 # a special deliverable.
200 $(eval $(call DeclareRecipesForPhase, STATIC_LIBS, \
201 TARGET_SUFFIX := static-libs, \
202 FILE_PREFIX := Lib, \
203 CHECK_MODULES := $(ALL_MODULES), \
204 EXTRA_ARGS := STATIC_LIBS=true, \
205 ))
206
207 ALL_TARGETS += $(STATIC_LIBS_TARGETS)
208
209 ################################################################################
210 # Targets for compiling native executables
211 $(eval $(call DeclareRecipesForPhase, LAUNCHER, \
212 TARGET_SUFFIX := launchers, \
213 FILE_PREFIX := Launcher, \
214 CHECK_MODULES := $(ALL_MODULES), \
215 ))
216
217 ALL_TARGETS += $(LAUNCHER_TARGETS)
218
219 ################################################################################
220 # Build hotspot target
221
222 HOTSPOT_VARIANT_TARGETS := $(addprefix hotspot-, $(JVM_VARIANTS))
223 HOTSPOT_VARIANT_GENSRC_TARGETS := $(addsuffix -gensrc, $(HOTSPOT_VARIANT_TARGETS))
224 HOTSPOT_VARIANT_LIBS_TARGETS := $(addsuffix -libs, $(HOTSPOT_VARIANT_TARGETS))
225 HOTSPOT_VARIANT_STATIC_LIBS_TARGETS := $(addsuffix -static-libs, $(HOTSPOT_VARIANT_TARGETS))
226
227 define DeclareHotspotGensrcRecipe
228 hotspot-$1-gensrc:
229 $$(call LogInfo, Building JVM variant '$1' with features '$(JVM_FEATURES_$1)')
230 +($(CD) $(TOPDIR)/make/hotspot && $(MAKE) $(MAKE_ARGS) -f gensrc/GenerateSources.gmk \
231 JVM_VARIANT=$1)
232 endef
233
234 $(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotGensrcRecipe,$v)))
235
236 define DeclareHotspotLibsRecipe
237 hotspot-$1-libs:
238 +($(CD) $(TOPDIR)/make/hotspot && $(MAKE) $(MAKE_ARGS) -f lib/CompileLibraries.gmk \
239 JVM_VARIANT=$1)
240 endef
241
242 $(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotLibsRecipe,$v)))
243
244 define DeclareHotspotStaticLibsRecipe
245 hotspot-$1-static-libs:
246 +($(CD) $(TOPDIR)/make/hotspot && $(MAKE) $(MAKE_ARGS) -f lib/CompileLibraries.gmk \
247 JVM_VARIANT=$1 STATIC_LIBS=true)
248 endef
249
250 $(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotStaticLibsRecipe,$v)))
251
252 $(eval $(call SetupTarget, hotspot-ide-project, \
253 MAKEFILE := ide/visualstudio/hotspot/CreateVSProject, \
254 DEPS := hotspot exploded-image, \
255 ARGS := -I$(TOPDIR)/make/hotspot, \
256 ))
257
258 $(eval $(call SetupTarget, eclipse-java-env, \
259 MAKEFILE := ide/eclipse/CreateWorkspace, \
260 ARGS := --always-make WORKSPACE=java, \
261 ))
262
263 $(eval $(call SetupTarget, eclipse-hotspot-env, \
264 MAKEFILE := ide/eclipse/CreateWorkspace, \
265 ARGS := --always-make WORKSPACE=hotspot, \
266 ))
267
268 $(eval $(call SetupTarget, eclipse-native-env, \
269 MAKEFILE := ide/eclipse/CreateWorkspace, \
270 ARGS := --always-make WORKSPACE=native, \
271 ))
272
273 $(eval $(call SetupTarget, eclipse-mixed-env, \
274 MAKEFILE := ide/eclipse/CreateWorkspace, \
275 ARGS := --always-make, \
276 ))
277
278 $(eval $(call SetupTarget, hotspot-xcode-project, \
279 MAKEFILE := ide/xcode/hotspot/CreateXcodeProject, \
280 TARGET := build, \
281 DEPS := hotspot compile-commands-hotspot jdk-image, \
282 ))
283
284 $(eval $(call SetupTarget, open-hotspot-xcode-project, \
285 MAKEFILE := ide/xcode/hotspot/CreateXcodeProject, \
286 TARGET := open, \
287 DEPS := hotspot-xcode-project, \
288 ))
289
290 ALL_TARGETS += $(HOTSPOT_VARIANT_TARGETS) $(HOTSPOT_VARIANT_GENSRC_TARGETS) \
291 $(HOTSPOT_VARIANT_LIBS_TARGETS) $(HOTSPOT_VARIANT_STATIC_LIBS_TARGETS)
292
293 ################################################################################
294 # Help and user support
295
296 $(eval $(call SetupTarget, doctor, \
297 MAKEFILE := Doctor, \
298 ))
299
300 ################################################################################
301 # Generate libs and launcher targets for creating compile_commands.json fragments
302 define DeclareCompileCommandsRecipe
303 $1-compile-commands:
304 $$(call LogInfo, Generating compile_commands.json fragments for $1)
305 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Main.gmk $1-only \
306 GENERATE_COMPILE_COMMANDS_ONLY=true)
307
308 COMPILE_COMMANDS_TARGETS_$2 += $1-compile-commands
309 endef
310
311 $(foreach t, $(HOTSPOT_VARIANT_LIBS_TARGETS), \
312 $(eval $(call DeclareCompileCommandsRecipe,$t,HOTSPOT)) \
313 )
314
315 $(foreach t, $(LIBS_TARGETS) $(LAUNCHER_TARGETS), \
316 $(eval $(call DeclareCompileCommandsRecipe,$t,JDK)) \
317 )
318
319 $(eval $(call SetupTarget, compile-commands, \
320 MAKEFILE := CompileCommands, \
321 ))
322
323 $(eval $(call SetupTarget, compile-commands-hotspot, \
324 MAKEFILE := CompileCommands, \
325 ))
326
327 ALL_TARGETS += $(COMPILE_COMMANDS_TARGETS_HOTSPOT) $(COMPILE_COMMANDS_TARGETS_JDK)
328
329 ################################################################################
330 # VS Code projects
331
332 $(eval $(call SetupTarget, vscode-project, \
333 MAKEFILE := ide/vscode/hotspot/CreateVSCodeProject, \
334 ARGS := VSCODE_INDEXER=cpptools, \
335 DEPS := compile-commands, \
336 ))
337
338 $(eval $(call SetupTarget, vscode-project-clangd, \
339 MAKEFILE := ide/vscode/hotspot/CreateVSCodeProject, \
340 ARGS := VSCODE_INDEXER=clangd, \
341 DEPS := compile-commands, \
342 ))
343
344 $(eval $(call SetupTarget, vscode-project-rtags, \
345 MAKEFILE := ide/vscode/hotspot/CreateVSCodeProject, \
346 ARGS := VSCODE_INDEXER=rtags, \
347 DEPS := compile-commands, \
348 ))
349
350 $(eval $(call SetupTarget, vscode-project-ccls, \
351 MAKEFILE := ide/vscode/hotspot/CreateVSCodeProject, \
352 ARGS := VSCODE_INDEXER=ccls, \
353 DEPS := compile-commands, \
354 ))
355
356 ################################################################################
357 # IDEA IntelliJ projects
358
359 $(eval $(call SetupTarget, idea-gen-config, \
360 MAKEFILE := ide/idea/jdk/IdeaGenConfig, \
361 ARGS := IDEA_OUTPUT="$(IDEA_OUTPUT)" MODULES="$(MODULES)", \
362 ))
363
364 ################################################################################
365 # Build demos targets
366
367 # The demos are currently linking to libjvm and libjava, just like all other
368 # jdk libs, even though they don't need to. To avoid warnings, make sure they
369 # aren't built until after libjava and libjvm are available to link to.
370 $(eval $(call SetupTarget, demos-jdk, \
371 MAKEFILE := CompileDemos, \
372 DEPS := java.base-libs exploded-image buildtools-jdk, \
373 ))
374
375 $(eval $(call SetupTarget, test-image-demos-jdk, \
376 MAKEFILE := CompileDemos, \
377 TARGET := images, \
378 DEPS := demos-jdk, \
379 ))
380
381 ################################################################################
382 # Jigsaw specific data and analysis targets.
383
384 $(eval $(call SetupTarget, generate-summary, \
385 MAKEFILE := GenerateModuleSummary, \
386 DEPS := jmods buildtools-modules runnable-buildjdk, \
387 ))
388
389 ################################################################################
390 # Jmod targets
391
392 JMOD_MODULES := $(ALL_MODULES)
393 JMOD_TARGETS := $(addsuffix -jmod, $(JMOD_MODULES))
394
395 define DeclareJmodRecipe
396 $1-jmod:
397 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
398 $(patsubst %,-I%/modules/$1,$(PHASE_MAKEDIRS)) \
399 -f CreateJmods.gmk MODULE=$1)
400 endef
401
402 $(foreach m, $(JMOD_MODULES), $(eval $(call DeclareJmodRecipe,$m)))
403
404 ALL_TARGETS += $(JMOD_TARGETS)
405
406 ################################################################################
407 # Images targets
408
409 $(eval $(call SetupTarget, store-source-revision, \
410 MAKEFILE := SourceRevision, \
411 TARGET := store-source-revision, \
412 ))
413
414 $(eval $(call SetupTarget, create-source-revision-tracker, \
415 MAKEFILE := SourceRevision, \
416 TARGET := create-source-revision-tracker, \
417 ))
418
419 BOOTCYCLE_TARGET := product-images
420 BOOTCYCLE_SPEC := $(dir $(SPEC))bootcycle-spec.gmk
421
422 bootcycle-images:
423 ifneq ($(COMPILE_TYPE), cross)
424 $(call LogWarn, Boot cycle build step 2: Building a new JDK image using previously built image)
425 $(call MakeDir, $(OUTPUTDIR)/bootcycle-build)
426 +$(MAKE) $(MAKE_ARGS) -f $(TOPDIR)/make/Init.gmk PARALLEL_TARGETS=$(BOOTCYCLE_TARGET) \
427 LOG_PREFIX="[bootcycle] " JOBS= SPEC=$(BOOTCYCLE_SPEC) main
428 else
429 $(call LogWarn, Boot cycle build disabled when cross compiling)
430 endif
431
432 $(eval $(call SetupTarget, zip-security, \
433 MAKEFILE := ZipSecurity, \
434 DEPS := buildtools-jdk java.base-java java.security.jgss-java java.security.jgss-libs, \
435 ))
436
437 $(eval $(call SetupTarget, zip-source, \
438 MAKEFILE := ZipSource, \
439 DEPS := buildtools-jdk gensrc, \
440 ))
441
442 $(eval $(call SetupTarget, jrtfs-jar, \
443 MAKEFILE := JrtfsJar, \
444 DEPS := interim-langtools, \
445 ))
446
447 $(eval $(call SetupTarget, jdk-image, \
448 MAKEFILE := Images, \
449 TARGET := jdk, \
450 DEPS := jmods zip-source demos release-file, \
451 ))
452
453 $(eval $(call SetupTarget, legacy-jre-image, \
454 MAKEFILE := Images, \
455 TARGET := jre, \
456 DEPS := jmods release-file, \
457 ))
458
459 $(eval $(call SetupTarget, symbols-image, \
460 MAKEFILE := Images, \
461 TARGET := symbols, \
462 ))
463
464 $(eval $(call SetupTarget, static-launchers, \
465 MAKEFILE := StaticLibs, \
466 TARGET := static-launchers, \
467 DEPS := hotspot-static-libs static-libs, \
468 ))
469
470 $(eval $(call SetupTarget, static-jdk-image, \
471 MAKEFILE := StaticLibs, \
472 TARGET := static-jdk-image, \
473 DEPS := static-exploded-image jdk-image, \
474 ))
475
476 $(eval $(call SetupTarget, static-libs-image, \
477 MAKEFILE := StaticLibsImage, \
478 TARGET := static-libs-image, \
479 ))
480
481 $(eval $(call SetupTarget, static-libs-graal-image, \
482 MAKEFILE := StaticLibsImage, \
483 TARGET := static-libs-graal-image, \
484 ))
485
486 $(eval $(call SetupTarget, mac-jdk-bundle, \
487 MAKEFILE := MacBundles, \
488 TARGET := jdk-bundle, \
489 DEPS := jdk-image, \
490 ))
491
492 $(eval $(call SetupTarget, mac-legacy-jre-bundle, \
493 MAKEFILE := MacBundles, \
494 TARGET := jre-bundle, \
495 DEPS := legacy-jre-image, \
496 ))
497
498 $(eval $(call SetupTarget, release-file, \
499 MAKEFILE := ReleaseFile, \
500 DEPS := create-source-revision-tracker, \
501 ))
502
503 $(eval $(call SetupTarget, exploded-image-optimize, \
504 MAKEFILE := ExplodedImageOptimize, \
505 DEPS := java copy gendata java.base-libs java.base-launchers \
506 buildtools-modules, \
507 ))
508
509 $(eval $(call SetupTarget, graal-builder-image, \
510 MAKEFILE := GraalBuilderImage, \
511 DEPS := jdk-image static-libs-graal-image, \
512 ))
513
514 ifeq ($(JCOV_ENABLED), true)
515 $(eval $(call SetupTarget, jcov-image, \
516 MAKEFILE := Coverage, \
517 TARGET := jcov-image, \
518 DEPS := jdk-image, \
519 ))
520 endif
521
522 ALL_TARGETS += bootcycle-images
523
524 ################################################################################
525 # Docs targets
526
527 # If building full docs, to complete docs-*-api we need both the javadoc and
528 # graphs targets.
529 $(eval $(call SetupTarget, docs-jdk-api-javadoc, \
530 MAKEFILE := Docs, \
531 TARGET := docs-jdk-api-javadoc, \
532 ))
533
534 $(eval $(call SetupTarget, docs-jdk-api-graphs, \
535 MAKEFILE := Docs, \
536 TARGET := docs-jdk-api-graphs, \
537 DEPS := buildtools-modules runnable-buildjdk, \
538 ))
539
540 $(eval $(call SetupTarget, docs-javase-api-javadoc, \
541 MAKEFILE := Docs, \
542 TARGET := docs-javase-api-javadoc, \
543 ))
544
545 $(eval $(call SetupTarget, docs-javase-api-graphs, \
546 MAKEFILE := Docs, \
547 TARGET := docs-javase-api-graphs, \
548 DEPS := buildtools-modules runnable-buildjdk, \
549 ))
550
551 $(eval $(call SetupTarget, docs-reference-api-javadoc, \
552 MAKEFILE := Docs, \
553 TARGET := docs-reference-api-javadoc, \
554 ))
555
556 $(eval $(call SetupTarget, docs-reference-api-graphs, \
557 MAKEFILE := Docs, \
558 TARGET := docs-reference-api-graphs, \
559 DEPS := buildtools-modules runnable-buildjdk, \
560 ))
561
562 # The gensrc steps for jdk.jdi create html spec files.
563 $(eval $(call SetupTarget, docs-jdk-specs, \
564 MAKEFILE := Docs, \
565 TARGET := docs-jdk-specs, \
566 DEPS := buildtools-jdk jdk.jdi-gensrc docs-jdk-index, \
567 ))
568
569 $(eval $(call SetupTarget, docs-jdk-index, \
570 MAKEFILE := Docs, \
571 TARGET := docs-jdk-index, \
572 ))
573
574 $(eval $(call SetupTarget, docs-zip, \
575 MAKEFILE := Docs, \
576 TARGET := docs-zip, \
577 DEPS := docs-jdk buildtools-jdk, \
578 ))
579
580 $(eval $(call SetupTarget, docs-specs-zip, \
581 MAKEFILE := Docs, \
582 TARGET := docs-specs-zip, \
583 DEPS := docs-jdk-specs buildtools-jdk, \
584 ))
585
586 $(eval $(call SetupTarget, update-build-docs, \
587 MAKEFILE := UpdateBuildDocs, \
588 ))
589
590 $(eval $(call SetupTarget, update-sleef-source, \
591 MAKEFILE := UpdateSleefSource, \
592 ))
593
594 $(eval $(call SetupTarget, update-x11wrappers, \
595 MAKEFILE := UpdateX11Wrappers, \
596 DEPS := java.base-copy buildtools-jdk, \
597 ))
598
599 ifneq ($(HSDIS_BACKEND), none)
600 $(eval $(call SetupTarget, build-hsdis, \
601 MAKEFILE := Hsdis, \
602 TARGET := build, \
603 ))
604
605 $(eval $(call SetupTarget, install-hsdis, \
606 MAKEFILE := Hsdis, \
607 TARGET := install, \
608 DEPS := jdk-image, \
609 ))
610 endif
611
612 ################################################################################
613 # Cross compilation support
614
615 ifeq ($(CREATING_BUILDJDK), true)
616 # This target is only called by the recursive call below.
617 create-buildjdk-interim-image-helper: interim-image jdk.jlink-launchers \
618 java.base-copy jdk.jdeps-launchers jdk.compiler-launchers
619 endif
620
621 BUILDJDK_MODULES := $(sort $(foreach m, jdk.jlink jdk.compiler \
622 $(INTERIM_IMAGE_MODULES), $(call FindTransitiveDepsForModule, $m) $m))
623
624 $(eval $(call SetupTarget, create-buildjdk-interim-image, \
625 MAKEFILE := Main, \
626 TARGET := create-buildjdk-interim-image-helper, \
627 ARGS := SPEC=$(dir $(SPEC))buildjdk-spec.gmk \
628 HOTSPOT_SPEC=$(dir $(SPEC))buildjdk-spec.gmk \
629 CREATING_BUILDJDK=true \
630 LOG_PREFIX="[buildjdk] " \
631 JAVA_MODULES="$(BUILDJDK_MODULES)", \
632 ))
633
634 ################################################################################
635 # The interim-image is a small jlinked image that is used to generate artifacts
636 # at build time for use when linking the real images.
637
638 INTERIM_JMOD_TARGETS := $(addsuffix -interim-jmod, $(INTERIM_IMAGE_MODULES))
639
640 define DeclareInterimJmodRecipe
641 $1-interim-jmod:
642 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CreateJmods.gmk \
643 MODULE=$1 \
644 JMODS_DIR=$(INTERIM_JMODS_DIR) \
645 JMODS_SUPPORT_DIR=$(INTERIM_JMODS_DIR)/support \
646 INTERIM_JMOD=true \
647 )
648 endef
649
650 $(foreach m, $(INTERIM_IMAGE_MODULES), $(eval $(call DeclareInterimJmodRecipe,$m)))
651
652 $(eval $(call SetupTarget, interim-image, \
653 MAKEFILE := InterimImage, \
654 ))
655
656 ifeq ($(ENABLE_GENERATE_CLASSLIST), true)
657 $(eval $(call SetupTarget, generate-link-opt-data, \
658 MAKEFILE := GenerateLinkOptData, \
659 ))
660 endif
661
662 ################################################################################
663 # Generate test names for all JTReg test groups
664 #
665
666 define DeclareRunTestRecipe
667 test-$1:
668 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk \
669 TEST="$1")
670
671 exploded-test-$1:
672 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk \
673 TEST="$1" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR))
674 endef
675
676 # ALL_NAMED_TESTS is defined in FindTests.gmk
677 $(foreach t, $(ALL_NAMED_TESTS), $(eval $(call DeclareRunTestRecipe,$t)))
678 ALL_TEST_TARGETS := $(addprefix test-, $(ALL_NAMED_TESTS))
679
680 # We only support the "exploded-test-gtest" shortcut
681 ALL_EXPLODED_TESTS := gtest
682 ALL_EXPLODED_TEST_TARGETS := $(addprefix exploded-test-, $(ALL_EXPLODED_TESTS))
683
684 ALL_TARGETS += $(ALL_TEST_TARGETS) $(ALL_EXPLODED_TEST_TARGETS)
685
686 ################################################################################
687 # Build tests and microbenchmarks
688 #
689
690 $(eval $(call SetupTarget, prepare-test-image, \
691 MAKEFILE := TestImage, \
692 TARGET := prepare-test-image, \
693 ))
694
695 $(eval $(call SetupTarget, build-test-hotspot-jtreg-native, \
696 MAKEFILE := test/JtregNativeHotspot, \
697 TARGET := build-test-hotspot-jtreg-native, \
698 DEPS := buildtools-jdk, \
699 ))
700
701 $(eval $(call SetupTarget, test-image-hotspot-jtreg-native, \
702 MAKEFILE := test/JtregNativeHotspot, \
703 TARGET := test-image-hotspot-jtreg-native, \
704 DEPS := build-test-hotspot-jtreg-native, \
705 ))
706
707 $(eval $(call SetupTarget, build-test-jdk-jtreg-native, \
708 MAKEFILE := test/JtregNativeJdk, \
709 TARGET := build-test-jdk-jtreg-native, \
710 DEPS := buildtools-jdk java.base-libs, \
711 ))
712
713 $(eval $(call SetupTarget, test-image-jdk-jtreg-native, \
714 MAKEFILE := test/JtregNativeJdk, \
715 TARGET := test-image-jdk-jtreg-native, \
716 DEPS := build-test-jdk-jtreg-native, \
717 ))
718
719 # Native files needed by the testlib
720 $(eval $(call SetupTarget, build-test-lib-native, \
721 MAKEFILE := test/BuildTestLibNative, \
722 TARGET := build-test-lib-native, \
723 DEPS := buildtools-jdk java.base-libs, \
724 ))
725
726 $(eval $(call SetupTarget, test-image-lib-native, \
727 MAKEFILE := test/BuildTestLibNative, \
728 TARGET := test-image-lib-native, \
729 DEPS := build-test-lib-native, \
730 ))
731
732 # Native files needed when testing the testlib itself
733 $(eval $(call SetupTarget, build-test-libtest-jtreg-native, \
734 MAKEFILE := test/JtregNativeLibTest, \
735 TARGET := build-test-libtest-jtreg-native, \
736 DEPS := buildtools-jdk, \
737 ))
738
739 $(eval $(call SetupTarget, test-image-libtest-jtreg-native, \
740 MAKEFILE := test/JtregNativeLibTest, \
741 TARGET := test-image-libtest-jtreg-native, \
742 DEPS := build-test-libtest-jtreg-native, \
743 ))
744
745 ifneq ($(GTEST_FRAMEWORK_SRC), )
746 $(eval $(call SetupTarget, test-image-hotspot-gtest, \
747 MAKEFILE := hotspot/test/GtestImage, \
748 DEPS := hotspot, \
749 ))
750 endif
751
752 $(eval $(call SetupTarget, build-test-lib, \
753 MAKEFILE := test/BuildTestLib, \
754 TARGET := build-test-lib, \
755 DEPS := exploded-image, \
756 ))
757
758 $(eval $(call SetupTarget, test-image-lib, \
759 MAKEFILE := test/BuildTestLib, \
760 TARGET := test-image-lib, \
761 DEPS := build-test-lib, \
762 ))
763
764 $(eval $(call SetupTarget, build-test-setup-aot, \
765 MAKEFILE := test/BuildTestSetupAOT, \
766 DEPS := interim-langtools exploded-image, \
767 ))
768
769 $(eval $(call SetupTarget, test-image-setup-aot, \
770 MAKEFILE := test/BuildTestSetupAOT, \
771 TARGET := images, \
772 DEPS := build-test-setup-aot, \
773 ))
774
775 ifeq ($(BUILD_FAILURE_HANDLER), true)
776 # Builds the failure handler jtreg extension
777 $(eval $(call SetupTarget, build-test-failure-handler, \
778 MAKEFILE := test/BuildFailureHandler, \
779 TARGET := build, \
780 DEPS := interim-langtools, \
781 ))
782
783 # Copies the failure handler jtreg extension into the test image
784 $(eval $(call SetupTarget, test-image-failure-handler, \
785 MAKEFILE := test/BuildFailureHandler, \
786 TARGET := images, \
787 DEPS := build-test-failure-handler, \
788 ))
789 endif
790
791 ifeq ($(BUILD_JTREG_TEST_THREAD_FACTORY), true)
792 # Builds the test thread factory jtreg extension
793 $(eval $(call SetupTarget, build-test-test-thread-factory, \
794 MAKEFILE := test/BuildJtregTestThreadFactory, \
795 TARGET := build, \
796 DEPS := interim-langtools exploded-image, \
797 ))
798
799 # Copies the jtreg test thread factory into the test image
800 $(eval $(call SetupTarget, test-image-test-thread-factory, \
801 MAKEFILE := test/BuildJtregTestThreadFactory, \
802 TARGET := images, \
803 DEPS := build-test-test-thread-factory, \
804 ))
805 endif
806
807 $(eval $(call SetupTarget, build-microbenchmark, \
808 MAKEFILE := test/BuildMicrobenchmark, \
809 DEPS := interim-langtools exploded-image build-test-lib, \
810 ))
811
812 ################################################################################
813 # Run tests
814
815 $(eval $(call SetupTarget, test, \
816 MAKEFILE := RunTests, \
817 ARGS := TEST="$(TEST)", \
818 DEPS := jdk-image test-image $(TEST_DEPS), \
819 ))
820
821 $(eval $(call SetupTarget, exploded-test, \
822 MAKEFILE := RunTests, \
823 ARGS := TEST="$(TEST)" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR), \
824 DEPS := exploded-image test-image $(TEST_DEPS), \
825 ))
826
827 ifeq ($(JCOV_ENABLED), true)
828 $(eval $(call SetupTarget, jcov-test, \
829 MAKEFILE := RunTests, \
830 ARGS := TEST="$(TEST)" TEST_OPTS_JCOV=true, \
831 DEPS := jcov-image test-image, \
832 ))
833 endif
834
835 ################################################################################
836 # Bundles
837
838 $(eval $(call SetupTarget, product-bundles, \
839 MAKEFILE := Bundles, \
840 TARGET := product-bundles, \
841 DEPS := product-images, \
842 ))
843
844 $(eval $(call SetupTarget, legacy-bundles, \
845 MAKEFILE := Bundles, \
846 TARGET := legacy-bundles, \
847 DEPS := legacy-images, \
848 ))
849
850 $(eval $(call SetupTarget, test-bundles, \
851 MAKEFILE := Bundles, \
852 TARGET := test-bundles, \
853 DEPS := test-image, \
854 ))
855
856 $(eval $(call SetupTarget, docs-jdk-bundles, \
857 MAKEFILE := Bundles, \
858 TARGET := docs-jdk-bundles, \
859 DEPS := docs-image, \
860 ))
861
862 $(eval $(call SetupTarget, docs-javase-bundles, \
863 MAKEFILE := Bundles, \
864 TARGET := docs-javase-bundles, \
865 DEPS := docs-javase-image, \
866 ))
867
868 $(eval $(call SetupTarget, docs-reference-bundles, \
869 MAKEFILE := Bundles, \
870 TARGET := docs-reference-bundles, \
871 DEPS := docs-reference-image, \
872 ))
873
874 $(eval $(call SetupTarget, static-libs-bundles, \
875 MAKEFILE := Bundles, \
876 TARGET := static-libs-bundles, \
877 DEPS := static-libs-image, \
878 ))
879
880 $(eval $(call SetupTarget, static-libs-graal-bundles, \
881 MAKEFILE := Bundles, \
882 TARGET := static-libs-graal-bundles, \
883 DEPS := static-libs-graal-image, \
884 ))
885
886 $(eval $(call SetupTarget, static-jdk-bundles, \
887 MAKEFILE := Bundles, \
888 TARGET := static-jdk-bundles, \
889 DEPS := static-jdk-image, \
890 ))
891
892 ifeq ($(JCOV_ENABLED), true)
893 $(eval $(call SetupTarget, jcov-bundles, \
894 MAKEFILE := Bundles, \
895 TARGET := jcov-bundles, \
896 DEPS := jcov-image, \
897 ))
898 endif
899
900 ################################################################################
901 #
902 # Dependency declarations between targets.
903 #
904 # These are declared in two groups. First all dependencies between targets that
905 # have recipes above as these dependencies may be disabled. Then the aggregator
906 # targets that do not have recipes of their own, which will never have their
907 # dependencies disabled.
908 #
909 ################################################################################
910 # Targets with recipes above
911
912 # If running an *-only target, parallel execution and dependencies between
913 # recipe targets are disabled. This makes it possible to run a select set of
914 # recipe targets in order. It's the responsibility of the user to make sure
915 # all prerequisites are fulfilled.
916 ifeq ($(DEPS), none)
917 .NOTPARALLEL:
918 else
919 $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
920
921 interim-langtools: $(INTERIM_LANGTOOLS_GENSRC_TARGETS)
922
923 $(HOTSPOT_GENSRC_TARGETS): interim-langtools buildtools-hotspot
924
925 $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
926
927 $(GENSRC_MODULEINFO_TARGETS): buildtools-jdk
928
929 $(GENDATA_TARGETS): interim-langtools buildtools-jdk
930
931 $(JAVA_TARGETS): interim-langtools
932
933 # Declare dependencies between hotspot-<variant>* targets
934 $(foreach v, $(JVM_VARIANTS), \
935 $(eval hotspot-$v-gensrc: java.base-copy buildtools-hotspot) \
936 $(eval hotspot-$v-libs: hotspot-$v-gensrc java.base-copy) \
937 $(eval hotspot-$v-static-libs: hotspot-$v-gensrc java.base-copy) \
938 )
939
940 # If not already set, set the JVM variant target so that the JVM will be built.
941 JVM_MAIN_LIB_TARGETS ?= hotspot-$(JVM_VARIANT_MAIN)-libs
942 JVM_MAIN_GENSRC_TARGETS ?= hotspot-$(JVM_VARIANT_MAIN)-gensrc
943
944 # Building one JVM variant is enough to start building the other libs
945 $(LIBS_TARGETS): $(JVM_MAIN_LIB_TARGETS)
946
947 # Static libs depend on hotspot gensrc
948 $(STATIC_LIBS_TARGETS): $(JVM_MAIN_GENSRC_TARGETS)
949
950 $(LAUNCHER_TARGETS): java.base-libs
951
952 # Declare dependency from <module>-java to <module>-gensrc
953 $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
954
955 # Declare dependencies between java modules
956 $(foreach m, $(JAVA_MODULES), \
957 $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
958 $(call FindDepsForModule,$m)))))
959 # Declare dependencies between the module meta targets
960 $(foreach m, $(ALL_MODULES), $(eval $m: $(call FindDepsForModule,$m)))
961
962 # Declare dependencies from <module>-lib to <module>-java
963 # Skip modules that do not have java source.
964 $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
965
966 # Declare dependencies from all other <module>-lib to java.base-lib
967 $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
968 $(eval $t: java.base-libs))
969
970 ifeq ($(ENABLE_HSDIS_BUNDLING), true)
971 java.base-copy: build-hsdis
972 endif
973
974 # On Windows, we need to copy tzmappings generated by gensrc
975 ifeq ($(call isTargetOs, windows), true)
976 java.base-copy: java.base-gensrc
977 endif
978
979 # jdk.accessibility depends on java.desktop
980 jdk.accessibility-libs: java.desktop-libs
981
982 # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
983 # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
984 # virtual target.
985 jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
986
987 # jdk.jfr-gendata uses TOOL_JFR_GEN from buildtools-hotspot
988 jdk.jfr-gendata: buildtools-hotspot
989
990 # The swing beans need to have java base properly generated to avoid errors
991 # in javadoc. The X11 wrappers need the java.base include files to have been
992 # copied and processed.
993 java.desktop-gensrc-src: java.base-gensrc java.base-copy
994
995 jdk.jdeps-gendata: java
996
997 # jdk.compiler gendata generates ct.sym, which requires all generated
998 # java source and compiled classes present.
999 jdk.compiler-gendata: $(JAVA_TARGETS)
1000
1001 # jdk.javadoc gendata generates element-list, which requires all java sources
1002 # but not compiled classes.
1003 jdk.javadoc-gendata: $(GENSRC_TARGETS)
1004
1005 # ct.sym and element-list generation also needs the BUILD_JDK. If the
1006 # BUILD_JDK was supplied externally, no extra prerequisites are needed.
1007 ifeq ($(CREATE_BUILDJDK), true)
1008 ifneq ($(CREATING_BUILDJDK), true)
1009 # When cross compiling and an external BUILD_JDK wasn't supplied, it's
1010 # produced by the create-buildjdk target.
1011 jdk.compiler-gendata: create-buildjdk
1012 jdk.javadoc-gendata: create-buildjdk
1013 endif
1014 else ifeq ($(EXTERNAL_BUILDJDK), false)
1015 # When not cross compiling, the BUILD_JDK is the interim jdk image, and
1016 # the javac launcher is needed.
1017 jdk.compiler-gendata: jdk.compiler-launchers java.base-launchers
1018 jdk.javadoc-gendata: jdk.compiler-launchers
1019 endif
1020
1021 # Declare dependencies between jmod targets.
1022 # java.base jmod needs jrt-fs.jar and access to the jmods for all non
1023 # upgradeable modules and their transitive dependencies.
1024 # When creating the BUILDJDK, we don't need to add hashes to java.base, thus
1025 # we don't need to depend on all other jmods
1026 ifneq ($(CREATING_BUILDJDK), true)
1027 java.base-jmod: jrtfs-jar $(addsuffix -jmod, $(filter-out java.base, $(sort \
1028 $(foreach m, $(filter-out $(call FindAllUpgradeableModules), $(JMOD_MODULES)), \
1029 $m $(call FindTransitiveDepsForModules, $m) \
1030 ))))
1031 endif
1032
1033 # If not already set, set the JVM target so that the JVM will be built.
1034 JVM_MAIN_TARGETS ?= hotspot
1035
1036 # Building java.base-jmod requires all of VM (ie hotspot) to be built.
1037 java.base-jmod: $(JVM_MAIN_TARGETS)
1038
1039 # Declare dependencies from <module>-jmod to all other module targets
1040 $(foreach m, $(JAVA_MODULES), $(eval $m_JMOD_DEPS += $m-java))
1041 $(foreach m, $(GENDATA_MODULES), $(eval $m_JMOD_DEPS += $m-gendata))
1042 $(foreach m, $(LIBS_MODULES), $(eval $m_JMOD_DEPS += $m-libs))
1043 $(foreach m, $(LAUNCHER_MODULES), $(eval $m_JMOD_DEPS += $m-launchers))
1044 $(foreach m, $(COPY_MODULES), $(eval $m_JMOD_DEPS += $m-copy))
1045 $(foreach m, $(ALL_MODULES), $(eval $m-jmod: $($(m)_JMOD_DEPS)))
1046 $(foreach m, $(INTERIM_IMAGE_MODULES), $(eval $m-interim-jmod: $($(m)_JMOD_DEPS)))
1047
1048 # Setup the minimal set of generated native source dependencies for hotspot
1049 $(foreach v, $(JVM_VARIANTS), \
1050 $(eval hotspot-$v-libs-compile-commands: hotspot-$v-gensrc) \
1051 $(foreach m, $(filter java.desktop jdk.hotspot.agent, $(GENSRC_MODULES)), \
1052 $(eval hotspot-$v-libs-compile-commands: $m-gensrc)) \
1053 )
1054
1055 # For the full JDK compile commands, create all possible generated sources
1056 $(foreach m, $(GENSRC_MODULES), $(eval $m-libs-compile-commands: $m-gensrc))
1057 $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs-compile-commands: $m-java))
1058
1059 $(COMPILE_COMMANDS_TARGETS_HOTSPOT): clean-compile-commands
1060 $(COMPILE_COMMANDS_TARGETS_JDK): clean-compile-commands
1061 compile-commands-hotspot: $(COMPILE_COMMANDS_TARGETS_HOTSPOT)
1062 compile-commands: $(COMPILE_COMMANDS_TARGETS_HOTSPOT) $(COMPILE_COMMANDS_TARGETS_JDK)
1063
1064 # The -static-libs targets depend on -java as well as java.base-copy.
1065 $(foreach m, $(filter $(JAVA_MODULES), $(STATIC_LIBS_MODULES)), \
1066 $(eval $m-static-libs: $m-java java.base-copy))
1067
1068 # Jmods cannot be created until we have the jmod tool ready to run. During
1069 # a normal build we run it from the exploded image, but when cross compiling
1070 # it's run from the buildjdk, which is either created at build time or user
1071 # supplied.
1072 ifeq ($(CREATE_BUILDJDK), true)
1073 ifneq ($(CREATING_BUILDJDK), true)
1074 # When cross compiling and buildjdk is to be created, simply depend on
1075 # creating the buildjdk.
1076 $(JMOD_TARGETS): create-buildjdk
1077 buildtools-modules: create-buildjdk
1078 else
1079 # While actually creating the buildjdk, we need to list the bare
1080 # minimum dependencies needed before running jmod, to avoid building
1081 # more than necessary. This includes:
1082 # * all java modules
1083 # * jdk.jlink-launchers
1084 # * copy jvm.cfg (done in java.base-copy)
1085 # * tzdb.dat (done in java.base-gendata)
1086 # Without all of these jimage, jlink and jmod won't start.
1087 $(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): java.base-libs java.base-copy \
1088 java.base-gendata jdk.jlink-launchers java
1089 endif
1090 else ifeq ($(EXTERNAL_BUILDJDK), false)
1091 # The normal non cross compilation usecase needs to wait for the full
1092 # exploded-image to avoid a race with the optimize target.
1093 $(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): exploded-image
1094 # The buildtools-modules are used for the exploded-image-optimize target,
1095 # but can be built either using the exploded-image or an external BUILDJDK.
1096 buildtools-modules: exploded-image-base
1097 endif
1098
1099 # All modules include the main license files from java.base.
1100 $(JMOD_TARGETS): java.base-copy
1101
1102 # jdk.javadoc uses an internal copy of the main license files from java.base.
1103 jdk.javadoc-copy: java.base-copy
1104
1105 zip-security: $(filter jdk.crypto%, $(JAVA_TARGETS))
1106
1107 ifeq ($(ENABLE_GENERATE_CLASSLIST), true)
1108 ifeq ($(CREATE_BUILDJDK), true)
1109 # If creating a buildjdk, the interim image needs to be based on that.
1110 generate-link-opt-data: create-buildjdk
1111 else ifeq ($(EXTERNAL_BUILDJDK), false)
1112 # If an external buildjdk has been provided, we skip generating an
1113 # interim-image and just use the external buildjdk for generating
1114 # classlist.
1115 generate-link-opt-data: interim-image
1116 endif
1117 generate-link-opt-data: buildtools-jdk
1118
1119 # The generated classlist needs to go into java.base-jmod.
1120 java.base-jmod jdk.jlink-jmod jdk-image legacy-jre-image: generate-link-opt-data
1121 endif
1122
1123 symbols-image: $(LIBS_TARGETS) $(LAUNCHER_TARGETS)
1124
1125 static-libs-image: hotspot-static-libs static-libs
1126
1127 static-libs-graal-image: static-libs
1128
1129 bootcycle-images: jdk-image
1130
1131 docs-jdk-api-javadoc: $(GENSRC_TARGETS)
1132
1133 docs-javase-api-javadoc: $(GENSRC_TARGETS)
1134
1135 docs-reference-api-javadoc: $(GENSRC_TARGETS)
1136
1137 # If not already set, then set the JVM specific docs targets
1138 JVM_DOCS_TARGETS ?= hotspot-$(JVM_VARIANT_MAIN)-gensrc
1139
1140 # The gensrc steps for hotspot create html spec files.
1141 docs-jdk-specs: $(JVM_DOCS_TARGETS)
1142
1143 # Tests
1144 test-make: clean-test-make compile-commands
1145
1146 test-make-compile-commands: compile-commands
1147
1148 # Declare dependency for all generated test targets
1149 $(foreach t, $(filter-out test-make%, $(ALL_TEST_TARGETS)), $(eval $t: jdk-image test-image $(TEST_DEPS)))
1150 $(foreach t, $(ALL_EXPLODED_TEST_TARGETS), $(eval $t: exploded-image test-image $(TEST_DEPS)))
1151
1152 interim-image: $(INTERIM_JMOD_TARGETS)
1153
1154 build-test-hotspot-jtreg-native: hotspot-$(JVM_VARIANT_MAIN)-libs
1155 build-test-libtest-jtreg-native: hotspot-$(JVM_VARIANT_MAIN)-libs
1156
1157 endif
1158
1159 ################################################################################
1160 # Virtual targets without recipes
1161
1162 # If not already set, set the JVM specific tools targets
1163 JVM_TOOLS_TARGETS ?= buildtools-hotspot
1164 buildtools: buildtools-langtools interim-langtools \
1165 buildtools-jdk $(JVM_TOOLS_TARGETS)
1166
1167 # Declare dependencies from hotspot-<variant> targets
1168 $(foreach v, $(JVM_VARIANTS), \
1169 $(eval hotspot-$v: hotspot-$v-gensrc hotspot-$v-libs) \
1170 )
1171 hotspot: $(HOTSPOT_VARIANT_TARGETS)
1172
1173 # Create targets hotspot-libs and hotspot-gensrc.
1174 $(foreach v, $(JVM_VARIANTS), \
1175 $(eval hotspot-libs: hotspot-$v-libs) \
1176 $(eval hotspot-gensrc: hotspot-$v-gensrc) \
1177 $(eval hotspot-static-libs: hotspot-$v-static-libs) \
1178 )
1179
1180 gensrc: $(GENSRC_TARGETS)
1181
1182 gendata: $(GENDATA_TARGETS)
1183
1184 copy: $(ALL_COPY_TARGETS)
1185
1186 java: $(JAVA_TARGETS)
1187
1188 libs: $(LIBS_TARGETS)
1189
1190 static-libs: $(STATIC_LIBS_TARGETS)
1191
1192 launchers: $(LAUNCHER_TARGETS)
1193
1194 jmods: $(JMOD_TARGETS)
1195
1196 # Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
1197 # is actually handled by jdk.jdi-gensrc
1198 jdk.jdwp.agent-gensrc: jdk.jdi-gensrc
1199
1200 # Declare dependencies from <module> to all the individual targets specific
1201 # to that module <module>-*, that are needed for the exploded image.
1202 $(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
1203 $(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
1204 $(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
1205 $(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
1206 $(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
1207 $(foreach m, $(ALL_COPY_MODULES), $(eval $m: $m-copy))
1208
1209 # Building java.base includes building all of hotspot.
1210 java.base: $(JVM_MAIN_TARGETS)
1211
1212 demos: demos-jdk
1213
1214 # The "exploded image" is a locally runnable JDK in $(OUTPUTDIR)/jdk.
1215 exploded-image-base: $(ALL_MODULES)
1216 exploded-image: exploded-image-base release-file
1217 # When cross compiling, no need to optimize the exploded image since it won't
1218 # be runnable on the host platform anyway.
1219 ifneq ($(COMPILE_TYPE), cross)
1220 exploded-image: exploded-image-optimize
1221 endif
1222
1223 # The runnable-buildjdk target guarantees that the buildjdk is done
1224 # building and ready to be used. The exact set of dependencies it needs
1225 # depends on what kind of buildjdk is used for the current configuration.
1226 runnable-buildjdk:
1227 ifeq ($(CREATE_BUILDJDK), true)
1228 ifneq ($(CREATING_BUILDJDK), true)
1229 runnable-buildjdk: create-buildjdk
1230 endif
1231 else ifeq ($(EXTERNAL_BUILDJDK), false)
1232 runnable-buildjdk: exploded-image
1233 endif
1234
1235 create-buildjdk: create-buildjdk-interim-image
1236
1237 docs-jdk-api: docs-jdk-api-javadoc
1238 docs-javase-api: docs-javase-api-javadoc
1239 docs-reference-api: docs-reference-api-javadoc
1240
1241 # If we're building full docs, we must also generate the module graphs to
1242 # get non-broken api documentation.
1243 ifeq ($(ENABLE_FULL_DOCS), true)
1244 docs-jdk-api: docs-jdk-api-graphs
1245 docs-javase-api: docs-javase-api-graphs
1246 docs-reference-api: docs-reference-api-graphs
1247
1248 # We must generate javadoc first so we know what graphs are needed
1249 docs-jdk-api-graphs: docs-jdk-api-javadoc
1250 docs-javase-api-graphs: docs-javase-api-javadoc
1251 docs-reference-api-graphs: docs-reference-api-javadoc
1252 endif
1253
1254 docs-jdk: docs-jdk-api docs-jdk-specs docs-jdk-index
1255 docs-javase: docs-javase-api
1256 docs-reference: docs-reference-api
1257
1258 # alias for backwards compatibility
1259 docs-javadoc: docs-jdk-api
1260
1261 mac-bundles: mac-jdk-bundle
1262
1263 # The $(OUTPUTDIR)/images directory contain the resulting deliverables,
1264 # and in line with this, our targets for creating these are named *-image[s].
1265
1266 # This target builds the product images, e.g. the JDK image
1267 # (and possibly other, more specific versions)
1268 product-images: jdk-image symbols-image exploded-image
1269
1270 # This target builds the legacy images, e.g. the legacy JRE image
1271 legacy-images: legacy-jre-image
1272
1273 # zip-security is actually a bundle, but for now it needs to be considered
1274 # an image until this can be cleaned up properly.
1275 product-images: zip-security
1276
1277 # The module summary cannot be run when:
1278 # * Cross compiling and building a partial BUILDJDK for the build host
1279 # * An external buildjdk has been supplied since it may not match the
1280 # module selection of the target jdk
1281 ifneq ($(CREATE_BUILDJDK), true)
1282 ifeq ($(EXTERNAL_BUILDJDK), false)
1283 product-images: generate-summary
1284 endif
1285 endif
1286
1287 ifeq ($(call isTargetOs, macosx), true)
1288 product-images: mac-jdk-bundle
1289
1290 legacy-images: mac-legacy-jre-bundle
1291 endif
1292
1293 static-exploded-image: static-launchers exploded-image
1294
1295 # These targets build the various documentation images
1296 docs-jdk-image: docs-jdk
1297 docs-javase-image: docs-javase
1298 docs-reference-image: docs-reference
1299 # The docs-jdk-image is what most users expect to be built
1300 docs-image: docs-jdk-image
1301 all-docs-images: docs-jdk-image docs-javase-image docs-reference-image
1302
1303 docs-bundles: docs-jdk-bundles
1304 all-docs-bundles: docs-jdk-bundles docs-javase-bundles docs-reference-bundles
1305
1306 # This target builds the test image
1307 test-image: prepare-test-image test-image-jdk-jtreg-native \
1308 test-image-demos-jdk test-image-libtest-jtreg-native \
1309 test-image-lib test-image-lib-native \
1310 test-image-setup-aot
1311
1312 ifneq ($(JVM_TEST_IMAGE_TARGETS), )
1313 # If JVM_TEST_IMAGE_TARGETS is externally defined, use it instead of the
1314 # standard hotspot set of tests.
1315 test-image: $(JVM_TEST_IMAGE_TARGETS)
1316 else
1317 test-image: test-image-hotspot-jtreg-native
1318 ifneq ($(GTEST_FRAMEWORK_SRC), )
1319 test-image: test-image-hotspot-gtest
1320 endif
1321 endif
1322
1323 ifeq ($(BUILD_FAILURE_HANDLER), true)
1324 test-image: test-image-failure-handler
1325 endif
1326
1327 ifeq ($(BUILD_JTREG_TEST_THREAD_FACTORY), true)
1328 test-image: test-image-test-thread-factory
1329 endif
1330
1331 ifneq ($(JMH_CORE_JAR), )
1332 test-image: build-microbenchmark
1333 endif
1334
1335 ################################################################################
1336
1337 # all-images builds all our deliverables as images.
1338 all-images: product-images static-jdk-image test-image all-docs-images
1339
1340 # all-bundles packages all our deliverables as tar.gz bundles.
1341 all-bundles: product-bundles test-bundles docs-bundles static-libs-bundles
1342
1343 ALL_TARGETS += buildtools hotspot hotspot-libs hotspot-static-libs \
1344 hotspot-gensrc gensrc gendata \
1345 copy java libs static-libs launchers jmods \
1346 jdk.jdwp.agent-gensrc $(ALL_MODULES) demos \
1347 exploded-image-base exploded-image runnable-buildjdk \
1348 create-buildjdk docs-jdk-api docs-javase-api docs-reference-api docs-jdk \
1349 docs-javase docs-reference docs-javadoc mac-bundles product-images legacy-images \
1350 docs-image docs-javase-image docs-reference-image all-docs-images \
1351 docs-bundles all-docs-bundles test-image all-images static-exploded-image \
1352 all-bundles
1353
1354 ################################################################################
1355
1356 # Traditional targets typically run by users.
1357 # These can be considered aliases for the targets now named by a more
1358 # "modern" naming scheme.
1359 default-target: $(DEFAULT_MAKE_TARGET)
1360 jdk: exploded-image
1361 images: product-images
1362 docs: docs-image
1363 bundles: all-bundles
1364 all: all-images
1365
1366 ALL_TARGETS += default jdk images docs bundles all
1367
1368 # Aliases used for running tests.
1369
1370 # Let "run-test" be an alias for "test"
1371 $(foreach t, $(ALL_NAMED_TESTS), $(eval run-test-$t: test-$t))
1372 RUN_TEST_TARGETS := $(addprefix run-test-, $(ALL_NAMED_TESTS))
1373
1374 run-test: test
1375 exploded-run-test: exploded-test
1376
1377 # "make check" is a common idiom for running basic testing
1378 check: test-tier1
1379
1380 # Keep some old names as aliases
1381 test-hotspot-jtreg: test-hotspot_all
1382 test-hotspot-jtreg-native: test-hotspot_native_sanity
1383 test-hotspot-gtest: exploded-test-gtest
1384 test-jdk-jtreg-native: test-jdk_native_sanity
1385
1386 # Set dependencies for doc tests
1387 $(eval $(call AddTestDependency, docs_all, docs-jdk))
1388 test-docs: test-docs_all
1389
1390 ALL_TARGETS += $(RUN_TEST_TARGETS) run-test exploded-run-test check \
1391 test-hotspot-jtreg test-hotspot-jtreg-native test-hotspot-gtest \
1392 test-jdk-jtreg-native test-docs
1393
1394 ################################################################################
1395 #
1396 # Clean targets
1397 #
1398 ################################################################################
1399 # Clean targets are automatically run serially by the Makefile calling this
1400 # file.
1401
1402 CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
1403 images make-support test-make bundles buildjdk test-results test-support \
1404 support/images
1405 CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
1406 CLEAN_SUPPORT_DIRS += demos
1407 CLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS))
1408 CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib
1409 CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS))
1410 CLEAN_PHASES += gensrc java native include
1411 CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
1412 CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
1413 # Construct targets of the form clean-$module-$phase
1414 CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
1415 $(addprefix $m-, $(CLEAN_PHASES))))
1416
1417 # Remove everything, except the output from configure.
1418 clean: $(CLEAN_DIR_TARGETS)
1419 ($(CD) $(OUTPUTDIR) && $(RM) -r build*.log* compile_commands.json)
1420 $(ECHO) Cleaned all build artifacts.
1421
1422 clean-docs:
1423 $(call CleanDocs)
1424
1425 clean-compile-commands:
1426 $(call CleanMakeSupportDir,compile-commands)
1427
1428 $(CLEAN_DIR_TARGETS):
1429 $(call CleanDir,$(patsubst clean-%, %, $@))
1430
1431 $(CLEAN_SUPPORT_DIR_TARGETS):
1432 $(call CleanSupportDir,$(patsubst clean-%, %, $@))
1433
1434 $(CLEAN_TEST_TARGETS):
1435 $(call CleanTest,$(patsubst clean-test-%, %, $@))
1436
1437 $(CLEAN_PHASE_TARGETS):
1438 $(call Clean-$(patsubst clean-%,%, $@))
1439
1440 $(CLEAN_MODULE_TARGETS):
1441 $(call CleanModule,$(patsubst clean-%, %, $@))
1442
1443 $(CLEAN_MODULE_PHASE_TARGETS):
1444 $(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
1445 $(word 2, $(subst -,$(SPACE),$@)))
1446
1447 # When removing the support dir, we must also remove jdk. Building classes has
1448 # the side effect of generating native headers. The headers end up in support
1449 # while classes and touch files end up in jdk.
1450 clean-support: clean-jdk
1451
1452 clean-test: clean-test-results clean-test-support
1453
1454 # When cleaning images, also clean the support/images directory.
1455 clean-images: clean-support/images
1456
1457 # Remove everything, including configure configuration. If the output
1458 # directory was created by configure and now becomes empty, remove it as well.
1459 dist-clean: clean
1460 ($(CD) $(OUTPUTDIR) && \
1461 $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide \
1462 configure.log* build.log*)
1463 $(if $(filter $(CONF_NAME), $(notdir $(OUTPUTDIR))), \
1464 if test "x`$(LS) $(OUTPUTDIR)`" != x; then \
1465 $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
1466 else \
1467 ($(CD) $(TOPDIR) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
1468 && $(RM) -r $(OUTPUTDIR)) \
1469 fi \
1470 )
1471 $(ECHO) Cleaned everything, you will have to re-run configure.
1472
1473 ALL_TARGETS += clean clean-docs clean-compile-commands dist-clean $(CLEAN_DIR_TARGETS) \
1474 $(CLEAN_SUPPORT_DIR_TARGETS) $(CLEAN_TEST_TARGETS) $(CLEAN_PHASE_TARGETS) \
1475 $(CLEAN_MODULE_TARGETS) $(CLEAN_MODULE_PHASE_TARGETS)
1476
1477 ################################################################################
1478 # Declare *-only targets for each normal target
1479 $(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
1480
1481 ALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS)))
1482
1483 ################################################################################
1484
1485 # The following targets are intentionally not added to ALL_TARGETS since they
1486 # are internal only, to support Init.gmk.
1487
1488 print-targets:
1489 $(info $(subst $(SPACE),$(NEWLINE),$(sort $(ALL_TARGETS))))
1490
1491 print-modules:
1492 $(info $(subst $(SPACE),$(NEWLINE),$(sort $(ALL_MODULES))))
1493
1494 print-tests:
1495 $(info $(subst $(SPACE),$(NEWLINE),$(sort $(ALL_NAMED_TESTS))))
1496
1497 create-main-targets-include:
1498 $(call LogInfo, Generating main target list)
1499 $(call MakeDir, $(MAKESUPPORT_OUTPUTDIR))
1500 @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
1501 $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
1502
1503 .PHONY: $(ALL_TARGETS)
1504
1505 FRC: # Force target
1506
1507 include MakeFileEnd.gmk