Main.gmk revision 1804:fdbe1b5e0eb6
1#
2# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# This code is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 2 only, as
7# published by the Free Software Foundation.  Oracle designates this
8# particular file as subject to the "Classpath" exception as provided
9# by Oracle in the LICENSE file that accompanied this code.
10#
11# This code is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14# version 2 for more details (a copy is included in the LICENSE file that
15# accompanied this code).
16#
17# You should have received a copy of the GNU General Public License version
18# 2 along with this work; if not, write to the Free Software Foundation,
19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20#
21# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22# or visit www.oracle.com if you need additional information or have any
23# questions.
24#
25
26################################################################################
27# This is the main makefile containing most actual top level targets. It needs
28# to be called with a SPEC file defined.
29################################################################################
30
31# Declare default target
32default:
33
34ifeq ($(wildcard $(SPEC)),)
35  $(error Main.gmk needs SPEC set to a proper spec.gmk)
36endif
37
38# Now load the spec
39include $(SPEC)
40
41include $(SRC_ROOT)/make/MainSupport.gmk
42
43# Load the vital tools for all the makefiles.
44include $(SRC_ROOT)/make/common/MakeBase.gmk
45include $(SRC_ROOT)/make/common/Modules.gmk
46
47# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
48# valid top level targets. It's used to declare them all as PHONY and to
49# generate the -only targets.
50ALL_TARGETS :=
51
52# Hook to include the corresponding custom file, if present.
53$(eval $(call IncludeCustomExtension, , Main.gmk))
54
55# All modules for the current target platform.
56ALL_MODULES := $(call FindAllModules)
57
58################################################################################
59################################################################################
60#
61# Recipes for all targets. Only recipes, dependencies are declared later.
62#
63################################################################################
64
65################################################################################
66# Interim/build tools targets, compiling tools used during the build
67
68buildtools-langtools:
69	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)
70
71interim-langtools:
72	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
73
74interim-rmic:
75	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
76
77interim-cldrconverter:
78	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk)
79
80buildtools-jdk:
81	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk java-tools)
82
83ALL_TARGETS += buildtools-langtools interim-langtools \
84    interim-rmic interim-cldrconverter buildtools-jdk
85
86################################################################################
87# Special targets for certain modules
88
89import-hotspot:
90	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk)
91
92unpack-sec:
93	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
94
95generate-exported-symbols:
96	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildStatic.gmk)
97
98ALL_TARGETS += import-hotspot unpack-sec generate-exported-symbols
99
100################################################################################
101# Gensrc targets, generating source before java compilation can be done
102$(eval $(call DeclareRecipesForPhase, GENSRC, \
103    TARGET_SUFFIX := gensrc, \
104    FILE_PREFIX := Gensrc, \
105    MAKE_SUBDIR := gensrc, \
106    CHECK_MODULES := $(ALL_MODULES), \
107    MULTIPLE_MAKEFILES := true))
108
109JDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
110LANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
111CORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
112HOTSPOT_GENSRC_TARGETS := $(filter %-gensrc-hotspot, $(GENSRC_TARGETS))
113
114ALL_TARGETS += $(GENSRC_TARGETS)
115
116################################################################################
117# Generate data targets
118$(eval $(call DeclareRecipesForPhase, GENDATA, \
119    TARGET_SUFFIX := gendata, \
120    FILE_PREFIX := Gendata, \
121    MAKE_SUBDIR := gendata, \
122    CHECK_MODULES := $(ALL_MODULES), \
123    USE_WRAPPER := true))
124
125ALL_TARGETS += $(GENDATA_TARGETS)
126
127################################################################################
128# Copy files targets
129$(eval $(call DeclareRecipesForPhase, COPY, \
130    TARGET_SUFFIX := copy, \
131    FILE_PREFIX := Copy, \
132    MAKE_SUBDIR := copy, \
133    CHECK_MODULES := $(ALL_MODULES), \
134    USE_WRAPPER := true, \
135    MULTIPLE_MAKEFILES := true))
136
137ALL_TARGETS += $(COPY_TARGETS)
138
139################################################################################
140# Targets for compiling all java modules. Nashorn is treated separately.
141JAVA_MODULES := $(call FindJavaModules)
142JAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))
143
144define DeclareCompileJavaRecipe
145  $1-java:
146	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CompileJavaModules.gmk \
147	    $1 JAVA_MODULES=$1 MODULE=$1)
148endef
149
150$(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \
151    $(eval $(call DeclareCompileJavaRecipe,$m)))
152
153# Build nashorn. Needs to be compiled separately from the rest of the modules
154# due to nasgen.
155jdk.scripting.nashorn-java:
156	+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk compile)
157
158ALL_TARGETS += $(JAVA_TARGETS)
159
160################################################################################
161# Targets for running rmic.
162$(eval $(call DeclareRecipesForPhase, RMIC, \
163    TARGET_SUFFIX := rmic, \
164    FILE_PREFIX := Rmic, \
165    MAKE_SUBDIR := rmic, \
166    CHECK_MODULES := $(ALL_MODULES)))
167
168ALL_TARGETS += $(RMIC_TARGETS)
169
170################################################################################
171# Targets for compiling native libraries
172$(eval $(call DeclareRecipesForPhase, LIBS, \
173    TARGET_SUFFIX := libs, \
174    FILE_PREFIX := Lib, \
175    MAKE_SUBDIR := lib, \
176    CHECK_MODULES := $(ALL_MODULES), \
177    USE_WRAPPER := true))
178
179ALL_TARGETS += $(LIBS_TARGETS)
180
181################################################################################
182# Targets for compiling native executables
183$(eval $(call DeclareRecipesForPhase, LAUNCHER, \
184    TARGET_SUFFIX := launchers, \
185    FILE_PREFIX := Launcher, \
186    MAKE_SUBDIR := launcher, \
187    CHECK_MODULES := $(ALL_MODULES), \
188    USE_WRAPPER := true))
189
190ALL_TARGETS += $(LAUNCHER_TARGETS)
191
192################################################################################
193# Build hotspot target
194
195ifeq ($(BUILD_HOTSPOT),true)
196  hotspot:
197	($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
198endif
199
200ALL_TARGETS += hotspot
201
202################################################################################
203# Build demos and samples targets
204
205demos-jdk:
206	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
207
208samples-jdk:
209	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk)
210
211ALL_TARGETS += demos-jdk samples-jdk
212
213################################################################################
214# Image targets
215
216# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
217# used to track the exact sources used to build that image.
218source-tips: $(SUPPORT_OUTPUTDIR)/source_tips
219$(SUPPORT_OUTPUTDIR)/source_tips: FRC
220	@$(MKDIR) -p $(@D)
221	@$(RM) $@
222	@$(call GetSourceTips)
223
224BOOTCYCLE_TARGET := product-images
225bootcycle-images:
226	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
227	+$(MAKE) $(MAKE_ARGS) -f $(SRC_ROOT)/make/Main.gmk \
228	    SPEC=$(dir $(SPEC))bootcycle-spec.gmk $(BOOTCYCLE_TARGET)
229
230zip-security:
231	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)
232
233zip-source:
234	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk)
235
236strip-binaries:
237	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk)
238
239jrtfs-jar:
240	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
241
242jimages:
243	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages)
244
245profiles:
246	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
247
248mac-bundles-jdk:
249	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
250
251ALL_TARGETS += source-tips bootcycle-images zip-security zip-source strip-binaries \
252    jrtfs-jar jimages profiles mac-bundles-jdk
253
254################################################################################
255# Docs targets
256
257docs-javadoc:
258	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
259
260docs-jvmtidoc:
261	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk jvmtidocs)
262
263ALL_TARGETS += docs-javadoc docs-jvmtidoc
264
265################################################################################
266# Build tests
267#
268
269prepare-test-image:
270	$(MKDIR) -p $(TEST_IMAGE_DIR)
271	$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'
272
273build-test-hotspot-jtreg-native:
274	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
275	    build-test-hotspot-jtreg-native)
276
277test-image-hotspot-jtreg-native:
278	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
279	    test-image-hotspot-jtreg-native)
280
281build-test-jdk-jtreg-native:
282	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
283	    build-test-jdk-jtreg-native)
284
285test-image-jdk-jtreg-native:
286	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
287	    test-image-jdk-jtreg-native)
288
289build-test-lib:
290	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f BuildTestLib.gmk)
291
292ALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \
293    test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
294    test-image-jdk-jtreg-native build-test-lib
295
296################################################################################
297# Run tests
298
299# Run tests specified by $(TEST), or the default test set.
300test:
301	$(call RunTests, $(TEST))
302
303test-hotspot-jtreg:
304	$(call RunTests, "hotspot_all")
305
306test-hotspot-jtreg-native:
307	$(call RunTests, "hotspot_native_sanity")
308
309test-hotspot-internal:
310	$(call RunTests, "hotspot_internal")
311
312test-jdk-jtreg-native:
313	$(call RunTests, "jdk_native_sanity")
314
315test-make:
316	($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))
317
318ALL_TARGETS += test test-hotspot-jtreg test-hotspot-jtreg-native \
319    test-hotspot-internal test-jdk-jtreg-native test-make
320
321################################################################################
322# Verification targets
323
324verify-modules:
325	@$(call TargetEnter)
326	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CheckModules.gmk)
327	@$(call TargetExit)
328
329ALL_TARGETS += verify-modules
330
331################################################################################
332# Install targets
333
334install:
335	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk)
336
337ALL_TARGETS += install
338
339################################################################################
340#
341# Dependency declarations between targets.
342#
343# These are declared in two groups. First all dependencies between targets that
344# have recipes above as these dependencies may be disabled. Then the aggregator
345# targets that do not have recipes of their own, which will never have their
346# dependencies disabled.
347#
348################################################################################
349# Targets with recipes above
350
351# If running an *-only target, parallel execution and dependencies between
352# recipe targets are disabled. This makes it possible to run a select set of
353# recipe targets in order. It's the responsibility of the user to make sure
354# all prerequisites are fulfilled.
355ifneq ($(findstring -only, $(MAKECMDGOALS)), )
356  .NOTPARALLEL:
357else
358  $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
359
360  interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
361
362  buildtools-jdk: interim-langtools interim-cldrconverter
363
364  $(CORBA_GENSRC_TARGETS): interim-langtools
365
366  $(HOTSPOT_GENSRC_TARGETS): interim-langtools
367
368  $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
369
370  $(GENDATA_TARGETS): interim-langtools buildtools-jdk
371
372  interim-rmic: interim-langtools
373
374  $(RMIC_TARGETS): interim-langtools interim-rmic
375
376  $(JAVA_TARGETS): interim-langtools
377
378  import-hotspot: hotspot
379
380  generate-exported-symbols: java.base-libs jdk.jdwp.agent-libs
381
382  $(LIBS_TARGETS): import-hotspot
383
384  $(LAUNCHER_TARGETS): java.base-libs
385
386  ifeq ($(STATIC_BUILD), true)
387    $(LAUNCHER_TARGETS): generate-exported-symbols
388  endif
389
390  # The demos are currently linking to libjvm and libjava, just like all other
391  # jdk libs, even though they don't need to. To avoid warnings, make sure they
392  # aren't built until after libjava and libjvm are available to link to.
393  demos-jdk: $(JAVA_TARGETS)
394
395  # Declare dependency from <module>-java to <module>-gensrc
396  $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
397
398  # Declare dependencies between java modules
399  $(foreach m, $(JAVA_MODULES), \
400      $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
401      $(call FindDepsForModule,$m)))))
402
403  # Declare dependencies between <module>-rmic to <module>-java
404  $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))
405
406  # Declare dependencies from <module>-lib to <module>-java
407  # Skip modules that do not have java source.
408  $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
409
410  # Declare dependencies from all other <module>-lib to java.base-lib
411  $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
412      $(eval $t: java.base-libs))
413  # Declare the special case dependency for jdk.deploy.osx where libosx
414  # links against libosxapp.
415  jdk.deploy.osx-libs: java.desktop-libs
416
417  # jdk.accessibility depends on java.desktop
418  jdk.accessibility-libs: java.desktop-libs
419
420  # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
421  # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
422  # virtual target.
423  jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
424
425  # The swing beans need to have java base properly generated to avoid errors
426  # in javadoc.
427  java.desktop-gensrc-jdk: java.base-gensrc
428
429  # Explicitly add dependencies for special targets
430  java.base-java: unpack-sec
431
432  # The copy target copies files generated by gensrc
433  java.base-copy-hotspot: java.base-gensrc-hotspot
434
435  jdk.jdeps-gendata: java rmic
436
437  zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
438      $(filter jdk.crypto%, $(JAVA_TARGETS))
439
440  zip-source: gensrc rmic
441
442  strip-binaries: libs launchers gendata copy
443
444  jrtfs-jar: buildtools-jdk
445
446  jimages: exploded-image zip-source strip-binaries source-tips demos samples \
447      jrtfs-jar
448
449  profiles: exploded-image strip-binaries source-tips
450
451  mac-bundles-jdk: jimages
452
453  bootcycle-images: jimages
454
455  docs-javadoc: gensrc rmic
456
457  docs-jvmtidoc: hotspot
458
459  test: jimages test-image
460
461  verify-modules: exploded-image
462
463  test-make: clean-test-make
464
465  build-test-lib: java
466
467  build-test-hotspot-jtreg-native: buildtools-jdk
468
469  build-test-jdk-jtreg-native: buildtools-jdk
470
471  test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native
472
473  test-image-jdk-jtreg-native: build-test-jdk-jtreg-native
474
475  test-hotspot-internal: exploded-image
476
477  test-hotspot-jtreg: jimages test-image
478
479  install: product-images
480
481endif
482
483################################################################################
484# Virtual targets without recipes
485
486buildtools: buildtools-langtools interim-langtools interim-rmic \
487    buildtools-jdk
488
489gensrc: $(GENSRC_TARGETS)
490
491gendata: $(GENDATA_TARGETS)
492
493copy: $(COPY_TARGETS)
494
495java: $(JAVA_TARGETS)
496
497rmic: $(RMIC_TARGETS)
498
499libs: $(LIBS_TARGETS)
500
501launchers: $(LAUNCHER_TARGETS)
502
503# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
504# is actually handled by jdk.jdi-gensrc
505jdk.jdwp.agent-gensrc: jdk.jdi-gensrc
506
507# Declare dependencies from <module> to all the individual targets specific
508# to that module <module>-*.
509$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
510$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
511$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
512$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
513$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
514$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
515$(foreach m, $(COPY_MODULES), $(eval $m: $m-copy))
516
517ALL_MODULE_TARGETS := $(sort $(GENSRC_MODULES) $(JAVA_MODULES) \
518    $(GENDATA_MODULES) $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES))
519
520demos: demos-jdk
521
522samples: samples-jdk
523
524# The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
525exploded-image: $(ALL_MODULE_TARGETS)
526
527mac-bundles: mac-bundles-jdk
528
529# The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
530# and in line with this, our targets for creating these are named *-image[s].
531
532# This target builds the product images, e.g. the JRE and JDK image
533# (and possibly other, more specific versions)
534product-images: jimages demos samples zip-security verify-modules
535
536ifeq ($(OPENJDK_TARGET_OS), macosx)
537  product-images: mac-bundles
538endif
539
540# This target builds the documentation image
541docs-image: docs-javadoc docs-jvmtidoc
542
543# This target builds the test image
544test-image: prepare-test-image test-image-hotspot-jtreg-native \
545    test-image-jdk-jtreg-native
546
547# all-images is the top-most target, it builds all our deliverables ("images").
548all-images: product-images test-image docs-image
549
550ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers \
551    jdk.jdwp.agent-gensrc $(ALL_MODULE_TARGETS) demos samples exploded-image \
552    mac-bundles product-images docs-image test-image all-images
553
554################################################################################
555
556# Traditional targets typically run by users.
557# These can be considered aliases for the targets now named by a more
558# "modern" naming scheme.
559default: exploded-image
560jdk: exploded-image
561images: product-images
562docs: docs-image
563all: all-images
564
565ALL_TARGETS += default jdk images docs all
566
567################################################################################
568################################################################################
569#
570# Clean targets
571#
572################################################################################
573# Clean targets are automatically run serially by the Makefile calling this
574# file.
575
576CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
577    images make-support test-make bundles
578CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
579CLEAN_SUPPORT_DIRS += demos
580CLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS))
581CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib
582CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS))
583CLEAN_PHASES := gensrc java native include docs
584CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
585CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
586# Construct targets of the form clean-$module-$phase
587CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
588    $(addprefix $m-, $(CLEAN_PHASES))))
589
590# Remove everything, except the output from configure.
591clean: $(CLEAN_DIR_TARGETS)
592	($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*)
593	$(ECHO) Cleaned all build artifacts.
594
595$(CLEAN_DIR_TARGETS):
596	$(call CleanDir,$(patsubst clean-%, %, $@))
597
598$(CLEAN_SUPPORT_DIR_TARGETS):
599	$(call CleanSupportDir,$(patsubst clean-%, %, $@))
600
601$(CLEAN_TEST_TARGETS):
602	$(call CleanTest,$(patsubst clean-test-%, %, $@))
603
604$(CLEAN_PHASE_TARGETS):
605	$(call Clean-$(patsubst clean-%,%, $@))
606
607$(CLEAN_MODULE_TARGETS):
608	$(call CleanModule,$(patsubst clean-%, %, $@))
609
610$(CLEAN_MODULE_PHASE_TARGETS):
611	$(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
612	    $(word 2, $(subst -,$(SPACE),$@)))
613
614# When removing the support dir, we must also remove jdk. Building classes has
615# the side effect of generating native headers. The headers end up in support
616# while classes and touch files end up in jdk.
617clean-support: clean-jdk
618
619# Remove everything, including configure configuration. If the output
620# directory was created by configure and now becomes empty, remove it as well.
621dist-clean: clean
622	($(CD) $(OUTPUT_ROOT) && \
623	    $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide)
624	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
625	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
626	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
627	  else \
628	    ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
629	        && $(RM) -r $(OUTPUT_ROOT)) \
630	  fi \
631	)
632	$(ECHO) Cleaned everything, you will have to re-run configure.
633
634ALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_SUPPORT_DIR_TARGETS) \
635    $(CLEAN_TEST_TARGETS) $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) \
636    $(CLEAN_MODULE_PHASE_TARGETS)
637
638################################################################################
639# Declare *-only targets for each normal target
640$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
641
642ALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS)))
643
644################################################################################
645
646# Include JPRT targets
647include $(SRC_ROOT)/make/Jprt.gmk
648
649################################################################################
650
651# The following targets are intentionally not added to ALL_TARGETS since they
652# are internal only, to support Init.gmk.
653
654print-targets:
655	  @$(ECHO) $(sort $(ALL_TARGETS))
656
657print-modules:
658	  @$(ECHO) $(sort $(ALL_MODULES))
659
660create-main-targets-include:
661	  @$(ECHO) $(LOG_INFO) Generating main target list
662	  @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
663	      $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
664
665################################################################################
666
667.PHONY: $(ALL_TARGETS)
668
669FRC: # Force target
670