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