Main.gmk revision 1345:23e62d3d9be0
189051Sjake#
289051Sjake# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
3182916Smarius# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489051Sjake#
589051Sjake# This code is free software; you can redistribute it and/or modify it
689051Sjake# under the terms of the GNU General Public License version 2 only, as
789051Sjake# published by the Free Software Foundation.  Oracle designates this
889051Sjake# particular file as subject to the "Classpath" exception as provided
989051Sjake# by Oracle in the LICENSE file that accompanied this code.
1089051Sjake#
1189051Sjake# This code is distributed in the hope that it will be useful, but WITHOUT
1289051Sjake# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1389051Sjake# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1489051Sjake# version 2 for more details (a copy is included in the LICENSE file that
1589051Sjake# accompanied this code).
1689051Sjake#
1789051Sjake# You should have received a copy of the GNU General Public License version
1889051Sjake# 2 along with this work; if not, write to the Free Software Foundation,
1989051Sjake# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2089051Sjake#
2189051Sjake# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2289051Sjake# or visit www.oracle.com if you need additional information or have any
2389051Sjake# questions.
2489051Sjake#
2589051Sjake
2689051Sjake################################################################################
2789051Sjake# This is the main makefile containing most actual top level targets. It needs
28114188Sjake# to be called with a SPEC file defined.
29114188Sjake
30114188Sjake# Declare default target
3189051Sjakedefault:
3289051Sjake
3389051Sjake# Now load the spec
3489051Sjakeinclude $(SPEC)
35166105Smarius
3691617Sjakeinclude $(SRC_ROOT)/make/MakeHelpers.gmk
37182730Smarius
3889051Sjake# Load the vital tools for all the makefiles.
3989051Sjakeinclude $(SRC_ROOT)/make/common/MakeBase.gmk
4089051Sjakeinclude $(SRC_ROOT)/make/common/Modules.gmk
4189051Sjake
4289051Sjake# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
4389051Sjake# valid top level targets. It's used to declare them all as PHONY and to
4491617Sjake# generate the -only targets.
45100899SjakeALL_TARGETS :=
46182916Smarius
47203833Smarius# Hook to include the corresponding custom file, if present.
48203833Smarius$(eval $(call IncludeCustomExtension, , Main.gmk))
49203833Smarius
50203833Smarius# All modules for the current target platform.
51203833Smarius# Manually add jdk.hotspot.agent for now.
52203833SmariusALL_MODULES := $(call FindAllModules) jdk.hotspot.agent
53182916Smarius
54182916Smarius################################################################################
55182916Smarius################################################################################
56182916Smarius#
57182916Smarius# Recipes for all targets. Only recipes, dependencies are declared later.
58182916Smarius#
59182916Smarius################################################################################
60182916Smarius
61182916Smarius################################################################################
62182916Smarius# Interim/build tools targets, compiling tools used during the build
63182916Smarius
64182916Smariusbuildtools-langtools:
65182916Smarius	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)
66182916Smarius
67182916Smariusinterim-langtools:
68182916Smarius	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
69182916Smarius
70182916Smariusinterim-corba:
71182916Smarius	+($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
72182916Smarius
73203833Smariusinterim-rmic:
74182916Smarius	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
75182916Smarius
76182916Smariusbuildtools-jdk:
77182916Smarius	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk java-tools)
78182916Smarius
79182916SmariusALL_TARGETS += buildtools-langtools interim-langtools interim-corba \
80182916Smarius    interim-rmic buildtools-jdk
81182916Smarius
82182916Smarius################################################################################
83182916Smarius# Special targets for certain modules
84182916Smarius
85182916Smariusimport-hotspot:
86182916Smarius	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk)
87182916Smarius
88182916Smariusunpack-sec:
89182916Smarius	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
90182916Smarius
91182916SmariusALL_TARGETS += import-hotspot unpack-sec
92182916Smarius
93182916Smarius################################################################################
94182916Smarius# Gensrc targets, generating source before java compilation can be done
95182916Smarius$(eval $(call DeclareRecipesForPhase, GENSRC, \
96182916Smarius    TARGET_SUFFIX := gensrc, \
97182916Smarius    FILE_PREFIX := Gensrc, \
98182916Smarius    MAKE_SUBDIR := gensrc, \
99203833Smarius    CHECK_MODULES := $(ALL_MODULES), \
100182916Smarius    MULTIPLE_MAKEFILES := true))
101182916Smarius
102182916SmariusJDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
103182916SmariusLANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
104182916SmariusCORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
105182916Smarius
106182916SmariusALL_TARGETS += $(GENSRC_TARGETS)
107182916Smarius
108182916Smarius################################################################################
109182916Smarius# Generate data targets
110182916Smarius$(eval $(call DeclareRecipesForPhase, GENDATA, \
111182916Smarius    TARGET_SUFFIX := gendata, \
112182916Smarius    FILE_PREFIX := Gendata, \
113182916Smarius    MAKE_SUBDIR := gendata, \
114182916Smarius    CHECK_MODULES := $(ALL_MODULES), \
115182916Smarius    USE_WRAPPER := true))
116182916Smarius
11791617SjakeALL_TARGETS += $(GENDATA_TARGETS)
118182916Smarius
119182916Smarius################################################################################
12091617Sjake# Copy files targets
12191617Sjake$(eval $(call DeclareRecipesForPhase, COPY, \
12291617Sjake    TARGET_SUFFIX := copy, \
123102040Sjake    FILE_PREFIX := Copy, \
124102040Sjake    MAKE_SUBDIR := copy, \
12591617Sjake    CHECK_MODULES := $(ALL_MODULES), \
12691617Sjake    USE_WRAPPER := true))
12791617Sjake
128182916SmariusALL_TARGETS += $(COPY_TARGETS)
129182916Smarius
130182916Smarius################################################################################
131182916Smarius# Targets for compiling all java modules. Nashorn is treated separately.
132182916SmariusJAVA_MODULES := $(call FindJavaModules)
133182916SmariusJAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))
134182916Smarius
135182916Smariusdefine DeclareCompileJavaRecipe
136182916Smarius  $1-java:
137182916Smarius	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CompileJavaModules.gmk \
138182916Smarius	    $1 JAVA_MODULES=$1)
139182916Smariusendef
140182916Smarius
141203833Smarius$(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \
142182916Smarius    $(eval $(call DeclareCompileJavaRecipe,$m)))
143182916Smarius
144182916Smarius# Build nashorn. Needs to be compiled separately from the rest of the modules
145182916Smarius# due to nasgen.
146182916Smariusjdk.scripting.nashorn-java:
147182916Smarius	+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk compile)
148182916Smarius
149182916SmariusALL_TARGETS += $(JAVA_TARGETS)
150182916Smarius
15191617Sjake################################################################################
152182916Smarius# Targets for running rmic.
153182916Smarius$(eval $(call DeclareRecipesForPhase, RMIC, \
154182916Smarius    TARGET_SUFFIX := rmic, \
155182916Smarius    FILE_PREFIX := Rmic, \
156182916Smarius    MAKE_SUBDIR := rmic, \
157182916Smarius    CHECK_MODULES := $(ALL_MODULES)))
158182916Smarius
15991617SjakeALL_TARGETS += $(RMIC_TARGETS)
160182916Smarius
161182916Smarius################################################################################
16291617Sjake# Targets for compiling native libraries
163182916Smarius$(eval $(call DeclareRecipesForPhase, LIBS, \
16491617Sjake    TARGET_SUFFIX := libs, \
165182916Smarius    FILE_PREFIX := Lib, \
16691617Sjake    MAKE_SUBDIR := lib, \
16791617Sjake    CHECK_MODULES := $(ALL_MODULES), \
168100899Sjake    USE_WRAPPER := true))
169182916Smarius
170182916SmariusALL_TARGETS += $(LIBS_TARGETS)
171182916Smarius
17291617Sjake################################################################################
17391617Sjake# Targets for compiling native executables
17491617Sjake$(eval $(call DeclareRecipesForPhase, LAUNCHER, \
17591617Sjake    TARGET_SUFFIX := launchers, \
176182916Smarius    FILE_PREFIX := Launcher, \
17791617Sjake    MAKE_SUBDIR := launcher, \
178182916Smarius    CHECK_MODULES := $(ALL_MODULES), \
17991617Sjake    USE_WRAPPER := true))
180182916Smarius
18191617SjakeALL_TARGETS += $(LAUNCHER_TARGETS)
18289051Sjake
18391617Sjake################################################################################
18489051Sjake# Build hotspot target
18591617Sjake
18691617Sjakeifeq ($(BUILD_HOTSPOT),true)
18791617Sjake  hotspot:
188182730Smarius	($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
18989051Sjakeendif
19091617Sjake
19189051SjakeALL_TARGETS += hotspot
19291617Sjake
19391617Sjake################################################################################
19491617Sjake# Build demos and samples targets
19591617Sjake
19691617Sjakedemos:
197182730Smarius	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
198182730Smarius
19991617Sjakesamples:
200182730Smarius	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk)
201182730Smarius
202182730SmariusALL_TARGETS += demos samples
203182730Smarius
204182730Smarius################################################################################
205182730Smarius# Image targets
206182730Smarius
207182730Smarius# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
208182730Smarius# used to track the exact sources used to build that image.
209182730Smariussource-tips: $(SUPPORT_OUTPUTDIR)/source_tips
210182730Smarius$(SUPPORT_OUTPUTDIR)/source_tips: FRC
211182730Smarius	@$(MKDIR) -p $(@D)
212182730Smarius	@$(RM) $@
213182730Smarius	@$(call GetSourceTips)
214182730Smarius
215182730SmariusBOOTCYCLE_TARGET := product-images
216182730Smariusbootcycle-images:
21789051Sjake	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
218181701Smarius	+$(MAKE) $(MAKE_ARGS) -f Main.gmk SPEC=$(dir $(SPEC))bootcycle-spec.gmk $(BOOTCYCLE_TARGET)
21989051Sjake
22091617Sjakezip-security:
22189051Sjake	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)
22289051Sjake
22389051Sjakezip-source:
22489051Sjake	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk)
22591617Sjake
22689051Sjakestrip-binaries:
22791617Sjake	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk)
22891617Sjake
22991617Sjakejrtfs-jar:
23091617Sjake	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
23191617Sjake
23291617Sjakejimages:
23391617Sjake	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages)
234182730Smarius
23591617Sjakeprofiles:
236182730Smarius	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
23789051Sjake
23889051Sjakemac-bundles:
23989051Sjake	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
240181701Smarius
24189051SjakeALL_TARGETS += source-tips bootcycle-images zip-security zip-source strip-binaries \
24291617Sjake    jrtfs-jar jimages profiles mac-bundles
24389051Sjake
24489051Sjake################################################################################
24589051Sjake# Docs targets
24691783Sjake
24791783Sjakedocs-javadoc:
24891783Sjake	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
24989051Sjake
250181701Smariusdocs-jvmtidoc:
25189051Sjake	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk jvmtidocs)
252182730Smarius
25391783SjakeALL_TARGETS += docs-javadoc docs-jvmtidoc
25489051Sjake
25591783Sjake################################################################################
25691783Sjake# Build tests
25791783Sjake#
25889051Sjake
259102040Sjakeprepare-test-image:
260102040Sjake	$(MKDIR) -p $(TEST_IMAGE_DIR)
26191783Sjake	$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'
26291783Sjake
26389051Sjakebuild-test-hotspot-jtreg-native:
26489051Sjake	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
26591783Sjake	    build-test-hotspot-jtreg-native)
26691783Sjake
267182730Smariustest-image-hotspot-jtreg-native:
26891783Sjake	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
26991783Sjake	    test-image-hotspot-jtreg-native)
27089051Sjake
271181701Smariusbuild-test-jdk-jtreg-native:
272181701Smarius	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
27389051Sjake	    build-test-jdk-jtreg-native)
27491783Sjake
27591617Sjaketest-image-jdk-jtreg-native:
27691617Sjake	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
27791617Sjake	    test-image-jdk-jtreg-native)
27889051Sjake
27989051SjakeALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \
28089051Sjake    test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
28189051Sjake    test-image-jdk-jtreg-native
28289051Sjake
28389051Sjake################################################################################
28489051Sjake# Run tests
28589051Sjake
28689051Sjake# Run tests specified by $(TEST), or the default test set.
28789051Sjaketest:
28891783Sjake	$(call RunTests, $(TEST))
28989051Sjake
29091783Sjaketest-hotspot-jtreg-native:
29189051Sjake	$(call RunTests, "hotspot_native_sanity")
29291783Sjake
29389051Sjaketest-jdk-jtreg-native:
29489051Sjake	$(call RunTests, "jdk_native_sanity")
29589051Sjake
29689051Sjaketest-make:
29789051Sjake	($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))
29889051Sjake
29989051SjakeALL_TARGETS += test test-hotspot-jtreg-native test-jdk-jtreg-native test-make
30089051Sjake
30191617Sjake################################################################################
30289051Sjake# Verification targets
30389051Sjake
30491617Sjakeverify-modules:
305	@$(call TargetEnter)
306	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CheckModules.gmk)
307	@$(call TargetExit)
308
309ALL_TARGETS += verify-modules
310
311################################################################################
312# Install targets
313
314install:
315	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk)
316
317ALL_TARGETS += install
318
319################################################################################
320#
321# Dependency declarations between targets.
322#
323# These are declared in two groups. First all dependencies between targets that
324# have recipes above as these dependencies may be disabled. Then the aggregator
325# targets that do not have recipes of their own, which will never have their
326# dependencies disabled.
327#
328################################################################################
329# Targets with recipes above
330
331# If running an *-only target, parallel execution and dependencies between
332# recipe targets are disabled. This makes it possible to run a select set of
333# recipe targets in order. It's the responsibility of the user to make sure
334# all prerequisites are fulfilled.
335ifneq ($(findstring -only, $(MAKECMDGOALS)), )
336  .NOTPARALLEL:
337else
338  $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
339
340  interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
341
342  buildtools-jdk: interim-langtools
343
344  $(CORBA_GENSRC_TARGETS): interim-langtools
345
346  $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
347
348  interim-corba: $(CORBA_GENSRC_TARGETS)
349
350  $(GENDATA_TARGETS): interim-langtools buildtools-jdk
351
352  interim-rmic: interim-langtools
353
354  $(RMIC_TARGETS): interim-langtools interim-corba interim-rmic
355
356  import-hotspot: hotspot
357
358  $(LIBS_TARGETS): import-hotspot
359
360  $(LAUNCHER_TARGETS): java.base-libs
361
362  # The demos are currently linking to libjvm and libjava, just like all other
363  # jdk libs, even though they don't need to. To avoid warnings, make sure they
364  # aren't built until after libjava and libjvm are available to link to.
365  demos: $(JAVA_TARGETS)
366
367  # Declare dependency from <module>-java to <module>-gensrc
368  $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
369
370  # Declare dependencies between java modules
371  $(foreach m, $(JAVA_MODULES), \
372      $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
373      $(call FindDepsForModule,$m)))))
374
375  # Declare dependencies between <module>-rmic to <module>-java
376  $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))
377
378  # Declare dependencies from <module>-lib to <module>-java
379  # Skip modules that do not have java source.
380  $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
381
382  # Declare dependencies from all other <module>-lib to java.base-lib
383  $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
384      $(eval $t: java.base-libs))
385  # Declare the special case dependency for jdk.deploy.osx where libosx
386  # links against libosxapp.
387  jdk.deploy.osx-libs: java.desktop-libs
388
389  # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
390  # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
391  # virtual target.
392  jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
393
394  # Until the module system is in place, jdk.jdi-gensrc needs to combine service
395  # loader configuration with jdk.hotspot.agent so is dependent on importing
396  # hotspot.
397  jdk.jdi-gensrc-jdk: import-hotspot
398
399  # The swing beans need to have java base properly generated to avoid errors
400  # in javadoc.
401  java.desktop-gensrc-jdk: java.base-gensrc
402
403  # Explicitly add dependencies for special targets
404  java.base-java: unpack-sec
405
406  jdk.dev-gendata: java rmic
407
408  zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
409      $(filter jdk.crypto%, $(JAVA_TARGETS))
410
411  zip-source: gensrc rmic
412
413  strip-binaries: libs launchers gendata copy
414
415  jrtfs-jar: buildtools-jdk
416
417  jimages: exploded-image zip-source strip-binaries source-tips demos samples \
418      jrtfs-jar
419
420  profiles: exploded-image strip-binaries source-tips
421
422  mac-bundles: jimages
423
424  bootcycle-images: jimages
425
426  docs-javadoc: gensrc rmic
427
428  docs-jvmtidoc: hotspot
429
430  test: jimages test-image
431
432  verify-modules: exploded-image
433
434  test-make: clean-test-make
435
436  test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native
437
438  test-image-jdk-jtreg-native: build-test-jdk-jtreg-native
439
440endif
441
442################################################################################
443# Virtual targets without recipes
444
445buildtools: buildtools-langtools interim-langtools interim-corba interim-rmic \
446    buildtools-jdk
447
448gensrc: $(GENSRC_TARGETS)
449
450gendata: $(GENDATA_TARGETS)
451
452copy: $(COPY_TARGETS)
453
454java: $(JAVA_TARGETS)
455
456rmic: $(RMIC_TARGETS)
457
458libs: $(LIBS_TARGETS)
459
460launchers: $(LAUNCHER_TARGETS)
461
462# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
463# is actually handled by jdk.jdi-gensrc
464jdk.jdwp.agent-gensrc: jdk.jdi-gensrc
465
466# Declare dependencies from <module> to all the individual targets specific
467# to that module <module>-*.
468$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
469$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
470$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
471$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
472$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
473$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
474$(foreach m, $(COPY_MODULES), $(eval $m: $m-copy))
475
476ALL_MODULE_TARGETS := $(sort $(GENSRC_MODULES) $(JAVA_MODULES) \
477    $(GENDATA_MODULES) $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES))
478
479# The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
480exploded-image: $(ALL_MODULE_TARGETS)
481
482# The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
483# and in line with this, our targets for creating these are named *-image[s].
484
485# This target builds the product images, e.g. the JRE and JDK image
486# (and possibly other, more specific versions)
487product-images: jimages demos samples zip-security verify-modules
488
489ifeq ($(OPENJDK_TARGET_OS), macosx)
490  product-images: mac-bundles
491endif
492
493# This target builds the documentation image
494docs-image: docs-javadoc docs-jvmtidoc
495
496# This target builds the test image
497test-image: prepare-test-image test-image-hotspot-jtreg-native \
498    test-image-jdk-jtreg-native
499
500# all-images is the top-most target, it builds all our deliverables ("images").
501all-images: product-images test-image docs-image
502
503ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers \
504    jdk.jdwp.agent-gensrc $(ALL_MODULE_TARGETS) exploded-image \
505    product-images docs-image test-image all-images
506
507################################################################################
508
509# Traditional targets typically run by users.
510# These can be considered aliases for the targets now named by a more
511# "modern" naming scheme.
512default: exploded-image
513jdk: exploded-image
514images: product-images
515docs: docs-image
516all: all-images
517
518ALL_TARGETS += default jdk images docs all
519
520################################################################################
521################################################################################
522#
523# Clean targets
524#
525################################################################################
526# Clean targets are automatically run serially by the Makefile calling this
527# file.
528
529CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
530    images make-support test-make
531CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
532CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native
533CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS))
534CLEAN_PHASES := gensrc java native include
535CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
536CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
537# Construct targets of the form clean-$module-$phase
538CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
539    $(addprefix $m-, $(CLEAN_PHASES))))
540
541# Remove everything, except the output from configure.
542clean: $(CLEAN_DIR_TARGETS)
543	($(CD) $(OUTPUT_ROOT) && $(RM) -r source_tips build.log* build-trace*.log*)
544	$(ECHO) Cleaned all build artifacts.
545
546$(CLEAN_DIR_TARGETS):
547	$(call CleanDir,$(patsubst clean-%, %, $@))
548
549$(CLEAN_TEST_TARGETS):
550	$(call CleanTest,$(patsubst clean-test-%, %, $@))
551
552$(CLEAN_PHASE_TARGETS):
553	$(call Clean-$(patsubst clean-%,%, $@))
554
555$(CLEAN_MODULE_TARGETS):
556	$(call CleanModule,$(patsubst clean-%, %, $@))
557
558$(CLEAN_MODULE_PHASE_TARGETS):
559	$(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
560	    $(word 2, $(subst -,$(SPACE),$@)))
561
562# When removing the support dir, we must also remove jdk. Building classes has
563# the side effect of generating native headers. The headers end up in support
564# while classes and touch files end up in jdk.
565clean-support: clean-jdk
566
567clean-docs: clean-docstemp
568
569# Remove everything, including configure configuration.
570# If the output directory was created by configure and now becomes empty, remove it as well.
571dist-clean: clean
572	($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments \
573	    Makefile compare.sh tmp javacservers)
574	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
575	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
576	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
577	  else \
578	    ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
579	        && $(RM) -r $(OUTPUT_ROOT)) \
580	  fi \
581	)
582	$(ECHO) Cleaned everything, you will have to re-run configure.
583
584ALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_TEST_TARGETS) \
585    $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) $(CLEAN_MODULE_PHASE_TARGETS)
586
587################################################################################
588
589# Setup a rule for SPEC file that fails if executed. This check makes sure the
590# configuration is up to date after changes to configure.
591ifeq ($(findstring reconfigure, $(MAKECMDGOALS)), )
592  $(SPEC): $(wildcard $(SRC_ROOT)/common/autoconf/*)
593	@$(ECHO) "ERROR: $(SPEC) is not up to date."
594	@$(ECHO) "Please rerun configure! Easiest way to do this is by running"
595	@$(ECHO) "'make reconfigure'."
596	@$(ECHO) "It may also be ignored by setting IGNORE_OLD_CONFIG=true"
597	@if test "x$(IGNORE_OLD_CONFIG)" != "xtrue"; then exit 1; fi
598endif
599
600# The reconfigure target is automatically run serially from everything else
601# by the Makefile calling this file.
602
603reconfigure:
604        ifneq ($(CONFIGURE_COMMAND_LINE), )
605	  @$(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'"
606        else
607	  @$(ECHO) "Re-running configure using default settings"
608        endif
609	@( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \
610	    $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
611
612ALL_TARGETS += reconfigure
613
614################################################################################
615# Declare *-only targets for each normal target
616$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
617
618ALL_TARGETS += $(addsuffix -only, $(filter-out clean%, $(ALL_TARGETS)))
619
620################################################################################
621
622.PHONY: $(ALL_TARGETS)
623
624include $(SRC_ROOT)/make/Jprt.gmk
625
626FRC: # Force target
627