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

Last change on this file since 201 was 173, checked in by dmik, 15 years ago

langtools/make: Fixed failed build due to Ant returning 666.

File size: 5.9 KB
Line 
1#
2# Copyright 2007 Sun Microsystems, Inc. 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. 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.
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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22# CA 95054 USA or visit www.sun.com if you need additional information or
23# have any questions.
24#
25
26# Makefile for langtools: wrapper around Ant build.xml file
27
28#
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.
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
43ifeq ($(SYSTEM_UNAME), Windows_NT)
44DEV_NULL = NUL
45else
46ifneq (,$(findstring CYGWIN,$(SYSTEM_UNAME)))
47DEV_NULL = NUL
48USING_CYGWIN = true
49else
50DEV_NULL = /dev/null
51endif
52endif
53
54ifdef USING_CYGWIN
55define FullPath
56$(shell cygpath -a -s -m $1 2> $(DEV_NULL))
57endef
58else
59define FullPath
60$(shell cd $1 2> $(DEV_NULL) && pwd)
61endef
62endif
63
64#
65# Makefile args
66#
67
68ifdef QUIET
69 ANT_OPTIONS += -quiet
70endif
71
72ifdef VERBOSE
73 ANT_OPTIONS += -verbose -debug
74endif
75
76ifdef JDK_VERSION
77 ANT_OPTIONS += -Djdk.version=$(JDK_VERSION)
78endif
79
80ifdef FULL_VERSION
81 ANT_OPTIONS += -Dfull.version='$(FULL_VERSION)' # will contain spaces
82endif
83
84ifdef MILESTONE
85ifneq ($(MILESTONE),fcs)
86 ANT_OPTIONS += -Dmilestone=$(MILESTONE)
87else
88 ANT_OPTIONS += -Drelease=$(JDK_VERSION)
89endif
90endif
91
92ifdef BUILD_NUMBER
93 ANT_OPTIONS += -Dbuild.number=$(BUILD_NUMBER)
94else
95 ifdef JDK_BUILD_NUMBER
96 ANT_OPTIONS += -Dbuild.number=$(JDK_BUILD_NUMBER)
97 endif
98endif
99
100ifeq ($(VARIANT), DBG)
101 ANT_OPTIONS += -Djavac.debug=true
102else
103 ifeq ($(VARIANT), OPT)
104 ANT_OPTIONS += -Djavac.debug=false
105 endif
106endif
107
108ifeq ($(DEBUG_CLASSFILES), true)
109 ANT_OPTIONS += -Djavac.debug=true
110 ANT_OPTIONS += -Ddebug.classfiles=true
111endif
112
113# Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
114# and the somewhat misnamed CLASS_VERSION (-target NN)
115ifdef TARGET_CLASS_VERSION
116 ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION)
117else
118 ifdef JAVAC_TARGET_ARG
119 ANT_OPTIONS += -Djavac.target=$(JAVAC_TARGET_ARG)
120 endif
121endif
122
123ifdef SOURCE_LANGUAGE_VERSION
124 ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION)
125else
126 ifdef JAVAC_SOURCE_ARG
127 ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG)
128 endif
129endif
130
131ifdef ALT_BOOTDIR
132 ANT_OPTIONS += -Dboot.java.home=$(ALT_BOOTDIR)
133 ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR)
134endif
135
136ifdef ALT_OUTPUTDIR
137 OUTPUTDIR = $(ALT_OUTPUTDIR)
138 ANT_OPTIONS += -Dbuild.dir=$(ALT_OUTPUTDIR)/build
139 ANT_OPTIONS += -Ddist.dir=$(ALT_OUTPUTDIR)/dist
140else
141 OUTPUTDIR = ..
142endif
143#ABS_OUTPUTDIR = $(abspath $(OUTPUTDIR))
144ABS_OUTPUTDIR = $(call FullPath,$(OUTPUTDIR))
145
146ANT_TMPDIR = $(ABS_OUTPUTDIR)/build/ant-tmp
147ANT_OPTS = ANT_OPTS=-Djava.io.tmpdir='$(ANT_TMPDIR)'
148
149ifdef FINDBUGS_HOME
150 ANT_OPTIONS += -Dfindbugs.home=$(FINDBUGS_HOME)
151endif
152
153ifeq ($(PLATFORM), os2)
154 # system classpath isn't necessary for the build but it's usually long (due to
155 # ant jars) and passing it to javac started through cmd.exe (as in case of
156 # fork=yes) causes cmd.exe to crash with SYS0008, so disable this
157 ANT_OPTIONS += -Dbuild.sysclasspath=ignore
158endif
159
160ifdef ANT_HOME
161 ifeq ($(PLATFORM), windows)
162 ANT = $(subst \,/,$(ANT_HOME))/bin/ant.bat
163 else
164 ifeq ($(PLATFORM), os2)
165 ANT = $(subst \,/,$(ANT_HOME))/bin/ant.cmd
166 else
167 ANT = $(ANT_HOME)/bin/ant
168 endif
169 endif
170 ifneq ($(shell test -x $(ANT); echo $$?), 0)
171 $(error $(ANT) not found -- please update ANT_HOME)
172 endif
173else
174 ANT = ant
175 ifneq ($(shell which $(ANT) > /dev/null; echo $$?), 0)
176 $(error 'ant' not found -- please set ANT_HOME or put 'ant' on your PATH)
177 endif
178endif
179
180# Default target and expected 'do everything' target
181all: build
182
183# Standard make clobber target
184clobber: clean
185
186# All ant targets of interest
187ANT_TARGETS = build clean sanity post-sanity diagnostics # for now
188
189# Create diagnostics log (careful, ant 1.8.0 -diagnostics always does an exit 1)
190# ant 1.8.1 -version does exit 666 here, ignore this
191$(OUTPUTDIR)/build/ant-diagnostics.log:
192 @mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR)
193 @$(RM) $@
194 $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -diagnostics > $@
195 -$(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -version >> $@
196
197# Create a make target for each
198$(ANT_TARGETS): $(OUTPUTDIR)/build/ant-diagnostics.log
199 @ mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR)
200 $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) $(ANT_OPTIONS) $@
201
202#-------------------------------------------------------------------
203#
204# Targets for Sun's internal JPRT build system
205
206CD = cd
207ZIP = zip
208
209JPRT_ARCHIVE_BUNDLE=$(ABS_OUTPUTDIR)/$(JPRT_BUILD_FLAVOR)-bundle.zip
210
211jprt_build_product jprt_build_debug jprt_build_fastdebug: all
212 ( $(CD) $(OUTPUTDIR) && \
213 $(ZIP) -q -r $(JPRT_ARCHIVE_BUNDLE) build dist )
214
215#-------------------------------------------------------------------
216
217# Declare these phony (not filenames)
218.PHONY: $(ANT_TARGETS) all clobber \
219 jprt_build_product jprt_build_debug jprt_build_fastdebug
Note: See TracBrowser for help on using the repository browser.