2 # Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation. Sun designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Sun in the LICENSE file that accompanied this code.
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 # CA 95054 USA or visit www.sun.com if you need additional information or
26 # Makefile for langtools: wrapper around Ant build.xml file
29 # On Solaris, the 'make' utility from Sun will not work with these makefiles.
30 # This little rule is only understood by Sun's make, and is harmless
31 # when seen by the GNU make tool. If using Sun's make, this causes the
32 # make command to fail.
34 SUN_MAKE_TEST:sh = @echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33
37 # Minimal platform defs
38 # Need FullPath because we can't rely on gnumake abspath, until we use v3.81
41 SYSTEM_UNAME := $(shell uname)
43 ifeq ($(SYSTEM_UNAME), Windows_NT)
46 ifneq (,$(findstring CYGWIN,$(SYSTEM_UNAME)))
56 $(shell cygpath -a -s -m $1 2> $(DEV_NULL))
60 $(shell cd $1 2> $(DEV_NULL) && pwd)
73 ANT_OPTIONS += -verbose -diagnostics
77 ANT_OPTIONS += -Djdk.version=$(JDK_VERSION)
81 ANT_OPTIONS += -Dfull.version='$(FULL_VERSION)' # will contain spaces
85 ifneq ($(MILESTONE),fcs)
86 ANT_OPTIONS += -Dmilestone=$(MILESTONE)
88 ANT_OPTIONS += -Drelease=$(JDK_VERSION)
93 ANT_OPTIONS += -Dbuild.number=$(BUILD_NUMBER)
95 ifdef JDK_BUILD_NUMBER
96 ANT_OPTIONS += -Dbuild.number=$(JDK_BUILD_NUMBER)
100 ifeq ($(VARIANT), DBG)
101 ANT_OPTIONS += -Djavac.debug=true
103 ifeq ($(VARIANT), OPT)
104 ANT_OPTIONS += -Djavac.debug=false
108 ifeq ($(DEBUG_CLASSFILES), true)
109 ANT_OPTIONS += -Djavac.debug=true
110 ANT_OPTIONS += -Ddebug.classfiles=true
113 # Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
114 # and the somewhat misnamed CLASS_VERSION (-target NN)
115 ifdef TARGET_CLASS_VERSION
116 ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION)
118 ifdef JAVAC_TARGET_ARG
119 ANT_OPTIONS += -Djavac.target=$(JAVAC_TARGET_ARG)
123 ifdef SOURCE_LANGUAGE_VERSION
124 ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION)
126 ifdef JAVAC_SOURCE_ARG
127 ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG)
132 ANT_OPTIONS += -Dboot.java.home=$(ALT_BOOTDIR)
133 ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR)
137 OUTPUTDIR = $(ALT_OUTPUTDIR)
138 ANT_OPTIONS += -Dbuild.dir=$(ALT_OUTPUTDIR)/build
139 ANT_OPTIONS += -Ddist.dir=$(ALT_OUTPUTDIR)/dist
143 #ABS_OUTPUTDIR = $(abspath $(OUTPUTDIR))
144 ABS_OUTPUTDIR = $(call FullPath,$(OUTPUTDIR))
146 ANT_TMPDIR = $(ABS_OUTPUTDIR)/build/ant-tmp
147 ANT_OPTS = ANT_OPTS=-Djava.io.tmpdir='$(ANT_TMPDIR)'
150 ANT_OPTIONS += -Dfindbugs.home=$(FINDBUGS_HOME)
154 ANT = $(ANT_HOME)/bin/ant
155 ifneq ($(shell test -x $(ANT) && echo OK), OK)
156 $(error $(ANT) not found -- please update ANT_HOME)
160 ifneq ($(shell test -x "`which $(ANT)`" && echo OK), OK)
161 $(error 'ant' not found -- please set ANT_HOME or put 'ant' on your PATH)
165 # Default target and expected 'do everything' target
168 # Standard make clobber target
171 # All ant targets of interest
172 ANT_TARGETS = build clean sanity post-sanity diagnostics # for now
174 # Create a make target for each
176 @ mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR)
177 $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -diagnostics > $(OUTPUTDIR)/build/ant-diagnostics.log
178 $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) $(ANT_OPTIONS) $@
180 #-------------------------------------------------------------------
182 # Targets for Sun's internal JPRT build system
187 JPRT_ARCHIVE_BUNDLE=$(ABS_OUTPUTDIR)/$(JPRT_BUILD_FLAVOR)-bundle.zip
189 jprt_build_product jprt_build_debug jprt_build_fastdebug: all
190 ( $(CD) $(OUTPUTDIR) && \
191 $(ZIP) -q -r $(JPRT_ARCHIVE_BUNDLE) build dist )
193 #-------------------------------------------------------------------
195 # Declare these phony (not filenames)
196 .PHONY: $(ANT_TARGETS) all clobber \
197 jprt_build_product jprt_build_debug jprt_build_fastdebug