source: trunk/openjdk/make/sanity-rules.gmk@ 302

Last change on this file since 302 was 278, checked in by dmik, 14 years ago

trunk: Merged in openjdk6 b22 from branches/vendor/oracle.

File size: 11.2 KB
Line 
1#
2# Copyright (c) 2001, 2010, 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#
25
26################################################################
27# SANITY
28################################################################
29
30sanity:: pre-sanity settings insane environment
31
32ifeq ($(BUILD_HOTSPOT), true)
33 sanity:: hotspot-sanity
34endif
35
36ifeq ($(BUILD_JDK), true)
37 sanity:: jdk-sanity
38endif
39
40sanity:: post-sanity
41
42source-sanity : pre-sanity alt_bootdir bootdir post-sanity
43
44$(ERROR_FILE) $(WARNING_FILE) $(MESSAGE_FILE):
45 @$(prep-target)
46
47purge-sanity: $(ERROR_FILE) $(WARNING_FILE) $(MESSAGE_FILE)
48 -@$(RM) $(ERROR_FILE) $(WARNING_FILE) $(MESSAGE_FILE)
49
50pre-sanity: purge-sanity
51
52# this should be the last rule in any target's sanity rule.
53post-sanity post-sanity-hotspot post-sanity-jdk:
54 @if [ -r $(MESSAGE_FILE) ]; then \
55 $(ECHO) "" ; \
56 $(CAT) $(MESSAGE_FILE) ; \
57 fi
58 @if [ -r $(WARNING_FILE) ]; then \
59 $(CAT) $(WARNING_FILE) ; \
60 fi
61 @if [ "x$(INSANE)" != x ]; then \
62 $(ECHO) "INSANE mode requested. \n" \
63 "Sanity will not force a build termination, even with errors.\n" \
64 "" >> $(ERROR_FILE); \
65 fi
66 @if [ -r $(ERROR_FILE) ]; then \
67 if [ "x$(INSANE)" = x ]; then \
68 $(ECHO) "Exiting because of the above error(s). \n" \
69 "">> $(ERROR_FILE); \
70 fi ; \
71 $(CAT) $(ERROR_FILE) ; \
72 if [ "x$(INSANE)" = x ]; then \
73 exit 1 ; \
74 fi ; \
75 fi
76ifdef PEDANTIC
77 @if [ -r $(WARNING_FILE) ]; then \
78 $(ECHO) "PEDANTIC mode requested. \n" \
79 "Exiting because of the above warning(s). \n" \
80 "" >> $(ERROR_FILE); \
81 $(CAT) $(ERROR_FILE) ; \
82 exit 1 ; \
83 fi
84endif
85 @if [ ! -r $(ERROR_FILE) ]; then \
86 $(ECHO) "Sanity check passed." ; \
87 fi
88
89insane:
90ifdef INSANE
91 @$(ECHO) "WARNING: You are building in 'INSANE' mode. You \n" \
92 " should not use this mode, and in fact, \n" \
93 " it may be removed at any time. If you \n" \
94 " have build problems as a result of using \n" \
95 " INSANE mode, then you should not expect \n" \
96 " assistance from anyone with the problems \n" \
97 " or consequences you experience. \n" \
98 "" >> $(WARNING_FILE)
99endif
100
101# Get list of environment variables set that we do not want set
102ifdef ALT_HOTSPOT_SERVER_PATH
103 DO_NOT_SET_LIST += ALT_HOTSPOT_SERVER_PATH
104endif
105ifdef ALT_HOTSPOT_CLIENT_PATH
106 DO_NOT_SET_LIST += ALT_HOTSPOT_CLIENT_PATH
107endif
108ifdef ALT_HOTSPOT_LIB_PATH
109 DO_NOT_SET_LIST += ALT_HOTSPOT_LIB_PATH
110endif
111
112# Error message for environment variable set that should not be
113%.do_not_set:
114 @$(ECHO) "ERROR: Your build environment has the variable\n" \
115 " $* defined. Please unset it and restart your build. \n" \
116 "" >> $(ERROR_FILE)
117
118# Check the environment variables
119environment: $(DO_NOT_SET_LIST:%=%.do_not_set)
120ifeq ($(LANGTOOLS_SRC_AVAILABLE), true)
121 ifneq ($(BUILD_LANGTOOLS), true)
122 @$(ECHO) "WARNING: You are not building the LANGTOOLS sources.\n" \
123 " Lang tools (javac) will be obtained from \n" \
124 " the location set in ALT_JDK_IMPORT_PATH. \n" \
125 "" >> $(WARNING_FILE)
126 endif
127endif
128ifeq ($(JAXP_SRC_AVAILABLE), true)
129 ifneq ($(BUILD_JAXP), true)
130 @$(ECHO) "WARNING: You are not building the JAXP sources.\n" \
131 " The jaxp files will be obtained from \n" \
132 " the location set in ALT_JDK_IMPORT_PATH. \n" \
133 "" >> $(WARNING_FILE)
134 endif
135endif
136ifeq ($(JAXWS_SRC_AVAILABLE), true)
137 ifneq ($(BUILD_JAXWS), true)
138 @$(ECHO) "WARNING: You are not building the JAXWS sources.\n" \
139 " The jaxws files will be obtained from \n" \
140 " the location set in ALT_JDK_IMPORT_PATH. \n" \
141 "" >> $(WARNING_FILE)
142 endif
143endif
144ifeq ($(CORBA_SRC_AVAILABLE), true)
145 ifneq ($(BUILD_CORBA), true)
146 @$(ECHO) "WARNING: You are not building the CORBA sources.\n" \
147 " The corba files will be obtained from \n" \
148 " the location set in ALT_JDK_IMPORT_PATH. \n" \
149 "" >> $(WARNING_FILE)
150 endif
151endif
152ifeq ($(HOTSPOT_SRC_AVAILABLE), true)
153 ifneq ($(BUILD_HOTSPOT), true)
154 @$(ECHO) "WARNING: You are not building the HOTSPOT sources.\n" \
155 " Hotspot libs will be obtained from \n" \
156 " the location set in ALT_HOTSPOT_IMPORT_PATH. \n" \
157 "" >> $(WARNING_FILE)
158 endif
159endif
160ifeq ($(JDK_SRC_AVAILABLE), true)
161 ifneq ($(BUILD_JDK), true)
162 @$(ECHO) "WARNING: You are not building the JDK sources.\n" \
163 " This will result in a development-only\n" \
164 " build of the JDK , lacking the jdk binaries.\n" \
165 "" >> $(WARNING_FILE)
166 endif
167endif
168ifeq ($(JDK_SRC_AVAILABLE), true)
169 ifneq ($(BUILD_JDK), true)
170 @$(ECHO) "WARNING: You are not building JDK from\n" \
171 " the control build. This will result in a development-only\n" \
172 " build of the JDK , lacking the jdk binaries.\n" \
173 "" >> $(WARNING_FILE)
174 endif
175endif
176ifdef NO_DOCS
177 @$(ECHO) "WARNING: Your build environment has the variable NO_DOCS\n" \
178 " defined. This will result in a development-only\n" \
179 " build of the JDK, lacking the documentation\n" \
180 " build.\n" \
181 "" >> $(WARNING_FILE)
182endif
183ifdef NO_IMAGES
184 @$(ECHO) "WARNING: Your build environment has the variable NO_IMAGES\n" \
185 " defined. This will result in a development-only\n" \
186 " build of the JDK, lacking the install images\n" \
187 " and bundles.\n" \
188 "" >> $(WARNING_FILE)
189endif
190ifdef DEV_ONLY
191 @$(ECHO) "WARNING: Your build environment has the variable DEV_ONLY\n" \
192 " defined. This will result in a development-only\n" \
193 " build of the JDK, lacking the documentation\n" \
194 " build and installation bundles.\n" \
195 "" >> $(WARNING_FILE)
196endif
197
198######################################################
199# if specified, ALT_BOOTDIR must point to non-relative path if set
200######################################################
201alt_bootdir:
202ifdef ALT_BOOTDIR
203 @if [ `$(ECHO) $(subst \,/,$(ALT_BOOTDIR)) | $(EGREP) -ci '^([a-z]:)?/'` -ne 1 ]; then \
204 $(ECHO) "ERROR: ALT_BOOTDIR must be an Absolute Path Name, \n" \
205 " not a Relative Path Name. \n" \
206 " The current value of ALT_BOOTDIR is \n" \
207 " $(ALT_BOOTDIR) \n" \
208 " Please fix this and continue your build. \n" \
209 "" >> $(ERROR_FILE) ; \
210 fi
211endif
212
213######################################################
214# BOOTDIR must point to a valid JDK.
215######################################################
216JAVA_VERSION := $(shell $(BOOTDIR)/bin/java$(EXE_SUFFIX) -version 2>&1 | $(NAWK) -F'"' '{ print $$2 }')
217JAVA_VERSION_OK := $(shell $(ECHO) $(JAVA_VERSION) | $(EGREP) -c '^1.[5-6].[0-9]')
218bootdir:
219 @if [ -x $(BOOTDIR)/bin/java$(EXE_SUFFIX) ]; then \
220 if [ $(JAVA_VERSION_OK) -ne 1 ]; then \
221 $(ECHO) "ERROR: Your BOOTDIR environment variable does not point \n" \
222 " to a valid JDK for bootstrapping this build. \n" \
223 " A JDK $(JDK_MKTG_VERSION) source generation process must be \n" \
224 " bootstrapped using JDK $(PREVIOUS_JDK_VERSION) fcs (or later). \n" \
225 " Apparently, your bootstrap JDK is version $(JAVA_VERSION) \n" \
226 " Please update your ALT_BOOTDIR setting and start your build again. \n" \
227 "" >> $(ERROR_FILE) ; \
228 fi \
229 else \
230 $(ECHO) "ERROR: BOOTDIR does not point to a valid Java 2 SDK \n" \
231 " Check that you have access to \n" \
232 " $(BOOTDIR)/bin/java$(EXE_SUFFIX) \n" \
233 " and/or check your value of ALT_BOOTDIR. \n" \
234 "" >> $(ERROR_FILE) ; \
235 fi
236
237######################################################
238# dump out the variable settings...
239######################################################
240ifneq ($(PLATFORM), windows)
241 ifndef HOSTNAME
242 HOSTNAME := $(shell hostname)
243 endif
244endif
245settings::
246 @$(ECHO) "Build Machine Information:" >> $(MESSAGE_FILE)
247ifeq ($(PLATFORM), windows)
248 @$(ECHO) " build machine = $(COMPUTERNAME)" >> $(MESSAGE_FILE)
249else
250 @$(ECHO) " build machine = $(HOSTNAME)" >> $(MESSAGE_FILE)
251endif
252 @$(ECHO) "" >> $(MESSAGE_FILE)
253 @$(ECHO) "Build Directory Structure:" >> $(MESSAGE_FILE)
254 @$(ECHO) " CWD = `$(PWD)`" >> $(MESSAGE_FILE)
255 @$(ECHO) " TOPDIR = $(TOPDIR)" >> $(MESSAGE_FILE)
256ifeq ($(LANGTOOLS_SRC_AVAILABLE), true)
257 @$(ECHO) " LANGTOOLS_TOPDIR = $(LANGTOOLS_TOPDIR)" >> $(MESSAGE_FILE)
258endif
259ifeq ($(JAXP_SRC_AVAILABLE), true)
260 @$(ECHO) " JAXP_TOPDIR = $(JAXP_TOPDIR)" >> $(MESSAGE_FILE)
261endif
262ifeq ($(JAXWS_SRC_AVAILABLE), true)
263 @$(ECHO) " JAXWS_TOPDIR = $(JAXWS_TOPDIR)" >> $(MESSAGE_FILE)
264endif
265ifeq ($(CORBA_SRC_AVAILABLE), true)
266 @$(ECHO) " CORBA_TOPDIR = $(CORBA_TOPDIR)" >> $(MESSAGE_FILE)
267endif
268ifeq ($(HOTSPOT_SRC_AVAILABLE), true)
269 @$(ECHO) " HOTSPOT_TOPDIR = $(HOTSPOT_TOPDIR)" >> $(MESSAGE_FILE)
270endif
271ifeq ($(JDK_SRC_AVAILABLE), true)
272 @$(ECHO) " JDK_TOPDIR = $(JDK_TOPDIR)" >> $(MESSAGE_FILE)
273endif
274ifeq ($(MOTIF_SRC_AVAILABLE), true)
275 @$(ECHO) " MOTIF_TOPDIR = $(MOTIF_TOPDIR)" >> $(MESSAGE_FILE)
276endif
277 @$(ECHO) "" >> $(MESSAGE_FILE)
278ifneq ($(SKIP_COMPARE_IMAGES), true)
279 @$(ECHO) "External File/Binary Locations:" >> $(MESSAGE_FILE)
280 @$(ECHO) " PREVIOUS_JRE_BUNDLE = $(PREVIOUS_JRE_BUNDLE) " >> $(MESSAGE_FILE)
281 @$(ECHO) " PREVIOUS_JDK_BUNDLE = $(PREVIOUS_JDK_BUNDLE) " >> $(MESSAGE_FILE)
282 @$(ECHO) "" >> $(MESSAGE_FILE)
283endif
284 @$(ECHO) "Build Directives:" >> $(MESSAGE_FILE)
285ifeq ($(LANGTOOLS_SRC_AVAILABLE), true)
286 @$(ECHO) " BUILD_LANGTOOLS = $(BUILD_LANGTOOLS) " >> $(MESSAGE_FILE)
287endif
288ifeq ($(JAXP_SRC_AVAILABLE), true)
289 @$(ECHO) " BUILD_JAXP = $(BUILD_JAXP) " >> $(MESSAGE_FILE)
290endif
291ifeq ($(JAXWS_SRC_AVAILABLE), true)
292 @$(ECHO) " BUILD_JAXWS = $(BUILD_JAXWS) " >> $(MESSAGE_FILE)
293endif
294ifeq ($(CORBA_SRC_AVAILABLE), true)
295 @$(ECHO) " BUILD_CORBA = $(BUILD_CORBA) " >> $(MESSAGE_FILE)
296endif
297ifeq ($(HOTSPOT_SRC_AVAILABLE), true)
298 @$(ECHO) " BUILD_HOTSPOT = $(BUILD_HOTSPOT) " >> $(MESSAGE_FILE)
299endif
300ifeq ($(JDK_SRC_AVAILABLE), true)
301 @$(ECHO) " BUILD_JDK = $(BUILD_JDK) " >> $(MESSAGE_FILE)
302endif
303 @$(ECHO) " DEBUG_CLASSFILES = $(DEBUG_CLASSFILES) " >> $(MESSAGE_FILE)
304 @$(ECHO) " DEBUG_BINARIES = $(DEBUG_BINARIES) " >> $(MESSAGE_FILE)
305 @$(ECHO) "" >> $(MESSAGE_FILE)
306
307.PHONY: sanity settings pre-sanity insane \
308 post-sanity post-sanity-hotspot post-sanity-jdk \
309 alt_bootdir bootdir
Note: See TracBrowser for help on using the repository browser.