Main.gmk revision 1737:f1a26551298e
180709Sjake#
280709Sjake# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
380709Sjake# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
480709Sjake#
580709Sjake# This code is free software; you can redistribute it and/or modify it
680709Sjake# under the terms of the GNU General Public License version 2 only, as
780709Sjake# published by the Free Software Foundation.  Oracle designates this
880709Sjake# particular file as subject to the "Classpath" exception as provided
980709Sjake# by Oracle in the LICENSE file that accompanied this code.
1080709Sjake#
1180709Sjake# This code is distributed in the hope that it will be useful, but WITHOUT
1280709Sjake# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1380709Sjake# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1481337Sobrien# version 2 for more details (a copy is included in the LICENSE file that
1580709Sjake# accompanied this code).
1680709Sjake#
1781337Sobrien# You should have received a copy of the GNU General Public License version
1880709Sjake# 2 along with this work; if not, write to the Free Software Foundation,
1980709Sjake# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2080709Sjake#
2180709Sjake# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2280709Sjake# or visit www.oracle.com if you need additional information or have any
2380709Sjake# questions.
2480709Sjake#
2580709Sjake
2680709Sjake################################################################################
2780709Sjake# This is the main makefile containing most actual top level targets. It needs
2880709Sjake# to be called with a SPEC file defined.
2980709Sjake################################################################################
3080709Sjake
3180709Sjake# Declare default target
3280709Sjakedefault:
33100771Sjake
3482910Sjakeifeq ($(wildcard $(SPEC)),)
3580709Sjake  $(error Main.gmk needs SPEC set to a proper spec.gmk)
3680709Sjakeendif
3786527Sjake
3891783Sjake# Now load the spec
3991613Sjakeinclude $(SPEC)
4091613Sjake
4180709Sjakeinclude $(SRC_ROOT)/make/MainSupport.gmk
4291176Sjake
4384186Sjake# Load the vital tools for all the makefiles.
4480709Sjakeinclude $(SRC_ROOT)/make/common/MakeBase.gmk
4580709Sjakeinclude $(SRC_ROOT)/make/common/Modules.gmk
4681381Sjake
4781381Sjake# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
4881381Sjake# valid top level targets. It's used to declare them all as PHONY and to
4981381Sjake# generate the -only targets.
5080709SjakeALL_TARGETS :=
5180709Sjake
5297001Sjake# Hook to include the corresponding custom file, if present.
5380709Sjake$(eval $(call IncludeCustomExtension, , Main.gmk))
5480709Sjake
5581135Stmm# All modules for the current target platform.
5680709Sjake# Manually add jdk.hotspot.agent for now.
5786527SjakeALL_MODULES := $(call FindAllModules) jdk.hotspot.agent
5881614Sjake
5988657Sjake################################################################################
6080709Sjake################################################################################
6180709Sjake#
6280709Sjake# Recipes for all targets. Only recipes, dependencies are declared later.
6382910Sjake#
6489052Sjake################################################################################
6580709Sjake
6680709Sjake################################################################################
6780709Sjake# Interim/build tools targets, compiling tools used during the build
6882010Sjake
6991617Sjakebuildtools-langtools:
7088788Sjake	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)
7180709Sjake
7283756Sjakeinterim-langtools:
7383756Sjake	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
7480709Sjake
7580709Sjakeinterim-rmic:
7680709Sjake	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
7783366Sjulian
7884186Sjakeinterim-cldrconverter:
7991360Sjake	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk)
8083366Sjulian
8180709Sjakebuildtools-jdk:
8280709Sjake	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk java-tools)
8382910Sjake
8480709SjakeALL_TARGETS += buildtools-langtools interim-langtools \
8581135Stmm    interim-rmic interim-cldrconverter buildtools-jdk
8681135Stmm
8781135Stmm################################################################################
8881135Stmm# Special targets for certain modules
8988657Sjake
9088657Sjakeimport-hotspot:
9191224Sjake	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk)
9291224Sjake
93100771Sjakeunpack-sec:
9481381Sjake	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
9591783Sjake
9689052Sjakegenerate-exported-symbols:
9788657Sjake	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildStatic.gmk)
98100771Sjake
99100771SjakeALL_TARGETS += import-hotspot unpack-sec generate-exported-symbols
100100771Sjake
10181381Sjake################################################################################
10288657Sjake# Gensrc targets, generating source before java compilation can be done
10388657Sjake$(eval $(call DeclareRecipesForPhase, GENSRC, \
10491224Sjake    TARGET_SUFFIX := gensrc, \
10580709Sjake    FILE_PREFIX := Gensrc, \
10691336Sjake    MAKE_SUBDIR := gensrc, \
10791336Sjake    CHECK_MODULES := $(ALL_MODULES), \
10891336Sjake    MULTIPLE_MAKEFILES := true))
10980709Sjake
11080709SjakeJDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
11180709SjakeLANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
11291617SjakeCORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
11391617SjakeHOTSPOT_GENSRC_TARGETS := $(filter %-gensrc-hotspot, $(GENSRC_TARGETS))
11489052Sjake
11589052SjakeALL_TARGETS += $(GENSRC_TARGETS)
11691783Sjake
11789052Sjake################################################################################
11891617Sjake# Generate data targets
11991617Sjake$(eval $(call DeclareRecipesForPhase, GENDATA, \
12091617Sjake    TARGET_SUFFIX := gendata, \
12189052Sjake    FILE_PREFIX := Gendata, \
12297001Sjake    MAKE_SUBDIR := gendata, \
12397001Sjake    CHECK_MODULES := $(ALL_MODULES), \
12497001Sjake    USE_WRAPPER := true))
12597001Sjake
12697001SjakeALL_TARGETS += $(GENDATA_TARGETS)
12797001Sjake
12897001Sjake################################################################################
12997001Sjake# Copy files targets
13097001Sjake$(eval $(call DeclareRecipesForPhase, COPY, \
13197001Sjake    TARGET_SUFFIX := copy, \
13297001Sjake    FILE_PREFIX := Copy, \
13397001Sjake    MAKE_SUBDIR := copy, \
13497001Sjake    CHECK_MODULES := $(ALL_MODULES), \
13597001Sjake    USE_WRAPPER := true, \
13697001Sjake    MULTIPLE_MAKEFILES := true))
13797001Sjake
138100771SjakeALL_TARGETS += $(COPY_TARGETS)
139100771Sjake
140100771Sjake################################################################################
141100771Sjake# Targets for compiling all java modules. Nashorn is treated separately.
14285244SjakeJAVA_MODULES := $(call FindJavaModules)
14384186SjakeJAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))
14489052Sjake
14584186Sjakedefine DeclareCompileJavaRecipe
14684186Sjake  $1-java:
14782910Sjake	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CompileJavaModules.gmk \
14885244Sjake	    $1 JAVA_MODULES=$1 MODULE=$1)
14985244Sjakeendef
15085244Sjake
15191532Sjake$(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \
15291532Sjake    $(eval $(call DeclareCompileJavaRecipe,$m)))
15391532Sjake
15491532Sjake# Build nashorn. Needs to be compiled separately from the rest of the modules
15582910Sjake# due to nasgen.
15682910Sjakejdk.scripting.nashorn-java:
15793949Sjake	+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk compile)
15893949Sjake
15982910SjakeALL_TARGETS += $(JAVA_TARGETS)
16092199Sjake
16193503Sjake################################################################################
16293503Sjake# Targets for running rmic.
16393503Sjake$(eval $(call DeclareRecipesForPhase, RMIC, \
16493503Sjake    TARGET_SUFFIX := rmic, \
16593503Sjake    FILE_PREFIX := Rmic, \
16693503Sjake    MAKE_SUBDIR := rmic, \
16793503Sjake    CHECK_MODULES := $(ALL_MODULES)))
16882910Sjake
16991224SjakeALL_TARGETS += $(RMIC_TARGETS)
17080709Sjake
17181381Sjake################################################################################
17280709Sjake# Targets for compiling native libraries
17381614Sjake$(eval $(call DeclareRecipesForPhase, LIBS, \
17480709Sjake    TARGET_SUFFIX := libs, \
17588657Sjake    FILE_PREFIX := Lib, \
176100771Sjake    MAKE_SUBDIR := lib, \
177100771Sjake    CHECK_MODULES := $(ALL_MODULES), \
178100771Sjake    USE_WRAPPER := true))
179100771Sjake
18088657SjakeALL_TARGETS += $(LIBS_TARGETS)
18180709Sjake
18280709Sjake################################################################################
18384186Sjake# Targets for compiling native executables
18484186Sjake$(eval $(call DeclareRecipesForPhase, LAUNCHER, \
18587702Sjhb    TARGET_SUFFIX := launchers, \
18687702Sjhb    FILE_PREFIX := Launcher, \
18787702Sjhb    MAKE_SUBDIR := launcher, \
18891337Sjake    CHECK_MODULES := $(ALL_MODULES), \
18997265Sjake    USE_WRAPPER := true))
19097265Sjake
19197265SjakeALL_TARGETS += $(LAUNCHER_TARGETS)
19289052Sjake
19391613Sjake################################################################################
19491613Sjake# Build hotspot target
19591613Sjake
19691617Sjakeifeq ($(BUILD_HOTSPOT),true)
19789052Sjake  hotspot:
19880709Sjake	($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
19984186Sjakeendif
20084186Sjake
20197265SjakeALL_TARGETS += hotspot
20281614Sjake
20397265Sjake################################################################################
20497265Sjake# Build demos and samples targets
20597265Sjake
20697265Sjakedemos-jdk:
20797265Sjake	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
20881614Sjake
20992199Sjakesamples-jdk:
21091783Sjake	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk)
21189052Sjake
21289052SjakeALL_TARGETS += demos-jdk samples-jdk
21389052Sjake
21489052Sjake################################################################################
21581614Sjake# Image targets
21681614Sjake
21781614Sjake# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
21881614Sjake# used to track the exact sources used to build that image.
21981614Sjakesource-tips: $(SUPPORT_OUTPUTDIR)/source_tips
22097265Sjake$(SUPPORT_OUTPUTDIR)/source_tips: FRC
22185244Sjake	@$(MKDIR) -p $(@D)
22283366Sjulian	@$(RM) $@
22383366Sjulian	@$(call GetSourceTips)
22482910Sjake
22588788SjakeBOOTCYCLE_TARGET := product-images
22688788Sjakebootcycle-images:
22791613Sjake	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
22891613Sjake	+$(MAKE) $(MAKE_ARGS) -f $(SRC_ROOT)/make/Main.gmk \
22982910Sjake	    SPEC=$(dir $(SPEC))bootcycle-spec.gmk $(BOOTCYCLE_TARGET)
23088657Sjake
23188657Sjakezip-security:
23282910Sjake	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)
23380709Sjake
23480709Sjakezip-source:
23588657Sjake	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk)
23688657Sjake
23783366Sjulianstrip-binaries:
23883366Sjulian	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk)
23983366Sjulian
24083366Sjulianjrtfs-jar:
24183366Sjulian	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
24283366Sjulian
24383366Sjulianjimages:
24483366Sjulian	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages)
24584186Sjake
24681135Stmmprofiles:
24780709Sjake	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
24880709Sjake
24982010Sjakemac-bundles-jdk:
25080709Sjake	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
25182910Sjake
25282910SjakeALL_TARGETS += source-tips bootcycle-images zip-security zip-source strip-binaries \
25382910Sjake    jrtfs-jar jimages profiles mac-bundles-jdk
25480709Sjake
25581381Sjake################################################################################
25688657Sjake# Docs targets
25781381Sjake
25888657Sjakedocs-javadoc:
25981381Sjake	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
26081135Stmm
26181135Stmmdocs-jvmtidoc:
26281135Stmm	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk jvmtidocs)
26381135Stmm
26481135StmmALL_TARGETS += docs-javadoc docs-jvmtidoc
26580709Sjake
26680709Sjake################################################################################
26780709Sjake# Build tests
26882910Sjake#
26982010Sjake
27088657Sjakeprepare-test-image:
27188657Sjake	$(MKDIR) -p $(TEST_IMAGE_DIR)
27288657Sjake	$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'
27388657Sjake
27488657Sjakebuild-test-hotspot-jtreg-native:
27580709Sjake	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
27680709Sjake	    build-test-hotspot-jtreg-native)
27780709Sjake
27880709Sjaketest-image-hotspot-jtreg-native:
27980709Sjake	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
28080709Sjake	    test-image-hotspot-jtreg-native)
28180709Sjake
28280709Sjakebuild-test-jdk-jtreg-native:
28380709Sjake	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
28480709Sjake	    build-test-jdk-jtreg-native)
28580709Sjake
28680709Sjaketest-image-jdk-jtreg-native:
28780709Sjake	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
28880709Sjake	    test-image-jdk-jtreg-native)
28980709Sjake
29080709Sjakebuild-test-lib:
29180709Sjake	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f BuildTestLib.gmk)
29288657Sjake
29388657SjakeALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \
29488657Sjake    test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
29588657Sjake    test-image-jdk-jtreg-native build-test-lib
29688657Sjake
29788657Sjake################################################################################
29880709Sjake# Run tests
29988657Sjake
30080709Sjake# Run tests specified by $(TEST), or the default test set.
30188657Sjaketest:
30288657Sjake	$(call RunTests, $(TEST))
30388657Sjake
30482910Sjaketest-hotspot-jtreg-native:
30580709Sjake	$(call RunTests, "hotspot_native_sanity")
30688788Sjake
30788788Sjaketest-jdk-jtreg-native:
308	$(call RunTests, "jdk_native_sanity")
309
310test-make:
311	($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))
312
313ALL_TARGETS += test test-hotspot-jtreg-native test-jdk-jtreg-native test-make
314
315################################################################################
316# Verification targets
317
318verify-modules:
319	@$(call TargetEnter)
320	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CheckModules.gmk)
321	@$(call TargetExit)
322
323ALL_TARGETS += verify-modules
324
325################################################################################
326# Install targets
327
328install:
329	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk)
330
331ALL_TARGETS += install
332
333################################################################################
334#
335# Dependency declarations between targets.
336#
337# These are declared in two groups. First all dependencies between targets that
338# have recipes above as these dependencies may be disabled. Then the aggregator
339# targets that do not have recipes of their own, which will never have their
340# dependencies disabled.
341#
342################################################################################
343# Targets with recipes above
344
345# If running an *-only target, parallel execution and dependencies between
346# recipe targets are disabled. This makes it possible to run a select set of
347# recipe targets in order. It's the responsibility of the user to make sure
348# all prerequisites are fulfilled.
349ifneq ($(findstring -only, $(MAKECMDGOALS)), )
350  .NOTPARALLEL:
351else
352  $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
353
354  interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
355
356  buildtools-jdk: interim-langtools interim-cldrconverter
357
358  $(CORBA_GENSRC_TARGETS): interim-langtools
359
360  $(HOTSPOT_GENSRC_TARGETS): interim-langtools
361
362  $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
363
364  $(GENDATA_TARGETS): interim-langtools buildtools-jdk
365
366  interim-rmic: interim-langtools
367
368  $(RMIC_TARGETS): interim-langtools interim-rmic
369
370  $(JAVA_TARGETS): interim-langtools
371
372  import-hotspot: hotspot
373
374  generate-exported-symbols: java.base-libs jdk.jdwp.agent-libs
375
376  $(LIBS_TARGETS): import-hotspot
377
378  $(LAUNCHER_TARGETS): java.base-libs
379
380  ifeq ($(STATIC_BUILD), true)
381    $(LAUNCHER_TARGETS): generate-exported-symbols
382  endif
383
384  # The demos are currently linking to libjvm and libjava, just like all other
385  # jdk libs, even though they don't need to. To avoid warnings, make sure they
386  # aren't built until after libjava and libjvm are available to link to.
387  demos-jdk: $(JAVA_TARGETS)
388
389  # Declare dependency from <module>-java to <module>-gensrc
390  $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
391
392  # Declare dependencies between java modules
393  $(foreach m, $(JAVA_MODULES), \
394      $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
395      $(call FindDepsForModule,$m)))))
396
397  # Declare dependencies between <module>-rmic to <module>-java
398  $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))
399
400  # Declare dependencies from <module>-lib to <module>-java
401  # Skip modules that do not have java source.
402  $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
403
404  # Declare dependencies from all other <module>-lib to java.base-lib
405  $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
406      $(eval $t: java.base-libs))
407  # Declare the special case dependency for jdk.deploy.osx where libosx
408  # links against libosxapp.
409  jdk.deploy.osx-libs: java.desktop-libs
410
411  # jdk.accessibility depends on java.desktop
412  jdk.accessibility-libs: java.desktop-libs
413
414  # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
415  # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
416  # virtual target.
417  jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
418
419  # Until the module system is in place, jdk.jdi-gensrc needs to combine service
420  # loader configuration with jdk.hotspot.agent so is dependent on importing
421  # hotspot.
422  jdk.jdi-gensrc-jdk: import-hotspot
423
424  # The swing beans need to have java base properly generated to avoid errors
425  # in javadoc.
426  java.desktop-gensrc-jdk: java.base-gensrc
427
428  # Explicitly add dependencies for special targets
429  java.base-java: unpack-sec
430
431  # The copy target copies files generated by gensrc
432  java.base-copy-hotspot: java.base-gensrc-hotspot
433
434  jdk.jdeps-gendata: java rmic
435
436  zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
437      $(filter jdk.crypto%, $(JAVA_TARGETS))
438
439  zip-source: gensrc rmic
440
441  strip-binaries: libs launchers gendata copy
442
443  jrtfs-jar: buildtools-jdk
444
445  jimages: exploded-image zip-source strip-binaries source-tips demos samples \
446      jrtfs-jar
447
448  profiles: exploded-image strip-binaries source-tips
449
450  mac-bundles-jdk: jimages
451
452  bootcycle-images: jimages
453
454  docs-javadoc: gensrc rmic
455
456  docs-jvmtidoc: hotspot
457
458  test: jimages test-image
459
460  verify-modules: exploded-image
461
462  test-make: clean-test-make
463
464  build-test-hotspot-jtreg-native: buildtools-jdk
465
466  build-test-jdk-jtreg-native: buildtools-jdk
467
468  test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native
469
470  test-image-jdk-jtreg-native: build-test-jdk-jtreg-native
471
472endif
473
474################################################################################
475# Virtual targets without recipes
476
477buildtools: buildtools-langtools interim-langtools interim-rmic \
478    buildtools-jdk
479
480gensrc: $(GENSRC_TARGETS)
481
482gendata: $(GENDATA_TARGETS)
483
484copy: $(COPY_TARGETS)
485
486java: $(JAVA_TARGETS)
487
488rmic: $(RMIC_TARGETS)
489
490libs: $(LIBS_TARGETS)
491
492launchers: $(LAUNCHER_TARGETS)
493
494# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
495# is actually handled by jdk.jdi-gensrc
496jdk.jdwp.agent-gensrc: jdk.jdi-gensrc
497
498# Declare dependencies from <module> to all the individual targets specific
499# to that module <module>-*.
500$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
501$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
502$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
503$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
504$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
505$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
506$(foreach m, $(COPY_MODULES), $(eval $m: $m-copy))
507
508ALL_MODULE_TARGETS := $(sort $(GENSRC_MODULES) $(JAVA_MODULES) \
509    $(GENDATA_MODULES) $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES))
510
511demos: demos-jdk
512
513samples: samples-jdk
514
515# The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
516exploded-image: $(ALL_MODULE_TARGETS)
517
518mac-bundles: mac-bundles-jdk
519
520# The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
521# and in line with this, our targets for creating these are named *-image[s].
522
523# This target builds the product images, e.g. the JRE and JDK image
524# (and possibly other, more specific versions)
525product-images: jimages demos samples zip-security verify-modules
526
527ifeq ($(OPENJDK_TARGET_OS), macosx)
528  product-images: mac-bundles
529endif
530
531# This target builds the documentation image
532docs-image: docs-javadoc docs-jvmtidoc
533
534# This target builds the test image
535test-image: prepare-test-image test-image-hotspot-jtreg-native \
536    test-image-jdk-jtreg-native
537
538# all-images is the top-most target, it builds all our deliverables ("images").
539all-images: product-images test-image docs-image
540
541ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers \
542    jdk.jdwp.agent-gensrc $(ALL_MODULE_TARGETS) demos samples exploded-image \
543    mac-bundles product-images docs-image test-image all-images
544
545################################################################################
546
547# Traditional targets typically run by users.
548# These can be considered aliases for the targets now named by a more
549# "modern" naming scheme.
550default: exploded-image
551jdk: exploded-image
552images: product-images
553docs: docs-image
554all: all-images
555
556ALL_TARGETS += default jdk images docs all
557
558################################################################################
559################################################################################
560#
561# Clean targets
562#
563################################################################################
564# Clean targets are automatically run serially by the Makefile calling this
565# file.
566
567CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
568    images make-support test-make bundles
569CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
570CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib
571CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS))
572CLEAN_PHASES := gensrc java native include docs
573CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
574CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
575# Construct targets of the form clean-$module-$phase
576CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
577    $(addprefix $m-, $(CLEAN_PHASES))))
578
579# Remove everything, except the output from configure.
580clean: $(CLEAN_DIR_TARGETS)
581	($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*)
582	$(ECHO) Cleaned all build artifacts.
583
584$(CLEAN_DIR_TARGETS):
585	$(call CleanDir,$(patsubst clean-%, %, $@))
586
587$(CLEAN_TEST_TARGETS):
588	$(call CleanTest,$(patsubst clean-test-%, %, $@))
589
590$(CLEAN_PHASE_TARGETS):
591	$(call Clean-$(patsubst clean-%,%, $@))
592
593$(CLEAN_MODULE_TARGETS):
594	$(call CleanModule,$(patsubst clean-%, %, $@))
595
596$(CLEAN_MODULE_PHASE_TARGETS):
597	$(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
598	    $(word 2, $(subst -,$(SPACE),$@)))
599
600# When removing the support dir, we must also remove jdk. Building classes has
601# the side effect of generating native headers. The headers end up in support
602# while classes and touch files end up in jdk.
603clean-support: clean-jdk
604
605# Remove everything, including configure configuration. If the output
606# directory was created by configure and now becomes empty, remove it as well.
607dist-clean: clean
608	($(CD) $(OUTPUT_ROOT) && \
609	    $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide)
610	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
611	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
612	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
613	  else \
614	    ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
615	        && $(RM) -r $(OUTPUT_ROOT)) \
616	  fi \
617	)
618	$(ECHO) Cleaned everything, you will have to re-run configure.
619
620ALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_TEST_TARGETS) \
621    $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) $(CLEAN_MODULE_PHASE_TARGETS)
622
623################################################################################
624# Declare *-only targets for each normal target
625$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
626
627ALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS)))
628
629################################################################################
630
631# Include JPRT targets
632include $(SRC_ROOT)/make/Jprt.gmk
633
634################################################################################
635
636# The following targets are intentionally not added to ALL_TARGETS since they
637# are internal only, to support Init.gmk.
638
639print-targets:
640	  @$(ECHO) $(sort $(ALL_TARGETS))
641
642print-modules:
643	  @$(ECHO) $(sort $(ALL_MODULES))
644
645create-main-targets-include:
646	  @$(ECHO) $(LOG_INFO) Generating main target list
647	  @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
648	      $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
649
650################################################################################
651
652.PHONY: $(ALL_TARGETS)
653
654FRC: # Force target
655