Main.gmk revision 975:b18872ff5379
14Srgrimes#
24Srgrimes# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
34Srgrimes# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44Srgrimes#
54Srgrimes# This code is free software; you can redistribute it and/or modify it
64Srgrimes# under the terms of the GNU General Public License version 2 only, as
74Srgrimes# published by the Free Software Foundation.  Oracle designates this
84Srgrimes# particular file as subject to the "Classpath" exception as provided
94Srgrimes# by Oracle in the LICENSE file that accompanied this code.
104Srgrimes#
114Srgrimes# This code is distributed in the hope that it will be useful, but WITHOUT
124Srgrimes# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
134Srgrimes# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
144Srgrimes# version 2 for more details (a copy is included in the LICENSE file that
154Srgrimes# accompanied this code).
164Srgrimes#
174Srgrimes# You should have received a copy of the GNU General Public License version
184Srgrimes# 2 along with this work; if not, write to the Free Software Foundation,
194Srgrimes# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
204Srgrimes#
214Srgrimes# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
224Srgrimes# or visit www.oracle.com if you need additional information or have any
234Srgrimes# questions.
244Srgrimes#
254Srgrimes
264Srgrimes### This is the main part of the Makefile, for the normal case with SPEC specifying a single existing spec.gmk file.
274Srgrimes
284Srgrimes# Now load the spec
294Srgrimesinclude $(SPEC)
30123180Speter
314Srgrimes# Load the vital tools for all the makefiles.
324Srgrimesinclude $(SRC_ROOT)/make/common/MakeBase.gmk
33118031Sobrien
34118031Sobrien# Hook to include the corresponding custom file, if present.
35118031Sobrien$(eval $(call IncludeCustomExtension, , Main.gmk))
362056Swollman
372056Swollman### Clean up from previous run
3845720Speter
3911865Sphk# Remove any build.log from a previous run, if they exist
4076166Smarkmifneq (,$(BUILD_LOG))
4133281Sbde  ifneq (,$(BUILD_LOG_PREVIOUS))
4245720Speter    # Rotate old log
4376166Smarkm    $(shell $(RM) $(BUILD_LOG_PREVIOUS) 2> /dev/null)
4476166Smarkm    $(shell $(MV) $(BUILD_LOG) $(BUILD_LOG_PREVIOUS) 2> /dev/null)
4576166Smarkm  else
4611865Sphk    $(shell $(RM) $(BUILD_LOG) 2> /dev/null)
4745720Speter  endif
4845720Speter  $(shell $(RM) $(OUTPUT_ROOT)/build-trace-time.log 2> /dev/null)
494478Sbdeendif
503816Swollman# Remove any javac server logs and port files. This
5130805Sbde# prevents a new make run to reuse the previous servers.
5230805Sbdeifneq (,$(SJAVAC_SERVER_DIR))
53122849Speter  $(shell $(MKDIR) -p $(SJAVAC_SERVER_DIR) && $(RM) -rf $(SJAVAC_SERVER_DIR)/*)
5426309Speterendif
552056Swollman
5630805Sbde# Reset the build timers.
5745720Speter$(eval $(call ResetAllTimers))
582056Swollman
5930805Sbde# Setup number of jobs to use. -jN is unfortunately not available for us to parse from the command line,
60103409Smini# hence this workaround.
613816SwollmanMAKE_ARGS:=$(MAKE_ARGS) -j$(JOBS)
624Srgrimes
63122292Speter### Main targets
644Srgrimes
654Srgrimesdefault: jdk
66143063Sjoerg	@$(call CheckIfMakeAtEnd)
674Srgrimes
685351Sbdeall: images docs
694Srgrimes	@$(call CheckIfMakeAtEnd)
704Srgrimes
7135215Sbde# Setup a rule for SPEC file that fails if executed. This check makes sure the configuration
7235215Sbde# is up to date after changes to configure
7379609Speter$(SPEC): $(wildcard $(SRC_ROOT)/common/autoconf/*)
7479609Speter	@$(ECHO) "ERROR: $(SPEC) is not up to date."
75130228Speter	@$(ECHO) "Please rerun configure! Easiest way to do this is by running"
764Srgrimes	@$(ECHO) "'make reconfigure'."
774Srgrimes	@if test "x$(IGNORE_OLD_CONFIG)" != "xtrue"; then exit 1; fi
784Srgrimes
794Srgrimesstart-make: $(SPEC)
80143434Speter	@$(call AtMakeStart)
814Srgrimes
8293024Sbdelangtools: langtools-only
8393024Sbdelangtools-only: start-make
8493024Sbde	@$(call TargetEnter)
8593024Sbde	@($(CD) $(LANGTOOLS_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildLangtools.gmk)
8693024Sbde	@$(call TargetExit)
8793024Sbde
8893024Sbdecorba: langtools corba-only
8993024Sbdecorba-only: start-make
9093024Sbde	@$(call TargetEnter)
914Srgrimes	@($(CD) $(CORBA_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildCorba.gmk)
92143434Speter	@$(call TargetExit)
934Srgrimes
94114349Speterjaxp: langtools jaxp-only
95114349Speterjaxp-only: start-make
9679609Speter	@$(call TargetEnter)
974Srgrimes	@($(CD) $(JAXP_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJaxp.gmk)
984Srgrimes	@$(call TargetExit)
99114349Speter
10011865Sphkjaxws: langtools jaxp jaxws-only
10111865Sphkjaxws-only: start-make
10211865Sphk	@$(call TargetEnter)
10311865Sphk	@($(CD) $(JAXWS_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJaxws.gmk)
104122292Speter	@$(call TargetExit)
105122292Speter
1064Srgrimesifeq ($(BUILD_HOTSPOT),true)
1074Srgrimes  hotspot: hotspot-only
1084Srgrimes  hotspot-only: start-make
1094Srgrimes	@$(call TargetEnter)
1104Srgrimes	@($(CD) $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
111125177Speter	@$(call TargetExit)
1124Srgrimesendif
11392860Simp
114130226Speterjdk: langtools hotspot corba jaxp jaxws jdk-only
115122295Speterjdk-only: start-make
1164Srgrimes	@$(call TargetEnter)
11792860Simp	@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk $(JDK_TARGET))
118125177Speter	@$(call TargetExit)
1194Srgrimes
120114349Speternashorn: jdk nashorn-only
121122295Speternashorn-only: start-make
1224Srgrimes	@$(call TargetEnter)
123130226Speter	@($(CD) $(NASHORN_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk)
124130226Speter	@$(call TargetExit)
125122295Speter
126122295Speterdemos: jdk demos-only
127130667Speterdemos-only: start-make
128130667Speter	@$(call TargetEnter)
129122295Speter	@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk demos)
130122295Speter	@$(call TargetExit)
1314Srgrimes
1324Srgrimes# Note: This double-colon rule is intentional, to support
1334Srgrimes# custom make file integration.
1344Srgrimesimages:: source-tips demos nashorn images-only
1354Srgrimesimages-only: start-make
1364Srgrimes	@$(call TargetEnter)
137122292Speter	@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk images)
1384Srgrimes	@$(call TargetExit)
13992860Simp
1404Srgrimesoverlay-images: source-tips demos overlay-images-only
14192860Simpoverlay-images-only: start-make
142125177Speter	@$(call TargetEnter)
143125177Speter	@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk overlay-images)
144125177Speter	@$(call TargetExit)
145125177Speter
146125177Speterprofiles: profiles-oscheck source-tips jdk hotspot profiles-only
147125177Speterprofiles-only: start-make
14892860Simp	@$(call TargetEnter)
1494Srgrimes	@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk profiles)
1504Srgrimes	@$(call TargetExit)
151103409Smini
152122292Speterprofiles-oscheck:
153103409Smini        ifneq ($(OPENJDK_TARGET_OS), linux)
154103409Smini	  @echo "Error: The Java SE 8 Compact Profiles are only implemented for Linux at this time" && exit 1
155114349Speter        endif
156103409Smini
157103409Sminiinstall: images install-only
15849081Scracauerinstall-only: start-make
15949081Scracauer	@$(call TargetEnter)
16049081Scracauer	@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk install)
16149081Scracauer	@$(call TargetExit)
16249081Scracauer
16349081Scracauerdocs: jdk docs-only
16449098Scracauerdocs-only: start-make
16549081Scracauer	@$(call TargetEnter)
16649081Scracauer	@($(CD) $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
16749081Scracauer	@$(call TargetExit)
16849081Scracauer
16949098Scracauersign-jars: jdk sign-jars-only
17049081Scracauersign-jars-only: start-make
17149081Scracauer	@$(call TargetEnter)
17249081Scracauer	@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk sign-jars)
17349098Scracauer	@$(call TargetExit)
17449081Scracauer
17549081Scracauerbootcycle-images: images bootcycle-images-only
17649081Scracauerbootcycle-images-only: start-make
17749081Scracauer	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
17849098Scracauer	@($(CD) $(SRC_ROOT) && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(dir $(SPEC))bootcycle-spec.gmk images)
17949081Scracauer
18049098Scracauertest: images test-only
18149081Scracauertest-only: start-make
18249081Scracauer	@$(call TargetEnter)
18349081Scracauer	@($(CD) $(SRC_ROOT)/test && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 -k MAKEFLAGS= JT_HOME=$(JT_HOME) PRODUCT_HOME=$(JDK_IMAGE_DIR) ALT_OUTPUTDIR=$(OUTPUT_ROOT) CONCURRENCY=$(JOBS) $(TEST)) || true
18449081Scracauer	@$(call TargetExit)
18549081Scracauer
18649081Scracauer# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
18749081Scracauer# used to track the exact sources used to build that image.
18849081Scracauersource-tips: $(OUTPUT_ROOT)/source_tips
18949081Scracauer$(OUTPUT_ROOT)/source_tips: FRC
19049081Scracauer	@$(MKDIR) -p $(@D)
19149081Scracauer	@$(RM) $@
19249081Scracauer	@$(call GetSourceTips)
19349081Scracauer
19449081Scracauer
19549081Scracauer# Remove everything, except the output from configure.
19649098Scracauerclean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-overlay-images clean-bootcycle-build clean-docs clean-test
19749098Scracauer	@($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*)
19849081Scracauer	@$(ECHO) Cleaned all build artifacts.
19949081Scracauer
20049098Scracauer# Remove everything, including configure configuration.
20149098Scracauer# If the output directory was created by configure and now becomes empty, remove it as well.
20249098Scracauer# FIXME: tmp should not be here, fix ResetTimers instead. And remove spec.sh!
20349098Scracauerdist-clean: clean
20449098Scracauer	@($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments Makefile compare.sh spec.sh tmp javacservers)
20549098Scracauer	@$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
20649098Scracauer	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
20749098Scracauer	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
20849098Scracauer	  else \
20949098Scracauer	    ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" && $(RM) -r $(OUTPUT_ROOT)) \
21049098Scracauer	  fi \
21149098Scracauer	)
21249098Scracauer	@$(ECHO) Cleaned everything, you will have to re-run configure.
21349098Scracauer
21449098Scracauerclean-langtools:
21549098Scracauer	$(call CleanComponent,langtools)
21649098Scracauerclean-corba:
21749098Scracauer	$(call CleanComponent,corba)
21849098Scracauerclean-jaxp:
21949098Scracauer	$(call CleanComponent,jaxp)
22049098Scracauerclean-jaxws:
22149098Scracauer	$(call CleanComponent,jaxws)
22249098Scracauerclean-hotspot:
22349098Scracauer	$(call CleanComponent,hotspot)
22449098Scracauerclean-jdk:
22549098Scracauer	$(call CleanComponent,jdk)
22649098Scracauerclean-nashorn:
22749098Scracauer	$(call CleanComponent,nashorn)
22849098Scracauerclean-images:
22949098Scracauer	$(call CleanComponent,images)
23049098Scracauerclean-overlay-images:
23149098Scracauer	$(call CleanComponent,overlay-images)
23249098Scracauerclean-bootcycle-build:
23349098Scracauer	$(call CleanComponent,bootcycle-build)
23449098Scracauerclean-docs:
23549098Scracauer	$(call CleanComponent,docs)
23649098Scracauer	$(call CleanComponent,docstemp)
23749098Scracauerclean-test:
23849098Scracauer	$(call CleanComponent,testoutput)
23949098Scracauer	
24049098Scracauerreconfigure:
24149098Scracauer        ifneq ($(CONFIGURE_COMMAND_LINE), )
24249098Scracauer	  @$(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'"
24349098Scracauer        else
24449098Scracauer	  @$(ECHO) "Re-running configure using default settings"
24549098Scracauer        endif
24649098Scracauer	@( cd $(OUTPUT_ROOT) && $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
24749098Scracauer
24849098Scracauer.PHONY: langtools corba jaxp jaxws hotspot jdk nashorn images overlay-images install test docs
24949098Scracauer.PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only nashorn-only images-only overlay-images-only install-only test-only docs-only
25049098Scracauer.PHONY: default all clean dist-clean bootcycle-images start-make
25149098Scracauer.PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-docs clean-test clean-overlay-images clean-bootcycle-build
25249098Scracauer.PHONY: profiles profiles-only profiles-oscheck
25349098Scracauer
25449098Scracauerinclude $(root_dir)/make/Jprt.gmk
25549098Scracauer
25649098ScracauerFRC: # Force target
25749098Scracauer