author | ohair |
Tue, 25 May 2010 15:54:51 -0700 | |
changeset 5520 | 86e4b9a9da40 |
parent 5219 | 6765bf7b1023 |
child 5848 | c5a4ce47e780 |
permissions | -rw-r--r-- |
10 | 1 |
# |
5520 | 2 |
# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. |
10 | 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 |
|
5520 | 7 |
# published by the Free Software Foundation. Oracle designates this |
10 | 8 |
# particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
# by Oracle in the LICENSE file that accompanied this code. |
10 | 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 |
# |
|
5520 | 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. |
|
10 | 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 |
# |
|
34 |
SUN_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 |
||
41 |
SYSTEM_UNAME := $(shell uname) |
|
42 |
||
43 |
ifeq ($(SYSTEM_UNAME), Windows_NT) |
|
44 |
DEV_NULL = NUL |
|
45 |
else |
|
46 |
ifneq (,$(findstring CYGWIN,$(SYSTEM_UNAME))) |
|
47 |
DEV_NULL = NUL |
|
48 |
USING_CYGWIN = true |
|
49 |
else |
|
50 |
DEV_NULL = /dev/null |
|
51 |
endif |
|
52 |
endif |
|
53 |
||
54 |
ifdef USING_CYGWIN |
|
55 |
define FullPath |
|
56 |
$(shell cygpath -a -s -m $1 2> $(DEV_NULL)) |
|
57 |
endef |
|
58 |
else |
|
59 |
define FullPath |
|
60 |
$(shell cd $1 2> $(DEV_NULL) && pwd) |
|
61 |
endef |
|
62 |
endif |
|
63 |
||
64 |
# |
|
65 |
# Makefile args |
|
66 |
# |
|
67 |
||
68 |
ifdef QUIET |
|
69 |
ANT_OPTIONS += -quiet |
|
70 |
endif |
|
71 |
||
72 |
ifdef VERBOSE |
|
4941
37df21e3fdb7
6928623: Behaviour of VERBOSE=true on langtools build
andrew
parents:
4697
diff
changeset
|
73 |
ANT_OPTIONS += -verbose -debug |
10 | 74 |
endif |
75 |
||
76 |
ifdef JDK_VERSION |
|
77 |
ANT_OPTIONS += -Djdk.version=$(JDK_VERSION) |
|
78 |
endif |
|
79 |
||
80 |
ifdef FULL_VERSION |
|
81 |
ANT_OPTIONS += -Dfull.version='$(FULL_VERSION)' # will contain spaces |
|
82 |
endif |
|
83 |
||
84 |
ifdef MILESTONE |
|
1650
980a667baa29
6778493: Fix (langtools) ant build to honor fcs MILESTONE setting
jjg
parents:
10
diff
changeset
|
85 |
ifneq ($(MILESTONE),fcs) |
10 | 86 |
ANT_OPTIONS += -Dmilestone=$(MILESTONE) |
1650
980a667baa29
6778493: Fix (langtools) ant build to honor fcs MILESTONE setting
jjg
parents:
10
diff
changeset
|
87 |
else |
980a667baa29
6778493: Fix (langtools) ant build to honor fcs MILESTONE setting
jjg
parents:
10
diff
changeset
|
88 |
ANT_OPTIONS += -Drelease=$(JDK_VERSION) |
980a667baa29
6778493: Fix (langtools) ant build to honor fcs MILESTONE setting
jjg
parents:
10
diff
changeset
|
89 |
endif |
10 | 90 |
endif |
91 |
||
92 |
ifdef BUILD_NUMBER |
|
93 |
ANT_OPTIONS += -Dbuild.number=$(BUILD_NUMBER) |
|
94 |
else |
|
95 |
ifdef JDK_BUILD_NUMBER |
|
96 |
ANT_OPTIONS += -Dbuild.number=$(JDK_BUILD_NUMBER) |
|
97 |
endif |
|
98 |
endif |
|
99 |
||
100 |
ifeq ($(VARIANT), DBG) |
|
101 |
ANT_OPTIONS += -Djavac.debug=true |
|
102 |
else |
|
103 |
ifeq ($(VARIANT), OPT) |
|
104 |
ANT_OPTIONS += -Djavac.debug=false |
|
105 |
endif |
|
106 |
endif |
|
107 |
||
2848
98fc22703cbc
6829575: 100028: Debug information is incomplete or missing
aph
parents:
1650
diff
changeset
|
108 |
ifeq ($(DEBUG_CLASSFILES), true) |
98fc22703cbc
6829575: 100028: Debug information is incomplete or missing
aph
parents:
1650
diff
changeset
|
109 |
ANT_OPTIONS += -Djavac.debug=true |
2850
307d7719ccb7
6837665: Deal with windows ant problem where commas in -D options do not work
aph
parents:
2849
diff
changeset
|
110 |
ANT_OPTIONS += -Ddebug.classfiles=true |
2848
98fc22703cbc
6829575: 100028: Debug information is incomplete or missing
aph
parents:
1650
diff
changeset
|
111 |
endif |
98fc22703cbc
6829575: 100028: Debug information is incomplete or missing
aph
parents:
1650
diff
changeset
|
112 |
|
10 | 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) |
|
117 |
else |
|
118 |
ifdef JAVAC_TARGET_ARG |
|
119 |
ANT_OPTIONS += -Djavac.target=$(JAVAC_TARGET_ARG) |
|
120 |
endif |
|
121 |
endif |
|
122 |
||
2982 | 123 |
ifdef SOURCE_LANGUAGE_VERSION |
124 |
ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION) |
|
125 |
else |
|
126 |
ifdef JAVAC_SOURCE_ARG |
|
127 |
ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG) |
|
128 |
endif |
|
129 |
endif |
|
130 |
||
10 | 131 |
ifdef ALT_BOOTDIR |
132 |
ANT_OPTIONS += -Dboot.java.home=$(ALT_BOOTDIR) |
|
133 |
ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR) |
|
134 |
endif |
|
135 |
||
4415
7d4f73717fba
6902337: fix langtools build to allow forward refs into jdk/ repo
jjg
parents:
2988
diff
changeset
|
136 |
# To facilitate bootstrapping, much of langtools can be compiled with (just) |
7d4f73717fba
6902337: fix langtools build to allow forward refs into jdk/ repo
jjg
parents:
2988
diff
changeset
|
137 |
# a boot JDK. However, some source files need to be compiled against |
7d4f73717fba
6902337: fix langtools build to allow forward refs into jdk/ repo
jjg
parents:
2988
diff
changeset
|
138 |
# new JDK API. In a bootstrap build, an import JDK may not be available, |
7d4f73717fba
6902337: fix langtools build to allow forward refs into jdk/ repo
jjg
parents:
2988
diff
changeset
|
139 |
# so build.xml can also build against the source files in a jdk repo, |
7d4f73717fba
6902337: fix langtools build to allow forward refs into jdk/ repo
jjg
parents:
2988
diff
changeset
|
140 |
# in which case it will automatically generate stub files for the new JDK API. |
7d4f73717fba
6902337: fix langtools build to allow forward refs into jdk/ repo
jjg
parents:
2988
diff
changeset
|
141 |
ifdef JDK_TOPDIR |
7d4f73717fba
6902337: fix langtools build to allow forward refs into jdk/ repo
jjg
parents:
2988
diff
changeset
|
142 |
ANT_OPTIONS += -Dimport.jdk=$(JDK_TOPDIR) |
7d4f73717fba
6902337: fix langtools build to allow forward refs into jdk/ repo
jjg
parents:
2988
diff
changeset
|
143 |
else |
7d4f73717fba
6902337: fix langtools build to allow forward refs into jdk/ repo
jjg
parents:
2988
diff
changeset
|
144 |
ifdef ALT_JDK_TOPDIR |
7d4f73717fba
6902337: fix langtools build to allow forward refs into jdk/ repo
jjg
parents:
2988
diff
changeset
|
145 |
ANT_OPTIONS += -Dimport.jdk=$(ALT_JDK_TOPDIR) |
7d4f73717fba
6902337: fix langtools build to allow forward refs into jdk/ repo
jjg
parents:
2988
diff
changeset
|
146 |
else |
4697
6b2500c26d51
6915078: ALT_JDK_IMPORT_PATH typo in langtools/make/Makefile
jjg
parents:
4415
diff
changeset
|
147 |
ifdef ALT_JDK_IMPORT_PATH |
6b2500c26d51
6915078: ALT_JDK_IMPORT_PATH typo in langtools/make/Makefile
jjg
parents:
4415
diff
changeset
|
148 |
ANT_OPTIONS += -Dimport.jdk=$(ALT_JDK_IMPORT_PATH) |
4415
7d4f73717fba
6902337: fix langtools build to allow forward refs into jdk/ repo
jjg
parents:
2988
diff
changeset
|
149 |
endif |
7d4f73717fba
6902337: fix langtools build to allow forward refs into jdk/ repo
jjg
parents:
2988
diff
changeset
|
150 |
endif |
7d4f73717fba
6902337: fix langtools build to allow forward refs into jdk/ repo
jjg
parents:
2988
diff
changeset
|
151 |
endif |
7d4f73717fba
6902337: fix langtools build to allow forward refs into jdk/ repo
jjg
parents:
2988
diff
changeset
|
152 |
|
10 | 153 |
ifdef ALT_OUTPUTDIR |
154 |
OUTPUTDIR = $(ALT_OUTPUTDIR) |
|
155 |
ANT_OPTIONS += -Dbuild.dir=$(ALT_OUTPUTDIR)/build |
|
156 |
ANT_OPTIONS += -Ddist.dir=$(ALT_OUTPUTDIR)/dist |
|
157 |
else |
|
158 |
OUTPUTDIR = .. |
|
159 |
endif |
|
160 |
#ABS_OUTPUTDIR = $(abspath $(OUTPUTDIR)) |
|
161 |
ABS_OUTPUTDIR = $(call FullPath,$(OUTPUTDIR)) |
|
162 |
||
163 |
ANT_TMPDIR = $(ABS_OUTPUTDIR)/build/ant-tmp |
|
164 |
ANT_OPTS = ANT_OPTS=-Djava.io.tmpdir='$(ANT_TMPDIR)' |
|
165 |
||
166 |
ifdef FINDBUGS_HOME |
|
167 |
ANT_OPTIONS += -Dfindbugs.home=$(FINDBUGS_HOME) |
|
168 |
endif |
|
169 |
||
170 |
ifdef ANT_HOME |
|
171 |
ANT = $(ANT_HOME)/bin/ant |
|
172 |
ifneq ($(shell test -x $(ANT) && echo OK), OK) |
|
173 |
$(error $(ANT) not found -- please update ANT_HOME) |
|
174 |
endif |
|
175 |
else |
|
176 |
ANT = ant |
|
177 |
ifneq ($(shell test -x "`which $(ANT)`" && echo OK), OK) |
|
178 |
$(error 'ant' not found -- please set ANT_HOME or put 'ant' on your PATH) |
|
179 |
endif |
|
180 |
endif |
|
181 |
||
182 |
# Default target and expected 'do everything' target |
|
183 |
all: build |
|
184 |
||
185 |
# Standard make clobber target |
|
186 |
clobber: clean |
|
187 |
||
188 |
# All ant targets of interest |
|
189 |
ANT_TARGETS = build clean sanity post-sanity diagnostics # for now |
|
190 |
||
5219
6765bf7b1023
6938326: Use of "ant -diagnostics" a problem with ant 1.8.0, exit code 1 now
ohair
parents:
4941
diff
changeset
|
191 |
# Create diagnostics log (careful, ant 1.8.0 -diagnostics always does an exit 1) |
6765bf7b1023
6938326: Use of "ant -diagnostics" a problem with ant 1.8.0, exit code 1 now
ohair
parents:
4941
diff
changeset
|
192 |
$(OUTPUTDIR)/build/ant-diagnostics.log: |
6765bf7b1023
6938326: Use of "ant -diagnostics" a problem with ant 1.8.0, exit code 1 now
ohair
parents:
4941
diff
changeset
|
193 |
@mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR) |
6765bf7b1023
6938326: Use of "ant -diagnostics" a problem with ant 1.8.0, exit code 1 now
ohair
parents:
4941
diff
changeset
|
194 |
@$(RM) $@ |
6765bf7b1023
6938326: Use of "ant -diagnostics" a problem with ant 1.8.0, exit code 1 now
ohair
parents:
4941
diff
changeset
|
195 |
$(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -diagnostics > $@ ; \ |
6765bf7b1023
6938326: Use of "ant -diagnostics" a problem with ant 1.8.0, exit code 1 now
ohair
parents:
4941
diff
changeset
|
196 |
$(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -version >> $@ |
6765bf7b1023
6938326: Use of "ant -diagnostics" a problem with ant 1.8.0, exit code 1 now
ohair
parents:
4941
diff
changeset
|
197 |
|
10 | 198 |
# Create a make target for each |
5219
6765bf7b1023
6938326: Use of "ant -diagnostics" a problem with ant 1.8.0, exit code 1 now
ohair
parents:
4941
diff
changeset
|
199 |
$(ANT_TARGETS): $(OUTPUTDIR)/build/ant-diagnostics.log |
10 | 200 |
@ mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR) |
201 |
$(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) $(ANT_OPTIONS) $@ |
|
202 |
||
203 |
#------------------------------------------------------------------- |
|
204 |
# |
|
205 |
# Targets for Sun's internal JPRT build system |
|
206 |
||
207 |
CD = cd |
|
208 |
ZIP = zip |
|
209 |
||
210 |
JPRT_ARCHIVE_BUNDLE=$(ABS_OUTPUTDIR)/$(JPRT_BUILD_FLAVOR)-bundle.zip |
|
211 |
||
212 |
jprt_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 |