view control/make/common/Defs.gmk @ 4:bf1d8af0651f trunk

[svn] Load openjdk/jdk7/b16 into jdk/trunk.
author xiomara
date Fri, 20 Jul 2007 21:22:05 +0000
parents a4ed3fb96592
children 27e0bf49438e
line wrap: on
line source

#
# Copyright 1995-2007 Sun Microsystems, Inc.  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.  Sun designates this
# particular file as subject to the "Classpath" exception as provided
# by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#

#
# Common variables used by all the Java makefiles.  This file should
# not contain rules.
#

# WARNING: This file is shared with other components.
#          So when it includes other files, it must use *_TOPDIR vars.
#

# Change to TOPDIR but be careful with ALT_TOPDIR when it's non-empty
ifneq ($(ALT_TOPDIR), )
  # Freshen macro needs to use *.gmk files from this source tree, not 
  #     ALT_TOPDIR, which might not exist yet.
  #  WARNING: ONLY set CONTROL_COMMON_DIR and J2SE_SHARED_DIR here 
  #           when ALT_TOPDIR is non-empty and 
  #           TOPDIR is set. The ':=' is important, we need to fix this
  #           value here so it doesn't change when TOPDIR gets set to
  #           ALT_TOPDIR.  Note, the name ALT_TOPDIR was a poor choice
  #           and probably should have been called NEW_TOPDIR when used
  #           with the Freshen macro, or NEW_SOURCE_AREA maybe.
  #           If the docs and RE scripts were fixed to not use ALT_TOPDIR
  #           with the freshen, this could be fixed.
  #
  # Only define CONTROL_COMMON_DIR and J2SE_SHARED_DIR once
  #
  ifndef CONTROL_COMMON_DIR
    ifdef TOPDIR
      CONTROL_COMMON_DIR := $(TOPDIR)/control/make/common
    else
      CONTROL_COMMON_DIR = $(CONTROL_TOPDIR)/make/common
    endif
  endif
  ifndef J2SE_SHARED_DIR
    ifdef TOPDIR
      J2SE_SHARED_DIR := $(TOPDIR)/j2se/make/common/shared
    else
      J2SE_SHARED_DIR = $(J2SE_TOPDIR)/make/common/shared
    endif
  endif
  # Now set TOPDIR to this location
  TOPDIR = $(ALT_TOPDIR)
else
  # Only define CONTROL_COMMON_DIR and J2SE_SHARED_DIR once
  ifndef CONTROL_COMMON_DIR
    CONTROL_COMMON_DIR = $(CONTROL_TOPDIR)/make/common
  endif
  ifndef J2SE_SHARED_DIR
    J2SE_SHARED_DIR = $(J2SE_TOPDIR)/make/common/shared
  endif
endif

ifndef CONTROL_TOPDIR
  ifdef ALT_CONTROL_TOPDIR
    CONTROL_TOPDIR=$(ALT_CONTROL_TOPDIR)
  else
    ifndef CONTROL_TOPDIR_NAME
      CONTROL_TOPDIR_NAME=control
    endif #CONTROL_TOPDIR_NAME
    CONTROL_TOPDIR=$(TOPDIR)/$(CONTROL_TOPDIR_NAME)
  endif
endif #CONTROL_TOPDIR

# set default values for where to find the other components. Allow
# overrides to reset
ifndef HOTSPOT_TOPDIR
  HOTSPOT_TOPDIR_NAME = hotspot
  HOTSPOT_TOPDIR=$(TOPDIR)/$(HOTSPOT_TOPDIR_NAME)
  ifdef ALT_HOTSPOT_TOPDIR
    HOTSPOT_TOPDIR=$(ALT_HOTSPOT_TOPDIR)
  endif
endif

ifndef MOTIF_TOPDIR
  MOTIF_TOPDIR_NAME = motif
  MOTIF_TOPDIR=$(TOPDIR)/$(MOTIF_TOPDIR_NAME)
  ifdef ALT_MOTIF_TOPDIR
    MOTIF_TOPDIR=$(ALT_MOTIF_TOPDIR)
  endif
endif

ifndef J2SE_TOPDIR
  J2SE_TOPDIR_NAME = j2se
  J2SE_TOPDIR=$(TOPDIR)/$(J2SE_TOPDIR_NAME)
  ifdef ALT_J2SE_TOPDIR
    J2SE_TOPDIR=$(ALT_J2SE_TOPDIR)
  endif
endif

ifndef INSTALL_TOPDIR
  INSTALL_TOPDIR_NAME = install
  INSTALL_TOPDIR=$(TOPDIR)/$(INSTALL_TOPDIR_NAME)
  ifdef ALT_INSTALL_TOPDIR
    INSTALL_TOPDIR=$(ALT_INSTALL_TOPDIR)
  endif
endif

ifndef SPONSORS_TOPDIR
  SPONSORS_TOPDIR_NAME = sponsors
  SPONSORS_TOPDIR=$(TOPDIR)/$(SPONSORS_TOPDIR_NAME)
  ifdef ALT_SPONSORS_TOPDIR
    SPONSORS_TOPDIR=$(ALT_SPONSORS_TOPDIR)
  endif
endif

ifndef DEPLOY_TOPDIR
  DEPLOY_TOPDIR_NAME = deploy
  DEPLOY_TOPDIR=$(TOPDIR)/$(DEPLOY_TOPDIR_NAME)
  ifdef ALT_DEPLOY_TOPDIR
    DEPLOY_TOPDIR=$(ALT_DEPLOY_TOPDIR)
  endif
endif

ALL_TOPDIRS = \
	$(CONTROL_TOPDIR) \
	$(J2SE_TOPDIR) \
	$(HOTSPOT_TOPDIR) \
	$(MOTIF_TOPDIR) \
	$(INSTALL_TOPDIR) \
	$(SPONSORS_TOPDIR) \
	$(DEPLOY_TOPDIR)

ALL_TOPDIR_NAMES = \
	$(CONTROL_TOPDIR_NAME) \
	$(J2SE_TOPDIR_NAME) \
	$(HOTSPOT_TOPDIR_NAME) \
	$(MOTIF_TOPDIR_NAME) \
	$(INSTALL_TOPDIR_NAME) \
	$(SPONSORS_TOPDIR_NAME) \
	$(DEPLOY_TOPDIR_NAME)

# Get shared platform settings
include $(J2SE_SHARED_DIR)/Platform.gmk

# Default output directory
_OUTPUTDIR=$(CONTROL_TOPDIR)/build/$(PLATFORM)-$(ARCH)

# Get platform specific settings
include $(CONTROL_COMMON_DIR)/Defs-$(PLATFORM).gmk

# Define absolute paths to TOPDIRs
ABS_CONTROL_TOPDIR:=$(call OptFullPath,"$(CONTROL_TOPDIR)")
ABS_J2SE_TOPDIR:=$(call OptFullPath,"$(J2SE_TOPDIR)")
ABS_HOTSPOT_TOPDIR:=$(call OptFullPath,"$(HOTSPOT_TOPDIR)")
ABS_MOTIF_TOPDIR:=$(call OptFullPath,"$(MOTIF_TOPDIR)")
ABS_INSTALL_TOPDIR:=$(call OptFullPath,"$(INSTALL_TOPDIR)")
ABS_SPONSORS_TOPDIR:=$(call OptFullPath,"$(SPONSORS_TOPDIR)")
ABS_DEPLOY_TOPDIR:=$(call OptFullPath,"$(DEPLOY_TOPDIR)")

#
# Source directories - all the directories managed by the SCM, includes a
#    last item '.' which is needed to keep deleted files in sync.
#    This broken up list allows for some platforms to deal with the
#    large number of files that need to be created.
#
CONTROL_SOURCE       = make .
HOTSPOT_SOURCE       = make src build doc agent .
MOTIF_SOURCE         = lib .
J2SE_SOURCE          = make src test .
INSTALL_SOURCE	     = make src .
SPONSORS_SOURCE	     = make src .
DEPLOY_SOURCE	     = make src .

TEMP_DIR = $(OUTPUTDIR)/tmp
ABS_TEMP_DIR = $(ABS_OUTPUTDIR)/tmp

dummy := $(shell $(MKDIR) -p $(TEMP_DIR))

# Macro to return true or false if a file exists and is readable
define MkExists
$(shell if [ -r $1 ]; then $(ECHO) true; else $(ECHO) false; fi)
endef

HOTSPOT_SRC_AVAILABLE := $(call MkExists,$(HOTSPOT_TOPDIR)/make/Makefile)
ifndef BUILD_HOTSPOT
  ifdef ALT_HOTSPOT_IMPORT_PATH
    BUILD_HOTSPOT := false
  else
    BUILD_HOTSPOT := $(HOTSPOT_SRC_AVAILABLE)
  endif
endif

MOTIF_SRC_AVAILABLE := $(call MkExists,$(MOTIF_TOPDIR)/lib/Xm/Makefile)
ifndef BUILD_MOTIF
  ifdef ALT_MOTIF_DIR
    BUILD_MOTIF := false
  else
    BUILD_MOTIF := $(MOTIF_SRC_AVAILABLE)
  endif
endif

J2SE_SRC_AVAILABLE := $(call MkExists,$(J2SE_TOPDIR)/make/Makefile)
ifndef BUILD_J2SE
  BUILD_J2SE := $(J2SE_SRC_AVAILABLE)
endif
ifeq ($(J2SE_SRC_AVAILABLE),true)
  J2SE_CLOSED_SRC_AVAILABLE := $(call MkExists,$(J2SE_TOPDIR)/src/closed)
  ifeq ($(J2SE_CLOSED_SRC_AVAILABLE),false)
    OPENJDK = true
  endif
endif

DEPLOY_SRC_AVAILABLE := $(call MkExists,$(DEPLOY_TOPDIR)/make/Makefile)
ifndef BUILD_DEPLOY
  BUILD_DEPLOY := $(DEPLOY_SRC_AVAILABLE)
endif

INSTALL_SRC_AVAILABLE := $(call MkExists,$(INSTALL_TOPDIR)/make/Makefile)
ifndef BUILD_INSTALL
  ifdef DEV_ONLY
    BUILD_INSTALL := false
  else
    BUILD_INSTALL := $(INSTALL_SRC_AVAILABLE)
  endif
endif

SPONSORS_SRC_AVAILABLE := $(call MkExists,$(SPONSORS_TOPDIR)/make/Makefile)
ifndef BUILD_SPONSORS
  ifdef DEV_ONLY
    BUILD_SPONSORS := false
  else
    BUILD_SPONSORS := $(SPONSORS_SRC_AVAILABLE)
  endif
endif

# Do we build the source and openjdk binary plug bundles?
BUNDLE_RULES = $(CONTROL_TOPDIR)/make/closed/bundles.gmk
BUNDLE_RULES_AVAILABLE := $(call MkExists,$(BUNDLE_RULES))

# Current things we do NOT build for OPENJDK
ifdef OPENJDK
  BUILD_MOTIF = false
  BUILD_DEPLOY = false
  BUILD_INSTALL = false
  BUILD_SPONSORS = false
  BUNDLE_RULES_AVAILABLE := false
  # These could be over-ridden on the command line or in environment
  ifndef SKIP_FASTDEBUG_BUILD
    SKIP_FASTDEBUG_BUILD = true
  endif
  ifndef SKIP_DEBUG_BUILD
    SKIP_DEBUG_BUILD = true
  endif
  ifndef SKIP_COMPARE_IMAGES
    SKIP_COMPARE_IMAGES = true
  endif
endif

# Many reasons why we would want to skip the comparison to previous jdk
ifndef SKIP_COMPARE_IMAGES
  ifeq ($(BUILD_J2SE), false)
    SKIP_COMPARE_IMAGES = true
  endif
  ifeq ($(BUILD_DEPLOY), false)
    SKIP_COMPARE_IMAGES = true
  endif
  ifeq ($(BUILD_INSTALL), false)
    SKIP_COMPARE_IMAGES = true
  endif
  ifdef DEV_ONLY
    SKIP_COMPARE_IMAGES = true
  endif
endif

# Select defaults if these are not set to true or false
ifndef SKIP_DEBUG_BUILD
  SKIP_DEBUG_BUILD=true
endif
ifndef SKIP_FASTDEBUG_BUILD
  SKIP_FASTDEBUG_BUILD=false
endif

# Output directory for hotspot build
HOTSPOT_DIR = $(ABS_OUTPUTDIR)/hotspot

# The MESSAGE, WARNING and ERROR files are used to store sanity check and 
# source check messages, warnings and errors. 
export ERROR_FILE   := $(ABS_OUTPUTDIR)/sanityCheckErrors.txt
export WARNING_FILE := $(ABS_OUTPUTDIR)/sanityCheckWarnings.txt
export MESSAGE_FILE := $(ABS_OUTPUTDIR)/sanityCheckMessages.txt

# source bundle generation definitions
BUNDLE_DATE := $(shell $(DATE) '+%d_%b_%Y' | $(TR) "[A-Z]" "[a-z]")
ifdef ALT_BUNDLE_DATE
  BUNDLE_DATE := $(ALT_BUNDLE_DATE)
endif

SRC_BUNDLEDIR       = $(OUTPUTDIR)/source-bundles
ABS_SRC_BUNDLEDIR   = $(ABS_OUTPUTDIR)/source-bundles
BIN_BUNDLEDIR       = $(OUTPUTDIR)/bundles
ABS_BIN_BUNDLEDIR   = $(ABS_OUTPUTDIR)/bundles
JRL_BUNDLEDIR 	    = $(OUTPUTDIR)/java.net
ABS_JRL_BUNDLEDIR   = $(ABS_OUTPUTDIR)/java.net

dummy := $(shell $(MKDIR) -p $(BIN_BUNDLEDIR))
dummy := $(shell $(MKDIR) -p $(SRC_BUNDLEDIR) )
dummy := $(shell $(MKDIR) -p $(JRL_BUNDLEDIR) )

# If the update version contains non-numeric characters, we need
# to massage it into a numeric format.  Unfortunately, the
# Windows VERSIONINFO resource that we stick in jvm.dll cannot
# handle non-numeric characters.  We have to do this here because
# Hotspot (nmake) cannot handle calculations.  So we use the
# following formula:
# COOKED_JDK_UPDATE_VERSION = JDK_UPDATE_VERSION * 10 + EXCEPTION_VERSION
# 
# Here are some examples:
#     1.5.0    b01  ->  5,0,0,1
#     1.5.0_10 b01  ->  5,0,100,1 
#     1.4.2 b01     ->  4,2,0,1
#     1.4.2_02 b01  ->  4,2,20,1
#     1.4.2_02a b01 ->  4,2,21,1
#     1.4.2_02b b01 ->  4,2,22,1
ifdef JDK_UPDATE_VERSION
  VTMP := $(shell $(ECHO) $(JDK_UPDATE_VERSION) | $(TR) "abcde" "12345")
  CHAR1 := $(shell $(ECHO) $(VTMP) | $(NAWK) '{print substr($$1, 1, 1);}')
  CHAR2 := $(shell $(ECHO) $(VTMP) | $(NAWK) '{print substr($$1, 2, 1);}')
  CHAR3 := $(shell $(ECHO) $(VTMP) | $(NAWK) '{print substr($$1, 3, 1);}')
  ifeq ($(CHAR3),)
    CHAR3 := 0
  endif
  ifeq ($(CHAR1), 0)
    COOKED_JDK_UPDATE_VERSION := $(CHAR2)$(CHAR3)
  else
    COOKED_JDK_UPDATE_VERSION := $(CHAR1)$(CHAR2)$(CHAR3)
  endif
endif

ifneq ($(JDK_BUILD_NUMBER),)
 COOKED_BUILD_NUMBER = $(shell $(ECHO) $(JDK_BUILD_NUMBER) \
			       | $(SED) -e 's/^b//' | $(SED) -e 's/^0//')
else
 COOKED_BUILD_NUMBER = 0
endif