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