make/Makefile
author ohair
Tue Dec 28 11:17:31 2010 -0800 (2 years ago)
changeset 109 633c329e6d87
parent 990e4ccb5a0d40
permissions -rw-r--r--
6962318: Update copyright year
Reviewed-by: andrew
duke@0
#
ohair@109
# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
duke@0
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0
#
duke@0
# This code is free software; you can redistribute it and/or modify it
duke@0
# under the terms of the GNU General Public License version 2 only, as
ohair@86
# published by the Free Software Foundation.  Oracle designates this
duke@0
# particular file as subject to the "Classpath" exception as provided
ohair@86
# by Oracle in the LICENSE file that accompanied this code.
duke@0
#
duke@0
# This code is distributed in the hope that it will be useful, but WITHOUT
duke@0
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
duke@0
# version 2 for more details (a copy is included in the LICENSE file that
duke@0
# accompanied this code).
duke@0
#
duke@0
# You should have received a copy of the GNU General Public License version
duke@0
# 2 along with this work; if not, write to the Free Software Foundation,
duke@0
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0
#
ohair@86
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@86
# or visit www.oracle.com if you need additional information or have any
ohair@86
# questions.
duke@0
#
duke@0
duke@0
# Makefile for langtools: wrapper around Ant build.xml file
duke@0
duke@0
#
jjg@89
# On Solaris, the standard 'make' utility will not work with these makefiles.
jjg@89
#    This little rule is only understood by Solaris make, and is harmless
jjg@89
#    when seen by the GNU make tool. If using Solaris make, this causes the
duke@0
#    make command to fail.
duke@0
#
duke@0
SUN_MAKE_TEST:sh = @echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33
duke@0
duke@0
#
duke@0
# Minimal platform defs
duke@0
# Need FullPath because we can't rely on gnumake abspath, until we use v3.81
duke@0
#
duke@0
duke@0
SYSTEM_UNAME := $(shell uname)
duke@0
jjg@99
# Where is unwanted output to be delivered?
jjg@99
# On Windows, MKS uses the special file "NUL", cygwin uses the customary unix file.
duke@0
ifeq ($(SYSTEM_UNAME), Windows_NT)
duke@0
DEV_NULL = NUL
duke@0
else
jjg@99
DEV_NULL = /dev/null 
jjg@99
endif
jjg@99
duke@0
ifneq (,$(findstring CYGWIN,$(SYSTEM_UNAME)))
duke@0
USING_CYGWIN = true
duke@0
endif
duke@0
duke@0
ifdef USING_CYGWIN
duke@0
define FullPath
duke@0
$(shell cygpath -a -s -m $1 2> $(DEV_NULL))
duke@0
endef
duke@0
else
duke@0
define FullPath
duke@0
$(shell cd $1 2> $(DEV_NULL) && pwd)
duke@0
endef
duke@0
endif
duke@0
duke@0
#
duke@0
# Makefile args
duke@0
#
duke@0
duke@0
ifdef QUIET
duke@0
  ANT_OPTIONS += -quiet
duke@0
endif
duke@0
duke@0
ifdef VERBOSE
andrew@74
  ANT_OPTIONS += -verbose -debug
duke@0
endif
duke@0
duke@0
ifdef JDK_VERSION
duke@0
  ANT_OPTIONS += -Djdk.version=$(JDK_VERSION)
duke@0
endif 
duke@0
duke@0
ifdef FULL_VERSION
duke@0
  ANT_OPTIONS += -Dfull.version='$(FULL_VERSION)' # will contain spaces
duke@0
endif 
duke@0
duke@0
ifdef MILESTONE
jjg@37
ifneq ($(MILESTONE),fcs)
duke@0
  ANT_OPTIONS += -Dmilestone=$(MILESTONE)
jjg@37
else
jjg@37
  ANT_OPTIONS += -Drelease=$(JDK_VERSION)
jjg@37
endif
duke@0
endif
duke@0
duke@0
ifdef BUILD_NUMBER
duke@0
  ANT_OPTIONS += -Dbuild.number=$(BUILD_NUMBER)
duke@0
else
duke@0
  ifdef JDK_BUILD_NUMBER
duke@0
    ANT_OPTIONS += -Dbuild.number=$(JDK_BUILD_NUMBER)
duke@0
  endif
duke@0
endif
duke@0
duke@0
ifeq ($(VARIANT), DBG)
duke@0
  ANT_OPTIONS += -Djavac.debug=true
duke@0
else
duke@0
  ifeq ($(VARIANT), OPT)
duke@0
    ANT_OPTIONS += -Djavac.debug=false
duke@0
  endif
duke@0
endif
duke@0
aph@45
ifeq ($(DEBUG_CLASSFILES), true)
jjg@49
  ANT_OPTIONS += -Djavac.debug=true
aph@45
  ANT_OPTIONS += -Ddebug.classfiles=true
aph@45
endif
aph@45
duke@0
# Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
duke@0
# and the somewhat misnamed CLASS_VERSION (-target NN)
duke@0
ifdef TARGET_CLASS_VERSION
duke@0
  ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION)
duke@0
else
duke@0
  ifdef JAVAC_TARGET_ARG 
duke@0
    ANT_OPTIONS += -Djavac.target=$(JAVAC_TARGET_ARG)
jjg@49
  endif
jjg@49
endif 
jjg@49
jjg@49
ifdef SOURCE_LANGUAGE_VERSION
jjg@49
  ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION)
jjg@49
else
jjg@49
  ifdef JAVAC_SOURCE_ARG 
jjg@49
    ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG)
duke@0
  endif
duke@0
endif 
duke@0
duke@0
ifdef ALT_BOOTDIR
duke@0
  ANT_OPTIONS += -Dboot.java.home=$(ALT_BOOTDIR)
duke@0
  ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR)
duke@0
endif
duke@0
duke@0
ifdef ALT_OUTPUTDIR
duke@0
  OUTPUTDIR = $(ALT_OUTPUTDIR)
duke@0
  ANT_OPTIONS += -Dbuild.dir=$(ALT_OUTPUTDIR)/build
duke@0
  ANT_OPTIONS += -Ddist.dir=$(ALT_OUTPUTDIR)/dist
duke@0
else
duke@0
  OUTPUTDIR = ..
duke@0
endif
duke@0
#ABS_OUTPUTDIR = $(abspath $(OUTPUTDIR))
duke@0
ABS_OUTPUTDIR = $(call FullPath,$(OUTPUTDIR))
duke@0
duke@0
ANT_TMPDIR = $(ABS_OUTPUTDIR)/build/ant-tmp
duke@0
ANT_OPTS = ANT_OPTS=-Djava.io.tmpdir='$(ANT_TMPDIR)'
duke@0
duke@0
ifdef FINDBUGS_HOME
duke@0
  ANT_OPTIONS += -Dfindbugs.home=$(FINDBUGS_HOME)
duke@0
endif
duke@0
duke@0
ifdef ANT_HOME
duke@0
  ANT = $(ANT_HOME)/bin/ant
duke@0
  ifneq ($(shell test -x $(ANT) && echo OK), OK)
duke@0
    $(error $(ANT) not found -- please update ANT_HOME)
duke@0
  endif
duke@0
else
duke@0
  ANT = ant
duke@0
  ifneq ($(shell test -x "`which $(ANT)`" && echo OK), OK)
duke@0
    $(error 'ant' not found -- please set ANT_HOME or put 'ant' on your PATH)
duke@0
  endif
duke@0
endif
duke@0
duke@0
# Default target and expected 'do everything' target
duke@0
all: build
duke@0
duke@0
# Standard make clobber target
duke@0
clobber: clean
duke@0
duke@0
# All ant targets of interest
duke@0
ANT_TARGETS = build clean sanity post-sanity diagnostics # for now
duke@0
ohair@80
# Create diagnostics log (careful, ant 1.8.0 -diagnostics always does an exit 1)
ohair@80
$(OUTPUTDIR)/build/ant-diagnostics.log:
ohair@80
	@mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR)
ohair@80
	@$(RM) $@
ohair@80
	$(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -diagnostics > $@ ; \
ohair@80
	  $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -version >> $@
ohair@80
duke@0
# Create a make target for each
ohair@80
$(ANT_TARGETS): $(OUTPUTDIR)/build/ant-diagnostics.log
duke@0
	@ mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR)
duke@0
	$(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) $(ANT_OPTIONS) $@
duke@0
duke@0
#-------------------------------------------------------------------
duke@0
#
jjg@89
# Targets for Oracle's internal JPRT build system
duke@0
duke@0
CD = cd
duke@0
ZIP = zip
duke@0
duke@0
JPRT_ARCHIVE_BUNDLE=$(ABS_OUTPUTDIR)/$(JPRT_BUILD_FLAVOR)-bundle.zip
duke@0
duke@0
jprt_build_product jprt_build_debug jprt_build_fastdebug: all
duke@0
	( $(CD) $(OUTPUTDIR) && \
duke@0
	  $(ZIP) -q -r $(JPRT_ARCHIVE_BUNDLE) build dist )
duke@0
duke@0
#-------------------------------------------------------------------
duke@0
duke@0
# Declare these phony (not filenames)
duke@0
.PHONY: $(ANT_TARGETS) all clobber \
duke@0
	jprt_build_product jprt_build_debug jprt_build_fastdebug