1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/make/sanity-rules.gmk Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,356 @@ 1.4 +# 1.5 +# Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. 1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 +# 1.8 +# This code is free software; you can redistribute it and/or modify it 1.9 +# under the terms of the GNU General Public License version 2 only, as 1.10 +# published by the Free Software Foundation. Sun designates this 1.11 +# particular file as subject to the "Classpath" exception as provided 1.12 +# by Sun in the LICENSE file that accompanied this code. 1.13 +# 1.14 +# This code is distributed in the hope that it will be useful, but WITHOUT 1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 +# version 2 for more details (a copy is included in the LICENSE file that 1.18 +# accompanied this code). 1.19 +# 1.20 +# You should have received a copy of the GNU General Public License version 1.21 +# 2 along with this work; if not, write to the Free Software Foundation, 1.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 +# 1.24 +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.25 +# CA 95054 USA or visit www.sun.com if you need additional information or 1.26 +# have any questions. 1.27 +# 1.28 + 1.29 +################################################################ 1.30 +# SANITY 1.31 +################################################################ 1.32 + 1.33 +sanity:: pre-sanity settings insane environment 1.34 + 1.35 +ifeq ($(BUILD_HOTSPOT), true) 1.36 + sanity:: hotspot-sanity 1.37 +endif 1.38 + 1.39 +ifeq ($(BUILD_DEPLOY), true) 1.40 + sanity:: deploy-sanity 1.41 +endif 1.42 + 1.43 +ifeq ($(BUILD_JDK), true) 1.44 + sanity:: jdk-sanity 1.45 +endif 1.46 + 1.47 +# Only need these sanity rules when not doing a debug build 1.48 +ifeq ($(DEBUG_NAME),) 1.49 + 1.50 + ifeq ($(BUILD_INSTALL), true) 1.51 + sanity:: install-sanity 1.52 + endif 1.53 + 1.54 + ifeq ($(BUILD_SPONSORS), true) 1.55 + sanity:: sponsors-sanity 1.56 + endif 1.57 + 1.58 +endif 1.59 + 1.60 +sanity:: post-sanity 1.61 + 1.62 +source-sanity : pre-sanity alt_bootdir bootdir post-sanity 1.63 + 1.64 +$(ERROR_FILE) $(WARNING_FILE) $(MESSAGE_FILE): 1.65 + @$(prep-target) 1.66 + 1.67 +purge-sanity: $(ERROR_FILE) $(WARNING_FILE) $(MESSAGE_FILE) 1.68 + -@$(RM) $(ERROR_FILE) $(WARNING_FILE) $(MESSAGE_FILE) 1.69 + 1.70 +pre-sanity: purge-sanity 1.71 + 1.72 +# this should be the last rule in any target's sanity rule. 1.73 +post-sanity post-sanity-hotspot post-sanity-jdk post-sanity-install post-sanity-deploy: 1.74 + @if [ -r $(MESSAGE_FILE) ]; then \ 1.75 + $(ECHO) "" ; \ 1.76 + $(CAT) $(MESSAGE_FILE) ; \ 1.77 + fi 1.78 + @if [ -r $(WARNING_FILE) ]; then \ 1.79 + $(CAT) $(WARNING_FILE) ; \ 1.80 + fi 1.81 + @if [ "x$(INSANE)" != x ]; then \ 1.82 + $(ECHO) "INSANE mode requested. \n" \ 1.83 + "Sanity will not force a build termination, even with errors.\n" \ 1.84 + "" >> $(ERROR_FILE); \ 1.85 + fi 1.86 + @if [ -r $(ERROR_FILE) ]; then \ 1.87 + if [ "x$(INSANE)" = x ]; then \ 1.88 + $(ECHO) "Exiting because of the above error(s). \n" \ 1.89 + "">> $(ERROR_FILE); \ 1.90 + fi ; \ 1.91 + $(CAT) $(ERROR_FILE) ; \ 1.92 + if [ "x$(INSANE)" = x ]; then \ 1.93 + exit 1 ; \ 1.94 + fi ; \ 1.95 + fi 1.96 +ifdef PEDANTIC 1.97 + @if [ -r $(WARNING_FILE) ]; then \ 1.98 + $(ECHO) "PEDANTIC mode requested. \n" \ 1.99 + "Exiting because of the above warning(s). \n" \ 1.100 + "" >> $(ERROR_FILE); \ 1.101 + $(CAT) $(ERROR_FILE) ; \ 1.102 + exit 1 ; \ 1.103 + fi 1.104 +endif 1.105 + @if [ ! -r $(ERROR_FILE) ]; then \ 1.106 + $(ECHO) "Sanity check passed." ; \ 1.107 + fi 1.108 + 1.109 +insane: 1.110 +ifdef INSANE 1.111 + @$(ECHO) "WARNING: You are building in 'INSANE' mode. You \n" \ 1.112 + " should not use this mode, and in fact, \n" \ 1.113 + " it may be removed at any time. If you \n" \ 1.114 + " have build problems as a result of using \n" \ 1.115 + " INSANE mode, then you should not expect \n" \ 1.116 + " assistance from anyone with the problems \n" \ 1.117 + " or consequences you experience. \n" \ 1.118 + "" >> $(WARNING_FILE) 1.119 +endif 1.120 + 1.121 +# Get list of environment variables set that we do not want set 1.122 +ifdef ALT_HOTSPOT_SERVER_PATH 1.123 + DO_NOT_SET_LIST += ALT_HOTSPOT_SERVER_PATH 1.124 +endif 1.125 +ifdef ALT_HOTSPOT_CLIENT_PATH 1.126 + DO_NOT_SET_LIST += ALT_HOTSPOT_CLIENT_PATH 1.127 +endif 1.128 +ifdef ALT_HOTSPOT_LIB_PATH 1.129 + DO_NOT_SET_LIST += ALT_HOTSPOT_LIB_PATH 1.130 +endif 1.131 + 1.132 +# Error message for environment variable set that should not be 1.133 +%.do_not_set: 1.134 + @$(ECHO) "ERROR: Your build environment has the variable\n" \ 1.135 + " $* defined. Please unset it and restart your build. \n" \ 1.136 + "" >> $(ERROR_FILE) 1.137 + 1.138 +# Check the environment variables 1.139 +environment: $(DO_NOT_SET_LIST:%=%.do_not_set) 1.140 +ifeq ($(LANGTOOLS_SRC_AVAILABLE), true) 1.141 + ifneq ($(BUILD_LANGTOOLS), true) 1.142 + @$(ECHO) "WARNING: You are not building the LANGTOOLS sources.\n" \ 1.143 + " Lang tools (javac) will be obtained from \n" \ 1.144 + " the location set in ALT_JDK_IMPORT_PATH. \n" \ 1.145 + "" >> $(WARNING_FILE) 1.146 + endif 1.147 +endif 1.148 +ifeq ($(JAXP_SRC_AVAILABLE), true) 1.149 + ifneq ($(BUILD_JAXP), true) 1.150 + @$(ECHO) "WARNING: You are not building the JAXP sources.\n" \ 1.151 + " The jaxp files will be obtained from \n" \ 1.152 + " the location set in ALT_JDK_IMPORT_PATH. \n" \ 1.153 + "" >> $(WARNING_FILE) 1.154 + endif 1.155 +endif 1.156 +ifeq ($(JAXWS_SRC_AVAILABLE), true) 1.157 + ifneq ($(BUILD_JAXWS), true) 1.158 + @$(ECHO) "WARNING: You are not building the JAXWS sources.\n" \ 1.159 + " The jaxws files will be obtained from \n" \ 1.160 + " the location set in ALT_JDK_IMPORT_PATH. \n" \ 1.161 + "" >> $(WARNING_FILE) 1.162 + endif 1.163 +endif 1.164 +ifeq ($(CORBA_SRC_AVAILABLE), true) 1.165 + ifneq ($(BUILD_CORBA), true) 1.166 + @$(ECHO) "WARNING: You are not building the CORBA sources.\n" \ 1.167 + " The corba files will be obtained from \n" \ 1.168 + " the location set in ALT_JDK_IMPORT_PATH. \n" \ 1.169 + "" >> $(WARNING_FILE) 1.170 + endif 1.171 +endif 1.172 +ifeq ($(HOTSPOT_SRC_AVAILABLE), true) 1.173 + ifneq ($(BUILD_HOTSPOT), true) 1.174 + @$(ECHO) "WARNING: You are not building the HOTSPOT sources.\n" \ 1.175 + " Hotspot libs will be obtained from \n" \ 1.176 + " the location set in ALT_HOTSPOT_IMPORT_PATH. \n" \ 1.177 + "" >> $(WARNING_FILE) 1.178 + endif 1.179 +endif 1.180 +ifeq ($(JDK_SRC_AVAILABLE), true) 1.181 + ifneq ($(BUILD_JDK), true) 1.182 + @$(ECHO) "WARNING: You are not building the JDK sources.\n" \ 1.183 + " This will result in a development-only\n" \ 1.184 + " build of the JDK , lacking the jdk binaries.\n" \ 1.185 + "" >> $(WARNING_FILE) 1.186 + endif 1.187 +endif 1.188 +ifeq ($(DEPLOY_SRC_AVAILABLE), true) 1.189 + ifneq ($(BUILD_DEPLOY), true) 1.190 + @$(ECHO) "WARNING: You are not building the DEPLOY sources.\n" \ 1.191 + " This will result in a development-only\n" \ 1.192 + " build of the JDK, lacking the plugin and javaws binaries.\n" \ 1.193 + "" >> $(WARNING_FILE) 1.194 + endif 1.195 +endif 1.196 +ifeq ($(INSTALL_SRC_AVAILABLE), true) 1.197 + ifneq ($(BUILD_INSTALL), true) 1.198 + @$(ECHO) "WARNING: You are not building the INSTALL sources.\n" \ 1.199 + " This will result in a development-only\n" \ 1.200 + " build of the JDK, lacking the installation bundles\n" \ 1.201 + "" >> $(WARNING_FILE) 1.202 + endif 1.203 +endif 1.204 +ifeq ($(SPONSORS_SRC_AVAILABLE), true) 1.205 + ifneq ($(BUILD_SPONSORS), true) 1.206 + @$(ECHO) "WARNING: You are not building the SPONSORS sources.\n" \ 1.207 + "" >> $(WARNING_FILE) 1.208 + endif 1.209 +endif 1.210 +ifndef OPENJDK 1.211 + ifdef NO_DOCS 1.212 + @$(ECHO) "WARNING: Your build environment has the variable NO_DOCS\n" \ 1.213 + " defined. This will result in a development-only\n" \ 1.214 + " build of the JDK, lacking the documentation.\n" \ 1.215 + "" >> $(WARNING_FILE) 1.216 + endif 1.217 +endif 1.218 +ifdef NO_IMAGES 1.219 + @$(ECHO) "WARNING: Your build environment has the variable NO_IMAGES\n" \ 1.220 + " defined. This will result in a development-only\n" \ 1.221 + " build of the JDK, lacking the install images\n" \ 1.222 + " and bundles.\n" \ 1.223 + "" >> $(WARNING_FILE) 1.224 +endif 1.225 +ifdef DEV_ONLY 1.226 + @$(ECHO) "WARNING: Your build environment has the variable DEV_ONLY\n" \ 1.227 + " defined. This will result in a development-only\n" \ 1.228 + " build of the JDK, lacking the documentation\n" \ 1.229 + " build and installation bundles.\n" \ 1.230 + "" >> $(WARNING_FILE) 1.231 +endif 1.232 + 1.233 +###################################################### 1.234 +# if specified, ALT_BOOTDIR must point to non-relative path if set 1.235 +###################################################### 1.236 +alt_bootdir: 1.237 +ifdef ALT_BOOTDIR 1.238 + @if [ `$(ECHO) $(subst \,/,$(ALT_BOOTDIR)) | $(EGREP) -ci '^([a-z]:)?/'` -ne 1 ]; then \ 1.239 + $(ECHO) "ERROR: ALT_BOOTDIR must be an Absolute Path Name, \n" \ 1.240 + " not a Relative Path Name. \n" \ 1.241 + " The current value of ALT_BOOTDIR is \n" \ 1.242 + " $(ALT_BOOTDIR) \n" \ 1.243 + " Please fix this and continue your build. \n" \ 1.244 + "" >> $(ERROR_FILE) ; \ 1.245 + fi 1.246 +endif 1.247 + 1.248 +###################################################### 1.249 +# BOOTDIR must point to a valid JDK. 1.250 +###################################################### 1.251 +JAVA_VERSION := $(shell $(BOOTDIR)/bin/java$(EXE_SUFFIX) -version 2>&1 | $(NAWK) -F'"' '{ print $$2 }') 1.252 +JAVA_VERSION_OK := $(shell $(ECHO) $(JAVA_VERSION) | $(EGREP) -c '^1.[5-6].[0-9]') 1.253 +bootdir: 1.254 + @if [ -x $(BOOTDIR)/bin/java$(EXE_SUFFIX) ]; then \ 1.255 + if [ $(JAVA_VERSION_OK) -ne 1 ]; then \ 1.256 + $(ECHO) "ERROR: Your BOOTDIR environment variable does not point \n" \ 1.257 + " to a valid JDK for bootstrapping this build. \n" \ 1.258 + " A JDK $(JDK_MKTG_VERSION) source generation process must be \n" \ 1.259 + " bootstrapped using JDK $(PREVIOUS_JDK_VERSION) fcs (or later). \n" \ 1.260 + " Apparently, your bootstrap JDK is version $(JAVA_VERSION) \n" \ 1.261 + " Please update your ALT_BOOTDIR setting and start your build again. \n" \ 1.262 + "" >> $(ERROR_FILE) ; \ 1.263 + fi \ 1.264 + else \ 1.265 + $(ECHO) "ERROR: BOOTDIR does not point to a valid Java 2 SDK \n" \ 1.266 + " Check that you have access to \n" \ 1.267 + " $(BOOTDIR)/bin/java$(EXE_SUFFIX) \n" \ 1.268 + " and/or check your value of ALT_BOOTDIR. \n" \ 1.269 + "" >> $(ERROR_FILE) ; \ 1.270 + fi 1.271 + 1.272 +###################################################### 1.273 +# dump out the variable settings... 1.274 +###################################################### 1.275 +ifneq ($(PLATFORM), windows) 1.276 + ifndef HOSTNAME 1.277 + HOSTNAME := $(shell hostname) 1.278 + endif 1.279 +endif 1.280 +settings:: 1.281 + @$(ECHO) "Build Machine Information:" >> $(MESSAGE_FILE) 1.282 +ifeq ($(PLATFORM), windows) 1.283 + @$(ECHO) " build machine = $(COMPUTERNAME)" >> $(MESSAGE_FILE) 1.284 +else 1.285 + @$(ECHO) " build machine = $(HOSTNAME)" >> $(MESSAGE_FILE) 1.286 +endif 1.287 + @$(ECHO) "" >> $(MESSAGE_FILE) 1.288 + @$(ECHO) "Build Directory Structure:" >> $(MESSAGE_FILE) 1.289 + @$(ECHO) " CWD = `$(PWD)`" >> $(MESSAGE_FILE) 1.290 + @$(ECHO) " TOPDIR = $(TOPDIR)" >> $(MESSAGE_FILE) 1.291 + @$(ECHO) " CONTROL_TOPDIR = $(CONTROL_TOPDIR)" >> $(MESSAGE_FILE) 1.292 +ifeq ($(LANGTOOLS_SRC_AVAILABLE), true) 1.293 + @$(ECHO) " LANGTOOLS_TOPDIR = $(LANGTOOLS_TOPDIR)" >> $(MESSAGE_FILE) 1.294 +endif 1.295 +ifeq ($(JAXP_SRC_AVAILABLE), true) 1.296 + @$(ECHO) " JAXP_TOPDIR = $(JAXP_TOPDIR)" >> $(MESSAGE_FILE) 1.297 +endif 1.298 +ifeq ($(JAXWS_SRC_AVAILABLE), true) 1.299 + @$(ECHO) " JAXWS_TOPDIR = $(JAXWS_TOPDIR)" >> $(MESSAGE_FILE) 1.300 +endif 1.301 +ifeq ($(CORBA_SRC_AVAILABLE), true) 1.302 + @$(ECHO) " CORBA_TOPDIR = $(CORBA_TOPDIR)" >> $(MESSAGE_FILE) 1.303 +endif 1.304 +ifeq ($(HOTSPOT_SRC_AVAILABLE), true) 1.305 + @$(ECHO) " HOTSPOT_TOPDIR = $(HOTSPOT_TOPDIR)" >> $(MESSAGE_FILE) 1.306 +endif 1.307 +ifeq ($(JDK_SRC_AVAILABLE), true) 1.308 + @$(ECHO) " JDK_TOPDIR = $(JDK_TOPDIR)" >> $(MESSAGE_FILE) 1.309 +endif 1.310 +ifeq ($(DEPLOY_SRC_AVAILABLE), true) 1.311 + @$(ECHO) " DEPLOY_TOPDIR = $(DEPLOY_TOPDIR)" >> $(MESSAGE_FILE) 1.312 +endif 1.313 +ifeq ($(INSTALL_SRC_AVAILABLE), true) 1.314 + @$(ECHO) " INSTALL_TOPDIR = $(INSTALL_TOPDIR)" >> $(MESSAGE_FILE) 1.315 +endif 1.316 +ifeq ($(SPONSORS_SRC_AVAILABLE), true) 1.317 + @$(ECHO) " SPONSORS_TOPDIR = $(SPONSORS_TOPDIR)" >> $(MESSAGE_FILE) 1.318 +endif 1.319 + @$(ECHO) "" >> $(MESSAGE_FILE) 1.320 +ifneq ($(SKIP_COMPARE_IMAGES), true) 1.321 + @$(ECHO) "External File/Binary Locations:" >> $(MESSAGE_FILE) 1.322 + @$(ECHO) " PREVIOUS_JRE_BUNDLE = $(PREVIOUS_JRE_BUNDLE) " >> $(MESSAGE_FILE) 1.323 + @$(ECHO) " PREVIOUS_JDK_BUNDLE = $(PREVIOUS_JDK_BUNDLE) " >> $(MESSAGE_FILE) 1.324 + @$(ECHO) "" >> $(MESSAGE_FILE) 1.325 +endif 1.326 + @$(ECHO) "Build Directives:" >> $(MESSAGE_FILE) 1.327 +ifeq ($(LANGTOOLS_SRC_AVAILABLE), true) 1.328 + @$(ECHO) " BUILD_LANGTOOLS = $(BUILD_LANGTOOLS) " >> $(MESSAGE_FILE) 1.329 +endif 1.330 +ifeq ($(JAXP_SRC_AVAILABLE), true) 1.331 + @$(ECHO) " BUILD_JAXP = $(BUILD_JAXP) " >> $(MESSAGE_FILE) 1.332 +endif 1.333 +ifeq ($(JAXWS_SRC_AVAILABLE), true) 1.334 + @$(ECHO) " BUILD_JAXWS = $(BUILD_JAXWS) " >> $(MESSAGE_FILE) 1.335 +endif 1.336 +ifeq ($(CORBA_SRC_AVAILABLE), true) 1.337 + @$(ECHO) " BUILD_CORBA = $(BUILD_CORBA) " >> $(MESSAGE_FILE) 1.338 +endif 1.339 +ifeq ($(HOTSPOT_SRC_AVAILABLE), true) 1.340 + @$(ECHO) " BUILD_HOTSPOT = $(BUILD_HOTSPOT) " >> $(MESSAGE_FILE) 1.341 +endif 1.342 +ifeq ($(JDK_SRC_AVAILABLE), true) 1.343 + @$(ECHO) " BUILD_JDK = $(BUILD_JDK) " >> $(MESSAGE_FILE) 1.344 +endif 1.345 +ifeq ($(DEPLOY_SRC_AVAILABLE), true) 1.346 + @$(ECHO) " BUILD_DEPLOY = $(BUILD_DEPLOY) " >> $(MESSAGE_FILE) 1.347 +endif 1.348 +ifeq ($(INSTALL_SRC_AVAILABLE), true) 1.349 + @$(ECHO) " BUILD_INSTALL = $(BUILD_INSTALL) " >> $(MESSAGE_FILE) 1.350 +endif 1.351 +ifeq ($(SPONSORS_SRC_AVAILABLE), true) 1.352 + @$(ECHO) " BUILD_SPONSORS = $(BUILD_SPONSORS) " >> $(MESSAGE_FILE) 1.353 +endif 1.354 + @$(ECHO) "" >> $(MESSAGE_FILE) 1.355 + 1.356 +.PHONY: sanity settings pre-sanity insane \ 1.357 + post-sanity post-sanity-hotspot post-sanity-jdk \ 1.358 + post-sanity-install post-sanity-deploy \ 1.359 + alt_bootdir bootdir