Main.gmk revision 1315:32470a815f99
1243791Sdim#
2243791Sdim# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
3243791Sdim# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4243791Sdim#
5243791Sdim# This code is free software; you can redistribute it and/or modify it
6243791Sdim# under the terms of the GNU General Public License version 2 only, as
7243791Sdim# published by the Free Software Foundation.  Oracle designates this
8243791Sdim# particular file as subject to the "Classpath" exception as provided
9243791Sdim# by Oracle in the LICENSE file that accompanied this code.
10243791Sdim#
11243791Sdim# This code is distributed in the hope that it will be useful, but WITHOUT
12243791Sdim# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13243791Sdim# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14243791Sdim# version 2 for more details (a copy is included in the LICENSE file that
15243791Sdim# accompanied this code).
16243791Sdim#
17243791Sdim# You should have received a copy of the GNU General Public License version
18243791Sdim# 2 along with this work; if not, write to the Free Software Foundation,
19243791Sdim# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20243791Sdim#
21243791Sdim# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22243791Sdim# or visit www.oracle.com if you need additional information or have any
23243791Sdim# questions.
24243791Sdim#
25243791Sdim
26243791Sdim################################################################################
27243791Sdim# This is the main makefile containing most actual top level targets. It needs
28243791Sdim# to be called with a SPEC file defined.
29243791Sdim
30243791Sdim# Declare default target
31243791Sdimdefault:
32243791Sdim
33243791Sdim# Now load the spec
34243791Sdiminclude $(SPEC)
35243791Sdim
36243791Sdiminclude $(SRC_ROOT)/make/MakeHelpers.gmk
37243791Sdim
38243791Sdim# Load the vital tools for all the makefiles.
39243791Sdiminclude $(SRC_ROOT)/make/common/MakeBase.gmk
40243791Sdiminclude $(SRC_ROOT)/make/common/Modules.gmk
41243791Sdim
42243791Sdim# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
43243791Sdim# valid top level targets. It's used to declare them all as PHONY and to
44243791Sdim# generate the -only targets.
45243791SdimALL_TARGETS :=
46243791Sdim
47243791Sdim# Hook to include the corresponding custom file, if present.
48243791Sdim$(eval $(call IncludeCustomExtension, , Main.gmk))
49243791Sdim
50243791Sdim# All modules for the current target platform.
51243791Sdim# Manually add jdk.hotspot.agent for now.
52243791SdimALL_MODULES := $(call FindAllModules) jdk.hotspot.agent
53243791Sdim
54243791Sdim################################################################################
55243791Sdim################################################################################
56243791Sdim#
57243791Sdim# Recipes for all targets. Only recipes, dependencies are declared later.
58243791Sdim#
59243791Sdim################################################################################
60243791Sdim
61243791Sdim################################################################################
62243791Sdim# Interim/build tools targets, compiling tools used during the build
63243791Sdim
64243791Sdimbuildtools-langtools:
65243791Sdim	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)
66243791Sdim
67243791Sdiminterim-langtools:
68243791Sdim	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
69243791Sdim
70243791Sdiminterim-corba:
71243791Sdim	+($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
72243791Sdim
73243791Sdiminterim-rmic:
74243791Sdim	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
75243791Sdim
76243791Sdimbuildtools-jdk:
77243791Sdim	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk java-tools)
78243791Sdim
79243791SdimALL_TARGETS += buildtools-langtools interim-langtools interim-corba \
80243791Sdim    interim-rmic buildtools-jdk
81243791Sdim
82243791Sdim################################################################################
83243791Sdim# Special targets for certain modules
84252723Sdim
85243791Sdimimport-hotspot:
86252723Sdim	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk)
87252723Sdim
88252723Sdimunpack-sec:
89252723Sdim	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
90243791Sdim
91243791SdimALL_TARGETS += import-hotspot unpack-sec
92243791Sdim
93243791Sdim################################################################################
94243791Sdim# Gensrc targets, generating source before java compilation can be done
95243791Sdim$(eval $(call DeclareRecipesForPhase, GENSRC, \
96243791Sdim    TARGET_SUFFIX := gensrc, \
97243791Sdim    FILE_PREFIX := Gensrc, \
98243791Sdim    MAKE_SUBDIR := gensrc, \
99243791Sdim    CHECK_MODULES := $(ALL_MODULES), \
100243791Sdim    MULTIPLE_MAKEFILES := true))
101243791Sdim
102243791SdimJDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
103243791SdimLANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
104243791SdimCORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
105243791Sdim
106243791SdimALL_TARGETS += $(GENSRC_TARGETS)
107243791Sdim
108243791Sdim################################################################################
109243791Sdim# Generate data targets
110243791Sdim$(eval $(call DeclareRecipesForPhase, GENDATA, \
111243791Sdim    TARGET_SUFFIX := gendata, \
112243791Sdim    FILE_PREFIX := Gendata, \
113243791Sdim    MAKE_SUBDIR := gendata, \
114243791Sdim    CHECK_MODULES := $(ALL_MODULES), \
115243791Sdim    USE_WRAPPER := true))
116243791Sdim
117243791SdimALL_TARGETS += $(GENDATA_TARGETS)
118243791Sdim
119243791Sdim################################################################################
120243791Sdim# Copy files targets
121243791Sdim$(eval $(call DeclareRecipesForPhase, COPY, \
122243791Sdim    TARGET_SUFFIX := copy, \
123243791Sdim    FILE_PREFIX := Copy, \
124243791Sdim    MAKE_SUBDIR := copy, \
125243791Sdim    CHECK_MODULES := $(ALL_MODULES), \
126243791Sdim    USE_WRAPPER := true))
127243791Sdim
128243791SdimALL_TARGETS += $(COPY_TARGETS)
129243791Sdim
130243791Sdim################################################################################
131243791Sdim# Targets for compiling all java modules. Nashorn is treated separately.
132243791SdimJAVA_MODULES := $(call FindJavaModules)
133243791SdimJAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))
134243791Sdim
135243791Sdimdefine DeclareCompileJavaRecipe
136243791Sdim  $1-java:
137243791Sdim	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CompileJavaModules.gmk \
138243791Sdim	    $1 JAVA_MODULES=$1)
139243791Sdimendef
140243791Sdim
141243791Sdim$(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \
142243791Sdim    $(eval $(call DeclareCompileJavaRecipe,$m)))
143243791Sdim
144243791Sdim# Build nashorn. Needs to be compiled separately from the rest of the modules
145243791Sdim# due to nasgen.
146243791Sdimjdk.scripting.nashorn-java:
147243791Sdim	+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk compile)
148243791Sdim
149243791SdimALL_TARGETS += $(JAVA_TARGETS)
150243791Sdim
151243791Sdim################################################################################
152243791Sdim# Targets for running rmic.
153243791Sdim$(eval $(call DeclareRecipesForPhase, RMIC, \
154243791Sdim    TARGET_SUFFIX := rmic, \
155243791Sdim    FILE_PREFIX := Rmic, \
156243791Sdim    MAKE_SUBDIR := rmic, \
157243791Sdim    CHECK_MODULES := $(ALL_MODULES)))
158243791Sdim
159243791SdimALL_TARGETS += $(RMIC_TARGETS)
160243791Sdim
161243791Sdim################################################################################
162243791Sdim# Targets for compiling native libraries
163243791Sdim$(eval $(call DeclareRecipesForPhase, LIBS, \
164243791Sdim    TARGET_SUFFIX := libs, \
165243791Sdim    FILE_PREFIX := Lib, \
166243791Sdim    MAKE_SUBDIR := lib, \
167243791Sdim    CHECK_MODULES := $(ALL_MODULES), \
168243791Sdim    USE_WRAPPER := true))
169243791Sdim
170243791SdimALL_TARGETS += $(LIBS_TARGETS)
171243791Sdim
172243791Sdim################################################################################
173243791Sdim# Targets for compiling native executables
174243791Sdim$(eval $(call DeclareRecipesForPhase, LAUNCHER, \
175243791Sdim    TARGET_SUFFIX := launchers, \
176243791Sdim    FILE_PREFIX := Launcher, \
177243791Sdim    MAKE_SUBDIR := launcher, \
178243791Sdim    CHECK_MODULES := $(ALL_MODULES), \
179243791Sdim    USE_WRAPPER := true))
180243791Sdim
181243791SdimALL_TARGETS += $(LAUNCHER_TARGETS)
182243791Sdim
183243791Sdim################################################################################
184243791Sdim# Build hotspot target
185243791Sdim
186243791Sdimifeq ($(BUILD_HOTSPOT),true)
187243791Sdim  hotspot:
188243791Sdim	($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
189243791Sdimendif
190243791Sdim
191243791SdimALL_TARGETS += hotspot
192243791Sdim
193243791Sdim################################################################################
194243791Sdim# Build demos and samples targets
195243791Sdim
196252723Sdimdemos:
197252723Sdim	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
198252723Sdim
199252723Sdimsamples:
200252723Sdim	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk)
201252723Sdim
202243791SdimALL_TARGETS += demos samples
203243791Sdim
204243791Sdim################################################################################
205243791Sdim# Image targets
206243791Sdim
207243791Sdim# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
208243791Sdim# used to track the exact sources used to build that image.
209243791Sdimsource-tips: $(SUPPORT_OUTPUTDIR)/source_tips
210243791Sdim$(SUPPORT_OUTPUTDIR)/source_tips: FRC
211243791Sdim	@$(MKDIR) -p $(@D)
212243791Sdim	@$(RM) $@
213243791Sdim	@$(call GetSourceTips)
214243791Sdim
215243791SdimBOOTCYCLE_TARGET := images
216243791Sdimbootcycle-images:
217243791Sdim	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
218243791Sdim	+$(MAKE) $(MAKE_ARGS) -f Main.gmk SPEC=$(dir $(SPEC))bootcycle-spec.gmk $(BOOTCYCLE_TARGET)
219243791Sdim
220243791Sdimzip-security:
221243791Sdim	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)
222243791Sdim
223243791Sdimzip-source:
224243791Sdim	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk)
225243791Sdim
226243791Sdimstrip-binaries:
227243791Sdim	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk)
228243791Sdim
229243791Sdimjrtfs-jar:
230243791Sdim	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
231243791Sdim
232243791Sdimjimages:
233243791Sdim	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages)
234243791Sdim
235243791Sdimprofiles:
236243791Sdim	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
237243791Sdim
238243791Sdimmac-bundles:
239243791Sdim	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
240252723Sdim
241243791Sdimprepare-test-image:
242243791Sdim	$(MKDIR) -p $(TEST_IMAGE_DIR)
243252723Sdim	$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'
244243791Sdim
245243791SdimALL_TARGETS += source-tips bootcycle-images zip-security zip-source strip-binaries \
246243791Sdim    jrtfs-jar jimages profiles mac-bundles prepare-test-image
247243791Sdim
248243791Sdim################################################################################
249243791Sdim# Docs targets
250243791Sdim
251243791Sdimdocs-javadoc:
252243791Sdim	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
253243791Sdim
254243791Sdimdocs-jvmtidoc:
255243791Sdim	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk jvmtidocs)
256243791Sdim
257243791SdimALL_TARGETS += docs-javadoc docs-jvmtidoc
258243791Sdim
259243791Sdim################################################################################
260243791Sdim# Test target
261243791Sdim
262243791Sdimtest:
263243791Sdim	($(CD) $(SRC_ROOT)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \
264243791Sdim	    JT_HOME=$(JT_HOME) PRODUCT_HOME=$(JDK_IMAGE_DIR) \
265243791Sdim	    ALT_OUTPUTDIR=$(OUTPUT_ROOT) CONCURRENCY=$(JOBS) $(TEST)) || true
266243791Sdim
267243791Sdimtest-make:
268243791Sdim	($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))
269243791Sdim
270263509SdimALL_TARGETS += test test-make
271263509Sdim
272263509Sdim################################################################################
273263509Sdim# Verification targets
274263509Sdim
275263509Sdimverify-modules:
276263509Sdim	@$(call TargetEnter)
277263509Sdim	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CheckModules.gmk)
278263509Sdim	@$(call TargetExit)
279263509Sdim
280263509SdimALL_TARGETS += verify-modules
281263509Sdim
282263509Sdim################################################################################
283263509Sdim# Install targets
284263509Sdim
285263509Sdiminstall:
286263509Sdim	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk)
287263509Sdim
288263509SdimALL_TARGETS += install
289263509Sdim
290263509Sdim################################################################################
291263509Sdim#
292263509Sdim# Dependency declarations between targets.
293263509Sdim#
294263509Sdim# These are declared in two groups. First all dependencies between targets that
295263509Sdim# have recipes above as these dependencies may be disabled. Then the aggregator
296263509Sdim# targets that do not have recipes of their own, which will never have their
297263509Sdim# dependencies disabled.
298263509Sdim#
299263509Sdim################################################################################
300263509Sdim# Targets with recipes above
301
302# If running an *-only target, parallel execution and dependencies between
303# recipe targets are disabled. This makes it possible to run a select set of
304# recipe targets in order. It's the responsibility of the user to make sure
305# all prerequisites are fulfilled.
306ifneq ($(findstring -only, $(MAKECMDGOALS)), )
307  .NOTPARALLEL:
308else
309  $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
310
311  interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
312
313  buildtools-jdk: interim-langtools
314
315  $(CORBA_GENSRC_TARGETS): interim-langtools
316
317  $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
318
319  interim-corba: $(CORBA_GENSRC_TARGETS)
320
321  $(GENDATA_TARGETS): interim-langtools buildtools-jdk
322
323  interim-rmic: interim-langtools
324
325  $(RMIC_TARGETS): interim-langtools interim-corba interim-rmic
326
327  import-hotspot: hotspot
328
329  $(LIBS_TARGETS): import-hotspot
330
331  $(LAUNCHER_TARGETS): java.base-libs
332
333  # The demos are currently linking to libjvm and libjava, just like all other
334  # jdk libs, even though they don't need to. To avoid warnings, make sure they
335  # aren't built until after libjava and libjvm are available to link to.
336  demos: $(JAVA_TARGETS)
337
338  # Declare dependency from <module>-java to <module>-gensrc
339  $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
340
341  # Declare dependencies between java modules
342  $(foreach m, $(JAVA_MODULES), \
343      $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
344      $(call FindDepsForModule,$m)))))
345
346  # Declare dependencies between <module>-rmic to <module>-java
347  $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))
348
349  # Declare dependencies from <module>-lib to <module>-java
350  # Skip jdk.jdwp.agent as it contains no java code.
351  $(foreach m, $(filter-out jdk.jdwp.agent, $(LIBS_MODULES)), $(eval $m-libs: $m-java))
352
353  # Declare dependencies from all other <module>-lib to java.base-lib
354  $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
355      $(eval $t: java.base-libs))
356  # Declare the special case dependency for jdk.deploy.osx where libosx
357  # links against libosxapp.
358  jdk.deploy.osx-libs: java.desktop-libs
359
360  # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
361  # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
362  # virtual target.
363  jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
364
365  # Until the module system is in place, jdk.jdi-gensrc needs to combine service
366  # loader configuration with jdk.hotspot.agent so is dependent on importing
367  # hotspot.
368  jdk.jdi-gensrc-jdk: import-hotspot
369
370  # The swing beans need to have java base properly generated to avoid errors
371  # in javadoc.
372  java.desktop-gensrc-jdk: java.base-gensrc
373
374  # Explicitly add dependencies for special targets
375  java.base-java: unpack-sec
376
377  jdk.dev-gendata: java rmic
378
379  zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
380      $(filter jdk.crypto%, $(JAVA_TARGETS))
381
382  zip-source: gensrc rmic
383
384  strip-binaries: libs launchers gendata copy
385
386  jrtfs-jar: buildtools-jdk
387
388  jimages: exploded-image zip-source strip-binaries source-tips demos samples \
389      jrtfs-jar
390
391  profiles: exploded-image strip-binaries source-tips
392
393  mac-bundles: jimages
394
395  bootcycle-images: jimages
396
397  docs-javadoc: gensrc rmic
398
399  docs-jvmtidoc: hotspot
400
401  test: jimages
402
403  verify-modules: exploded-image
404
405  test-make: clean-test-make
406
407endif
408
409################################################################################
410# Virtual targets without recipes
411
412buildtools: buildtools-langtools interim-langtools interim-corba interim-rmic \
413    buildtools-jdk
414
415gensrc: $(GENSRC_TARGETS)
416
417gendata: $(GENDATA_TARGETS)
418
419copy: $(COPY_TARGETS)
420
421java: $(JAVA_TARGETS)
422
423rmic: $(RMIC_TARGETS)
424
425libs: $(LIBS_TARGETS)
426
427launchers: $(LAUNCHER_TARGETS)
428
429# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
430# is actually handled by jdk.jdi-gensrc
431jdk.jdwp.agent-gensrc: jdk.jdi-gensrc
432
433# Declare dependencies from <module> to all the individual targets specific
434# to that module <module>-*.
435$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
436$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
437$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
438$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
439$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
440$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
441$(foreach m, $(COPY_MODULES), $(eval $m: $m-copy))
442
443ALL_MODULE_TARGETS := $(sort $(GENSRC_MODULES) $(JAVA_MODULES) \
444    $(GENDATA_MODULES) $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES))
445
446exploded-image: $(ALL_MODULE_TARGETS)
447# The old 'jdk' target most closely matches the new exploded-image. Keep an
448# alias for ease of use.
449jdk: exploded-image
450
451images: test-image jimages demos samples zip-security verify-modules
452
453ifeq ($(OPENJDK_TARGET_OS), macosx)
454  images: mac-bundles
455endif
456
457docs: docs-javadoc docs-jvmtidoc
458
459test-image: prepare-test-image
460
461ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers \
462    jdk.jdwp.agent-gensrc $(ALL_MODULE_TARGETS) exploded-image jdk images \
463    docs test-image
464
465################################################################################
466
467all: images
468default: exploded-image
469
470ALL_TARGETS += default all
471
472################################################################################
473################################################################################
474#
475# Clean targets
476#
477################################################################################
478# Clean targets are automatically run serially by the Makefile calling this
479# file.
480
481CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
482    images make-support test-make
483CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
484CLEAN_PHASES := gensrc java native include
485CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
486CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
487# Construct targets of the form clean-$module-$phase
488CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
489    $(addprefix $m-, $(CLEAN_PHASES))))
490
491# Remove everything, except the output from configure.
492clean: $(CLEAN_DIR_TARGETS)
493	($(CD) $(OUTPUT_ROOT) && $(RM) -r source_tips build.log* build-trace*.log*)
494	$(ECHO) Cleaned all build artifacts.
495
496$(CLEAN_DIR_TARGETS):
497	$(call CleanDir,$(patsubst clean-%, %, $@))
498
499$(CLEAN_PHASE_TARGETS):
500	$(call Clean-$(patsubst clean-%,%, $@))
501
502$(CLEAN_MODULE_TARGETS):
503	$(call CleanModule,$(patsubst clean-%, %, $@))
504
505$(CLEAN_MODULE_PHASE_TARGETS):
506	$(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
507	    $(word 2, $(subst -,$(SPACE),$@)))
508
509# When removing the support dir, we must also remove jdk. Building classes has
510# the side effect of generating native headers. The headers end up in support
511# while classes and touch files end up in jdk.
512clean-support: clean-jdk
513
514clean-docs: clean-docstemp
515
516# Remove everything, including configure configuration.
517# If the output directory was created by configure and now becomes empty, remove it as well.
518dist-clean: clean
519	($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments \
520	    Makefile compare.sh tmp javacservers)
521	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
522	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
523	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
524	  else \
525	    ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
526	        && $(RM) -r $(OUTPUT_ROOT)) \
527	  fi \
528	)
529	$(ECHO) Cleaned everything, you will have to re-run configure.
530
531ALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_PHASE_TARGETS) \
532    $(CLEAN_MODULE_TARGETS) $(CLEAN_MODULE_PHASE_TARGETS)
533
534################################################################################
535
536# Setup a rule for SPEC file that fails if executed. This check makes sure the
537# configuration is up to date after changes to configure.
538ifeq ($(findstring reconfigure, $(MAKECMDGOALS)), )
539  $(SPEC): $(wildcard $(SRC_ROOT)/common/autoconf/*)
540	@$(ECHO) "ERROR: $(SPEC) is not up to date."
541	@$(ECHO) "Please rerun configure! Easiest way to do this is by running"
542	@$(ECHO) "'make reconfigure'."
543	@$(ECHO) "It may also be ignored by setting IGNORE_OLD_CONFIG=true"
544	@if test "x$(IGNORE_OLD_CONFIG)" != "xtrue"; then exit 1; fi
545endif
546
547# The reconfigure target is automatically run serially from everything else
548# by the Makefile calling this file.
549
550reconfigure:
551        ifneq ($(CONFIGURE_COMMAND_LINE), )
552	  @$(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'"
553        else
554	  @$(ECHO) "Re-running configure using default settings"
555        endif
556	@( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \
557	    $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
558
559ALL_TARGETS += reconfigure
560
561################################################################################
562# Declare *-only targets for each normal target
563$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
564
565ALL_TARGETS += $(addsuffix -only, $(filter-out clean%, $(ALL_TARGETS)))
566
567################################################################################
568
569.PHONY: $(ALL_TARGETS)
570
571include $(SRC_ROOT)/make/Jprt.gmk
572
573FRC: # Force target
574