## Copyright (c) 1995, 2011, 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.### Common variables used by all the Java makefiles. This file should# not contain rules.### On Solaris, the 'make' utility from Sun will not work with these makefiles.# This little rule is only understood by Sun's make, and is harmless# when seen by the GNU make tool. If using Sun's make, this causes the# make command to fail.#SUN_MAKE_TEST:sh = echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33include $(BUILDDIR)/common/shared/Platform.gmkTOPDIR=$(BUILDDIR)/..include $(TOPDIR)/make/common/CancelImplicits.gmk# Historically PLATFORM_SRC used to be src/$(PLATFORM), but we switched it to# src/solaris so if you want to build on Linux you didn't need a src/linux# directory. In an ideal world it would be called src/genunix but we are not# there yet.#ifndef SHARE_SRC SHARE_SRC = $(TOPDIR)/src/shareendif_OUTPUTDIR=$(TOPDIR)/build/$(PLATFORM)-$(ARCH)## Get platform definitions#include $(TOPDIR)/make/common/Defs-$(PLATFORM).gmk## Localizations for the different parts of the product beyond English#JRE_LOCALES = de es fr it ja ko pt_BR sv zh_CN zh_TW zh_HKPLUGIN_LOCALES = de es fr it ja ko pt_BR sv zh_CN zh_TW zh_HKJDK_LOCALES = ja zh_CN## A list of locales we support but don't have resource files.# This is defined to optimize the search of resource bundles.#JRE_NONEXIST_LOCALES = en en_US de_DE es_ES fr_FR it_IT ja_JP ko_KR sv_SE zhLIBDIR = $(OUTPUTDIR)/libABS_LIBDIR = $(ABS_OUTPUTDIR)/lib# for ext jre filesEXTDIR = $(LIBDIR)/ext# for generated class filesCLASSBINDIR = $(OUTPUTDIR)/classesDEMOCLASSDIR = $(OUTPUTDIR)/democlasses# for generated tool class filesBUILDTOOLCLASSDIR = $(OUTPUTDIR)/btclasses# for build tool jar filesBUILDTOOLJARDIR = $(OUTPUTDIR)/btjarsABS_BUILDTOOLJARDIR = $(ABS_OUTPUTDIR)/btjars# for generated java source filesGENSRCDIR = $(OUTPUTDIR)/gensrc# for imported source filesIMPORTSRCDIR = $(OUTPUTDIR)/impsrc# for imported documentsIMPORTDOCDIR = $(OUTPUTDIR)/impdoc# for generated demoDEMODIR = $(OUTPUTDIR)/demo# for sample codeSAMPLEDIR = $(OUTPUTDIR)/sample# for generated documentationDOCSDIR = $(OUTPUTDIR)/docs$(DOCSDIRSUFFIX)DOCSDIRSUFFIX =# An attempt is made to generate unique enough directories for the# generated files to not have name collisisons. Most build units# defines PRODUCT (except Release.gmk), but then they may or may # not define PACKAGE, THREADIR (only HPI uses this), PROGRAM, and # LIBRARY. This code chunk attempts to generate a unique # OBJDIR/CLASSHDRDIR for each build unit based on which of those # values are set within each build unit.UNIQUE_LOCATION_STRING = tmpifneq ($(PRODUCT),) UNIQUE_LOCATION_STRING += /$(PRODUCT)endififneq ($(PACKAGE),) UNIQUE_LOCATION_STRING += /$(PACKAGE)endififneq ($(PROGRAM),) UNIQUE_LOCATION_STRING += /$(PROGRAM)endififneq ($(LIBRARY),) ifneq ($(LIBRARY_OUTPUT),) UNIQUE_LOCATION_STRING += /$(LIBRARY_OUTPUT) else UNIQUE_LOCATION_STRING += /$(LIBRARY) endifendififneq ($(THREADDIR),) UNIQUE_LOCATION_STRING += /$(THREADDIR)endif# the use of += above makes a space separated list which we need to # remove for filespecs.#NULLSTRING :=ONESPACE := $(NULLSTRING) # space before this comment is required.UNIQUE_PATH = $(subst $(ONESPACE),,$(UNIQUE_LOCATION_STRING))# TEMPDIR is a unique general purpose directory# need to use 'override' because GNU Make on Linux exports the wrong# value.override TEMPDIR = $(OUTPUTDIR)/$(UNIQUE_PATH)override ABS_TEMPDIR = $(ABS_OUTPUTDIR)/$(UNIQUE_PATH)# This must be created right away for pattern rules in Sanity.gmk to work.dummy1:=$(shell $(MKDIR) -p $(TEMPDIR))dummy2:=$(shell $(MKDIR) -p $(TEMP_DISK))## CLASSDESTDIR can be used to specify the directory where generated classes# are to be placed. The default is CLASSBINDIR.#ifndef CLASSDESTDIRCLASSDESTDIR = $(CLASSBINDIR)endif## vpaths. These are the default locations searched for source files.# GNUmakefiles of individual areas often override the default settings.# There are no longer default vpath entries for C and assembler files# so we can ensure that libraries don't get their hands on JVM files.## We define an intermediate variable for Java files because# we use its value later to help define $SOURCEPATHVPATH0.java = $(GENSRCDIR)$(CLASSPATH_SEPARATOR)$(PLATFORM_SRC)/classes$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/classesVPATH.java = $(VPATH0.java)vpath %.java $(VPATH.java)vpath %.class $(CLASSBINDIR)## Classpath seen by javac (different from the one seen by the VM# running javac), and useful variables.#SOURCEPATH = $(VPATH.java)PKG = $(shell $(EXPR) $(PACKAGE) : '\([a-z]*\)')PKGDIR = $(subst .,/,$(PACKAGE))## The java/javac/jdk variables (JAVAC_CMD, JAVA_CMD, etc.)#include $(BUILDDIR)/common/shared/Defs-java.gmk## Set opt level to ALT_OPT if set otherwise _OPT#POPT = $(_OPT$(ALT_OPT))$(ALT_OPT)## Convenient macros## Prepare $@ target, remove old one and making sure directory existsdefine prep-target$(MKDIR) -p $(@D)$(RM) $@endef# Simple install of $< file to $@define install-file$(prep-target)$(CP) $< $@endef# Cleanup rule for after debug java run (hotspot.log file is left around)# (This could be an old leftover file in a read-only area, use the @- prefix)HOTSPOT_LOG_NAME = hotspot.logdefine java-vm-cleanupif [ -w $(HOTSPOT_LOG_NAME) ] ; then $(RM) $(HOTSPOT_LOG_NAME); fiendef# Default make settings for processing SUBDIRS with clobber or clean namesSUBDIRS_MAKEFLAGS-clobber = INCREMENTAL_BUILD=falseSUBDIRS_MAKEFLAGS-clean = INCREMENTAL_BUILD=false# Given a SUBDIRS list, cd into them and make them# SUBDIRS_MAKEFLAGS Make settings for a subdir make# SUBDIRS_MAKEFLAGS-$@ Make settings specific to this targetdefine SUBDIRS-loop@for i in DUMMY $(SUBDIRS) ; do \ if [ "$$i" != "DUMMY" ] ; then \ $(MAKE) -C $${i} $@ \ $(SUBDIRS_MAKEFLAGS) \ $(SUBDIRS_MAKEFLAGS-$@) \ FULL_VERSION=$(FULL_VERSION) \ RELEASE=$(RELEASE) || exit 1; \ fi ; \doneendef# Given a OTHERSUBDIRS list, cd into them and make them (extra loop define)# OTHERSUBDIRS_MAKEFLAGS Make settings for a subdir makedefine OTHERSUBDIRS-loop@for i in DUMMY $(OTHERSUBDIRS) ; do \ if [ "$$i" != "DUMMY" ] ; then \ $(MAKE) -C $${i} $@ \ $(OTHERSUBDIRS_MAKEFLAGS) \ FULL_VERSION=$(FULL_VERSION) \ RELEASE=$(RELEASE) || exit 1; \ fi ; \doneendef# Prevent the use of many default suffix rules we do not need.SUFFIXES:.SUFFIXES: .java .class# Make sure we are all insaneifdef INSANE export INSANEendif# Make sure we have the current yearifndef COPYRIGHT_YEAR ifdef ALT_COPYRIGHT_YEAR COPYRIGHT_YEAR := $(ALT_COPYRIGHT_YEAR) else COPYRIGHT_YEAR := $(shell $(DATE) '+%Y') endif export COPYRIGHT_YEARendif# Install of imported file (JDK_IMPORT_PATH, or some other external location)define install-import-file@$(ECHO) "ASSEMBLY_IMPORT: $@"$(install-file)endef.PHONY: all build clean clobber