Main.gmk revision 1735:58e1d618b84c
12061Sjkh#
250479Speter# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
32061Sjkh# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
438666Sjb#
532427Sjb# This code is free software; you can redistribute it and/or modify it
6111131Sru# under the terms of the GNU General Public License version 2 only, as
7111131Sru# published by the Free Software Foundation.  Oracle designates this
8217733Sbz# particular file as subject to the "Classpath" exception as provided
9217733Sbz# by Oracle in the LICENSE file that accompanied this code.
1038666Sjb#
1138666Sjb# This code is distributed in the hope that it will be useful, but WITHOUT
1238666Sjb# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13159363Strhodes# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1464049Salex# version 2 for more details (a copy is included in the LICENSE file that
1564049Salex# accompanied this code).
16116679Ssimokawa#
1766071Smarkm# You should have received a copy of the GNU General Public License version
18116679Ssimokawa# 2 along with this work; if not, write to the Free Software Foundation,
1973504Sobrien# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20204661Simp#
21158962Snetchild# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22223148Sru# or visit www.oracle.com if you need additional information or have any
23169597Sdes# questions.
24169597Sdes#
25169597Sdes
26169597Sdes################################################################################
27231941Spluknet# This is the main makefile containing most actual top level targets. It needs
28169597Sdes# to be called with a SPEC file defined.
29169597Sdes################################################################################
30169597Sdes
31217815Sbz# Declare default target
32217815Sbzdefault:
33218524Sjhb
3432427Sjbifeq ($(wildcard $(SPEC)),)
3538666Sjb  $(error Main.gmk needs SPEC set to a proper spec.gmk)
36108451Sschweikhendif
3738666Sjb
3838666Sjb# Now load the spec
3938666Sjbinclude $(SPEC)
4038666Sjb
4117308Speterinclude $(SRC_ROOT)/make/MainSupport.gmk
42217273Simp
43217294Simp# Load the vital tools for all the makefiles.
4419175Sbdeinclude $(SRC_ROOT)/make/common/MakeBase.gmk
4596205Sjwdinclude $(SRC_ROOT)/make/common/Modules.gmk
46217297Simp
47217297Simp# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
4838042Sbde# valid top level targets. It's used to declare them all as PHONY and to
4996205Sjwd# generate the -only targets.
5096205SjwdALL_TARGETS :=
5138042Sbde
5296205Sjwd# Hook to include the corresponding custom file, if present.
53159363Strhodes$(eval $(call IncludeCustomExtension, , Main.gmk))
54159363Strhodes
5517308Speter# All modules for the current target platform.
5696205Sjwd# Manually add jdk.hotspot.agent for now.
5796205SjwdALL_MODULES := $(call FindAllModules) jdk.hotspot.agent
5817308Speter
59148330Snetchild################################################################################
60148330Snetchild################################################################################
61148330Snetchild#
62148330Snetchild# Recipes for all targets. Only recipes, dependencies are declared later.
63159831Sobrien#
64148330Snetchild################################################################################
65148330Snetchild
66148330Snetchild################################################################################
67148330Snetchild# Interim/build tools targets, compiling tools used during the build
68220512Sdougb
69148330Snetchildbuildtools-langtools:
70148330Snetchild	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)
7196205Sjwd
7296205Sjwdinterim-langtools:
7396205Sjwd	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
74162147Sru
75162147Sruinterim-rmic:
7698723Sdillon	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
7798723Sdillon
7898723Sdilloninterim-cldrconverter:
7938666Sjb	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk)
8038666Sjb
8117308Speterbuildtools-jdk:
82123311Speter	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk java-tools)
83123311Speter
84123311SpeterALL_TARGETS += buildtools-langtools interim-langtools \
85123311Speter    interim-rmic interim-cldrconverter buildtools-jdk
86175833Sjhb
87175833Sjhb################################################################################
88169597Sdes# Special targets for certain modules
89169597Sdes
90169597Sdesimport-hotspot:
91169597Sdes	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk)
92219177Snwhitehorn
93219177Snwhitehornunpack-sec:
94158962Snetchild	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
95219177Snwhitehorn
96219177Snwhitehorngenerate-exported-symbols:
97158962Snetchild	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildStatic.gmk)
98156840Sru
99123311SpeterALL_TARGETS += import-hotspot unpack-sec generate-exported-symbols
100137288Speter
101209128Sraj################################################################################
102209128Sraj# Gensrc targets, generating source before java compilation can be done
103156740Sru$(eval $(call DeclareRecipesForPhase, GENSRC, \
1042061Sjkh    TARGET_SUFFIX := gensrc, \
10597769Sru    FILE_PREFIX := Gensrc, \
10697252Sru    MAKE_SUBDIR := gensrc, \
107119579Sru    CHECK_MODULES := $(ALL_MODULES), \
10897252Sru    MULTIPLE_MAKEFILES := true))
10995730Sru
11095793SruJDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
111111617SruLANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
11295730SruCORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
113116679Ssimokawa
11495730SruALL_TARGETS += $(GENSRC_TARGETS)
115116679Ssimokawa
11695730Sru################################################################################
117110035Sru# Generate data targets
118107516Sru$(eval $(call DeclareRecipesForPhase, GENDATA, \
119138921Sru    TARGET_SUFFIX := gendata, \
120156145Syar    FILE_PREFIX := Gendata, \
121138921Sru    MAKE_SUBDIR := gendata, \
122133942Sru    CHECK_MODULES := $(ALL_MODULES), \
123133942Sru    USE_WRAPPER := true))
124156145Syar
125133942SruALL_TARGETS += $(GENDATA_TARGETS)
126110035Sru
127117234Sru################################################################################
128110035Sru# Copy files targets
129117229Sru$(eval $(call DeclareRecipesForPhase, COPY, \
130218206Simp    TARGET_SUFFIX := copy, \
13154324Smarcel    FILE_PREFIX := Copy, \
132218130Simp    MAKE_SUBDIR := copy, \
133218130Simp    CHECK_MODULES := $(ALL_MODULES), \
134221869Sattilio    USE_WRAPPER := true))
135218130Simp
136218130SimpALL_TARGETS += $(COPY_TARGETS)
137218130Simp
138218130Simp################################################################################
139218130Simp# Targets for compiling all java modules. Nashorn is treated separately.
140218130SimpJAVA_MODULES := $(call FindJavaModules)
141218130SimpJAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))
142218130Simp
143218130Simpdefine DeclareCompileJavaRecipe
144218130Simp  $1-java:
145218130Simp	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CompileJavaModules.gmk \
146218130Simp	    $1 JAVA_MODULES=$1 MODULE=$1)
147218130Simpendef
148218130Simp
149218130Simp$(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \
150218130Simp    $(eval $(call DeclareCompileJavaRecipe,$m)))
151218130Simp
152218130Simp# Build nashorn. Needs to be compiled separately from the rest of the modules
153218130Simp# due to nasgen.
154218130Simpjdk.scripting.nashorn-java:
155218130Simp	+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk compile)
156218130Simp
157218130SimpALL_TARGETS += $(JAVA_TARGETS)
158218130Simp
159218130Simp################################################################################
160218130Simp# Targets for running rmic.
161218130Simp$(eval $(call DeclareRecipesForPhase, RMIC, \
162218130Simp    TARGET_SUFFIX := rmic, \
163218130Simp    FILE_PREFIX := Rmic, \
16417308Speter    MAKE_SUBDIR := rmic, \
165119519Smarcel    CHECK_MODULES := $(ALL_MODULES)))
166119519Smarcel
167119519SmarcelALL_TARGETS += $(RMIC_TARGETS)
168119519Smarcel
169119519Smarcel################################################################################
170119519Smarcel# Targets for compiling native libraries
171119579Sru$(eval $(call DeclareRecipesForPhase, LIBS, \
172119519Smarcel    TARGET_SUFFIX := libs, \
173119519Smarcel    FILE_PREFIX := Lib, \
174119519Smarcel    MAKE_SUBDIR := lib, \
175119519Smarcel    CHECK_MODULES := $(ALL_MODULES), \
176119519Smarcel    USE_WRAPPER := true))
177126031Sgad
178126024SgadALL_TARGETS += $(LIBS_TARGETS)
179126024Sgad
180126024Sgad################################################################################
181126024Sgad# Targets for compiling native executables
182126024Sgad$(eval $(call DeclareRecipesForPhase, LAUNCHER, \
183126024Sgad    TARGET_SUFFIX := launchers, \
184126024Sgad    FILE_PREFIX := Launcher, \
185227879Sgjb    MAKE_SUBDIR := launcher, \
186126024Sgad    CHECK_MODULES := $(ALL_MODULES), \
187126024Sgad    USE_WRAPPER := true))
188227879Sgjb
189227879SgjbALL_TARGETS += $(LAUNCHER_TARGETS)
190227879Sgjb
191126024Sgad################################################################################
192126024Sgad# Build hotspot target
193126031Sgad
194126024Sgadifeq ($(BUILD_HOTSPOT),true)
195126024Sgad  hotspot:
196126024Sgad	($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
197172744Sdelphijendif
198126024Sgad
199126024SgadALL_TARGETS += hotspot
200126024Sgad
201133376Sharti################################################################################
202126024Sgad# Build demos and samples targets
203126024Sgad
204172744Sdelphijdemos-jdk:
205126024Sgad	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
206126024Sgad
207125885Sgadsamples-jdk:
208125885Sgad	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk)
20938666Sjb
21017308SpeterALL_TARGETS += demos-jdk samples-jdk
211119519Smarcel
212119579Sru################################################################################
213218206Simp# Image targets
2142302Spaul
21539206Sjkh# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
21639206Sjkh# used to track the exact sources used to build that image.
21739206Sjkhsource-tips: $(SUPPORT_OUTPUTDIR)/source_tips
218133945Sru$(SUPPORT_OUTPUTDIR)/source_tips: FRC
219220556Sbz	@$(MKDIR) -p $(@D)
220177609Sru	@$(RM) $@
221177609Sru	@$(call GetSourceTips)
222177609Sru
223133945SruBOOTCYCLE_TARGET := product-images
224132358Smarkmbootcycle-images:
22517308Speter	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
22654324Smarcel	+$(MAKE) $(MAKE_ARGS) -f $(SRC_ROOT)/make/Main.gmk \
22754324Smarcel	    SPEC=$(dir $(SPEC))bootcycle-spec.gmk $(BOOTCYCLE_TARGET)
228132234Smarcel
229132234Smarcelzip-security:
230132234Smarcel	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)
231132234Smarcel
23254324Smarcelzip-source:
23354324Smarcel	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk)
23454324Smarcel
235118531Srustrip-binaries:
23654324Smarcel	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk)
23754324Smarcel
23854324Smarceljrtfs-jar:
23954324Smarcel	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
24054324Smarcel
24154324Smarceljimages:
242133376Sharti	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages)
24354324Smarcel
244133376Shartiprofiles:
245133376Sharti	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
24654324Smarcel
24754324Smarcelmac-bundles-jdk:
24854324Smarcel	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
24954324Smarcel
25054324SmarcelALL_TARGETS += source-tips bootcycle-images zip-security zip-source strip-binaries \
251133376Sharti    jrtfs-jar jimages profiles mac-bundles-jdk
25254324Smarcel
25354324Smarcel################################################################################
25454324Smarcel# Docs targets
255118531Sru
256118531Srudocs-javadoc:
25754324Smarcel	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
258132234Smarcel
259132234Smarceldocs-jvmtidoc:
260132234Smarcel	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk jvmtidocs)
261132234Smarcel
262132234SmarcelALL_TARGETS += docs-javadoc docs-jvmtidoc
263132588Skensmith
264132358Smarkm################################################################################
265132234Smarcel# Build tests
266132358Smarkm#
267132234Smarcel
268132234Smarcelprepare-test-image:
269132234Smarcel	$(MKDIR) -p $(TEST_IMAGE_DIR)
27054324Smarcel	$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'
27154324Smarcel
27295730Srubuild-test-hotspot-jtreg-native:
27395730Sru	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
27495730Sru	    build-test-hotspot-jtreg-native)
27595730Sru
27695730Srutest-image-hotspot-jtreg-native:
27795730Sru	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
27895730Sru	    test-image-hotspot-jtreg-native)
27938666Sjb
280107374Srubuild-test-jdk-jtreg-native:
28117308Speter	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
28255678Smarcel	    build-test-jdk-jtreg-native)
283143032Sharti
284138515Shartitest-image-jdk-jtreg-native:
285117793Sru	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
286110035Sru	    test-image-jdk-jtreg-native)
287174564Simp
288110035Srubuild-test-lib:
2892061Sjkh	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f BuildTestLib.gmk)
29017308Speter
291107516SruALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \
292174539Simp    test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
293174539Simp    test-image-jdk-jtreg-native build-test-lib
29455678Smarcel
295107516Sru################################################################################
296107516Sru# Run tests
297107516Sru
298174564Simp# Run tests specified by $(TEST), or the default test set.
299107516Srutest:
300139112Sru	$(call RunTests, $(TEST))
301164470Sjb
302107516Srutest-hotspot-jtreg-native:
303122204Skris	$(call RunTests, "hotspot_native_sanity")
30455678Smarcel
30555678Smarceltest-jdk-jtreg-native:
306116696Sru	$(call RunTests, "jdk_native_sanity")
30755678Smarcel
308133376Shartitest-make:
309107516Sru	($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))
310107516Sru
311107516SruALL_TARGETS += test test-hotspot-jtreg-native test-jdk-jtreg-native test-make
312107516Sru
31355678Smarcel################################################################################
314185499Salfred# Verification targets
315218524Sjhb
316185499Salfredverify-modules:
317218524Sjhb	@$(call TargetEnter)
318218524Sjhb	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CheckModules.gmk)
319218524Sjhb	@$(call TargetExit)
32055678Smarcel
321111131SruALL_TARGETS += verify-modules
322111131Sru
323111131Sru################################################################################
324133945Sru# Install targets
325111131Sru
326111131Sruinstall:
327217125Simp	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk)
328221869Sattilio
329216520SnwhitehornALL_TARGETS += install
330221216Sjhb
331216520Snwhitehorn################################################################################
332216520Snwhitehorn#
333216520Snwhitehorn# Dependency declarations between targets.
334216520Snwhitehorn#
335216520Snwhitehorn# These are declared in two groups. First all dependencies between targets that
336168280Smarcel# have recipes above as these dependencies may be disabled. Then the aggregator
337218524Sjhb# targets that do not have recipes of their own, which will never have their
338218524Sjhb# dependencies disabled.
339218524Sjhb#
340218524Sjhb################################################################################
341218524Sjhb# Targets with recipes above
342219137Sjhb
343218524Sjhb# If running an *-only target, parallel execution and dependencies between
344217125Simp# recipe targets are disabled. This makes it possible to run a select set of
345217815Sbz# recipe targets in order. It's the responsibility of the user to make sure
346217125Simp# all prerequisites are fulfilled.
347217125Simpifneq ($(findstring -only, $(MAKECMDGOALS)), )
348217125Simp  .NOTPARALLEL:
349217125Simpelse
350217125Simp  $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
351217125Simp
352185499Salfred  interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
353217735Sbz
354185499Salfred  buildtools-jdk: interim-langtools interim-cldrconverter
355185499Salfred
356185499Salfred  $(CORBA_GENSRC_TARGETS): interim-langtools
357185499Salfred
358185499Salfred  $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
359133945Sru
360133945Sru  $(GENDATA_TARGETS): interim-langtools buildtools-jdk
361103985Sphk
362103985Sphk  interim-rmic: interim-langtools
363103985Sphk
364185499Salfred  $(RMIC_TARGETS): interim-langtools interim-rmic
365217754Sbz
366185499Salfred  $(JAVA_TARGETS): interim-langtools
367168280Smarcel
368162147Sru  import-hotspot: hotspot
369162147Sru
370216520Snwhitehorn  generate-exported-symbols: java.base-libs jdk.jdwp.agent-libs
371216520Snwhitehorn
372216520Snwhitehorn  $(LIBS_TARGETS): import-hotspot
373179232Sjb
374216520Snwhitehorn  $(LAUNCHER_TARGETS): java.base-libs
375216520Snwhitehorn
376216520Snwhitehorn  ifeq ($(STATIC_BUILD), true)
377218524Sjhb    $(LAUNCHER_TARGETS): generate-exported-symbols
378185250Sdes  endif
379218524Sjhb
380162147Sru  # The demos are currently linking to libjvm and libjava, just like all other
381216520Snwhitehorn  # jdk libs, even though they don't need to. To avoid warnings, make sure they
382218524Sjhb  # aren't built until after libjava and libjvm are available to link to.
383218524Sjhb  demos-jdk: $(JAVA_TARGETS)
384218524Sjhb
385216520Snwhitehorn  # Declare dependency from <module>-java to <module>-gensrc
386218524Sjhb  $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
387216520Snwhitehorn
388179232Sjb  # Declare dependencies between java modules
389205290Sdougb  $(foreach m, $(JAVA_MODULES), \
390219137Sjhb      $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
391219137Sjhb      $(call FindDepsForModule,$m)))))
392185250Sdes
393185499Salfred  # Declare dependencies between <module>-rmic to <module>-java
394185499Salfred  $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))
395103985Sphk
396201815Sbz  # Declare dependencies from <module>-lib to <module>-java
397201815Sbz  # Skip modules that do not have java source.
398205290Sdougb  $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
399201815Sbz
400201815Sbz  # Declare dependencies from all other <module>-lib to java.base-lib
401201815Sbz  $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
402202095Sbz      $(eval $t: java.base-libs))
403202095Sbz  # Declare the special case dependency for jdk.deploy.osx where libosx
404202095Sbz  # links against libosxapp.
405219137Sjhb  jdk.deploy.osx-libs: java.desktop-libs
406201815Sbz
407201815Sbz  # jdk.accessibility depends on java.desktop
408201815Sbz  jdk.accessibility-libs: java.desktop-libs
409148154Sru
410219137Sjhb  # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
411219137Sjhb  # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
412216934Simp  # virtual target.
413216934Simp  jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
414216934Simp
415216934Simp  # Until the module system is in place, jdk.jdi-gensrc needs to combine service
416216520Snwhitehorn  # loader configuration with jdk.hotspot.agent so is dependent on importing
417216520Snwhitehorn  # hotspot.
418185250Sdes  jdk.jdi-gensrc-jdk: import-hotspot
419185250Sdes
420201815Sbz  # The swing beans need to have java base properly generated to avoid errors
421216520Snwhitehorn  # in javadoc.
422148154Sru  java.desktop-gensrc-jdk: java.base-gensrc
423201815Sbz
424201815Sbz  # Explicitly add dependencies for special targets
425201815Sbz  java.base-java: unpack-sec
426148154Sru
427133945Sru  jdk.jdeps-gendata: java rmic
428133945Sru
429103985Sphk  zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
430118531Sru      $(filter jdk.crypto%, $(JAVA_TARGETS))
431118531Sru
432103985Sphk  zip-source: gensrc rmic
433185499Salfred
434185499Salfred  strip-binaries: libs launchers gendata copy
435185499Salfred
436185499Salfred  jrtfs-jar: buildtools-jdk
437185499Salfred
438185499Salfred  jimages: exploded-image zip-source strip-binaries source-tips demos samples \
439133945Sru      jrtfs-jar
440185499Salfred
441  profiles: exploded-image strip-binaries source-tips
442
443  mac-bundles-jdk: jimages
444
445  bootcycle-images: jimages
446
447  docs-javadoc: gensrc rmic
448
449  docs-jvmtidoc: hotspot
450
451  test: jimages test-image
452
453  verify-modules: exploded-image
454
455  test-make: clean-test-make
456
457  build-test-hotspot-jtreg-native: buildtools-jdk
458
459  build-test-jdk-jtreg-native: buildtools-jdk
460
461  test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native
462
463  test-image-jdk-jtreg-native: build-test-jdk-jtreg-native
464
465endif
466
467################################################################################
468# Virtual targets without recipes
469
470buildtools: buildtools-langtools interim-langtools interim-rmic \
471    buildtools-jdk
472
473gensrc: $(GENSRC_TARGETS)
474
475gendata: $(GENDATA_TARGETS)
476
477copy: $(COPY_TARGETS)
478
479java: $(JAVA_TARGETS)
480
481rmic: $(RMIC_TARGETS)
482
483libs: $(LIBS_TARGETS)
484
485launchers: $(LAUNCHER_TARGETS)
486
487# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
488# is actually handled by jdk.jdi-gensrc
489jdk.jdwp.agent-gensrc: jdk.jdi-gensrc
490
491# Declare dependencies from <module> to all the individual targets specific
492# to that module <module>-*.
493$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
494$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
495$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
496$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
497$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
498$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
499$(foreach m, $(COPY_MODULES), $(eval $m: $m-copy))
500
501ALL_MODULE_TARGETS := $(sort $(GENSRC_MODULES) $(JAVA_MODULES) \
502    $(GENDATA_MODULES) $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES))
503
504demos: demos-jdk
505
506samples: samples-jdk
507
508# The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
509exploded-image: $(ALL_MODULE_TARGETS)
510
511mac-bundles: mac-bundles-jdk
512
513# The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
514# and in line with this, our targets for creating these are named *-image[s].
515
516# This target builds the product images, e.g. the JRE and JDK image
517# (and possibly other, more specific versions)
518product-images: jimages demos samples zip-security verify-modules
519
520ifeq ($(OPENJDK_TARGET_OS), macosx)
521  product-images: mac-bundles
522endif
523
524# This target builds the documentation image
525docs-image: docs-javadoc docs-jvmtidoc
526
527# This target builds the test image
528test-image: prepare-test-image test-image-hotspot-jtreg-native \
529    test-image-jdk-jtreg-native
530
531# all-images is the top-most target, it builds all our deliverables ("images").
532all-images: product-images test-image docs-image
533
534ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers \
535    jdk.jdwp.agent-gensrc $(ALL_MODULE_TARGETS) demos samples exploded-image \
536    mac-bundles product-images docs-image test-image all-images
537
538################################################################################
539
540# Traditional targets typically run by users.
541# These can be considered aliases for the targets now named by a more
542# "modern" naming scheme.
543default: exploded-image
544jdk: exploded-image
545images: product-images
546docs: docs-image
547all: all-images
548
549ALL_TARGETS += default jdk images docs all
550
551################################################################################
552################################################################################
553#
554# Clean targets
555#
556################################################################################
557# Clean targets are automatically run serially by the Makefile calling this
558# file.
559
560CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
561    images make-support test-make bundles
562CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
563CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib
564CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS))
565CLEAN_PHASES := gensrc java native include docs
566CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
567CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
568# Construct targets of the form clean-$module-$phase
569CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
570    $(addprefix $m-, $(CLEAN_PHASES))))
571
572# Remove everything, except the output from configure.
573clean: $(CLEAN_DIR_TARGETS)
574	($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*)
575	$(ECHO) Cleaned all build artifacts.
576
577$(CLEAN_DIR_TARGETS):
578	$(call CleanDir,$(patsubst clean-%, %, $@))
579
580$(CLEAN_TEST_TARGETS):
581	$(call CleanTest,$(patsubst clean-test-%, %, $@))
582
583$(CLEAN_PHASE_TARGETS):
584	$(call Clean-$(patsubst clean-%,%, $@))
585
586$(CLEAN_MODULE_TARGETS):
587	$(call CleanModule,$(patsubst clean-%, %, $@))
588
589$(CLEAN_MODULE_PHASE_TARGETS):
590	$(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
591	    $(word 2, $(subst -,$(SPACE),$@)))
592
593# When removing the support dir, we must also remove jdk. Building classes has
594# the side effect of generating native headers. The headers end up in support
595# while classes and touch files end up in jdk.
596clean-support: clean-jdk
597
598# Remove everything, including configure configuration. If the output
599# directory was created by configure and now becomes empty, remove it as well.
600dist-clean: clean
601	($(CD) $(OUTPUT_ROOT) && \
602	    $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide)
603	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
604	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
605	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
606	  else \
607	    ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
608	        && $(RM) -r $(OUTPUT_ROOT)) \
609	  fi \
610	)
611	$(ECHO) Cleaned everything, you will have to re-run configure.
612
613ALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_TEST_TARGETS) \
614    $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) $(CLEAN_MODULE_PHASE_TARGETS)
615
616################################################################################
617# Declare *-only targets for each normal target
618$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
619
620ALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS)))
621
622################################################################################
623
624# Include JPRT targets
625include $(SRC_ROOT)/make/Jprt.gmk
626
627################################################################################
628
629# The following targets are intentionally not added to ALL_TARGETS since they
630# are internal only, to support Init.gmk.
631
632print-targets:
633	  @$(ECHO) $(sort $(ALL_TARGETS))
634
635print-modules:
636	  @$(ECHO) $(sort $(ALL_MODULES))
637
638create-main-targets-include:
639	  @$(ECHO) $(LOG_INFO) Generating main target list
640	  @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
641	      $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
642
643################################################################################
644
645.PHONY: $(ALL_TARGETS)
646
647FRC: # Force target
648