common/makefiles/Main.gmk

Sun, 17 Feb 2013 16:44:28 -0500

author
dholmes
date
Sun, 17 Feb 2013 16:44:28 -0500
changeset 627
28071e4ca1de
parent 624
7ed0c9db6943
parent 619
76808fb4194a
child 635
907a926d3c96
child 645
5b0b6ef58dbf
child 883
e877cb3eb4d6
permissions
-rw-r--r--

Merge

ohair@494 1 #
ohair@494 2 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
ohair@494 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ohair@494 4 #
ohair@494 5 # This code is free software; you can redistribute it and/or modify it
ohair@494 6 # under the terms of the GNU General Public License version 2 only, as
ohair@494 7 # published by the Free Software Foundation. Oracle designates this
ohair@494 8 # particular file as subject to the "Classpath" exception as provided
ohair@494 9 # by Oracle in the LICENSE file that accompanied this code.
ohair@494 10 #
ohair@494 11 # This code is distributed in the hope that it will be useful, but WITHOUT
ohair@494 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ohair@494 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ohair@494 14 # version 2 for more details (a copy is included in the LICENSE file that
ohair@494 15 # accompanied this code).
ohair@494 16 #
ohair@494 17 # You should have received a copy of the GNU General Public License version
ohair@494 18 # 2 along with this work; if not, write to the Free Software Foundation,
ohair@494 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ohair@494 20 #
ohair@494 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@494 22 # or visit www.oracle.com if you need additional information or have any
ohair@494 23 # questions.
ohair@494 24 #
ohair@494 25
ohair@494 26 ### This is the main part of the Makefile, for the normal case with SPEC specifying a single existing spec.gmk file.
ohair@494 27
ohair@494 28 # Now load the spec
ohair@494 29 include $(SPEC)
ohair@494 30
ohair@494 31 # Load the vital tools for all the makefiles.
ohair@494 32 include $(SRC_ROOT)/common/makefiles/MakeBase.gmk
ohair@494 33
ohair@494 34 # Include the corresponding custom file, if present.
ohair@494 35 -include $(CUSTOM_MAKE_DIR)/Main.gmk
ohair@494 36
ohair@494 37 ### Clean up from previous run
ohair@494 38
ohair@494 39 # Remove any build.log from a previous run, if they exist
ohair@494 40 ifneq (,$(BUILD_LOG))
ohair@494 41 ifneq (,$(BUILD_LOG_PREVIOUS))
ohair@494 42 # Rotate old log
ohair@494 43 $(shell $(RM) $(BUILD_LOG_PREVIOUS) 2> /dev/null)
ohair@494 44 $(shell $(MV) $(BUILD_LOG) $(BUILD_LOG_PREVIOUS) 2> /dev/null)
ohair@494 45 else
ohair@494 46 $(shell $(RM) $(BUILD_LOG) 2> /dev/null)
ohair@494 47 endif
ohair@494 48 $(shell $(RM) $(OUTPUT_ROOT)/build-trace-time.log 2> /dev/null)
ohair@494 49 endif
ohair@494 50 # Remove any javac server logs and port files. This
ohair@494 51 # prevents a new make run to reuse the previous servers.
ohair@494 52 ifneq (,$(SJAVAC_SERVER_DIR))
ohair@494 53 $(shell $(MKDIR) -p $(SJAVAC_SERVER_DIR) && $(RM) -rf $(SJAVAC_SERVER_DIR)/*)
ohair@494 54 endif
ohair@494 55
ohair@494 56 # Reset the build timers.
ohair@494 57 $(eval $(call ResetAllTimers))
ohair@494 58
ohair@494 59 # Setup number of jobs to use. -jN is unfortunately not available for us to parse from the command line,
ohair@494 60 # hence this workaround.
ohair@494 61 ifeq ($(JOBS),)
ohair@494 62 JOBS=$(NUM_CORES)
ohair@494 63 endif
ohair@494 64 MAKE_ARGS:=$(MAKE_ARGS) -j$(JOBS)
ohair@494 65
ohair@494 66 ### Main targets
ohair@494 67
erikj@559 68 default: jdk
erikj@559 69 @$(call CheckIfMakeAtEnd)
erikj@559 70
erikj@559 71 all: images docs
erikj@559 72 @$(call CheckIfMakeAtEnd)
ohair@494 73
erikj@566 74 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_BITS),solaris-64)
erikj@566 75 all: overlay-images
erikj@566 76 endif
erikj@566 77
erikj@609 78 # Setup a rule for SPEC file that fails if executed. This check makes sure the configuration
erikj@609 79 # is up to date after changes to configure
erikj@609 80 $(SPEC): $(wildcard $(SRC_ROOT)/common/autoconf/*)
erikj@609 81 @$(ECHO) ERROR: $(SPEC) is not up to date
erikj@609 82 @$(ECHO) Please rerun configure!
erikj@609 83 @if test "x$(IGNORE_OLD_CONFIG)" != "xtrue"; then exit 1; fi
erikj@609 84
erikj@609 85 start-make: $(SPEC)
ohair@494 86 @$(call AtMakeStart)
ohair@494 87
ohair@494 88 langtools: langtools-only
ohair@494 89 langtools-only: start-make
ohair@494 90 @$(call TargetEnter)
ohair@494 91 @($(CD) $(LANGTOOLS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildLangtools.gmk)
ohair@494 92 @$(call TargetExit)
ohair@494 93
ohair@494 94 corba: langtools corba-only
ohair@494 95 corba-only: start-make
ohair@494 96 @$(call TargetEnter)
ohair@494 97 @($(CD) $(CORBA_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildCorba.gmk)
ohair@494 98 @$(call TargetExit)
ohair@494 99
ohair@494 100 jaxp: langtools jaxp-only
ohair@494 101 jaxp-only: start-make
ohair@494 102 @$(call TargetEnter)
ohair@494 103 @($(CD) $(JAXP_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJaxp.gmk)
ohair@494 104 @$(call TargetExit)
ohair@494 105
ohair@494 106 jaxws: langtools jaxp jaxws-only
ohair@494 107 jaxws-only: start-make
ohair@494 108 @$(call TargetEnter)
ohair@494 109 @($(CD) $(JAXWS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJaxws.gmk)
ohair@494 110 @$(call TargetExit)
ohair@494 111
tbell@506 112 ifeq ($(BUILD_HOTSPOT),true)
ohair@494 113 hotspot: hotspot-only
ohair@494 114 hotspot-only: start-make
ohair@494 115 @$(call TargetEnter)
ohair@494 116 @($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
ohair@494 117 @$(call TargetExit)
tbell@506 118 endif
ohair@494 119
ohair@494 120 jdk: langtools hotspot corba jaxp jaxws jdk-only
ohair@494 121 jdk-only: start-make
ohair@494 122 @$(call TargetEnter)
ohair@494 123 @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk $(JDK_TARGET))
ohair@494 124 @$(call TargetExit)
ohair@494 125
ohair@494 126 demos: jdk demos-only
ohair@494 127 demos-only: start-make
ohair@494 128 @$(call TargetEnter)
ohair@494 129 @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk demos)
ohair@494 130 @$(call TargetExit)
ohair@494 131
dholmes@624 132 # Note: This double-colon rule is intentional, to support
dholmes@624 133 # custom make file integration.
dholmes@624 134 images:: source-tips demos images-only
ohair@494 135 images-only: start-make
ohair@494 136 @$(call TargetEnter)
ohair@494 137 @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk images)
ohair@494 138 @$(call TargetExit)
ohair@494 139
ohair@494 140 overlay-images: source-tips demos overlay-images-only
ohair@494 141 overlay-images-only: start-make
ohair@494 142 @$(call TargetEnter)
ohair@494 143 @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk overlay-images)
ohair@494 144 @$(call TargetExit)
ohair@494 145
dholmes@624 146 profiles: profiles-oscheck source-tips jdk hotspot profiles-only
dholmes@624 147 profiles-only: start-make
dholmes@624 148 @$(call TargetEnter)
dholmes@624 149 @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk profiles)
dholmes@624 150 @$(call TargetExit)
dholmes@624 151
dholmes@624 152 profiles-oscheck:
dholmes@624 153 ifneq ($(OPENJDK_TARGET_OS), linux)
dholmes@624 154 @echo "Error: The Java SE 8 Compact Profiles are only implemented for Linux at this time" && exit 1
dholmes@624 155 endif
dholmes@624 156
ohair@494 157 install: images install-only
ohair@494 158 install-only: start-make
ohair@494 159 @$(call TargetEnter)
ohair@494 160 @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk install)
ohair@494 161 @$(call TargetExit)
ohair@494 162
ohair@494 163 docs: jdk docs-only
ohair@494 164 docs-only: start-make
ohair@494 165 @$(call TargetEnter)
ohair@494 166 @($(CD) $(SRC_ROOT)/common/makefiles/javadoc && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
ohair@494 167 @$(call TargetExit)
ohair@494 168
erikj@563 169 sign-jars: jdk sign-jars-only
erikj@563 170 sign-jars-only: start-make
erikj@563 171 @$(call TargetEnter)
erikj@563 172 @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk sign-jars)
erikj@563 173 @$(call TargetExit)
erikj@563 174
ohair@494 175 bootcycle-images:
ohair@494 176 @$(ECHO) Boot cycle build step 1: Building the JDK image normally
ohair@494 177 @($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(SPEC) images)
ohair@494 178 @$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
ohair@494 179 @($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(dir $(SPEC))bootcycle-spec.gmk images)
ohair@494 180
ohair@494 181 test: start-make
ohair@494 182 @$(call TargetEnter)
mduigou@617 183 @($(CD) $(SRC_ROOT)/test && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 -k MAKEFLAGS= PRODUCT_HOME=$(OUTPUT_ROOT)/jdk JPRT_JAVA_HOME=$(OUTPUT_ROOT)/jdk ALT_OUTPUTDIR=$(OUTPUT_ROOT) $(TEST)) || true
ohair@494 184 @$(call TargetExit)
ohair@494 185
ohair@494 186 # Stores the tips for each repository. This file is be used when constructing the jdk image and can be
ohair@494 187 # used to track the exact sources used to build that image.
ohair@494 188 source-tips: $(OUTPUT_ROOT)/source_tips
ohair@494 189 $(OUTPUT_ROOT)/source_tips: FRC
ohair@494 190 @$(MKDIR) -p $(@D)
ohair@494 191 @$(RM) $@
ohair@494 192 @$(if $(HG),$(call GetSourceTips),$(ECHO) "hg not installed" > $@)
ohair@494 193
ohair@494 194
ohair@494 195 # Remove everything, except the output from configure.
erikj@518 196 clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-overlay-images clean-bootcycle-build clean-docs
ohair@494 197 @($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*)
ohair@494 198 @$(ECHO) Cleaned all build artifacts.
ohair@494 199
ohair@494 200 # Remove everything, including configure configuration.
ohair@494 201 # If the output directory was created by configure and now becomes empty, remove it as well.
ohair@494 202 # FIXME: tmp should not be here, fix ResetTimers instead. And remove spec.sh!
ohair@494 203 dist-clean: clean
ohair@494 204 @($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments Makefile compare.sh spec.sh tmp)
ohair@494 205 @$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
ohair@494 206 if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
ohair@494 207 $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ;\
ohair@494 208 else \
ohair@494 209 ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" && $(RM) -r $(OUTPUT_ROOT)) \
ohair@494 210 fi \
ohair@494 211 )
ohair@494 212 @$(ECHO) Cleaned everything, you will have to re-run configure.
ohair@494 213
ohair@494 214 clean-langtools:
ohair@494 215 $(call CleanComponent,langtools)
ohair@494 216 clean-corba:
ohair@494 217 $(call CleanComponent,corba)
ohair@494 218 clean-jaxp:
ohair@494 219 $(call CleanComponent,jaxp)
ohair@494 220 clean-jaxws:
ohair@494 221 $(call CleanComponent,jaxws)
ohair@494 222 clean-hotspot:
ohair@494 223 $(call CleanComponent,hotspot)
ohair@494 224 clean-jdk:
ohair@494 225 $(call CleanComponent,jdk)
ohair@494 226 clean-images:
ohair@494 227 $(call CleanComponent,images)
ohair@494 228 clean-overlay-images:
ohair@494 229 $(call CleanComponent,overlay-images)
ohair@494 230 clean-bootcycle-build:
ohair@494 231 $(call CleanComponent,bootcycle-build)
erikj@518 232 clean-docs:
erikj@518 233 $(call CleanComponent,docs)
erikj@518 234 $(call CleanComponent,docstemp)
ohair@494 235
ohair@494 236 .PHONY: langtools corba jaxp jaxws hotspot jdk images overlay-images install
ohair@494 237 .PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only overlay-images-only install-only
ohair@494 238 .PHONY: all test clean dist-clean bootcycle-images start-make
ohair@494 239 .PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-overlay-images clean-bootcycle-build
dholmes@624 240 .PHONY: profiles profiles-only profiles-oscheck
ohair@494 241
ohair@494 242 FRC: # Force target

mercurial