source: trunk/openjdk/langtools/make/Makefile@ 433

Last change on this file since 433 was 278, checked in by dmik, 14 years ago

trunk: Merged in openjdk6 b22 from branches/vendor/oracle.

File size: 6.0 KB
Line 
1#
2# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
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. Oracle designates this
8# particular file as subject to the "Classpath" exception as provided
9# by Oracle in the LICENSE file that accompanied this code.
10#
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).
16#
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.
20#
21# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22# or visit www.oracle.com if you need additional information or have any
23# questions.
24#
25
26# Makefile for langtools: wrapper around Ant build.xml file
27
28#
29# On Solaris, the standard 'make' utility will not work with these makefiles.
30# This little rule is only understood by Solaris make, and is harmless
31# when seen by the GNU make tool. If using Solaris make, this causes the
32# make command to fail.
33#
34SUN_MAKE_TEST:sh = @echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33
35
36#
37# Minimal platform defs
38# Need FullPath because we can't rely on gnumake abspath, until we use v3.81
39#
40
41SYSTEM_UNAME := $(shell uname)
42
43# Where is unwanted output to be delivered?
44# On Windows, MKS uses the special file "NUL", cygwin uses the customary unix file.
45ifeq ($(SYSTEM_UNAME), Windows_NT)
46DEV_NULL = NUL
47else
48DEV_NULL = /dev/null
49endif
50
51ifneq (,$(findstring CYGWIN,$(SYSTEM_UNAME)))
52USING_CYGWIN = true
53endif
54
55ifdef USING_CYGWIN
56define FullPath
57$(shell cygpath -a -s -m $1 2> $(DEV_NULL))
58endef
59else
60define FullPath
61$(shell cd $1 2> $(DEV_NULL) && pwd)
62endef
63endif
64
65#
66# Makefile args
67#
68
69ifdef QUIET
70 ANT_OPTIONS += -quiet
71endif
72
73ifdef VERBOSE
74 ANT_OPTIONS += -verbose -debug
75endif
76
77ifdef JDK_VERSION
78 ANT_OPTIONS += -Djdk.version=$(JDK_VERSION)
79endif
80
81ifdef FULL_VERSION
82 ANT_OPTIONS += -Dfull.version='$(FULL_VERSION)' # will contain spaces
83endif
84
85ifdef MILESTONE
86ifneq ($(MILESTONE),fcs)
87 ANT_OPTIONS += -Dmilestone=$(MILESTONE)
88else
89 ANT_OPTIONS += -Drelease=$(JDK_VERSION)
90endif
91endif
92
93ifdef BUILD_NUMBER
94 ANT_OPTIONS += -Dbuild.number=$(BUILD_NUMBER)
95else
96 ifdef JDK_BUILD_NUMBER
97 ANT_OPTIONS += -Dbuild.number=$(JDK_BUILD_NUMBER)
98 endif
99endif
100
101ifeq ($(VARIANT), DBG)
102 ANT_OPTIONS += -Djavac.debug=true
103else
104 ifeq ($(VARIANT), OPT)
105 ANT_OPTIONS += -Djavac.debug=false
106 endif
107endif
108
109ifeq ($(DEBUG_CLASSFILES), true)
110 ANT_OPTIONS += -Djavac.debug=true
111 ANT_OPTIONS += -Ddebug.classfiles=true
112endif
113
114# Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
115# and the somewhat misnamed CLASS_VERSION (-target NN)
116ifdef TARGET_CLASS_VERSION
117 ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION)
118else
119 ifdef JAVAC_TARGET_ARG
120 ANT_OPTIONS += -Djavac.target=$(JAVAC_TARGET_ARG)
121 endif
122endif
123
124ifdef SOURCE_LANGUAGE_VERSION
125 ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION)
126else
127 ifdef JAVAC_SOURCE_ARG
128 ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG)
129 endif
130endif
131
132ifdef ALT_BOOTDIR
133 ANT_OPTIONS += -Dboot.java.home=$(ALT_BOOTDIR)
134 ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR)
135endif
136
137ifdef ALT_OUTPUTDIR
138 OUTPUTDIR = $(ALT_OUTPUTDIR)
139 ANT_OPTIONS += -Dbuild.dir=$(ALT_OUTPUTDIR)/build
140 ANT_OPTIONS += -Ddist.dir=$(ALT_OUTPUTDIR)/dist
141else
142 OUTPUTDIR = ..
143endif
144#ABS_OUTPUTDIR = $(abspath $(OUTPUTDIR))
145ABS_OUTPUTDIR = $(call FullPath,$(OUTPUTDIR))
146
147ANT_TMPDIR = $(ABS_OUTPUTDIR)/build/ant-tmp
148ANT_OPTS = ANT_OPTS=-Djava.io.tmpdir='$(ANT_TMPDIR)'
149
150ifdef FINDBUGS_HOME
151 ANT_OPTIONS += -Dfindbugs.home=$(FINDBUGS_HOME)
152endif
153
154ifeq ($(PLATFORM), os2)
155 # system classpath isn't necessary for the build but it's usually long (due to
156 # ant jars) and passing it to javac started through cmd.exe (as in case of
157 # fork=yes) causes cmd.exe to crash with SYS0008, so disable this
158 ANT_OPTIONS += -Dbuild.sysclasspath=ignore
159endif
160
161ifdef ANT_HOME
162 ifeq ($(PLATFORM), windows)
163 ANT = $(subst \,/,$(ANT_HOME))/bin/ant.bat
164 else
165 ifeq ($(PLATFORM), os2)
166 ANT = $(subst \,/,$(ANT_HOME))/bin/ant.cmd
167 else
168 ANT = $(ANT_HOME)/bin/ant
169 endif
170 endif
171 ifneq ($(shell test -x $(ANT); echo $$?), 0)
172 $(error $(ANT) not found -- please update ANT_HOME)
173 endif
174else
175 ANT = ant
176 ifneq ($(shell which $(ANT) > /dev/null; echo $$?), 0)
177 $(error 'ant' not found -- please set ANT_HOME or put 'ant' on your PATH)
178 endif
179endif
180
181# Default target and expected 'do everything' target
182all: build
183
184# Standard make clobber target
185clobber: clean
186
187# All ant targets of interest
188ANT_TARGETS = build clean sanity post-sanity diagnostics # for now
189
190# Create diagnostics log (careful, ant 1.8.0 -diagnostics always does an exit 1)
191# ant 1.8.1 -version does exit 666 here, ignore this
192$(OUTPUTDIR)/build/ant-diagnostics.log:
193 @mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR)
194 @$(RM) $@
195 $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -diagnostics > $@
196 -$(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -version >> $@
197
198# Create a make target for each
199$(ANT_TARGETS): $(OUTPUTDIR)/build/ant-diagnostics.log
200 @ mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR)
201 $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) $(ANT_OPTIONS) $@
202
203#-------------------------------------------------------------------
204#
205# Targets for Oracle's internal JPRT build system
206
207CD = cd
208ZIP = zip
209
210JPRT_ARCHIVE_BUNDLE=$(ABS_OUTPUTDIR)/$(JPRT_BUILD_FLAVOR)-bundle.zip
211
212jprt_build_product jprt_build_debug jprt_build_fastdebug: all
213 ( $(CD) $(OUTPUTDIR) && \
214 $(ZIP) -q -r $(JPRT_ARCHIVE_BUNDLE) build dist )
215
216#-------------------------------------------------------------------
217
218# Declare these phony (not filenames)
219.PHONY: $(ANT_TARGETS) all clobber \
220 jprt_build_product jprt_build_debug jprt_build_fastdebug
Note: See TracBrowser for help on using the repository browser.