make/Main.gmk

changeset 912
a667caba1e84
parent 902
d832f6171acd
child 1133
50aaf272884f
child 1140
6d0ebf545f49
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/make/Main.gmk	Thu Nov 14 10:53:23 2013 +0100
     1.3 @@ -0,0 +1,245 @@
     1.4 +#
     1.5 +# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 +#
     1.8 +# This code is free software; you can redistribute it and/or modify it
     1.9 +# under the terms of the GNU General Public License version 2 only, as
    1.10 +# published by the Free Software Foundation.  Oracle designates this
    1.11 +# particular file as subject to the "Classpath" exception as provided
    1.12 +# by Oracle in the LICENSE file that accompanied this code.
    1.13 +#
    1.14 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 +# version 2 for more details (a copy is included in the LICENSE file that
    1.18 +# accompanied this code).
    1.19 +#
    1.20 +# You should have received a copy of the GNU General Public License version
    1.21 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 +#
    1.24 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 +# or visit www.oracle.com if you need additional information or have any
    1.26 +# questions.
    1.27 +#
    1.28 +
    1.29 +### This is the main part of the Makefile, for the normal case with SPEC specifying a single existing spec.gmk file.
    1.30 +
    1.31 +# Now load the spec
    1.32 +include $(SPEC)
    1.33 +
    1.34 +# Load the vital tools for all the makefiles.
    1.35 +include $(SRC_ROOT)/make/common/MakeBase.gmk
    1.36 +
    1.37 +# Include the corresponding custom file, if present.
    1.38 +-include $(CUSTOM_MAKE_DIR)/Main.gmk
    1.39 +
    1.40 +### Clean up from previous run
    1.41 +
    1.42 +# Remove any build.log from a previous run, if they exist
    1.43 +ifneq (,$(BUILD_LOG))
    1.44 +  ifneq (,$(BUILD_LOG_PREVIOUS))
    1.45 +    # Rotate old log
    1.46 +    $(shell $(RM) $(BUILD_LOG_PREVIOUS) 2> /dev/null)
    1.47 +    $(shell $(MV) $(BUILD_LOG) $(BUILD_LOG_PREVIOUS) 2> /dev/null)
    1.48 +  else
    1.49 +    $(shell $(RM) $(BUILD_LOG) 2> /dev/null)
    1.50 +  endif
    1.51 +  $(shell $(RM) $(OUTPUT_ROOT)/build-trace-time.log 2> /dev/null)
    1.52 +endif
    1.53 +# Remove any javac server logs and port files. This
    1.54 +# prevents a new make run to reuse the previous servers.
    1.55 +ifneq (,$(SJAVAC_SERVER_DIR))
    1.56 +  $(shell $(MKDIR) -p $(SJAVAC_SERVER_DIR) && $(RM) -rf $(SJAVAC_SERVER_DIR)/*)
    1.57 +endif
    1.58 +
    1.59 +# Reset the build timers.
    1.60 +$(eval $(call ResetAllTimers))
    1.61 +
    1.62 +# Setup number of jobs to use. -jN is unfortunately not available for us to parse from the command line,
    1.63 +# hence this workaround.
    1.64 +MAKE_ARGS:=$(MAKE_ARGS) -j$(JOBS)
    1.65 +
    1.66 +### Main targets
    1.67 +
    1.68 +default: jdk
    1.69 +	@$(call CheckIfMakeAtEnd)
    1.70 +
    1.71 +all: images docs
    1.72 +	@$(call CheckIfMakeAtEnd)
    1.73 +
    1.74 +# Setup a rule for SPEC file that fails if executed. This check makes sure the configuration
    1.75 +# is up to date after changes to configure
    1.76 +$(SPEC): $(wildcard $(SRC_ROOT)/common/autoconf/*)
    1.77 +	@$(ECHO) ERROR: $(SPEC) is not up to date
    1.78 +	@$(ECHO) Please rerun configure!
    1.79 +	@if test "x$(IGNORE_OLD_CONFIG)" != "xtrue"; then exit 1; fi
    1.80 +
    1.81 +start-make: $(SPEC)
    1.82 +	@$(call AtMakeStart)
    1.83 +
    1.84 +langtools: langtools-only
    1.85 +langtools-only: start-make
    1.86 +	@$(call TargetEnter)
    1.87 +	@($(CD) $(LANGTOOLS_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildLangtools.gmk)
    1.88 +	@$(call TargetExit)
    1.89 +
    1.90 +corba: langtools corba-only
    1.91 +corba-only: start-make
    1.92 +	@$(call TargetEnter)
    1.93 +	@($(CD) $(CORBA_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildCorba.gmk)
    1.94 +	@$(call TargetExit)
    1.95 +
    1.96 +jaxp: langtools jaxp-only
    1.97 +jaxp-only: start-make
    1.98 +	@$(call TargetEnter)
    1.99 +	@($(CD) $(JAXP_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJaxp.gmk)
   1.100 +	@$(call TargetExit)
   1.101 +
   1.102 +jaxws: langtools jaxp jaxws-only
   1.103 +jaxws-only: start-make
   1.104 +	@$(call TargetEnter)
   1.105 +	@($(CD) $(JAXWS_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJaxws.gmk)
   1.106 +	@$(call TargetExit)
   1.107 +
   1.108 +ifeq ($(BUILD_HOTSPOT),true)
   1.109 +  hotspot: hotspot-only
   1.110 +  hotspot-only: start-make
   1.111 +	@$(call TargetEnter)
   1.112 +	@($(CD) $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
   1.113 +	@$(call TargetExit)
   1.114 +endif
   1.115 +
   1.116 +jdk: langtools hotspot corba jaxp jaxws jdk-only
   1.117 +jdk-only: start-make
   1.118 +	@$(call TargetEnter)
   1.119 +	@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk $(JDK_TARGET))
   1.120 +	@$(call TargetExit)
   1.121 +
   1.122 +nashorn: jdk nashorn-only
   1.123 +nashorn-only: start-make
   1.124 +	@$(call TargetEnter)
   1.125 +	@($(CD) $(NASHORN_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk)
   1.126 +	@$(call TargetExit)
   1.127 +
   1.128 +demos: jdk demos-only
   1.129 +demos-only: start-make
   1.130 +	@$(call TargetEnter)
   1.131 +	@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk demos)
   1.132 +	@$(call TargetExit)
   1.133 +
   1.134 +# Note: This double-colon rule is intentional, to support
   1.135 +# custom make file integration.
   1.136 +images:: source-tips demos nashorn images-only
   1.137 +images-only: start-make
   1.138 +	@$(call TargetEnter)
   1.139 +	@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk images)
   1.140 +	@$(call TargetExit)
   1.141 +
   1.142 +overlay-images: source-tips demos overlay-images-only
   1.143 +overlay-images-only: start-make
   1.144 +	@$(call TargetEnter)
   1.145 +	@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk overlay-images)
   1.146 +	@$(call TargetExit)
   1.147 +
   1.148 +profiles: profiles-oscheck source-tips jdk hotspot profiles-only
   1.149 +profiles-only: start-make
   1.150 +	@$(call TargetEnter)
   1.151 +	@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk profiles)
   1.152 +	@$(call TargetExit)
   1.153 +
   1.154 +profiles-oscheck:
   1.155 +        ifneq ($(OPENJDK_TARGET_OS), linux)
   1.156 +	  @echo "Error: The Java SE 8 Compact Profiles are only implemented for Linux at this time" && exit 1
   1.157 +        endif
   1.158 +
   1.159 +install: images install-only
   1.160 +install-only: start-make
   1.161 +	@$(call TargetEnter)
   1.162 +	@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk install)
   1.163 +	@$(call TargetExit)
   1.164 +
   1.165 +docs: jdk docs-only
   1.166 +docs-only: start-make
   1.167 +	@$(call TargetEnter)
   1.168 +	@($(CD) $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
   1.169 +	@$(call TargetExit)
   1.170 +
   1.171 +sign-jars: jdk sign-jars-only
   1.172 +sign-jars-only: start-make
   1.173 +	@$(call TargetEnter)
   1.174 +	@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk sign-jars)
   1.175 +	@$(call TargetExit)
   1.176 +
   1.177 +bootcycle-images: images bootcycle-images-only
   1.178 +bootcycle-images-only: start-make
   1.179 +	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
   1.180 +	@($(CD) $(SRC_ROOT) && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(dir $(SPEC))bootcycle-spec.gmk images)
   1.181 +
   1.182 +test: images test-only
   1.183 +test-only: start-make
   1.184 +	@$(call TargetEnter)
   1.185 +	@($(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
   1.186 +	@$(call TargetExit)
   1.187 +
   1.188 +# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
   1.189 +# used to track the exact sources used to build that image.
   1.190 +source-tips: $(OUTPUT_ROOT)/source_tips
   1.191 +$(OUTPUT_ROOT)/source_tips: FRC
   1.192 +	@$(MKDIR) -p $(@D)
   1.193 +	@$(RM) $@
   1.194 +	@$(call GetSourceTips)
   1.195 +
   1.196 +
   1.197 +# Remove everything, except the output from configure.
   1.198 +clean: 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
   1.199 +	@($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*)
   1.200 +	@$(ECHO) Cleaned all build artifacts.
   1.201 +
   1.202 +# Remove everything, including configure configuration.
   1.203 +# If the output directory was created by configure and now becomes empty, remove it as well.
   1.204 +# FIXME: tmp should not be here, fix ResetTimers instead. And remove spec.sh!
   1.205 +dist-clean: clean
   1.206 +	@($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments Makefile compare.sh spec.sh tmp javacservers)
   1.207 +	@$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
   1.208 +	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
   1.209 +	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
   1.210 +	  else \
   1.211 +	    ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" && $(RM) -r $(OUTPUT_ROOT)) \
   1.212 +	  fi \
   1.213 +	)
   1.214 +	@$(ECHO) Cleaned everything, you will have to re-run configure.
   1.215 +
   1.216 +clean-langtools:
   1.217 +	$(call CleanComponent,langtools)
   1.218 +clean-corba:
   1.219 +	$(call CleanComponent,corba)
   1.220 +clean-jaxp:
   1.221 +	$(call CleanComponent,jaxp)
   1.222 +clean-jaxws:
   1.223 +	$(call CleanComponent,jaxws)
   1.224 +clean-hotspot:
   1.225 +	$(call CleanComponent,hotspot)
   1.226 +clean-jdk:
   1.227 +	$(call CleanComponent,jdk)
   1.228 +clean-nashorn:
   1.229 +	$(call CleanComponent,nashorn)
   1.230 +clean-images:
   1.231 +	$(call CleanComponent,images)
   1.232 +clean-overlay-images:
   1.233 +	$(call CleanComponent,overlay-images)
   1.234 +clean-bootcycle-build:
   1.235 +	$(call CleanComponent,bootcycle-build)
   1.236 +clean-docs:
   1.237 +	$(call CleanComponent,docs)
   1.238 +	$(call CleanComponent,docstemp)
   1.239 +clean-test:
   1.240 +	$(call CleanComponent,testoutput)
   1.241 +
   1.242 +.PHONY: langtools corba jaxp jaxws hotspot jdk nashorn images overlay-images install test docs
   1.243 +.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
   1.244 +.PHONY: default all clean dist-clean bootcycle-images start-make
   1.245 +.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
   1.246 +.PHONY: profiles profiles-only profiles-oscheck
   1.247 +
   1.248 +FRC: # Force target

mercurial