# # Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License version 2 only, as # published by the Free Software Foundation. Oracle designates this # particular file as subject to the "Classpath" exception as provided # by Oracle in the LICENSE file that accompanied this code. # # This code is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # version 2 for more details (a copy is included in the LICENSE file that # accompanied this code). # # You should have received a copy of the GNU General Public License version # 2 along with this work; if not, write to the Free Software Foundation, # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. # # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA # or visit www.oracle.com if you need additional information or have any # questions. # # # WARNING: This file is shared with other workspaces. # # # Shared sanity rules for the JDK builds. # .SUFFIXES: .hdiffs # All files created during sanity checking SANITY_FILES = $(ERROR_FILE) $(WARNING_FILE) $(MESSAGE_FILE) # Build readme BUILD_README=http://hg.openjdk.java.net/jdk7/build/raw-file/tip/README-builds.html define BuildReadme # section "See $(BUILD_README)#$1 (or file:/$(call FullPath,$(JDK_TOPDIR)/../README-builds.html)#$1)." endef # How to say "The Release Engineering people use this" THE_OFFICIAL_USES=The official $(PLATFORM) builds use # Warning about using different versions MAY_PRODUCE=This may produce binaries incorrectly or cause the build to fail. # If a comma is needed in the sentence, use ${comma} comma=, # How to say "You are using:" YOU_ARE_USING=You appear to be using # Error message define SanityError # primary secondary $(PRINTF) "\nERROR: %s\n" $1 >> $(ERROR_FILE); \ $(PRINTF) " %s\n" $2 >> $(ERROR_FILE) endef # Warning message define SanityWarning # primary secondary $(PRINTF) "\nWARNING: %s\n" $1 >> $(WARNING_FILE); \ $(PRINTF) " %s\n" $2 >> $(WARNING_FILE) endef # Issue unset variable warning define UnsetSanityWarning # name envname extraLines $(call SanityWarning, "You do not have a $(strip $1) setting.", \ "We recommend that you set $(strip $2)." $3) endef # Issue unset variable error define UnsetSanityError # name envname extraLines $(call SanityError, "You must have a $(strip $1) setting.", \ "We recommend that you set $(strip $2)." $3) endef # Issue bad variable setting error define BadPathSanityError # name envname extraLines $(call SanityError, "You do not have a valid $(strip $1) setting.", \ "Please check your access to $(strip $1)=$($(strip $1)) and/or check your value of $(strip $2)." $3) endef # Must be set and must exist and be a file define VarFileSanityCheck # name extraLines if [ ! -f "$($(strip $1))" -o ! -r "$($(strip $1))" ]; then \ $(call SanityError, "Missing file $(strip $1)=$($(strip $1)).",$2); \ fi endef # Must be set and must exist and be readable define VarPathSanityCheck # name envname extraLines if [ "$($(strip $1))" = "" ]; then \ $(call UnsetSanityError,$(strip $1),$(strip $2),$3); \ elif [ ! -d "$($(strip $1))" -o ! -r "$($(strip $1))" ]; then \ $(call BadPathSanityError,$(strip $1),$(strip $2),$3); \ fi endef # Unset is just a warning, if set must exist and be readable define OptionalVarPathSanityCheck # name envname extraLines if [ "$($(strip $1))" = "" ]; then \ $(call UnsetSanityWarning,$(strip $1),$(strip $2),$3); \ elif [ ! -d "$($(strip $1))" -o ! -r "$($(strip $1))" ]; then \ $(call BadPathSanityError,$(strip $1),$(strip $2),$3); \ fi endef # Common error, never set this environment variable define NeverSetSanityCheck # variableName $(if $($(strip $1)),$(call SanityError, \ "Your $(strip $1) environment variable is set.", \ "$(MAY_PRODUCE)" \ "Please unset $(strip $1) and start your build again."),) endef define VarPathFileSanityCheck # name envname filepath extraLines if [ ! -f "$(strip $3)" -o ! -r "$(strip $3)" ]; then \ $(call SanityError, "File $(strip $3) does not exist.",\ "You do not have a valid $(strip $1) setting." \ "Please check your access to $(strip $1)=$($(strip $1)) and/or check your value of $(strip $2)." $4); \ fi endef define OptionalVarPathFileSanityCheck # name envname filepath extraLines if [ ! -f "$(strip $3)" -o ! -r "$(strip $3)" ]; then \ $(call SanityWarning, "File $(strip $3) does not exist.",\ "You do not have a valid $(strip $1) setting." \ "Please check your access to $(strip $1)=$($(strip $1)) and/or check your value of $(strip $2)." $4); \ fi endef # Common error, version too old, silent to be same or newer define VersionSanityCheck # toolName foundVer reqVer extraLines $(if $(subst newer,,$(subst same,,$(call CheckVersions,$(strip $2),$(strip $3)))),\ $(call SanityError, \ "$(YOU_ARE_USING) $(strip $1) $(strip $2) which is a $(call CheckVersions,$(strip $2),$(strip $3)) version.", \ "$(THE_OFFICIAL_USES) $(strip $1) $(strip $3)." \ "$(MAY_PRODUCE)" \ $4)\ ,) endef # Common error, version too old, and warn if not an exact match define SameVersionSanityCheck # toolName foundVer reqVer extraLines $(if $(subst newer,,$(call CheckVersions,$(strip $2),$(strip $3))),\ $(call VersionSanityCheck,$(strip $1),$(strip $2),$(strip $3),$4),\ $(call SanityWarning, \ "$(YOU_ARE_USING) $(strip $1) $(strip $2) which is a $(call CheckVersions,$(strip $2),$(strip $3)) version.", \ "$(THE_OFFICIAL_USES) $(strip $1) $(strip $3)." \ "$(MAY_PRODUCE)" \ $4)) endef # Settings and rules to validate the JDK build environment. ifeq ($(PLATFORM), solaris) FREE_SPACE := $(shell $(DF) -b $(OUTPUTDIR) | $(TAIL) -1 | $(NAWK) '{print $$2;}') TEMP_FREE_SPACE := $(shell $(DF) -b $(TEMP_DISK) | $(TAIL) -1 | $(NAWK) '{print $$2;}') # What kind of system we are using (Variations are Solaris and OpenSolaris) OS_VERSION := $(shell uname -r) OS_VARIANT_NAME := $(strip $(shell head -1 /etc/release | awk '{print $$1;}') ) OS_VARIANT_VERSION := $(OS_VERSION) REQ_PATCH_LIST = $(JDK_TOPDIR)/make/PatchList.solaris ifeq ($(ARCH_FAMILY), sparc) PATCH_POSITION = $$4 else PATCH_POSITION = $$6 endif ifndef OPENJDK _GCC_VER :=$(shell $(GCC) -dumpversion 2>&1 ) GCC_VER :=$(call GetVersion,"$(_GCC_VER)") endif endif ifeq ($(PLATFORM), linux) FREE_SPACE := $(shell $(DF) --sync -kP $(OUTPUTDIR) | $(TAIL) -1 | $(NAWK) '{print $$4;}') TEMP_FREE_SPACE := $(shell $(DF) --sync -kP $(TEMP_DISK) | $(TAIL) -1 | $(NAWK) '{print $$4;}') # What kind of system we are using (Variation is the Linux vendor) OS_VERSION := $(shell uname -r) OS_VARIANT_NAME := $(shell \ if [ -f /etc/fedora-release ]; then \ echo "Fedora"; \ elif [ -f /etc/redhat-release ]; then \ echo "RedHat"; \ elif [ -f /etc/SuSE-release ]; then \ echo "SuSE"; \ else \ echo "Unknown"; \ fi) OS_VARIANT_VERSION := $(shell \ if [ "$(OS_VARIANT_NAME)" = "Fedora" ]; then \ $(CAT) /etc/fedora-release | $(HEAD) -1 | $(NAWK) '{ print $$3; }' ; \ fi) ALSA_INCLUDE=/usr/include/alsa/version.h ALSA_LIBRARY=/usr/lib/libasound.so _ALSA_VERSION := $(shell $(EGREP) SND_LIB_VERSION_STR $(ALSA_INCLUDE) | \ $(SED) -e 's@.*\"\(.*\)\".*@\1@' ) ALSA_VERSION := $(call GetVersion,$(_ALSA_VERSION)) endif ifeq ($(PLATFORM), windows) FREE_SPACE := $(shell $(DF) -kP $(OUTPUTDIR) | $(TAIL) -1 | $(NAWK) '{print $$4;}') TEMP_FREE_SPACE := $(shell $(DF) -kP $(TEMP_DISK) | $(TAIL) -1 | $(NAWK) '{print $$4;}') # Windows 2000 is 5.0, Windows XP is 5.1, Windows 2003 is 5.2 # Assume 5.0 (Windows 2000) if systeminfo does not help WINDOWS_MAPPING-5.0 := Windows2000 WINDOWS_MAPPING-5.1 := WindowsXP WINDOWS_MAPPING-5.2 := Windows2003 # What kind of system we are using (Variation is the common name) _OS_VERSION := \ $(shell systeminfo 2> $(DEV_NULL) | \ egrep '^OS Version:' | \ awk '{print $$3;}' ) ifeq ($(_OS_VERSION),) OS_VERSION = 5.0 else OS_VERSION = $(call MajorVersion,$(_OS_VERSION)).$(call MinorVersion,$(_OS_VERSION)) endif OS_VARIANT_NAME := $(WINDOWS_MAPPING-$(OS_VERSION)) OS_VARIANT_VERSION := $(OS_VERSION) ifdef USING_CYGWIN # CYGWIN version _CYGWIN_VER := $(SYSTEM_UNAME) CYGWIN_VER :=$(call GetVersion,$(_CYGWIN_VER)) endif DXSDK_VER := $(shell $(EGREP) DIRECT3D_VERSION $(DXSDK_INCLUDE_PATH)/d3d9.h 2>&1 | \ $(EGREP) "\#define" | $(NAWK) '{print $$3}') endif # Get the version numbers of what we are using _MAKE_VER :=$(shell $(MAKE) --version 2>&1 | $(HEAD) -n 1) _ZIP_VER :=$(shell $(ZIPEXE) -help 2>&1 | $(HEAD) -n 4 | $(EGREP) '^Zip') _UNZIP_VER :=$(shell $(UNZIP) -help 2>&1 | $(HEAD) -n 4 | $(EGREP) '^UnZip') _BOOT_VER :=$(shell $(BOOTDIR)/bin/java -version 2>&1 | $(HEAD) -n 1) MAKE_VER :=$(call GetVersion,"$(_MAKE_VER)") ZIP_VER :=$(call GetVersion,"$(_ZIP_VER)") UNZIP_VER :=$(call GetVersion,"$(_UNZIP_VER)") BOOT_VER :=$(call GetVersion,"$(_BOOT_VER)") _ANT_VER:=$(shell $(ANT) -version 2>&1 ) ANT_VER:=$(call GetVersion,"$(_ANT_VER)") ifdef ALT_BINDIR ALT_BINDIR_VERSION := $(shell $(ALT_BINDIR)/java$(EXE_SUFFIX) -version 2>&1 | $(NAWK) -F'"' '{ print $$2 }') ALT_BINDIR_OK := $(shell $(ECHO) $(ALT_BINDIR_VERSION) | $(EGREP) -c '^$(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION)') endif INSTALL_PATCHES_FILE = $(TEMPDIR)/installed.patches # Get ALL_SETTINGS defined include $(JDK_MAKE_SHARED_DIR)/Sanity-Settings.gmk .PHONY: \ sane-copyrightyear\ sane-settings \ sane-insane \ sane-build_number \ sane-os_version \ sane-memory_check \ sane-windows \ sane-locale \ sane-linux \ sane-cygwin \ sane-cygwin-shell \ sane-mks \ sane-arch_data_model \ sane-os_patch_level \ sane-classpath \ sane-java_home \ sane-fonts \ sane-binary-plugs \ sane-variant \ sane-ld_library_path \ sane-ld_library_path_64 \ sane-ld_options \ sane-ld_run_path \ sane-makeflags \ sane-alt_outputdir \ sane-outputdir \ sane-alt_bootdir \ sane-bootdir \ sane-local-bootdir \ sane-cups \ sane-devtools_path \ sane-compiler_path \ sane-unixcommand_path \ sane-usrbin_path \ sane-unixccs_path \ sane-docs_import \ sane-math_iso \ sane-libCrun \ sane-odbcdir \ sane-msdevtools_path \ sane-hotspot_binaries \ sane-hotspot_import \ sane-hotspot_import_dir \ sane-hotspot_import_include \ sane-compiler \ sane-link \ sane-cacerts \ sane-alsa-headers \ sane-ant_version \ sane-zip_version \ sane-unzip_version \ sane-msvcrt_path \ sane-freetype \ sane-build_modules ###################################################### # check for COPYRIGHT_YEAR variable ###################################################### sane-copyrightyear: ifdef ALT_COPYRIGHT_YEAR @$(call SanityWarning, \ "ALT_COPYRIGHT_YEAR but not the current year will be used for copyright year.",) endif ###################################################### # check for INSANE variable ###################################################### sane-insane: ifdef INSANE @$(call SanityWarning, \ "You are building in 'INSANE' mode${comma} this is not a supported option.", \ "Builds can be unpredictable and should not be trusted.") endif ###################################################### # check for GNU Make version ###################################################### sane-make: @$(call VersionSanityCheck,make,\ $(MAKE_VER),$(REQUIRED_MAKE_VER),) ###################################################### # Check the BUILD_NUMBER to make sure it contains bNN ###################################################### sane-build_number: @if [ "`$(ECHO) $(BUILD_NUMBER) | $(SED) 's@.*b[0-9][0-9]*.*@bNN@'`" != "bNN" ]; then \ $(call SanityWarning, \ "The BUILD_NUMBER needs to contain b[0-9][0-9]*.", \ "Currently BUILD_NUMBER=$(BUILD_NUMBER). \ This has been known to cause build failures.") ; \ fi ###################################################### # Check the ARCH_DATA_MODEL setting ###################################################### sane-arch_data_model: ifneq ($(ARCH_DATA_MODEL),32) ifneq ($(ARCH_DATA_MODEL),64) @$(call SanityError, \ "The setting of ARCH_DATA_MODEL must be 32 or 64.", \ "$(YOU_ARE_USING) ARCH_DATA_MODEL=$(ARCH_DATA_MODEL).") endif endif ###################################################### # Check the OS version # NOTE: OPENJDK explicitly does not check for OS release information. # Unless we know for sure that it will not build somewhere, we cannot # generate a fatal sanity error, and a warning about the official # build platform just becomes clutter. ###################################################### sane-os_version:: sane-arch_data_model sane-memory_check sane-locale sane-os_patch_level ifndef OPENJDK ifeq ($(OS_VARIANT_NAME),$(REQUIRED_OS_VARIANT_NAME)) @$(call SameVersionSanityCheck,$(OS_VARIANT_NAME) version, \ $(OS_VARIANT_VERSION),$(REQUIRED_OS_VARIANT_VERSION),) else @$(call SanityWarning,\ "$(OS_VARIANT_NAME) is not the required or expected $(REQUIRED_OS_VARIANT_NAME) variation.", ) @$(call SameVersionSanityCheck,$(PLATFORM) version,\ $(OS_VERSION),$(REQUIRED_OS_VERSION),) endif else ifeq ($(OS_VARIANT_NAME),$(REQUIRED_OS_VARIANT_NAME)) @$(call VersionSanityCheck,$(OS_VARIANT_NAME) version,\ $(OS_VARIANT_VERSION),$(REQUIRED_OS_VARIANT_VERSION),) else @$(call SanityWarning,\ "$(OS_VARIANT_NAME) is not the required $(REQUIRED_OS_VARIANT_NAME)", ) @$(call VersionSanityCheck,$(PLATFORM) version,\ $(OS_VERSION),$(REQUIRED_OS_VERSION),) endif endif # OPENJDK ifeq ($(PLATFORM), windows) sane-os_version:: sane-cygwin sane-mks sane-cygwin-shell endif ###################################################### # Check the memory available on this machine ###################################################### sane-memory_check: @if [ "$(LOW_MEMORY_MACHINE)" = "true" ]; then \ $(call SanityWarning, \ "This machine appears to only have $(MB_OF_MEMORY)Mb of physical memory.", \ "Builds on this machine could be slow.") ; \ fi ###################################################### # Check the locale (value of LC_ALL, not being empty or ==C can be a problem) ###################################################### sane-locale: ifneq ($(PLATFORM), windows) @if [ "$(LC_ALL)" != "" -a "$(LC_ALL)" != "C" ]; then \ $(call SanityWarning, \ "LC_ALL has been set to $(LC_ALL)${comma} this can cause build failures.", \ "Try setting LC_ALL to \"C\"."); \ fi @if [ "$(LANG)" != "" -a "$(LANG)" != "C" ]; then \ $(call SanityWarning, \ "LANG has been set to $(LANG)${comma} this can cause build failures.", \ "Try setting LANG to \"C\".") ; \ fi endif ###################################################### # Check the Windows cygwin version ###################################################### ifeq ($(PLATFORM), windows) sane-cygwin: ifdef USING_CYGWIN @$(call VersionSanityCheck,CYGWIN,\ $(CYGWIN_VER),$(REQUIRED_CYGWIN_VER),) endif endif ###################################################### # Check the cygwin shell is used, not cmd.exe ###################################################### ifeq ($(PLATFORM), windows) sane-cygwin-shell: ifdef USING_CYGWIN @if [ "$(SHLVL)" = "" -a "$(_)" = "" ]; then \ $(call SanityError, \ "You are using an unsupported shell.", \ "Use either sh${comma} bash${comma} ksh${comma} zsh${comma} or tcsh." \ "Using the cmd.exe utility is not supported." \ "If you still want to try your current shell${comma} \ please export SHLVL=1 when running $(MAKE)."); \ fi endif endif ###################################################### # Check the Windows mks version ###################################################### ifeq ($(PLATFORM), windows) sane-mks: ifndef USING_CYGWIN @$(call VersionSanityCheck,MKS,\ $(MKS_VER),$(REQUIRED_MKS_VER),) endif endif ###################################################### # Get list of installed patches (this file has a particular format) ###################################################### $(INSTALL_PATCHES_FILE): @$(prep-target) ifeq ($(PLATFORM), solaris) ifeq ($(OS_VERSION),$(REQUIRED_OS_VERSION)) $(SHOWREV) -p > $@ 2>&1 endif endif @$(ECHO) "" >> $@ ###################################################### # Check list of Solaris patches ###################################################### sane-os_patch_level: $(INSTALL_PATCHES_FILE) ifeq ($(PLATFORM), solaris) ifeq ($(OS_VERSION),$(REQUIRED_OS_VERSION)) @$(NAWK) 'BEGIN { \ readingInstallPatches = 0; \ requiredCount = 0; \ installCount = 0; \ } \ { \ if (readingInstallPatches) { \ if ($$1=="Patch:") { \ ns = split($$2,parts,"-"); \ installPatchNo[installCount]=parts[1]; \ installPatchRev[installCount]=parts[2]; \ installCount++; \ } \ } \ \ if (!readingInstallPatches) { \ if (index($$1,"#") != 0) continue; \ if (match($$1,"BUILD") > 0 \ && $$2 == $(OS_VERSION) \ && ($$7 == "REQ" || $$7 == "req") \ && $(PATCH_POSITION) != "none" \ && $(PATCH_POSITION) != "NONE") { \ ns = split($(PATCH_POSITION),parts,"-"); \ requiredPatchNo[requiredCount]=parts[1]; \ requiredPatchRev[requiredCount]=parts[2]; \ requiredCount++; \ } \ } \ } \ END { \ errorCount=0; \ for (i=0; i= requiredPatchRev[i]) { \ foundMatch = 1; \ break; \ } \ } \ if ( foundMatch == 0) { \ printf("WARNING: Your solaris install is missing the required patch %s-%s\n", requiredPatchNo[i], requiredPatchRev[i] ); \ printf(" Please update your your system patches or build on a different machine.\n\n" ); \ errorCount++; \ } \ } \ }' $(REQ_PATCH_LIST) readingInstallPatches=1 $(INSTALL_PATCHES_FILE) >> $(WARNING_FILE) endif endif # PLATFORM ###################################################### # CLASSPATH cannot be set, unless you are insane. ###################################################### sane-classpath: @$(call NeverSetSanityCheck, CLASSPATH) ###################################################### # JAVA_HOME cannot be set, unless you are insane. ###################################################### sane-java_home: @$(call NeverSetSanityCheck, JAVA_HOME) ###################################################### # Make sure the fonts are there # Exceptions are when explicitly building OPENJDK, or # when the entire CLOSED_SRC dir is excluded, so we are # implicitly building OPENJDK ###################################################### FONT_FILE=$(CLOSED_SRC)/share/lib/fonts/LucidaTypewriterRegular.ttf sane-fonts: ifndef OPENJDK @if [ -d $(CLOSED_SRC) ]; then \ $(call VarFileSanityCheck,FONT_FILE, \ "Verify you have downloaded and overlayed on the source area all the binary files.") ; \ fi endif ###################################################### # If building OPENJDK check pre-built binaries are # available for binary plug source components. ###################################################### ifdef OPENJDK sane-binary-plugs: ifeq ($(IMPORT_BINARY_PLUGS),true) @$(call OptionalVarPathSanityCheck,\ BINARY_PLUGS_PATH,ALT_BINARY_PLUGS_PATH, ) endif endif ###################################################### # VARIANT must be set to DBG or OPT ###################################################### sane-variant: ifneq ($(VARIANT),DBG) ifneq ($(VARIANT),OPT) @$(call SanityError, \ "Your VARIANT environment variable is set to VARIANT=$(VARIANT) \ and needs to be set to DBG or OPT.",) endif endif ###################################################### # LD_LIBRARY_PATH should not be set, unless you are insane. ###################################################### sane-ld_library_path: @$(call NeverSetSanityCheck, LD_LIBRARY_PATH) ###################################################### # LD_LIBRARY_PATH_64 should not be set, unless you are insane. ###################################################### sane-ld_library_path_64: @$(call NeverSetSanityCheck, LD_LIBRARY_PATH_64) ###################################################### # LD_OPTIONS should not be set, unless you are insane. ###################################################### sane-ld_options: @$(call NeverSetSanityCheck, LD_OPTIONS) ###################################################### # LD_RUN_PATH should not be set, unless you are insane. ###################################################### sane-ld_run_path: @$(call NeverSetSanityCheck, LD_RUN_PATH) ###################################################### # MAKEFLAGS cannot be set, unless you are insane. # it is unacceptable to have these in MAKEFLAGS # -e or --environment-overrides # -i or --ignore-errors # -I or --include-dir # -k or --keep-going # -r or --nobuiltin-rules # -o or --assume-old or --old-filevalue # -t or --touch value in MAKEFLAGS # Note - some may be processed out in GNU Make startup ###################################################### sane-makeflags: ifeq ($(origin MAKEFLAGS),environment) @if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(e|--environment-overrides)( |$$)'` -ne 0 ]; then \ $(call SanityError, \ "Either the build was started with the flag -e or \ --environment-overrides or the MAKEFLAGS variable has this value set.", \ "This will cause any environment variables you have defined to override \ the values defined by the makefiles." \ "This practice is not recommemded by the authors of GNU Make \ and will lead to an improper build." \ "Please fix and restart the build.") ; \ fi @if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(i|--ignore-errors)( |$$)'` -ne 0 ]; then \ $(call SanityError, \ "Either the build was started with the flag -i or \ --ignore-errors or the MAKEFLAGS environment variable has this value set.", \ "You will be unable to determine if the build is broken or not." \ "Please fix and restart the build.") ; \ fi @if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(I|--include-dir)( |$$)'` -ne 0 ]; then \ $(call SanityError, \ "Either the build was started with the flag -I or --include-dir \ or the MAKEFLAGS environment variable has this value set.", \ "This will render your build questionable as not all the rules and \ dependencies are captured by the build." \ "Please fix and restart the build.") ; \ fi @if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(k|--keep-going)( |$$)'` -ne 0 ]; then \ $(call SanityError, \ "Either the build was started with the flag -k or --keep-going \ or the MAKEFLAGS environment variable has this value set.", \ "You will be unable to determine if the build is broken or not." \ "Please fix and restart the build.") ; \ fi @if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(o|--assume-old|--old-file)( |$$)'` -ne 0 ]; then \ $(call SanityError, \ "Either the build was started with the flag -o or --assume-old or --old-file \ or the MAKEFLAGS environment variable has this value set.", \ "This could prevent the build from executing rules it should \ thus rendering a questionable result." \ "Please fix and restart the build.") ; \ fi @if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(r|--no-builtin-rules)( |$$)'` -ne 0 ]; then \ $(call SanityError, \ "Either the build was started with the flag -r or --no-builtin-rules \ or the MAKEFLAGS environment variable has this value set.", \ "This may break the build by not allowing builtin rules that may be required." \ "Please fix and restart the build.") ; \ fi @if [ `$(ECHO) $(MAKEFLAGS) | $(EGREP) -c '(^| )(t|--touch)( |$$)'` -ne 0 ]; then \ $(call SanityError, \ "Either the build was started with the flag -t or --touch \ or the MAKEFLAGS environment variable has this value set.", \ "This will leave the build in a unclear state and could lead to not \ executing rules which should be executed." \ "Please fix and restart the build.") ; \ fi @$(call NeverSetSanityCheck, MAKEFLAGS) endif ###################################################### # if specified, ALT_OUTPUTDIR must point to non-relative path if set ###################################################### sane-alt_outputdir: ifdef ALT_OUTPUTDIR @if [ `$(ECHO) $(subst \,/,$(ALT_OUTPUTDIR)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \ $(call SanityError, \ "ALT_OUTPUTDIR must be an Absolute Path Name not a Relative Path Name.",) ; \ fi ifeq ($(PLATFORM), windows) @if [ `$(ECHO) $(subst \,/,$(ALT_OUTPUTDIR)) | $(EGREP) -c '^([A-Za-z]:)'` -ne 1 ]; then \ $(call SanityError, \ "On windows ALT_OUTPUTDIR must contain the drive letter.",) ; \ fi endif endif ###################################################### # OUTPUTDIR tests ###################################################### sane-outputdir: @$(call VarPathSanityCheck,OUTPUTDIR,ALT_OUTPUTDIR, ) @if [ ! -w "$(OUTPUTDIR)" ]; then \ $(call SanityError, \ "You must have write permissions to OUTPUTDIR.", \ "The current value of OUTPUTDIR is $(OUTPUTDIR)." \ "Either obtain these permissions or set ALT_OUTPUTDIR.") ; \ fi @if [ $(FREE_SPACE) -lt $(REQUIRED_FREE_SPACE) ]; then \ $(call SanityWarning, \ "You may not have enough free space in your OUTPUTDIR.", \ "The current value of OUTPUTDIR is $(OUTPUTDIR)." \ "You need '$(REQUIRED_FREE_SPACE)' Kbytes free on this device to build \ and it appears that only '$(FREE_SPACE)' Kbytes are free." \ "Either obtain more space or set ALT_OUTPUTDIR to a larger disk.") ; \ fi ###################################################### # if specified, ALT_BOOTDIR must point to non-relative path if set ###################################################### sane-alt_bootdir: ifdef ALT_BOOTDIR @if [ `$(ECHO) $(subst \,/,$(ALT_BOOTDIR)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \ $(call SanityError, \ "ALT_BOOTDIR must be an Absolute Path Name${comma} not a Relative Path Name.", \ "The current value of ALT_BOOTDIR is $(ALT_BOOTDIR)." \ "Please fix this and continue your build.") ; \ fi endif ###################################################### # BOOTDIR must point to a valid JDK. ###################################################### sane-bootdir: @$(call VersionSanityCheck,boot JDK,\ $(BOOT_VER),$(REQUIRED_BOOT_VER), \ "Your ALT_BOOTDIR environment variable does not point to a valid JDK \ for bootstrapping this build." \ "A JDK $(JDK_MINOR_VERSION) $(MARKET_NAME) build must be bootstrapped using \ JDK $(PREVIOUS_JDK_VERSION) fcs (or later).") ###################################################### # BOOTDIR is recommended to reside on a local drive ###################################################### sane-local-bootdir: ifeq ($(PLATFORM), windows) @if [ `$(ECHO) $(BOOTDIR) | $(EGREP) -c '^[jJ]:'` -ne 0 ]; then \ $(call SanityWarning, \ "Your BOOTDIR is located on the J: drive.", \ "Often the J: drive is mapped over a network." \ "Using a mapped drive for the BOOTDIR may significantly slow down the build process." \ "You may want to consider using the ALT_BOOTDIR variable to point the build \ to another location for the BOOTDIR instead." \ "Your current BOOTDIR is: $(BOOTDIR)") ; \ fi endif ###################################################### # CACERTS_FILE must be absoulte path and readable ###################################################### sane-cacerts: ifdef ALT_CACERTS_FILE @if [ `$(ECHO) $(subst \,/,$(ALT_CACERTS_FILE)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \ $(call SanityError, \ "ALT_CACERTS_FILE must be an Absolute Path Name not a Relative Path Name.", \ "The current value of ALT_CACERTS_FILE is $(ALT_CACERTS_FILE)." \ "Please fix this and continue your build.") ; \ fi endif @# @# CACERTS_FILE must be readable @# @if [ ! -r "$(subst \,/,$(CACERTS_FILE))" ]; then \ $(call SanityError, \ "You do not have access to a valid cacerts file.", \ "Please check your access to $(subst \,/,$(CACERTS_FILE)) \ and/or check your value of ALT_CACERTS_FILE.") ; \ fi @# @# CACERTS_FILE must be a file @# @if [ -d "$(subst \,/,$(CACERTS_FILE))" ]; then \ $(call SanityError, \ "You do not have access to a valid cacerts file.", \ "The value of CACERTS_FILE must point to a normal file." \ "Please check your access to $(subst \,/,$(CACERTS_FILE)) \ and/or check your value of ALT_CACERTS_FILE.") ; \ fi ###################################################### # Check for availability of FreeType (OpenJDK specific) ###################################################### ifdef OPENJDK # The freetypecheck Makefile prints out "Failed" if not good enough $(TEMPDIR)/freetypeinfo: FRC @$(prep-target) @(($(CD) $(BUILDDIR)/tools/freetypecheck && $(MAKE)) || \ $(ECHO) "Failed to build freetypecheck." ) > $@ sane-freetype: $(TEMPDIR)/freetypeinfo @if [ "`$(CAT) $< | $(GREP) Fail`" != "" ]; then \ $(call SanityError, \ "FreeType version $(REQUIRED_FREETYPE_VERSION) or higher is required.", \ "`$(CAT) $<`") ; \ fi else #do nothing (not OpenJDK) sane-freetype: endif ###################################################### # if specified, BUILD_MODULES must contain valid values. ###################################################### MODULES_REGEX="all|base|desktop|management|enterprise|misc|tools" sane-build_modules: ifdef BUILD_MODULES @for m in $(BUILD_MODULES) ; do \ valid=`$(ECHO) $$m | $(EGREP) $(MODULES_REGEX)`; \ if [ "x$$valid" = "x" ]; then \ $(call SanityError, \ "$$m set in the BUILD_MODULES variable is invalid.", ) ; \ fi \ done endif ###################################################### # CUPS_HEADERS_PATH must be valid ###################################################### sane-cups: ifneq ($(PLATFORM), windows) @$(call VarPathFileSanityCheck,\ CUPS_HEADERS_PATH,ALT_CUPS_HEADERS_PATH,\ $(CUPS_HEADERS_PATH)/cups/cups.h,$(call BuildReadme,cups)) endif ###################################################### # Check for existence of DEVTOOLS_PATH ###################################################### sane-devtools_path: @$(call VarPathSanityCheck,DEVTOOLS_PATH,ALT_DEVTOOLS_PATH, ) ###################################################### # Check for existence of MS_RUNTIME_LIBRARIES ###################################################### sane-msvcrt_path: ifeq ($(PLATFORM), windows) @$(call VarPathFileSanityCheck,\ MSVCRT_DLL_PATH,ALT_MSVCRT_DLL_PATH,\ $(MSVCRT_DLL_PATH)/msvcrt.dll, ) ifneq ($(MSVCRNN_DLL),) @$(call VarPathFileSanityCheck,\ MSVCRNN_DLL_PATH,ALT_MSVCRNN_DLL_PATH,\ $(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL), ) endif endif ###################################################### # Check for existence of COMPILER_PATH ###################################################### sane-compiler_path: @$(call VarPathSanityCheck,COMPILER_PATH,ALT_COMPILER_PATH, ) ###################################################### # Check for existence of UNIXCOMMAND_PATH ###################################################### sane-unixcommand_path: @$(call VarPathSanityCheck,UNIXCOMMAND_PATH,ALT_UNIXCOMMAND_PATH, ) ifeq ($(PLATFORM), windows) @for utility in cpio ar file m4 ; do \ if [ ! -r "`$(WHICH) $${utility}`" ]; then \ $(call SanityWarning, \ "You do not have the utility $${utility} in the directory $(UNIXCOMMAND_PATH).", \ "The utilities cpio${comma} ar${comma} file${comma} and m4 are required."); \ fi; \ done endif ###################################################### # Check for existence of USRBIN_PATH on linux ###################################################### sane-usrbin_path: ifeq ($(PLATFORM), linux) @$(call VarPathSanityCheck,USRBIN_PATH,ALT_USRBIN_PATH, ) endif ###################################################### # Check for existence of UNIXCCS_PATH on solaris ###################################################### sane-unixccs_path: ifeq ($(PLATFORM), solaris) @$(call VarPathSanityCheck,UNIXCCS_PATH,ALT_UNIXCCS_PATH, ) endif ###################################################### # Verify the docs directory exists ###################################################### sane-docs_import: @$(call OptionalVarPathSanityCheck,\ HOTSPOT_DOCS_IMPORT_PATH,ALT_HOTSPOT_DOCS_IMPORT_PATH, ) ###################################################### # Check for possible problem regarding __fabsf, math_iso.h and the libm patch. # Hotspot should have been changed in Mustang 6.0 Build 47 to not depend # on __fabsf, this is just checking that fact now. ###################################################### sane-math_iso: ifeq ($(PLATFORM), solaris) @if [ -f $(HOTSPOT_SERVER_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) ]; then \ if [ "`$(NM) $(HOTSPOT_SERVER_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX) | $(GREP) __fabsf`" != "" ]; then \ $(call SanityWarning, \ "This version of hotspot relies on __fabsf which is not always available \ on Solaris 8 and 9 machines unless they have the latest libm patch \ and the file /usr/include/iso/math_iso.h which can trigger this dependency.", \ "Hotspot should NOT be dependent on this extern${comma} check the \ version of the hotspot library you are using.") ; \ fi; \ fi endif ###################################################### # Check for possible patch problem regarding /usr/lib/libCrun.so ###################################################### sane-libCrun: ifeq ($(PLATFORM), solaris) @if [ "`$(NM) /usr/lib/libCrun.so.1 | $(GREP) __1c2n6FIpv_0_`" = "" ]; then \ $(call SanityWarning, \ "The file /usr/lib/libCrun.so.1 is missing the extern __1c2n6FIpv_0_ \ which indicates that the system is missing a required Solaris patch \ or you are using a pre-FCS release of Solaris 10.", \ "You need the latest /usr/lib/libCrun.so.1 which comes with the \ FCS release of Solaris 10 and available through the latest \ Solaris 8 or 9 C++ runtime patches.") ; \ fi endif ###################################################### # Check for existence of MSDEVTOOLS_PATH on windows ###################################################### sane-msdevtools_path: ifeq ($(PLATFORM), windows) @$(call VarPathSanityCheck,MSDEVTOOLS_PATH,ALT_MSDEVTOOLS_PATH, ) endif ###################################################### # Check for existence of Hotspot binaries ###################################################### sane-hotspot_binaries: ifeq ($(ARCH_DATA_MODEL), 32) @$(call VarPathFileSanityCheck,\ HOTSPOT_CLIENT_PATH,ALT_HOTSPOT_CLIENT_PATH,\ $(HOTSPOT_CLIENT_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX),\ "The ALT_HOTSPOT_IMPORT_PATH may also be used.") endif @$(call VarPathFileSanityCheck,\ HOTSPOT_SERVER_PATH,ALT_HOTSPOT_SERVER_PATH,\ $(HOTSPOT_SERVER_PATH)/$(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX),\ "The ALT_HOTSPOT_IMPORT_PATH may also be used.") ifeq ($(PLATFORM), windows) @$(call VarPathFileSanityCheck,\ HOTSPOT_LIB_PATH,ALT_HOTSPOT_LIB_PATH,\ $(HOTSPOT_LIB_PATH)/jvm.lib, ) ifeq ($(ARCH_DATA_MODEL), 32) @$(call OptionalVarPathFileSanityCheck,\ HOTSPOT_CLIENT_PATH,ALT_HOTSPOT_CLIENT_PATH,\ $(HOTSPOT_CLIENT_PATH)/jvm.map, \ "These map files are optional and aid in the debugging of the JVM.") @$(call OptionalVarPathFileSanityCheck,\ HOTSPOT_CLIENT_PATH,ALT_HOTSPOT_CLIENT_PATH,\ $(HOTSPOT_CLIENT_PATH)/jvm.pdb, \ "These pdb files are optional and aid in the debugging of the JVM.") endif @$(call OptionalVarPathFileSanityCheck,\ HOTSPOT_SERVER_PATH,ALT_HOTSPOT_SERVER_PATH,\ $(HOTSPOT_SERVER_PATH)/jvm.map, \ "These map files are optional and aid in the debugging of the JVM.") @$(call OptionalVarPathFileSanityCheck,\ HOTSPOT_SERVER_PATH,ALT_HOTSPOT_SERVER_PATH,\ $(HOTSPOT_SERVER_PATH)/jvm.pdb, \ "These pdb files are optional and aid in the debugging of the JVM.") endif ###################################################### # Check for existence of misc Hotspot imported files ###################################################### HOTSPOT_INCLUDE_FILE_LIST = jvmti.h HOTSPOT_INCLUDE_FILE_LIST += jvmticmlr.h #HOTSPOT_INCLUDE_FILE_LIST += jni.h jni_md.h #HOTSPOT_INCLUDE_FILE_LIST += jvm.h jvm_md.h #HOTSPOT_INCLUDE_FILE_LIST += jmm.h TMP_SDK_INCLUDE_FILE_LIST=$(HOTSPOT_INCLUDE_FILE_LIST:%.h=$(TEMPDIR)/%.h) TMP_SDK_INCLUDE_FILE_DIFFS=$(HOTSPOT_INCLUDE_FILE_LIST:%.h=$(TEMPDIR)/%.hdiffs) # These include files must have a pattern: 'version: MAJOR.MINOR.MICRO' # where MACRO, MINOR, and MICRO are numbers, e.g. 1.0.1, 0.2.90, etc. # The critical version we are checking is MAJOR.MINOR, we print all three # when we detect an error. TMP_SDK_INCLUDE_FIND_VERSION= $(EGREP) 'version:' TMP_SDK_INCLUDE_GET_VERSION= $(TMP_SDK_INCLUDE_FIND_VERSION) | \ $(SED) -e 's@.*\([0-9][0-9]*\.[0-9][0-9]*\)\.[0-9].*@\1@' TMP_SDK_INCLUDE_GET_FULL_VERSION= $(TMP_SDK_INCLUDE_FIND_VERSION) | \ $(SED) -e 's@.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*@\1@' # Compare an interface file (Rule creates 2 temp files: %.h and %.h.IMPORT) # Files jvm.h, jvm_md.h and jmm.h are special in that they are not publicly # exported but do represent VM interfaces used by the rest of the jdk. # So these 3 will not be found in a promoted build and can only # be checked when this represents a full control build (i.e. the # HOTSPOT_IMPORT_PATH includes these files in it's 'include' directory). $(TEMPDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h @$(install-non-module-file) @$(RM) $@.IMPORT @if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(@F) ]; then \ $(CP) $(HOTSPOT_IMPORT_PATH)/include/$(@F) $@.IMPORT ; \ elif [ "$(@F)" != "jvm.h" -a "$(@F)" != "jmm.h" ]; then \ $(call SanityWarning, \ "HOTSPOT_IMPORT_PATH does not contain the interface file $(@F).", \ "Check your value of ALT_HOTSPOT_IMPORT_PATH."); \ $(CP) $< $@.IMPORT; \ else \ $(CP) $< $@.IMPORT; \ fi $(TEMPDIR)/%.h: $(PLATFORM_SRC)/javavm/export/%.h @$(install-non-module-file) @$(RM) $@.IMPORT @if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) ]; then \ $(CP) $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) $@.IMPORT ; \ elif [ "$(@F)" != "jvm_md.h" ]; then \ $(call SanityWarning, \ "HOTSPOT_IMPORT_PATH does not contain the interface file $(@F).", \ "Check your value of ALT_HOTSPOT_IMPORT_PATH."); \ $(CP) $< $@.IMPORT; \ else \ $(CP) $< $@.IMPORT; \ fi # Compares the two tempfiles: %.h and %.h.IMPORT, answer in %.hdiffs # Note: Putting anything into the hdiffs file will trigger generic IMPORT # warning message in hotspot_import_include. # First checks the major.minor versions, the micro number can differ. # Second checks the full version. # Lastly does a full diff if the full version differs or it has no version $(TEMPDIR)/%.hdiffs: $(TEMPDIR)/%.h @$(prep-target) @$(TOUCH) $@ @if [ "`$(CAT) $< | $(TMP_SDK_INCLUDE_GET_VERSION)`" != \ "`$(CAT) $<.IMPORT | $(TMP_SDK_INCLUDE_GET_VERSION)`" ]; then \ $(call SanityWarning, \ "The file $( $@ ; \ fi @if [ "`$(CAT) $< | $(TMP_SDK_INCLUDE_GET_FULL_VERSION)`" != \ "`$(CAT) $<.IMPORT | $(TMP_SDK_INCLUDE_GET_FULL_VERSION)`" ]; then \ $(RM) $<.filtered $<.IMPORT.filtered; \ $(EGREP) -v 'VERSION' $< > $<.filtered; \ $(EGREP) -v 'VERSION' $<.IMPORT > $<.IMPORT.filtered; \ ($(DIFF) -w $<.filtered $<.IMPORT.filtered || exit 0) >> $@ ; \ elif [ "`$(CAT) $< | $(TMP_SDK_INCLUDE_FIND_VERSION)`" = "" ]; then \ $(RM) $<.filtered $<.IMPORT.filtered; \ $(EGREP) -v '@\(#\)' $< > $<.filtered; \ $(EGREP) -v '@\(#\)' $<.IMPORT > $<.IMPORT.filtered; \ ($(DIFF) -w $<.filtered $<.IMPORT.filtered || exit 0) >> $@ ; \ fi # Verify all imported hotspot files sane-hotspot_import:: sane-hotspot_import_dir sane-hotspot_import_include # Verify the base directory exists sane-hotspot_import_dir: @$(RM) $(TMP_SDK_INCLUDE_FILE_DIFFS) @$(RM) $(TMP_SDK_INCLUDE_FILE_LIST) @$(call OptionalVarPathSanityCheck,\ HOTSPOT_IMPORT_PATH,ALT_HOTSPOT_IMPORT_PATH, ) # Verify hotspot include files sane-hotspot_import_include: $(TMP_SDK_INCLUDE_FILE_LIST) $(TMP_SDK_INCLUDE_FILE_DIFFS) @if [ "`$(CAT) $(TMP_SDK_INCLUDE_FILE_DIFFS)`" != "" ]; then \ $(call SanityWarning, \ "Possible HotSpot VM interface conflict.", \ "HOTSPOT_IMPORT_PATH is used to import files from the VM build." \ "It is also used to verify that any copied files are consistent between \ these two components." \ "It has been detected that one or more of the VM interface files inside \ this workspace may not match the interfaces exported by the VM \ or the VM versions could not be found." \ "The list of VM interface files is: \ $(HOTSPOT_INCLUDE_FILE_LIST)." \ "This workspace has copies of these files at: \ $(SHARE_SRC)/javavm/export and $(PLATFORM_SRC)/javavm/export \ for build purposes and they should contain the same interfaces \ as the VM versions imported from:" \ "\$$(HOTSPOT_IMPORT_PATH)/include" \ "(i.e. $(HOTSPOT_IMPORT_PATH)/include)" \ "If an interface indeed doesn't match then the use of this interface \ at JDK runtime could cause serious errors.") ; \ for i in $(TMP_SDK_INCLUDE_FILE_DIFFS); do \ if [ -s $$i ]; then \ $(PRINTF) "\n\n%s\n" "VM Interface Differences: $$i" \ >> $(WARNING_FILE); \ $(CAT) $$i >> $(WARNING_FILE); \ $(PRINTF) "\n" >> $(WARNING_FILE); \ fi; \ done; \ fi @$(RM) $(TMP_SDK_INCLUDE_FILE_DIFFS) @$(RM) $(TMP_SDK_INCLUDE_FILE_LIST) # The JDI-SA feature is not currently released on some platforms. # See the Defs-.gmk files. ifeq ($(INCLUDE_SA), true) # Verify that hotspot Serviceability Agent files are present. To keep # it simple, we will just check for one of them. The others have arch # dependent paths. sane-hotspot_import:: @$(call OptionalVarPathFileSanityCheck,\ HOTSPOT_IMPORT_PATH,ALT_HOTSPOT_IMPORT_PATH,\ $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar,\ "The JDI binding for the Serviceability Agent will not be included in the build.") endif ###################################################### # Check the ant version ###################################################### sane-ant_version: @$(call VersionSanityCheck,ant,\ $(ANT_VER),$(REQUIRED_ANT_VER),) ###################################################### # Check the zip file version ###################################################### sane-zip_version: sane-unzip_version @$(call VersionSanityCheck,zip,\ $(ZIP_VER),$(REQUIRED_ZIP_VER),) ###################################################### # Check the unzip file version ###################################################### sane-unzip_version: @$(call VersionSanityCheck,unzip,\ $(UNZIP_VER),$(REQUIRED_UNZIP_VER),) ###################################################### # Check for windows DirectX sdk directory ###################################################### sane-dxsdk: ifeq ($(PLATFORM), windows) @$(call VersionSanityCheck,dxsdk,\ $(DXSDK_VER),$(REQUIRED_DXSDK_VER),\ $(call BuildReadme,dxsdk)) @$(call VarPathFileSanityCheck,\ DXSDK_INCLUDE_PATH,ALT_DXSDK_INCLUDE_PATH,\ $(DXSDK_INCLUDE_PATH)/d3d9.h,\ $(call BuildReadme,dxsdk)) @if [ -r $(DXSDK_INCLUDE_PATH)/basetsd.h ]; then \ if [ `$(EGREP) -c __int3264 $(DXSDK_INCLUDE_PATH)/basetsd.h` -ne 0 ]; then \ $(call SanityWarning, \ "The DirectX SDK Include directory contains a newer basetsd.h \ which may indicate that you're using an incorrect version of DirectX SDK.", \ "This may result in a build failure." \ "The DirectX SDK Include dir was obtained from the following location: \ $(DXSDK_INCLUDE_PATH)" \ $(call BuildReadme,dxsdk)) fi \ fi endif ###################################################### # Check the linker version(s) ###################################################### sane-link: ifeq ($(PLATFORM), windows) ifdef LINK_VER @$(call SameVersionSanityCheck,link.exe,\ $(LINK_VER),$(REQUIRED_LINK_VER),\ "To build JDK $(JDK_VERSION) you need \ $(REQUIRED_COMPILER_VERSION) - link.exe version $(REQUIRED_LINK_VER)." \ "Specifically the $(REQUIRED_COMPILER_NAME) link.exe.") endif endif ###################################################### # Check the compiler version(s) ###################################################### sane-compiler: sane-link ifndef OPENJDK @$(call SameVersionSanityCheck,C/C++ compiler,\ $(CC_VER),$(REQUIRED_CC_VER), \ "The $(PLATFORM) compiler is not the $(REQUIRED_COMPILER_NAME) compiler." \ "The compiler was obtained from the following location: $(COMPILER_PATH)") else @$(call VersionSanityCheck,C/C++ compiler,,\ $(CC_VER),$(REQUIRED_CC_VER), \ "The $(PLATFORM) compiler is not the $(REQUIRED_COMPILER_NAME) compiler." \ "The compiler was obtained from the following location: $(COMPILER_PATH)") endif ###################################################### # Check that ALSA headers and libs are installed and # that the header has the right version. We only # need /usr/include/alsa/version.h and /usr/lib/libasound.so ###################################################### sane-alsa-headers: ifdef REQUIRED_ALSA_VERSION @$(call VersionSanityCheck,alsa,\ $(ALSA_VERSION),$(REQUIRED_ALSA_VERSION), \ "Please install or reinstall the ALSA packages (drivers and lib)." \ $(call BuildReadme,alsa)) endif ###################################################### # If a sanity file doesn't exist, just make sure it's dir exists $(SANITY_FILES): -@$(prep-target) ###################################################### # dump out the variable settings... ###################################################### sane-settings:: @$(ECHO) >> $(MESSAGE_FILE) @$(ECHO) $(ALL_SETTINGS) >> $(MESSAGE_FILE) @$(ECHO) >> $(MESSAGE_FILE) ###################################################### # Check for existence of DEPLOY_MSSDK on windows ###################################################### sane-mssdk_path: ifeq ($(PLATFORM), windows) @$(call OptionalVarPathSanityCheck,\ DEPLOY_MSSDK,ALT_DEPLOY_MSSDK, ) endif ###################################################### # Check for existence of INSTALL_MSSDK on windows ###################################################### sane-install-mssdk_path: ifeq ($(PLATFORM), windows) @$(call OptionalVarPathSanityCheck,\ INSTALL_MSSDK,ALT_INSTALL_MSSDK, ) endif ###################################################### # Check for existence of INSTALL_MSIVAL2 on windows ###################################################### sane-install-msival2_path: ifeq ($(PLATFORM), windows) @$(call OptionalVarPathSanityCheck,\ INSTALL_MSIVAL2,ALT_INSTALL_MSIVAL2, ) endif ###################################################### # Check the Solaris GNU c++ compiler for solaris plugin ###################################################### sane-gcc-compiler: ifeq ($(PLATFORM), solaris) ifndef OPENJDK @if [ -r $(GCC_COMPILER_PATH) ]; then \ if [ ! "$(GCC_VER)" = $(REQUIRED_GCC_VERSION) ]; then \ $(call SanityError, \ "The Solaris GCC compiler version must be $(REQUIRED_GCC_VERSION).", \ "You are using the following compiler version: $(GCC_VER)" \ "The compiler was obtained from the following location: \ $(GCC_COMPILER_PATH)" \ "Please change your compiler.") ; \ fi \ else \ $(call SanityError, \ "You do not have a valid GCC_COMPILER_PATH setting.", \ "Please check your access to $(GCC_COMPILER_PATH) \ and/or check your value of ALT_GCC_COMPILER_PATH." \ "This will affect you if you build the plugin target.") ; \ fi endif ifeq ($(PLATFORM), linux) ifdef ALT_GCC29_COMPILER_PATH @if [ ! -x $(ALT_GCC29_COMPILER_PATH)/bin/gcc ]; then \ $(call SanityError, \ "You do not have a valid ALT_GCC29_COMPILER_PATH setting.", \ "Please check your access to $(ALT_GCC29_COMPILER_PATH)/bin/gcc" \ "This will affect you if you build the plugin target.") ; \ fi endif ifdef ALT_GCC29_PLUGIN_LIB_PATH @if [ ! -r $(ALT_GCC29_PLUGIN_LIB_PATH)/libjavaplugin_oji.so ]; then \ $(call SanityError, \ "You do not have a valid ALT_GCC29_PLUGIN_LIB_PATH setting.", \ "Please check your access to \ $(ALT_GCC29_PLUGIN_LIB_PATH)/libjavaplugin_oji.so" \ "This will affect you if you build the plugin target \ specifically for gcc 2.9 version of OJI plugin library.") ; \ fi else @$(call VarPathSanityCheck,GCC29_COMPILER_PATH,ALT_GCC29_COMPILER_PATH, \ "This will affect you if you build the plugin target.") endif endif endif ###################################################### # MOZILLA_HEADERS_PATH must be valid ###################################################### sane-mozilla: ifeq ($(ARCH_DATA_MODEL), 32) ifdef ALT_MOZILLA_HEADERS_PATH @if [ `$(ECHO) $(subst \,/,$(ALT_MOZILLA_HEADERS_PATH)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \ $(call SanityError, \ "ALT_MOZILLA_HEADERS_PATH must be an Absolute Path Name not a Relative Path Name.", \ "The current value of ALT_MOZILLA_HEADERS_PATH is $(ALT_MOZILLA_HEADERS_PATH)" \ "Please fix this and continue your build.") ; \ fi endif ifeq ($(PLATFORM), windows) @$(call VarPathFileSanityCheck,\ MOZILLA_HEADERS_PATH,ALT_MOZILLA_HEADERS_PATH,\ $(MOZILLA_HEADERS_PATH)/mozilla_headers_18.win32/java/bool.h, \ "Or check your value of ALT_JDK_DEVTOOLS_DIR.") else @$(call VarPathFileSanityCheck,\ MOZILLA_HEADERS_PATH,ALT_MOZILLA_HEADERS_PATH,\ $(MOZILLA_HEADERS_PATH)/mozilla_headers_18/java/bool.h, \ "Or check your value of ALT_JDK_DEVTOOLS_DIR.") endif @$(call VarPathFileSanityCheck,\ MOZILLA_HEADERS_PATH,ALT_MOZILLA_HEADERS_PATH,\ $(MOZILLA_HEADERS_PATH)/plugin2_mozilla_headers/npapi.h, \ "Or check your value of ALT_JDK_DEVTOOLS_DIR." \ "This file is needed for plugin2.") endif ###################################################### # Make sure Java Kernel VM is accessible ###################################################### sane-kernel-vm: ifeq ($(PLATFORM), windows) ifeq ($(ARCH_DATA_MODEL), 32) @$(call OptionalVarPathFileSanityCheck,\ HOTSPOT_KERNEL_PATH,ALT_HOTSPOT_IMPORT_PATH,\ $(HOTSPOT_KERNEL_PATH)/jvm.dll,\ "Your HOTSPOT_IMPORT_PATH does not include a Kernel VM." \ "The kernel installer may not be built (unless hotspot is also).") endif endif ###################################################### # SECURITY_BASELINE_131 test ###################################################### security_baseline_131: ifeq ($(PLATFORM), windows) @$(call OptionalVarPathSanityCheck,\ SECURITY_BASELINE_131,SECURITY_BASELINE_131, ) endif ###################################################### # SECURITY_BASELINE_142 test ###################################################### security_baseline_142: ifeq ($(PLATFORM), windows) @$(call OptionalVarPathSanityCheck,\ SECURITY_BASELINE_142,SECURITY_BASELINE_142, ) endif ###################################################### # SECURITY_BASELINE_150 test ###################################################### security_baseline_150: ifeq ($(PLATFORM), windows) @$(call OptionalVarPathSanityCheck,\ SECURITY_BASELINE_150,SECURITY_BASELINE_150, ) endif ###################################################### # SECURITY_BASELINE_160 test ###################################################### security_baseline_160: ifeq ($(PLATFORM), windows) @$(call OptionalVarPathSanityCheck,\ SECURITY_BASELINE_160,SECURITY_BASELINE_160, ) endif ###################################################### # this should be the last rule in any target's sanity rule. ###################################################### sane-lastrule: ifndef EXTERNALSANITYCONTROL @if [ -r $(MESSAGE_FILE) ]; then \ $(CAT) $(MESSAGE_FILE) ; \ fi @if [ -r $(WARNING_FILE) ]; then \ $(CAT) $(WARNING_FILE) ; \ fi @if [ "x$(INSANE)" != x ]; then \ $(PRINTF) "\n%s\n%s\n\n" "INSANE mode requested." \ "Sanity will not force a build termination, even with errors." \ >> $(ERROR_FILE); \ fi @if [ -r $(ERROR_FILE) ]; then \ if [ "x$(INSANE)" = x ]; then \ $(PRINTF) "\n%s\n\n" "Exiting because of the above error(s)." \ >> $(ERROR_FILE); \ fi ; \ $(CAT) $(ERROR_FILE) ; \ if [ "x$(INSANE)" = x ]; then \ exit 1 ; \ fi ; \ fi ifdef PEDANTIC @if [ -r $(WARNING_FILE) ]; then \ $(PRINTF) "\n%s\n%s\n\n" "PEDANTIC mode requested." \ "Exiting because of the above warning(s)." \ >> $(ERROR_FILE); \ $(CAT) $(ERROR_FILE) ; \ exit 1 ; \ fi endif # PEDANTIC @if [ ! -r $(ERROR_FILE) ]; then \ $(PRINTF) "\n%s\n" "Sanity check passed." ; \ fi endif # EXTERNALSANITYCONTROL