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

Last change on this file since 30 was 2, checked in by dmik, 15 years ago

Imported OpenJDK 6 b19 sources from Oracle.

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