Main.gmk 38.7 KB
Newer Older
O
ohair 已提交
1
#
2
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
O
ohair 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

C
chegar 已提交
26 27 28
################################################################################
# This is the main makefile containing most actual top level targets. It needs
# to be called with a SPEC file defined.
I
ihse 已提交
29
################################################################################
C
chegar 已提交
30 31 32

# Declare default target
default:
O
ohair 已提交
33

I
ihse 已提交
34 35 36 37
ifeq ($(wildcard $(SPEC)),)
  $(error Main.gmk needs SPEC set to a proper spec.gmk)
endif

O
ohair 已提交
38 39 40
# Now load the spec
include $(SPEC)

I
ihse 已提交
41
include $(SRC_ROOT)/make/MainSupport.gmk
C
chegar 已提交
42

43
# Load the vital tools for all the makefiles.
I
ihse 已提交
44
include $(SRC_ROOT)/make/common/MakeBase.gmk
45
include $(SRC_ROOT)/make/common/Modules.gmk
46
include $(SRC_ROOT)/make/common/FindTests.gmk
O
ohair 已提交
47

C
chegar 已提交
48
# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
49
# valid top level targets. It's used to declare them all as PHONY and to
C
chegar 已提交
50 51 52
# generate the -only targets.
ALL_TARGETS :=

53 54
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, , Main.gmk))
O
ohair 已提交
55

C
chegar 已提交
56
# All modules for the current target platform.
57
ALL_MODULES := $(call FindAllModules)
O
ohair 已提交
58

C
chegar 已提交
59 60 61 62 63 64
################################################################################
################################################################################
#
# Recipes for all targets. Only recipes, dependencies are declared later.
#
################################################################################
O
ohair 已提交
65

C
chegar 已提交
66 67
################################################################################
# Interim/build tools targets, compiling tools used during the build
O
ohair 已提交
68

69 70 71 72
# When creating a BUILDJDK, the buildtools and interim targets have already
# been built and should not be built again.
ifneq ($(CREATING_BUILDJDK), true)
  buildtools-langtools:
C
chegar 已提交
73 74
	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)

75
  interim-langtools:
C
chegar 已提交
76
	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
O
ohair 已提交
77

78
  interim-rmic:
C
chegar 已提交
79
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
80

81
  interim-cldrconverter:
N
naoto 已提交
82 83
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk)

84
  buildtools-jdk:
E
erikj 已提交
85
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileTools.gmk)
86 87 88

  buildtools-modules:
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileModuleTools.gmk)
89 90 91

  buildtools-hotspot:
	+($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileTools.gmk)
92
endif
O
ohair 已提交
93

94
ALL_TARGETS += buildtools-langtools interim-langtools \
95 96
    interim-rmic interim-cldrconverter buildtools-jdk buildtools-modules \
    buildtools-hotspot
C
chegar 已提交
97 98 99 100 101 102 103

################################################################################
# Special targets for certain modules

unpack-sec:
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)

104 105 106
generate-exported-symbols:
	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildStatic.gmk)

107
ALL_TARGETS += unpack-sec generate-exported-symbols
C
chegar 已提交
108 109 110

################################################################################
# Gensrc targets, generating source before java compilation can be done
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
#
# When creating a BUILDJDK, the java targets have already been built and copied
# into the buildjdk so no need to generate sources.
ifneq ($(CREATING_BUILDJDK), true)
  $(eval $(call DeclareRecipesForPhase, GENSRC, \
      TARGET_SUFFIX := gensrc, \
      FILE_PREFIX := Gensrc, \
      MAKE_SUBDIR := gensrc, \
      CHECK_MODULES := $(ALL_MODULES), \
      MULTIPLE_MAKEFILES := true))

  JDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
  LANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
  CORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
  HOTSPOT_GENSRC_TARGETS := $(filter %-gensrc-hotspot, $(GENSRC_TARGETS))

  GENSRC_MODULEINFO_MODULES := $(ALL_MODULES)
  GENSRC_MODULEINFO_TARGETS := $(addsuffix -gensrc-moduleinfo, \
      $(GENSRC_MODULEINFO_MODULES))

  GENSRC_MODULES := $(GENSRC_MODULEINFO_MODULES)
  GENSRC_TARGETS += $(sort $(GENSRC_MODULEINFO_TARGETS) \
      $(addsuffix -gensrc, $(GENSRC_MODULES)))

  define DeclareModuleInfoRecipe
    $1-gensrc-moduleinfo:
A
alanb 已提交
137 138 139
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
	    -f GensrcModuleInfo.gmk MODULE=$1)

140 141
    $1-gensrc: $1-gensrc-moduleinfo
  endef
A
alanb 已提交
142

143 144
  $(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m)))
endif
A
alanb 已提交
145

C
chegar 已提交
146 147 148 149
ALL_TARGETS += $(GENSRC_TARGETS)

################################################################################
# Generate data targets
C
chegar 已提交
150 151 152 153 154 155
$(eval $(call DeclareRecipesForPhase, GENDATA, \
    TARGET_SUFFIX := gendata, \
    FILE_PREFIX := Gendata, \
    MAKE_SUBDIR := gendata, \
    CHECK_MODULES := $(ALL_MODULES), \
    USE_WRAPPER := true))
C
chegar 已提交
156 157 158 159 160

ALL_TARGETS += $(GENDATA_TARGETS)

################################################################################
# Copy files targets
C
chegar 已提交
161 162 163 164 165
$(eval $(call DeclareRecipesForPhase, COPY, \
    TARGET_SUFFIX := copy, \
    FILE_PREFIX := Copy, \
    MAKE_SUBDIR := copy, \
    CHECK_MODULES := $(ALL_MODULES), \
166 167
    USE_WRAPPER := true, \
    MULTIPLE_MAKEFILES := true))
C
chegar 已提交
168

A
alanb 已提交
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
ALL_COPY_MODULES += $(COPY_MODULES)
ALL_COPY_TARGETS += $(COPY_TARGETS)

IMPORT_COPY_MODULES := $(call FindImportedModules)
IMPORT_COPY_TARGETS := $(addsuffix -copy, $(IMPORT_COPY_MODULES))
ALL_COPY_MODULES += $(IMPORT_COPY_MODULES)
ALL_COPY_TARGETS += $(IMPORT_COPY_TARGETS)

define DeclareImportCopyRecipe
  $1-copy:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
	    -f CopyImportModules.gmk MODULE=$1)
endef

$(foreach m, $(IMPORT_COPY_MODULES), $(eval $(call DeclareImportCopyRecipe,$m)))

ALL_TARGETS += $(ALL_COPY_TARGETS)
C
chegar 已提交
186 187 188

################################################################################
# Targets for compiling all java modules. Nashorn is treated separately.
A
alanb 已提交
189
JAVA_MODULES := $(ALL_MODULES)
C
chegar 已提交
190 191 192 193
JAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))

define DeclareCompileJavaRecipe
  $1-java:
194 195
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
	    -f CompileJavaModules.gmk MODULE=$1)
C
chegar 已提交
196 197 198 199 200 201 202 203
endef

$(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \
    $(eval $(call DeclareCompileJavaRecipe,$m)))

# Build nashorn. Needs to be compiled separately from the rest of the modules
# due to nasgen.
jdk.scripting.nashorn-java:
204 205
	+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
	    -f BuildNashorn.gmk compile)
C
chegar 已提交
206 207 208 209 210

ALL_TARGETS += $(JAVA_TARGETS)

################################################################################
# Targets for running rmic.
C
chegar 已提交
211 212 213 214 215
$(eval $(call DeclareRecipesForPhase, RMIC, \
    TARGET_SUFFIX := rmic, \
    FILE_PREFIX := Rmic, \
    MAKE_SUBDIR := rmic, \
    CHECK_MODULES := $(ALL_MODULES)))
C
chegar 已提交
216 217 218 219 220

ALL_TARGETS += $(RMIC_TARGETS)

################################################################################
# Targets for compiling native libraries
C
chegar 已提交
221 222 223 224 225 226
$(eval $(call DeclareRecipesForPhase, LIBS, \
    TARGET_SUFFIX := libs, \
    FILE_PREFIX := Lib, \
    MAKE_SUBDIR := lib, \
    CHECK_MODULES := $(ALL_MODULES), \
    USE_WRAPPER := true))
C
chegar 已提交
227

C
chegar 已提交
228
ALL_TARGETS += $(LIBS_TARGETS)
229

C
chegar 已提交
230 231
################################################################################
# Targets for compiling native executables
C
chegar 已提交
232 233 234 235 236 237
$(eval $(call DeclareRecipesForPhase, LAUNCHER, \
    TARGET_SUFFIX := launchers, \
    FILE_PREFIX := Launcher, \
    MAKE_SUBDIR := launcher, \
    CHECK_MODULES := $(ALL_MODULES), \
    USE_WRAPPER := true))
C
chegar 已提交
238 239 240 241 242

ALL_TARGETS += $(LAUNCHER_TARGETS)

################################################################################
# Build hotspot target
O
ohair 已提交
243

244 245 246 247 248 249 250
HOTSPOT_VARIANT_TARGETS := $(addprefix hotspot-, $(JVM_VARIANTS))
HOTSPOT_VARIANT_GENSRC_TARGETS := $(addsuffix -gensrc, $(HOTSPOT_VARIANT_TARGETS))
HOTSPOT_VARIANT_LIBS_TARGETS := $(addsuffix -libs, $(HOTSPOT_VARIANT_TARGETS))

define DeclareHotspotGensrcRecipe
  hotspot-$1-gensrc:
	$$(call LogInfo, Building JVM variant '$1' with features '$(JVM_FEATURES_$1)')
251
	+($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f gensrc/GenerateSources.gmk \
252 253 254 255 256 257 258
	    JVM_VARIANT=$1)
endef

$(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotGensrcRecipe,$v)))

define DeclareHotspotLibsRecipe
  hotspot-$1-libs:
259
	+($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f lib/CompileLibraries.gmk \
260 261 262 263 264 265
	    JVM_VARIANT=$1)
endef

$(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotLibsRecipe,$v)))

hotspot-jsig:
266
	+($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f lib/CompileLibjsig.gmk)
O
ohair 已提交
267

E
erikj 已提交
268
hotspot-ide-project:
269
	+($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f ide/CreateVSProject.gmk)
E
erikj 已提交
270

271 272
ALL_TARGETS += $(HOTSPOT_VARIANT_TARGETS) $(HOTSPOT_VARIANT_GENSRC_TARGETS) \
    $(HOTSPOT_VARIANT_LIBS_TARGETS) hotspot-jsig hotspot-ide-project
273

C
chegar 已提交
274
################################################################################
275
# Build demos targets
276

E
erikj 已提交
277
demos-jdk:
C
chegar 已提交
278 279
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)

280 281 282 283
test-image-demos-jdk:
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk images)

ALL_TARGETS += demos-jdk test-image-demos-jdk
O
ohair 已提交
284

C
chegar 已提交
285
################################################################################
A
alanb 已提交
286 287 288
# Jigsaw specific data and analysis targets.

generate-summary:
289
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f GenerateModuleSummary.gmk)
A
alanb 已提交
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310

ALL_TARGETS += generate-summary

################################################################################
# Jmod targets

JMOD_MODULES := $(ALL_MODULES)
JMOD_TARGETS := $(addsuffix -jmod, $(JMOD_MODULES))

define DeclareJmodRecipe
  $1-jmod:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateJmods.gmk \
	    MODULE=$1)
endef

$(foreach m, $(JMOD_MODULES), $(eval $(call DeclareJmodRecipe,$m)))

ALL_TARGETS += $(JMOD_TARGETS)

################################################################################
# Images targets
O
ohair 已提交
311

312 313
store-source-revision:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f SourceRevision.gmk store-source-revision)
314

315 316
create-source-revision-tracker:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f SourceRevision.gmk create-source-revision-tracker)
O
ohair 已提交
317

318
BOOTCYCLE_TARGET := product-images
C
chegar 已提交
319
bootcycle-images:
320 321
        ifneq ($(COMPILE_TYPE), cross)
	  $(call LogWarn, Boot cycle build step 2: Building a new JDK image using previously built image)
322
	  +$(MAKE) $(MAKE_ARGS) -f $(SRC_ROOT)/make/Init.gmk PARALLEL_TARGETS=$(BOOTCYCLE_TARGET) \
323 324 325 326
	      JOBS= SPEC=$(dir $(SPEC))bootcycle-spec.gmk main
        else
	  $(call LogWarn, Boot cycle build disabled when cross compiling)
        endif
C
chegar 已提交
327

C
chegar 已提交
328 329
zip-security:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)
C
chegar 已提交
330

C
chegar 已提交
331 332
zip-source:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk)
C
chegar 已提交
333

C
chegar 已提交
334 335
jrtfs-jar:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
C
chegar 已提交
336

337 338 339 340 341 342 343 344
jdk-image:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jdk)

jre-image:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jre)

symbols-image:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk symbols)
C
chegar 已提交
345

346
profiles-image:
C
chegar 已提交
347 348
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)

E
erikj 已提交
349
mac-bundles-jdk:
C
chegar 已提交
350
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
C
chegar 已提交
351

352 353 354
release-file:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ReleaseFile.gmk)

355 356 357
exploded-image-optimize:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ExplodedImageOptimize.gmk)

358
ALL_TARGETS += store-source-revision create-source-revision-tracker bootcycle-images zip-security \
359
    zip-source jrtfs-jar jdk-image jre-image \
360
    symbols-image profiles-image mac-bundles-jdk \
361
    release-file exploded-image-optimize
C
chegar 已提交
362 363 364 365

################################################################################
# Docs targets

366 367 368
# If building full docs, to complete docs-*-api we need both the javadoc and
# modulegraph targets.
docs-jdk-api-javadoc:
I
ihse 已提交
369
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-jdk-api-javadoc)
370

371
docs-jdk-api-modulegraph:
I
ihse 已提交
372
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-jdk-api-modulegraph)
C
chegar 已提交
373

374
docs-javase-api-javadoc:
I
ihse 已提交
375
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-javase-api-javadoc)
376 377

docs-javase-api-modulegraph:
I
ihse 已提交
378
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-javase-api-modulegraph)
379

380
docs-jdk-specs:
I
ihse 已提交
381
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-jdk-specs)
C
chegar 已提交
382

M
mchung 已提交
383 384 385
docs-jdk-index:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-jdk-index)

386
docs-zip:
I
ihse 已提交
387
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-zip)
388

389 390 391
update-build-docs:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f UpdateBuildDocs.gmk)

392
ALL_TARGETS += docs-jdk-api-javadoc docs-jdk-api-modulegraph \
393
    docs-javase-api-javadoc docs-javase-api-modulegraph docs-jdk-specs \
M
mchung 已提交
394
    docs-jdk-index docs-zip update-build-docs
C
chegar 已提交
395

A
alanb 已提交
396 397 398
################################################################################
# Cross compilation support

399
ifeq ($(CREATING_BUILDJDK), true)
A
alanb 已提交
400
  # This target is only called by the recursive call below.
401 402
  create-buildjdk-interim-image-helper: interim-image jdk.jlink-launchers \
      java.base-copy jdk.jdeps-launchers
A
alanb 已提交
403 404 405 406 407
endif

create-buildjdk-copy:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateBuildJdkCopy.gmk)

408
create-buildjdk-interim-image:
A
alanb 已提交
409 410 411 412 413 414
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Main.gmk \
	    $@-helper \
	    SPEC=$(dir $(SPEC))buildjdk-spec.gmk \
	    HOTSPOT_SPEC=$(dir $(SPEC))buildjdk-spec.gmk \
	    CREATING_BUILDJDK=true)

415 416 417
ALL_TARGETS += create-buildjdk-copy create-buildjdk-interim-image

################################################################################
418
# The interim-image is a small jlinked image that is used to generate artifacts
419 420
# at build time for use when linking the real images.

421 422 423 424 425 426 427 428 429 430 431 432 433 434
INTERIM_JMOD_TARGETS := $(addsuffix -interim-jmod, $(INTERIM_IMAGE_MODULES))

define DeclareInterimJmodRecipe
  $1-interim-jmod:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateJmods.gmk \
	    MODULE=$1 \
	    JMODS_DIR=$(INTERIM_JMODS_DIR) \
	    JMODS_TEMPDIR=$(INTERIM_JMODS_DIR)/temp \
	    INTERIM_JMOD=true \
	)
endef

$(foreach m, $(INTERIM_IMAGE_MODULES), $(eval $(call DeclareInterimJmodRecipe,$m)))

435 436 437
interim-image:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f InterimImage.gmk)

438
ifeq ($(ENABLE_GENERATE_CLASSLIST), true)
439 440
  generate-link-opt-data:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f GenerateLinkOptData.gmk)
441
endif
442

443
ALL_TARGETS += $(INTERIM_JMOD_TARGETS) interim-image generate-link-opt-data
A
alanb 已提交
444

445 446 447 448 449 450 451 452
################################################################################
# Generate test names for all JTReg test groups
#

define DeclareRunTestRecipe
  run-test-$1:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test TEST="$1")

453 454 455 456
  exploded-run-test-$1:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test \
	    TEST="$1" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR))

457 458 459 460 461
endef

# ALL_NAMED_TESTS is defined in FindTests.gmk
$(foreach t, $(ALL_NAMED_TESTS), $(eval $(call DeclareRunTestRecipe,$t)))
ALL_TEST_TARGETS := $(addprefix run-test-, $(ALL_NAMED_TESTS))
462
ALL_EXPLODED_TEST_TARGETS := $(addprefix exploded-run-test-, $(ALL_NAMED_TESTS))
463

464
ALL_TARGETS += $(ALL_TEST_TARGETS) $(ALL_EXPLODED_TEST_TARGETS)
465

C
chegar 已提交
466
################################################################################
467 468 469 470 471 472 473 474 475 476 477 478 479 480
# Build tests
#

prepare-test-image:
	$(MKDIR) -p $(TEST_IMAGE_DIR)
	$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'

build-test-hotspot-jtreg-native:
	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
	    build-test-hotspot-jtreg-native)

test-image-hotspot-jtreg-native:
	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
	    test-image-hotspot-jtreg-native)
C
chegar 已提交
481

482 483 484 485 486 487 488 489
build-test-jdk-jtreg-native:
	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
	    build-test-jdk-jtreg-native)

test-image-jdk-jtreg-native:
	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
	    test-image-jdk-jtreg-native)

490 491 492
run-test:
	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test TEST="$(TEST)")

493 494 495 496
exploded-run-test:
	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test \
	    TEST="$(TEST)" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR))

497 498 499 500 501
ifeq ($(BUILD_GTEST), true)
  test-image-hotspot-gtest:
	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f GtestImage.gmk)
endif

502 503 504
build-test-lib:
	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f BuildTestLib.gmk)

505 506 507
ifeq ($(BUILD_FAILURE_HANDLER), true)
  # Builds the failure handler jtreg extension
  build-test-failure-handler:
508 509 510
	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) \
	    -f BuildFailureHandler.gmk build)

511 512
  # Runs the tests for the failure handler jtreg extension
  test-failure-handler:
513 514 515
	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) \
	    -f BuildFailureHandler.gmk test)

516 517
  # Copies the failure handler jtreg extension into the test image
  test-image-failure-handler:
518 519
	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) \
	     -f BuildFailureHandler.gmk images)
520
endif
521

522 523
ALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \
    test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
524
    test-image-jdk-jtreg-native build-test-lib build-test-failure-handler \
525
    test-failure-handler test-image-failure-handler test-image-hotspot-gtest \
526
    run-test exploded-run-test
527 528 529 530 531

################################################################################
# Run tests

# Run tests specified by $(TEST), or the default test set.
C
chegar 已提交
532
test:
533
	$(call RunTests, $(TEST), $(JDK_IMAGE_DIR))
534

535
test-hotspot-jtreg:
536
	$(call RunTests, "hotspot_all", $(JDK_IMAGE_DIR))
537

538
test-hotspot-jtreg-native:
539
	$(call RunTests, "hotspot_native_sanity", $(JDK_IMAGE_DIR))
540

541
test-hotspot-internal:
542 543 544 545
	$(call RunTests, "hotspot_internal", $(JDK_OUTPUTDIR))

test-hotspot-gtest:
	$(call RunTests, "hotspot_gtest", $(JDK_OUTPUTDIR))
546

547
test-jdk-jtreg-native:
548
	$(call RunTests, "jdk_native_sanity", $(JDK_IMAGE_DIR))
C
chegar 已提交
549 550 551 552

test-make:
	($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))

553
ALL_TARGETS += test test-hotspot-jtreg test-hotspot-jtreg-native \
554
    test-hotspot-internal test-hotspot-gtest test-jdk-jtreg-native test-make
C
chegar 已提交
555

E
erikj 已提交
556 557 558 559 560 561
################################################################################
# Bundles

product-bundles:
	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk product-bundles)

562 563 564
profiles-bundles:
	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk profiles-bundles)

E
erikj 已提交
565 566 567 568 569 570
test-bundles:
	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk test-bundles)

docs-bundles:
	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk docs-bundles)

571
ALL_TARGETS += product-bundles profiles-bundles test-bundles docs-bundles
E
erikj 已提交
572

C
chegar 已提交
573 574 575 576 577 578 579 580 581 582
################################################################################
# Install targets

install:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk)

ALL_TARGETS += install

################################################################################
#
583
# Dependency declarations between targets.
C
chegar 已提交
584
#
585
# These are declared in two groups. First all dependencies between targets that
C
chegar 已提交
586 587 588 589 590 591 592
# have recipes above as these dependencies may be disabled. Then the aggregator
# targets that do not have recipes of their own, which will never have their
# dependencies disabled.
#
################################################################################
# Targets with recipes above

593 594
# If running an *-only target, parallel execution and dependencies between
# recipe targets are disabled. This makes it possible to run a select set of
C
chegar 已提交
595
# recipe targets in order. It's the responsibility of the user to make sure
596
# all prerequisites are fulfilled.
C
chegar 已提交
597 598 599
ifneq ($(findstring -only, $(MAKECMDGOALS)), )
  .NOTPARALLEL:
else
C
chegar 已提交
600 601
  $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools

C
chegar 已提交
602 603
  interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)

N
naoto 已提交
604
  buildtools-jdk: interim-langtools interim-cldrconverter
C
chegar 已提交
605

606 607
  buildtools-hotspot: interim-langtools

608 609
  buildtools-modules: exploded-image-base

C
chegar 已提交
610 611
  $(CORBA_GENSRC_TARGETS): interim-langtools

612
  $(HOTSPOT_GENSRC_TARGETS): interim-langtools buildtools-hotspot
613

C
chegar 已提交
614
  $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
C
chegar 已提交
615

A
alanb 已提交
616 617
  $(GENSRC_MODULEINFO_TARGETS): buildtools-jdk

C
chegar 已提交
618
  $(GENDATA_TARGETS): interim-langtools buildtools-jdk
C
chegar 已提交
619 620 621

  interim-rmic: interim-langtools

622
  $(RMIC_TARGETS): interim-langtools interim-rmic
C
chegar 已提交
623

E
erikj 已提交
624 625
  $(JAVA_TARGETS): interim-langtools

626 627 628 629 630 631
  # Declare dependencies between hotspot-<variant>* targets
  $(foreach v, $(JVM_VARIANTS), \
      $(eval hotspot-$v: hotspot-$v-gensrc hotspot-$v-libs) \
      $(eval hotspot-$v-libs: hotspot-$v-gensrc) \
  )

E
erikj 已提交
632 633
  hotspot-ide-project: hotspot exploded-image

634 635
  generate-exported-symbols: java.base-libs jdk.jdwp.agent-libs

636 637
  # Building one JVM variant is enough to start building the other libs
  $(LIBS_TARGETS): hotspot-$(JVM_VARIANT_MAIN)-libs
C
chegar 已提交
638 639 640

  $(LAUNCHER_TARGETS): java.base-libs

641 642 643 644
  ifeq ($(STATIC_BUILD), true)
    $(LAUNCHER_TARGETS): generate-exported-symbols
  endif

645 646 647
  # The demos are currently linking to libjvm and libjava, just like all other
  # jdk libs, even though they don't need to. To avoid warnings, make sure they
  # aren't built until after libjava and libjvm are available to link to.
648
  demos-jdk: java.base-libs exploded-image-optimize
649
  test-image-demos-jdk: demos-jdk
C
chegar 已提交
650 651 652 653 654 655 656 657 658 659 660 661 662

  # Declare dependency from <module>-java to <module>-gensrc
  $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))

  # Declare dependencies between java modules
  $(foreach m, $(JAVA_MODULES), \
      $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
      $(call FindDepsForModule,$m)))))

  # Declare dependencies between <module>-rmic to <module>-java
  $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))

  # Declare dependencies from <module>-lib to <module>-java
663 664 665
  # Skip modules that do not have java source.
  # When creating a BUILDJDK, the java compilation has already been done by the
  # normal build and copied in.
A
alanb 已提交
666
  ifneq ($(CREATING_BUILDJDK), true)
667
    $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
A
alanb 已提交
668
  endif
C
chegar 已提交
669 670

  # Declare dependencies from all other <module>-lib to java.base-lib
C
chegar 已提交
671
  $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
C
chegar 已提交
672 673
      $(eval $t: java.base-libs))

674 675 676
  # jdk.accessibility depends on java.desktop
  jdk.accessibility-libs: java.desktop-libs

677
  # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
C
chegar 已提交
678 679 680 681
  # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
  # virtual target.
  jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc

682 683
  # The swing beans need to have java base properly generated to avoid errors
  # in javadoc.
C
chegar 已提交
684
  java.desktop-gensrc-jdk: java.base-gensrc
685

686 687 688 689 690 691 692 693
  # The annotation processing for jdk.internal.vm.ci and jdk.internal.vm.compiler
  # needs classes from the current JDK.
  jdk.internal.vm.ci-gensrc-hotspot: $(addsuffix -java, \
      $(call FindTransitiveDepsForModule, jdk.internal.vm.ci))
  jdk.internal.vm.compiler-gensrc-hotspot: $(addsuffix -java, \
      $(call FindTransitiveDepsForModule, jdk.internal.vm.compiler))

  # For jdk.internal.vm.compiler, the gensrc step is generating a module-info.java.extra
694
  # file to be processed by the gensrc-moduleinfo target.
695
  jdk.internal.vm.compiler-gensrc-moduleinfo: jdk.internal.vm.compiler-gensrc-hotspot
696

C
chegar 已提交
697 698 699
  # Explicitly add dependencies for special targets
  java.base-java: unpack-sec

700
  jdk.jdeps-gendata: java rmic
701

702 703 704
  # The ct.sym generation uses all the moduleinfos as input
  jdk.compiler-gendata: $(GENSRC_MODULEINFO_TARGETS)

705 706
  # Declare dependencies between jmod targets.
  # java.base jmod needs jrt-fs.jar and access to the other jmods to be built.
707 708 709
  # When creating a BUILDJDK, we don't need to add hashes to java.base, thus
  # we don't need to depend on all other jmods
  ifneq ($(CREATING_BUILDJDK), true)
710
    java.base-jmod: jrtfs-jar $(filter-out java.base-jmod, $(JMOD_TARGETS))
711
  endif
A
alanb 已提交
712

713 714 715
  # Building java.base-jmod requires all of hotspot to be built.
  java.base-jmod: hotspot

A
alanb 已提交
716
  # Declare dependencies from <module>-jmod to all other module targets
717 718 719
  # When creating a BUILDJDK, the java compilation has already been done by the
  # normal build and copied in.
  ifneq ($(CREATING_BUILDJDK), true)
720
    $(foreach m, $(JAVA_MODULES), $(eval $m_JMOD_DEPS += $m-java))
721
  endif
722 723 724 725 726 727 728
  $(foreach m, $(GENDATA_MODULES), $(eval $m_JMOD_DEPS += $m-gendata))
  $(foreach m, $(RMIC_MODULES), $(eval $m_JMOD_DEPS += $m-rmic))
  $(foreach m, $(LIBS_MODULES), $(eval $m_JMOD_DEPS += $m-libs))
  $(foreach m, $(LAUNCHER_MODULES), $(eval $m_JMOD_DEPS += $m-launchers))
  $(foreach m, $(COPY_MODULES), $(eval $m_JMOD_DEPS += $m-copy))
  $(foreach m, $(ALL_MODULES), $(eval $m-jmod: $($(m)_JMOD_DEPS)))
  $(foreach m, $(INTERIM_IMAGE_MODULES), $(eval $m-interim-jmod: $($(m)_JMOD_DEPS)))
A
alanb 已提交
729

730 731 732 733 734 735 736 737 738 739 740 741 742 743
  # Jmods cannot be created until we have the jmod tool ready to run. During
  # a normal build we run it from the exploded image, but when cross compiling
  # it's run from the buildjdk, which is either created at build time or user
  # supplied.
  #
  # For the exploded image to be runnable, all java modules and
  # jdk.jlink-launchers need to be built. We also need to copy jvm.cfg (done
  # in java.base-copy) and tzdb.dat (done in java.base-gendata) to the
  # appropriate location otherwise jimage, jlink and jmod won't start. This
  # also applies when creating the buildjdk.
  DEFAULT_JMOD_DEPS := java.base-libs java.base-copy java.base-gendata \
      jdk.jlink-launchers
  # When cross compiling and buildjdk is to be created, depend on creating the
  # buildjdk instead of the default dependencies.
A
alanb 已提交
744
  ifeq ($(CREATE_BUILDJDK), true)
745
    # Avoid calling create-buildjdk from within a create-buildjdk call.
746 747
    ifneq ($(CREATING_BUILDJDK), true)
      $(JMOD_TARGETS): create-buildjdk
748
      buildtools-modules: create-buildjdk
749 750
    else
      # While actually creating the buildjdk, the default deps applies.
751
      $(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): $(DEFAULT_JMOD_DEPS)
752
    endif
753 754 755
  else
    # The normal non cross compilation case uses the default deps.
    # To avoid races with the optimize target, that also needs to happen first.
756 757
    $(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): $(DEFAULT_JMOD_DEPS) \
        exploded-image-optimize
A
alanb 已提交
758 759
  endif

760 761 762
  # All modules include the main license files from java.base.
  $(JMOD_TARGETS): java.base-copy

C
chegar 已提交
763 764
  zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
      $(filter jdk.crypto%, $(JAVA_TARGETS))
C
chegar 已提交
765

C
chegar 已提交
766
  zip-source: gensrc rmic
C
chegar 已提交
767

A
alanb 已提交
768
  jrtfs-jar: interim-langtools
C
chegar 已提交
769

770 771 772
  ifeq ($(ENABLE_GENERATE_CLASSLIST), true)
    ifeq ($(CREATE_BUILDJDK), true)
      # If creating a buildjdk, the interim image needs to be based on that.
773
      generate-link-opt-data: create-buildjdk
774 775 776 777
    else ifeq ($(EXTERNAL_BUILDJDK), false)
      # If an external buildjdk has been provided, we skip generating an
      # interim-image and just use the external buildjdk for generating
      # classlist.
778
      generate-link-opt-data: interim-image
779
    endif
780
    generate-link-opt-data: buildtools-jdk
781

782
    # The generated classlist needs to go into java.base-jmod.
783
    java.base-jmod jdk.jlink-jmod jdk-image jre-image: generate-link-opt-data
784 785
  endif

786 787
  release-file: create-source-revision-tracker

788
  jdk-image: jmods zip-source demos release-file
789
  jre-image: jmods release-file
790
  symbols-image: $(LIBS_TARGETS) $(LAUNCHER_TARGETS)
C
chegar 已提交
791

792
  profiles-image: jmods release-file
C
chegar 已提交
793

794
  mac-bundles-jdk: jdk-image jre-image
C
chegar 已提交
795

796 797 798 799 800
  # The optimize target can run as soon as the modules dir has been completely
  # populated (java, copy and gendata targets) and the basic libs and launchers
  # have been built.
  exploded-image-optimize: java copy gendata java.base-libs java.base-launchers \
      buildtools-modules
801

802
  bootcycle-images: jdk-image
C
chegar 已提交
803

804 805 806
  docs-jdk-api-javadoc: $(GENSRC_TARGETS) rmic

  docs-javase-api-javadoc: $(GENSRC_TARGETS) rmic
807

808
  docs-jdk-api-modulegraph: exploded-image buildtools-modules
C
chegar 已提交
809

810
  docs-javase-api-modulegraph: exploded-image buildtools-modules
811

812
  # The gensrc steps for hotspot and jdk.jdi create html spec files.
813 814
  docs-jdk-specs: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc \
      docs-jdk-index
C
chegar 已提交
815

M
mchung 已提交
816 817
  docs-jdk-index: exploded-image buildtools-modules

818
  docs-zip: docs-jdk
819

820
  test: jdk-image test-image
C
chegar 已提交
821

822
  run-test: jdk-image test-image
823
  exploded-run-test: exploded-image test-image
824 825 826

  # Declare dependency for all generated test targets
  $(foreach t, $(ALL_TEST_TARGETS), $(eval $t: jdk-image test-image))
827
  $(foreach t, $(ALL_EXPLODED_TEST_TARGETS), $(eval $t: exploded-image test-image))
828

829 830
  create-buildjdk-copy: jdk.jlink-java java.base-gendata \
      $(addsuffix -java, $(INTERIM_IMAGE_MODULES))
A
alanb 已提交
831

832 833
  create-buildjdk-interim-image: create-buildjdk-copy

834
  interim-image: $(INTERIM_JMOD_TARGETS)
C
chegar 已提交
835

836 837
  test-make: clean-test-make

838
  build-test-lib: exploded-image-optimize
E
erikj 已提交
839

840 841 842 843 844 845
  build-test-failure-handler: interim-langtools

  test-failure-handler: build-test-failure-handler

  test-image-failure-handler: build-test-failure-handler

846 847
  build-test-hotspot-jtreg-native: buildtools-jdk \
      hotspot-$(JVM_VARIANT_MAIN)-libs
848

849
  build-test-jdk-jtreg-native: buildtools-jdk java.base-libs
850

851 852 853 854
  test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native

  test-image-jdk-jtreg-native: build-test-jdk-jtreg-native

855 856
  test-image-hotspot-gtest: hotspot

857 858
  test-hotspot-internal: exploded-image

859
  test-hotspot-jtreg: jdk-image test-image
860

861 862
  test-hotspot-gtest: exploded-image test-image-hotspot-gtest

863 864
  install: product-images

E
erikj 已提交
865 866
  product-bundles: product-images

867 868
  profiles-bundles: profiles-images

E
erikj 已提交
869 870 871 872
  test-bundles: test-image

  docs-bundles: docs-image

873
  generate-summary: jmods buildtools-modules
A
alanb 已提交
874

C
chegar 已提交
875 876 877 878 879
endif

################################################################################
# Virtual targets without recipes

880
buildtools: buildtools-langtools interim-langtools interim-rmic \
881
    buildtools-jdk buildtools-hotspot
C
chegar 已提交
882

883 884 885 886 887 888 889 890 891 892
hotspot: $(HOTSPOT_VARIANT_TARGETS) hotspot-jsig

hotspot-libs: hotspot-jsig

# Create targets hotspot-libs and hotspot-gensrc.
$(foreach v, $(JVM_VARIANTS), \
  $(eval hotspot-libs: hotspot-$v-libs) \
  $(eval hotspot-gensrc: hotspot-$v-gensrc) \
)

C
chegar 已提交
893 894 895 896
gensrc: $(GENSRC_TARGETS)

gendata: $(GENDATA_TARGETS)

A
alanb 已提交
897
copy: $(ALL_COPY_TARGETS)
C
chegar 已提交
898 899 900 901 902

java: $(JAVA_TARGETS)

rmic: $(RMIC_TARGETS)

C
chegar 已提交
903
libs: $(LIBS_TARGETS)
C
chegar 已提交
904 905 906

launchers: $(LAUNCHER_TARGETS)

A
alanb 已提交
907 908
jmods: $(JMOD_TARGETS)

C
chegar 已提交
909 910 911
# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
# is actually handled by jdk.jdi-gensrc
jdk.jdwp.agent-gensrc: jdk.jdi-gensrc
C
chegar 已提交
912 913

# Declare dependencies from <module> to all the individual targets specific
914
# to that module <module>-*, that are needed for the exploded image.
C
chegar 已提交
915 916 917 918
$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
C
chegar 已提交
919
$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
C
chegar 已提交
920
$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
A
alanb 已提交
921
$(foreach m, $(ALL_COPY_MODULES), $(eval $m: $m-copy))
922 923 924 925

# Building java.base includes building all of hotspot.
java.base: hotspot

E
erikj 已提交
926 927
demos: demos-jdk

928
# The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
929
exploded-image-base: $(ALL_MODULES)
930
exploded-image: exploded-image-base release-file
931 932 933 934 935
# When cross compiling, no need to optimize the exploded image since it won't
# be runnable on the host platform anyway.
ifneq ($(COMPILE_TYPE), cross)
  exploded-image: exploded-image-optimize
endif
C
chegar 已提交
936

937
create-buildjdk: create-buildjdk-copy create-buildjdk-interim-image
A
alanb 已提交
938

939 940 941 942 943 944 945 946 947 948
docs-jdk-api: docs-jdk-api-javadoc
docs-javase-api: docs-javase-api-javadoc

# If we're building full docs, we must also generate the module graphs to
# get non-broken api documentation.
ifeq ($(ENABLE_FULL_DOCS), true)
  docs-jdk-api: docs-jdk-api-modulegraph
  docs-javase-api: docs-javase-api-modulegraph
endif

M
mchung 已提交
949
docs-jdk: docs-jdk-api docs-jdk-specs docs-jdk-index
950 951 952 953 954
docs-javase: docs-javase-api

# alias for backwards compatibility
docs-javadoc: docs-jdk-api

E
erikj 已提交
955 956
mac-bundles: mac-bundles-jdk

957
# The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
958 959 960 961
# and in line with this, our targets for creating these are named *-image[s].

# This target builds the product images, e.g. the JRE and JDK image
# (and possibly other, more specific versions)
962 963 964 965 966
product-images: jdk-image jre-image symbols-image exploded-image

# zip-security is actually a bundle, but for now it needs to be considered
# an image until this can be cleaned up properly.
product-images: zip-security
A
alanb 已提交
967

968 969 970
# Declare these for backwards compatiblity and convenience.
profiles profiles-images: profiles-image

971 972 973 974
# The module summary cannot be run when:
# * Cross compiling and building a partial BUILDJDK for the build host
# * An external buildjdk has been supplied since it may not match the
#   module selection of the target jdk
A
alanb 已提交
975
ifneq ($(CREATE_BUILDJDK), true)
976 977 978
  ifeq ($(EXTERNAL_BUILDJDK), false)
    product-images: generate-summary
  endif
A
alanb 已提交
979
endif
C
chegar 已提交
980

C
chegar 已提交
981
ifeq ($(OPENJDK_TARGET_OS), macosx)
982
  product-images: mac-bundles
C
chegar 已提交
983
endif
C
chegar 已提交
984

985
# This target builds the documentation image
986
docs-image: docs-jdk
C
chegar 已提交
987

988
# This target builds the test image
989
test-image: prepare-test-image test-image-hotspot-jtreg-native \
990 991
    test-image-jdk-jtreg-native test-image-failure-handler test-image-hotspot-gtest \
    test-image-demos-jdk
992

E
erikj 已提交
993
# all-images builds all our deliverables as images.
994 995
all-images: product-images test-image docs-image

E
erikj 已提交
996 997 998
# all-bundles packages all our deliverables as tar.gz bundles.
all-bundles: product-bundles test-bundles docs-bundles

999 1000
ALL_TARGETS += buildtools hotspot hotspot-libs hotspot-gensrc gensrc gendata \
    copy java rmic libs launchers jmods \
1001
    jdk.jdwp.agent-gensrc $(ALL_MODULES) demos \
1002
    exploded-image-base exploded-image \
1003 1004
    create-buildjdk docs-jdk-api docs-javase-api docs-jdk docs-javase \
    docs-javadoc mac-bundles product-images \
1005 1006
    profiles profiles-images \
    docs-image test-image all-images \
E
erikj 已提交
1007
    all-bundles
C
chegar 已提交
1008 1009 1010

################################################################################

1011 1012 1013
# Traditional targets typically run by users.
# These can be considered aliases for the targets now named by a more
# "modern" naming scheme.
1014
default: $(DEFAULT_MAKE_TARGET)
1015 1016 1017
jdk: exploded-image
images: product-images
docs: docs-image
E
erikj 已提交
1018
bundles: all-bundles
1019
all: all-images
C
chegar 已提交
1020

E
erikj 已提交
1021
ALL_TARGETS += default jdk images docs bundles all
C
chegar 已提交
1022 1023 1024 1025 1026 1027 1028

################################################################################
################################################################################
#
# Clean targets
#
################################################################################
1029
# Clean targets are automatically run serially by the Makefile calling this
1030
# file.
C
chegar 已提交
1031

C
chegar 已提交
1032
CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
A
alanb 已提交
1033
    images make-support test-make bundles buildjdk
C
chegar 已提交
1034
CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
I
ihse 已提交
1035 1036
CLEAN_SUPPORT_DIRS += demos
CLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS))
1037
CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib
1038
CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS))
1039
CLEAN_PHASES := gensrc java native include
C
chegar 已提交
1040 1041 1042 1043 1044
CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
# Construct targets of the form clean-$module-$phase
CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
    $(addprefix $m-, $(CLEAN_PHASES))))
O
ohair 已提交
1045 1046

# Remove everything, except the output from configure.
C
chegar 已提交
1047
clean: $(CLEAN_DIR_TARGETS)
E
erikj 已提交
1048
	($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*)
C
chegar 已提交
1049 1050
	$(ECHO) Cleaned all build artifacts.

1051 1052 1053
clean-docs:
	$(call CleanDocs)

C
chegar 已提交
1054 1055 1056
$(CLEAN_DIR_TARGETS):
	$(call CleanDir,$(patsubst clean-%, %, $@))

I
ihse 已提交
1057 1058 1059
$(CLEAN_SUPPORT_DIR_TARGETS):
	$(call CleanSupportDir,$(patsubst clean-%, %, $@))

1060 1061 1062
$(CLEAN_TEST_TARGETS):
	$(call CleanTest,$(patsubst clean-test-%, %, $@))

C
chegar 已提交
1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076
$(CLEAN_PHASE_TARGETS):
	$(call Clean-$(patsubst clean-%,%, $@))

$(CLEAN_MODULE_TARGETS):
	$(call CleanModule,$(patsubst clean-%, %, $@))

$(CLEAN_MODULE_PHASE_TARGETS):
	$(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
	    $(word 2, $(subst -,$(SPACE),$@)))

# When removing the support dir, we must also remove jdk. Building classes has
# the side effect of generating native headers. The headers end up in support
# while classes and touch files end up in jdk.
clean-support: clean-jdk
C
chegar 已提交
1077

E
erikj 已提交
1078 1079
# Remove everything, including configure configuration. If the output
# directory was created by configure and now becomes empty, remove it as well.
O
ohair 已提交
1080
dist-clean: clean
E
erikj 已提交
1081 1082
	($(CD) $(OUTPUT_ROOT) && \
	    $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide)
C
chegar 已提交
1083
	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
1084 1085 1086
	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
	  else \
C
chegar 已提交
1087 1088
	    ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
	        && $(RM) -r $(OUTPUT_ROOT)) \
1089 1090
	  fi \
	)
C
chegar 已提交
1091 1092
	$(ECHO) Cleaned everything, you will have to re-run configure.

1093
ALL_TARGETS += clean clean-docs dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_SUPPORT_DIR_TARGETS) \
I
ihse 已提交
1094 1095
    $(CLEAN_TEST_TARGETS) $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) \
    $(CLEAN_MODULE_PHASE_TARGETS)
C
chegar 已提交
1096 1097

################################################################################
I
ihse 已提交
1098 1099
# Declare *-only targets for each normal target
$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
C
chegar 已提交
1100

I
ihse 已提交
1101
ALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS)))
1102

I
ihse 已提交
1103
################################################################################
O
ohair 已提交
1104

I
ihse 已提交
1105 1106
# Include JPRT targets
include $(SRC_ROOT)/make/Jprt.gmk
C
chegar 已提交
1107 1108 1109

################################################################################

I
ihse 已提交
1110 1111 1112
# The following targets are intentionally not added to ALL_TARGETS since they
# are internal only, to support Init.gmk.

I
ihse 已提交
1113 1114 1115 1116 1117 1118
print-targets:
	  @$(ECHO) $(sort $(ALL_TARGETS))

print-modules:
	  @$(ECHO) $(sort $(ALL_MODULES))

1119 1120 1121
print-tests:
	  @$(ECHO) $(sort $(ALL_NAMED_TESTS))

I
ihse 已提交
1122
create-main-targets-include:
E
erikj 已提交
1123
	  $(call LogInfo, Generating main target list)
I
ihse 已提交
1124 1125
	  @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
	      $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
C
chegar 已提交
1126 1127 1128 1129

################################################################################

.PHONY: $(ALL_TARGETS)
O
ohair 已提交
1130 1131

FRC: # Force target