common/makefiles/Main.gmk

changeset 494
e64f2cb57d05
child 506
78bb27faf889
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/common/makefiles/Main.gmk	Fri Oct 26 14:29:57 2012 -0700
     1.3 @@ -0,0 +1,208 @@
     1.4 +#
     1.5 +# Copyright (c) 2011, 2012, 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)/common/makefiles/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 +ifeq ($(JOBS),)
    1.65 +    JOBS=$(NUM_CORES)
    1.66 +endif
    1.67 +MAKE_ARGS:=$(MAKE_ARGS) -j$(JOBS)
    1.68 +
    1.69 +### Main targets
    1.70 +
    1.71 +all: jdk
    1.72 +
    1.73 +start-make:
    1.74 +	@$(call AtMakeStart)
    1.75 +
    1.76 +langtools: langtools-only
    1.77 +langtools-only: start-make
    1.78 +	@$(call TargetEnter)
    1.79 +	@($(CD) $(LANGTOOLS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildLangtools.gmk)
    1.80 +	@$(call TargetExit)
    1.81 +
    1.82 +corba: langtools corba-only
    1.83 +corba-only: start-make
    1.84 +	@$(call TargetEnter)
    1.85 +	@($(CD) $(CORBA_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildCorba.gmk)
    1.86 +	@$(call TargetExit)
    1.87 +
    1.88 +jaxp: langtools jaxp-only
    1.89 +jaxp-only: start-make
    1.90 +	@$(call TargetEnter)
    1.91 +	@($(CD) $(JAXP_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJaxp.gmk)
    1.92 +	@$(call TargetExit)
    1.93 +
    1.94 +jaxws: langtools jaxp jaxws-only
    1.95 +jaxws-only: start-make
    1.96 +	@$(call TargetEnter)
    1.97 +	@($(CD) $(JAXWS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJaxws.gmk)
    1.98 +	@$(call TargetExit)
    1.99 +
   1.100 +hotspot: hotspot-only
   1.101 +hotspot-only: start-make
   1.102 +	@$(call TargetEnter)
   1.103 +	@($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
   1.104 +	@$(call TargetExit)
   1.105 +
   1.106 +jdk: langtools hotspot corba jaxp jaxws jdk-only
   1.107 +jdk-only: start-make
   1.108 +	@$(call TargetEnter)
   1.109 +	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk $(JDK_TARGET))
   1.110 +	@$(call TargetExit)
   1.111 +
   1.112 +demos: jdk demos-only
   1.113 +demos-only: start-make
   1.114 +	@$(call TargetEnter)
   1.115 +	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk demos)
   1.116 +	@$(call TargetExit)
   1.117 +
   1.118 +images: source-tips demos images-only
   1.119 +images-only: start-make
   1.120 +	@$(call TargetEnter)
   1.121 +	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk images)
   1.122 +	@$(call TargetExit)
   1.123 +
   1.124 +overlay-images: source-tips demos overlay-images-only
   1.125 +overlay-images-only: start-make
   1.126 +	@$(call TargetEnter)
   1.127 +	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk overlay-images)
   1.128 +	@$(call TargetExit)
   1.129 +
   1.130 +bundles: images bundles-only
   1.131 +bundles-only: start-make
   1.132 +	@$(call TargetEnter)
   1.133 +	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk bundles)
   1.134 +	@$(call TargetExit)
   1.135 +
   1.136 +install: images install-only
   1.137 +install-only: start-make
   1.138 +	@$(call TargetEnter)
   1.139 +	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk install)
   1.140 +	@$(call TargetExit)
   1.141 +
   1.142 +docs: jdk docs-only
   1.143 +docs-only: start-make
   1.144 +	@$(call TargetEnter)
   1.145 +	@($(CD) $(SRC_ROOT)/common/makefiles/javadoc && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
   1.146 +	@$(call TargetExit)
   1.147 +
   1.148 +bootcycle-images:
   1.149 +	@$(ECHO) Boot cycle build step 1: Building the JDK image normally
   1.150 +	@($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(SPEC) images)
   1.151 +	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
   1.152 +	@($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(dir $(SPEC))bootcycle-spec.gmk images)
   1.153 +
   1.154 +test: start-make
   1.155 +	@$(call TargetEnter)
   1.156 +	@($(CD) $(SRC_ROOT)/test && $(BUILD_LOG_WRAPPER) $(MAKE) MAKEFLAGS= -j1 PRODUCT_HOME=$(OUTPUT_ROOT)/jdk JPRT_JAVA_HOME=$(OUTPUT_ROOT)/jdk ALT_OUTPUTDIR=$(OUTPUT_ROOT) $(TEST)) || true
   1.157 +	@$(call TargetExit)
   1.158 +
   1.159 +# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
   1.160 +# used to track the exact sources used to build that image.
   1.161 +source-tips: $(OUTPUT_ROOT)/source_tips
   1.162 +$(OUTPUT_ROOT)/source_tips: FRC
   1.163 +	@$(MKDIR) -p $(@D)
   1.164 +	@$(RM) $@
   1.165 +	@$(if $(HG),$(call GetSourceTips),$(ECHO) "hg not installed" > $@)
   1.166 +
   1.167 +
   1.168 +# Remove everything, except the output from configure.
   1.169 +clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-overlay-images clean-bootcycle-build
   1.170 +	@($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*)
   1.171 +	@$(ECHO) Cleaned all build artifacts.
   1.172 +
   1.173 +# Remove everything, including configure configuration.
   1.174 +# If the output directory was created by configure and now becomes empty, remove it as well.
   1.175 +# FIXME: tmp should not be here, fix ResetTimers instead. And remove spec.sh!
   1.176 +dist-clean: clean
   1.177 +	@($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments Makefile compare.sh spec.sh tmp)
   1.178 +	@$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
   1.179 +    if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
   1.180 +        $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ;\
   1.181 +    else \
   1.182 +        ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" && $(RM) -r $(OUTPUT_ROOT)) \
   1.183 +    fi \
   1.184 +  )
   1.185 +	@$(ECHO) Cleaned everything, you will have to re-run configure.
   1.186 +
   1.187 +clean-langtools:
   1.188 +	$(call CleanComponent,langtools)
   1.189 +clean-corba:
   1.190 +	$(call CleanComponent,corba)
   1.191 +clean-jaxp:
   1.192 +	$(call CleanComponent,jaxp)
   1.193 +clean-jaxws:
   1.194 +	$(call CleanComponent,jaxws)
   1.195 +clean-hotspot:
   1.196 +	$(call CleanComponent,hotspot)
   1.197 +clean-jdk:
   1.198 +	$(call CleanComponent,jdk)
   1.199 +clean-images:
   1.200 +	$(call CleanComponent,images)
   1.201 +clean-overlay-images:
   1.202 +	$(call CleanComponent,overlay-images)
   1.203 +clean-bootcycle-build:
   1.204 +	$(call CleanComponent,bootcycle-build)
   1.205 +
   1.206 +.PHONY: langtools corba jaxp jaxws hotspot jdk images overlay-images install
   1.207 +.PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only overlay-images-only install-only
   1.208 +.PHONY: all test clean dist-clean bootcycle-images start-make
   1.209 +.PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-overlay-images clean-bootcycle-build
   1.210 +
   1.211 +FRC: # Force target

mercurial