author | iris |
Tue, 06 Oct 2015 10:55:12 -0700 | |
changeset 34008 | 17051561bbaf |
parent 32720 | 7e0e586a6817 |
child 32920 | 5bea8a04f0a5 |
permissions | -rw-r--r-- |
0 | 1 |
# |
29662 | 2 |
# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. |
0 | 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 |
|
5499 | 7 |
# published by the Free Software Foundation. Oracle designates this |
0 | 8 |
# particular file as subject to the "Classpath" exception as provided |
5499 | 9 |
# by Oracle in the LICENSE file that accompanied this code. |
0 | 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 |
# |
|
5499 | 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. |
|
0 | 24 |
# |
25 |
||
29662 | 26 |
################################################################################ |
27 |
# This is the bootstrapping part of the build. This file is included from the |
|
28 |
# top level Makefile, and is responsible for launching the Main.gmk file with |
|
29 |
# the proper make and the proper make arguments. |
|
30 |
################################################################################ |
|
31 |
||
21759 | 32 |
# This must be the first rule |
33 |
default: |
|
29662 | 34 |
.PHONY: default |
17
bb9f330cd95a
6649672: Adjustments to OUTPUTDIR default and mkdirs to avoid empty directory clutter
ohair
parents:
16
diff
changeset
|
35 |
|
21759 | 36 |
# Inclusion of this pseudo-target will cause make to execute this file |
29662 | 37 |
# serially, regardless of -j. |
21759 | 38 |
.NOTPARALLEL: |
9618 | 39 |
|
29788 | 40 |
ifeq ($(HAS_SPEC),) |
29662 | 41 |
############################################################################## |
29788 | 42 |
# This is the default mode. We have not been recursively called with a SPEC. |
29662 | 43 |
############################################################################## |
44 |
||
29788 | 45 |
# Include our helper functions. |
46 |
include $(topdir)/make/InitSupport.gmk |
|
8441 | 47 |
|
29788 | 48 |
# Here are "global" targets, i.e. targets that can be executed without having |
49 |
# a configuration. This will define ALL_GLOBAL_TARGETS. |
|
50 |
include $(topdir)/make/Help.gmk |
|
29662 | 51 |
|
29788 | 52 |
# Targets provided by Init.gmk. |
32715
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
53 |
ALL_INIT_TARGETS := print-modules print-targets print-configuration \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
54 |
reconfigure pre-compare-build post-compare-build |
25854 | 55 |
|
29662 | 56 |
# CALLED_TARGETS is the list of targets that the user provided, |
57 |
# or "default" if unspecified. |
|
58 |
CALLED_TARGETS := $(if $(MAKECMDGOALS), $(MAKECMDGOALS), default) |
|
29788 | 59 |
|
60 |
# Extract non-global targets that require a spec file. |
|
61 |
CALLED_SPEC_TARGETS := $(filter-out $(ALL_GLOBAL_TARGETS), $(CALLED_TARGETS)) |
|
62 |
||
63 |
# If we have only global targets, or if we are called with -qp (assuming an |
|
64 |
# external part, e.g. bash completion, is trying to understand our targets), |
|
65 |
# we will skip SPEC location and the sanity checks. |
|
66 |
ifeq ($(CALLED_SPEC_TARGETS), ) |
|
67 |
ONLY_GLOBAL_TARGETS := true |
|
68 |
endif |
|
69 |
ifneq ($(findstring qp, $(MAKEFLAGS)),) |
|
70 |
ONLY_GLOBAL_TARGETS := true |
|
71 |
endif |
|
72 |
||
73 |
ifeq ($(ONLY_GLOBAL_TARGETS), true) |
|
74 |
############################################################################ |
|
75 |
# We have only global targets, or are called with -pq. |
|
76 |
############################################################################ |
|
77 |
||
78 |
ifeq ($(wildcard $(SPEC)), ) |
|
79 |
# If we have no SPEC provided, we will just make a "best effort" target list. |
|
80 |
# First try to grab any available pre-existing main-targets.gmk. |
|
81 |
main_targets_file := $(firstword $(wildcard $(build_dir)/*/make-support/main-targets.gmk)) |
|
82 |
ifneq ($(main_targets_file), ) |
|
83 |
# Extract the SPEC that corresponds to this main-targets.gmk file. |
|
84 |
SPEC := $(patsubst %/make-support/main-targets.gmk, %/spec.gmk, $(main_targets_file)) |
|
85 |
else |
|
86 |
# None found, pick an arbitrary SPEC for which to generate a file |
|
87 |
SPEC := $(firstword $(all_spec_files)) |
|
88 |
endif |
|
89 |
endif |
|
90 |
||
91 |
ifneq ($(wildcard $(SPEC)), ) |
|
92 |
$(eval $(call DefineMainTargets, LAZY, $(SPEC))) |
|
93 |
else |
|
94 |
# If we have no configurations we can not provide any main targets. |
|
95 |
ALL_MAIN_TARGETS := |
|
96 |
endif |
|
97 |
||
98 |
ALL_TARGETS := $(sort $(ALL_GLOBAL_TARGETS) $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS)) |
|
99 |
||
100 |
# Just list all our targets. |
|
101 |
$(ALL_TARGETS): |
|
102 |
||
103 |
.PHONY: $(ALL_TARGETS) |
|
104 |
||
105 |
else |
|
106 |
############################################################################ |
|
107 |
# This is the normal case, we have been called from the command line by the |
|
108 |
# user and we need to call ourself back with a proper SPEC. |
|
109 |
# We have at least one non-global target, so we need to find a spec file. |
|
110 |
############################################################################ |
|
111 |
||
112 |
# Basic checks on environment and command line. |
|
113 |
$(eval $(call CheckControlVariables)) |
|
114 |
$(eval $(call CheckDeprecatedEnvironment)) |
|
115 |
$(eval $(call CheckInvalidMakeFlags)) |
|
116 |
||
117 |
# Check that CONF_CHECK is valid. |
|
118 |
$(eval $(call ParseConfCheckOption)) |
|
119 |
||
120 |
# Check that the LOG given is valid, and set LOG_LEVEL, LOG_NOFILE and MAKE_LOG_FLAGS. |
|
121 |
$(eval $(call ParseLogLevel)) |
|
122 |
||
123 |
# After this SPECS contain 1..N spec files (otherwise ParseConfAndSpec fails). |
|
29662 | 124 |
$(eval $(call ParseConfAndSpec)) |
25854 | 125 |
|
29788 | 126 |
# Extract main targets from Main.gmk using the spec(s) provided. In theory, |
127 |
# with multiple specs, we should find the intersection of targets provided |
|
128 |
# by all specs, but we approximate this by an arbitrary spec from the list. |
|
129 |
# This will setup ALL_MAIN_TARGETS. |
|
130 |
$(eval $(call DefineMainTargets, FORCE, $(firstword $(SPECS)))) |
|
131 |
||
132 |
# Separate called targets depending on type. |
|
29662 | 133 |
INIT_TARGETS := $(filter $(ALL_INIT_TARGETS), $(CALLED_SPEC_TARGETS)) |
29788 | 134 |
MAIN_TARGETS := $(filter $(ALL_MAIN_TARGETS), $(CALLED_SPEC_TARGETS)) |
135 |
SEQUENTIAL_TARGETS := $(filter dist-clean clean%, $(MAIN_TARGETS)) |
|
136 |
PARALLEL_TARGETS := $(filter-out $(SEQUENTIAL_TARGETS), $(MAIN_TARGETS)) |
|
874
638ddad10e12
6728161: Add SKIP_BOOT_CYCLE feature to create boot jdk and use it during build
ohair
parents:
668
diff
changeset
|
137 |
|
29662 | 138 |
# The spec files depend on the autoconf source code. This check makes sure |
139 |
# the configuration is up to date after changes to configure. |
|
140 |
$(SPECS): $(wildcard $(topdir)/common/autoconf/*) |
|
141 |
ifeq ($(CONF_CHECK), fail) |
|
142 |
@echo "Error: The configuration is not up to date for '$(lastword $(subst /, , $(dir $@)))'." |
|
143 |
$(call PrintConfCheckFailed) |
|
144 |
@exit 2 |
|
145 |
else ifeq ($(CONF_CHECK), auto) |
|
146 |
@echo "Note: The configuration is not up to date for '$(lastword $(subst /, , $(dir $@)))'." |
|
147 |
@( cd $(topdir) && \ |
|
29788 | 148 |
$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \ |
149 |
SPEC=$@ HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \ |
|
29662 | 150 |
reconfigure ) |
151 |
else ifeq ($(CONF_CHECK), ignore) |
|
152 |
# Do nothing |
|
26398
ca1f84f97e20
8057537: Serialize reconfigure and fix make clean-foo foo
erikj
parents:
26128
diff
changeset
|
153 |
endif |
25854 | 154 |
|
29788 | 155 |
# Unless reconfigure is explicitely called, let all main targets depend on |
156 |
# the spec files to be up to date. |
|
157 |
ifeq ($(findstring reconfigure, $(INIT_TARGETS)), ) |
|
158 |
$(MAIN_TARGETS): $(SPECS) |
|
29662 | 159 |
endif |
874
638ddad10e12
6728161: Add SKIP_BOOT_CYCLE feature to create boot jdk and use it during build
ohair
parents:
668
diff
changeset
|
160 |
|
29788 | 161 |
make-info: |
162 |
ifneq ($(findstring $(LOG_LEVEL),info debug trace),) |
|
163 |
$(info Running make as '$(strip $(MAKE) $(MFLAGS) \ |
|
164 |
$(COMMAND_LINE_VARIABLES) $(MAKECMDGOALS))') |
|
165 |
endif |
|
166 |
||
32715
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
167 |
MAKE_INIT_WITH_SPEC_ARGUMENTS := ACTUAL_TOPDIR=$(topdir) \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
168 |
USER_MAKE_VARS="$(USER_MAKE_VARS)" MAKE_LOG_FLAGS=$(MAKE_LOG_FLAGS) \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
169 |
LOG_LEVEL=$(LOG_LEVEL) LOG_NOFILE=$(LOG_NOFILE) \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
170 |
INIT_TARGETS="$(INIT_TARGETS)" \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
171 |
SEQUENTIAL_TARGETS="$(SEQUENTIAL_TARGETS)" \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
172 |
PARALLEL_TARGETS="$(PARALLEL_TARGETS)" |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
173 |
|
29788 | 174 |
# Now the init and main targets will be called, once for each SPEC. The |
175 |
# recipe will be run once for every target specified, but we only want to |
|
176 |
# execute the recipe a single time, hence the TARGET_DONE with a dummy |
|
177 |
# command if true. |
|
32715
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
178 |
# The COMPARE_BUILD part implements special support for makefile development. |
29788 | 179 |
$(ALL_INIT_TARGETS) $(ALL_MAIN_TARGETS): make-info |
29662 | 180 |
@$(if $(TARGET_DONE), \ |
181 |
true \ |
|
182 |
, \ |
|
32715
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
183 |
( cd $(topdir) && \ |
29662 | 184 |
$(foreach spec, $(SPECS), \ |
29788 | 185 |
$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/Init.gmk \ |
32715
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
186 |
SPEC=$(spec) HAS_SPEC=true $(MAKE_INIT_WITH_SPEC_ARGUMENTS) \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
187 |
main && \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
188 |
$(if $(and $(COMPARE_BUILD), $(PARALLEL_TARGETS)), \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
189 |
$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
190 |
SPEC=$(spec) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
191 |
COMPARE_BUILD="$(COMPARE_BUILD)" pre-compare-build && \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
192 |
$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/Init.gmk \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
193 |
SPEC=$(spec) HAS_SPEC=true $(MAKE_INIT_WITH_SPEC_ARGUMENTS) \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
194 |
COMPARE_BUILD="$(COMPARE_BUILD)" main && \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
195 |
$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
196 |
SPEC=$(spec) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
197 |
COMPARE_BUILD="$(COMPARE_BUILD)" post-compare-build && \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
198 |
) \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
199 |
) true ) \ |
29662 | 200 |
$(eval TARGET_DONE=true) \ |
201 |
) |
|
202 |
||
203 |
.PHONY: $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS) |
|
0 | 204 |
|
29788 | 205 |
endif # $(ONLY_GLOBAL_TARGETS)!=true |
29662 | 206 |
|
207 |
else # HAS_SPEC=true |
|
208 |
||
209 |
############################################################################## |
|
210 |
# Now we have a spec. This part provides the "main" target that acts as a |
|
211 |
# trampoline to call the Main.gmk with the value of $(MAKE) found in the spec |
|
212 |
# file. |
|
213 |
############################################################################## |
|
214 |
||
29788 | 215 |
include $(SPEC) |
216 |
||
217 |
# Our helper functions. |
|
218 |
include $(TOPDIR)/make/InitSupport.gmk |
|
219 |
||
220 |
# Verify that the spec file we included seems okay. |
|
221 |
$(eval $(call CheckSpecSanity)) |
|
222 |
||
32715
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
223 |
# Parse COMPARE_BUILD (for makefile development) |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
224 |
$(eval $(call ParseCompareBuild)) |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
225 |
|
29662 | 226 |
ifeq ($(LOG_NOFILE), true) |
227 |
# Disable log wrapper if LOG=[level,]nofile was given |
|
228 |
override BUILD_LOG_WRAPPER := |
|
229 |
endif |
|
230 |
||
231 |
ifeq ($(OUTPUT_SYNC_SUPPORTED), true) |
|
232 |
OUTPUT_SYNC_FLAG := -O$(OUTPUT_SYNC) |
|
233 |
endif |
|
234 |
||
29788 | 235 |
############################################################################## |
236 |
# Init targets |
|
237 |
############################################################################## |
|
238 |
||
239 |
print-modules: |
|
240 |
( cd $(TOPDIR) && \ |
|
241 |
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \ |
|
242 |
NO_RECIPES=true print-modules ) |
|
243 |
||
244 |
print-targets: |
|
245 |
( cd $(TOPDIR) && \ |
|
246 |
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \ |
|
247 |
NO_RECIPES=true print-targets ) |
|
28902
0c09b47449c8
8069064: Various improvements and fixes in build system
ihse
parents:
28286
diff
changeset
|
248 |
|
32461
e1cfbafc4e9c
8135180: Print configure arguments using make print-configuration
ihse
parents:
32344
diff
changeset
|
249 |
print-configuration: |
e1cfbafc4e9c
8135180: Print configure arguments using make print-configuration
ihse
parents:
32344
diff
changeset
|
250 |
$(ECHO) $(CONFIGURE_COMMAND_LINE) |
e1cfbafc4e9c
8135180: Print configure arguments using make print-configuration
ihse
parents:
32344
diff
changeset
|
251 |
|
29662 | 252 |
reconfigure: |
253 |
ifneq ($(CONFIGURE_COMMAND_LINE), ) |
|
254 |
$(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'" |
|
255 |
else |
|
256 |
$(ECHO) "Re-running configure using default settings" |
|
257 |
endif |
|
258 |
( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \ |
|
259 |
$(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) ) |
|
260 |
||
29788 | 261 |
############################################################################## |
262 |
# The main target, for delegating into Main.gmk |
|
263 |
############################################################################## |
|
29662 | 264 |
|
32715
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
265 |
MAIN_TARGETS := $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) |
29788 | 266 |
TARGET_DESCRIPTION := target$(if $(word 2, $(MAIN_TARGETS)),s) \ |
267 |
'$(strip $(MAIN_TARGETS))' in configuration '$(CONF_NAME)' |
|
29662 | 268 |
|
269 |
# MAKEOVERRIDES is automatically set and propagated by Make to sub-Make calls. |
|
270 |
# We need to clear it of the init-specific variables. The user-specified |
|
271 |
# variables are explicitely propagated using $(USER_MAKE_VARS). |
|
272 |
main: MAKEOVERRIDES := |
|
0 | 273 |
|
29788 | 274 |
main: $(INIT_TARGETS) |
275 |
ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), ) |
|
276 |
$(call RotateLogFiles) |
|
32344
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
277 |
$(call PrepareFailureLogs) |
29788 | 278 |
$(BUILD_LOG_WRAPPER) $(PRINTF) "Building $(TARGET_DESCRIPTION)\n" |
279 |
ifneq ($(SEQUENTIAL_TARGETS), ) |
|
280 |
# Don't touch build output dir since we might be cleaning. That |
|
281 |
# means no log wrapper. |
|
282 |
( cd $(TOPDIR) && \ |
|
283 |
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \ |
|
284 |
$(SEQUENTIAL_TARGETS) ) |
|
285 |
endif |
|
286 |
ifneq ($(PARALLEL_TARGETS), ) |
|
287 |
$(call StartGlobalTimer) |
|
288 |
$(call PrepareSmartJavac) |
|
289 |
( cd $(TOPDIR) && \ |
|
290 |
$(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \ |
|
32344
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
291 |
-j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \ |
32715
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
292 |
$(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) || \ |
32344
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
293 |
( exitcode=$$? && $(BUILD_LOG_WRAPPER) \ |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
294 |
$(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" && \ |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
295 |
cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -j 1 -f make/Init.gmk \ |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
296 |
HAS_SPEC=true on-failure ; \ |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
297 |
exit $$exitcode ) ) |
29788 | 298 |
$(call CleanupSmartJavac) |
299 |
$(call StopGlobalTimer) |
|
300 |
$(call ReportBuildTimes) |
|
301 |
endif |
|
302 |
$(BUILD_LOG_WRAPPER) $(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n" |
|
29662 | 303 |
endif |
304 |
||
32344
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
305 |
on-failure: |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
306 |
ifneq ($(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*), ) |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
307 |
$(PRINTF) "=== Output from failing command(s) repeated here ===\n" |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
308 |
$(foreach logfile, $(sort $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*)), \ |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
309 |
$(PRINTF) "* For target $(notdir $(basename $(logfile))):\n" $(NEWLINE) \ |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
310 |
$(CAT) $(logfile) | $(GREP) -v -e "^Note: including file:" $(NEWLINE) \ |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
311 |
) |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
312 |
$(PRINTF) "=== End of repeated output ===\n" |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
313 |
endif |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
314 |
if $(GREP) -q "recipe for target .* failed" $(BUILD_LOG) 2> /dev/null; then \ |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
315 |
$(PRINTF) "=== Make failure sequence repeated here ===\n" ; \ |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
316 |
$(GREP) "recipe for target .* failed" $(BUILD_LOG) ; \ |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
317 |
$(PRINTF) "=== End of repeated output ===\n" ; \ |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
318 |
$(PRINTF) "Hint: Try searching the build log for the name of the first failed target.\n" ; \ |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
319 |
else \ |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
320 |
$(PRINTF) "No indication of failed target found.\n" ; \ |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
321 |
$(PRINTF) "Hint: Try searching the build log for '] Error'.\n" ; \ |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
322 |
fi |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
323 |
$(PRINTF) "Hint: If caused by a warning, try configure --disable-warnings-as-errors.\n\n" |
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
324 |
|
32715
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
325 |
# Support targets for COMPARE_BUILD, used for makefile development |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
326 |
pre-compare-build: |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
327 |
$(ECHO) "Preparing for comparison rebuild" |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
328 |
# Apply patch, if any |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
329 |
ifneq ($(COMPARE_BUILD_PATCH), ) |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
330 |
$(PATCH) -p1 < $(COMPARE_BUILD_PATCH) |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
331 |
endif |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
332 |
# Move the first build away and re-create the output directory |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
333 |
( cd $(TOPDIR) && \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
334 |
$(MV) $(OUTPUT_ROOT) $(OUTPUT_ROOT).OLD && \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
335 |
$(MKDIR) -p $(OUTPUT_ROOT) ) |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
336 |
# Re-run configure with the same arguments (and possibly some additional), |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
337 |
# must be done after patching. |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
338 |
( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \ |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
339 |
$(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) $(COMPARE_BUILD_CONF)) |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
340 |
|
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
341 |
post-compare-build: |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
342 |
# Compare first and second build. Ignore any error code from compare.sh. |
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
343 |
$(ECHO) "Comparing between comparison rebuild (this/new) and baseline (other/old)" |
32720
7e0e586a6817
8137014: Various improvements in build infrastructure
ihse
parents:
32715
diff
changeset
|
344 |
ifneq ($(COMPARE_BUILD_COMP_DIR), ) |
7e0e586a6817
8137014: Various improvements in build infrastructure
ihse
parents:
32715
diff
changeset
|
345 |
+(cd $(OUTPUT_ROOT) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) -2dirs $(OUTPUT_ROOT)/$(COMPARE_BUILD_COMP_DIR) $(OUTPUT_ROOT).OLD/$(COMPARE_BUILD_COMP_DIR) || true) |
7e0e586a6817
8137014: Various improvements in build infrastructure
ihse
parents:
32715
diff
changeset
|
346 |
else |
7e0e586a6817
8137014: Various improvements in build infrastructure
ihse
parents:
32715
diff
changeset
|
347 |
+(cd $(OUTPUT_ROOT) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) -o $(OUTPUT_ROOT).OLD || true) |
7e0e586a6817
8137014: Various improvements in build infrastructure
ihse
parents:
32715
diff
changeset
|
348 |
endif |
32715
4d558a41a1ec
8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents:
32461
diff
changeset
|
349 |
|
32344
0b288e0efcfa
8062618: Create a build failure summary at end of build log
ihse
parents:
30415
diff
changeset
|
350 |
.PHONY: print-targets print-modules reconfigure main on-failure |
29662 | 351 |
endif |