Mercurial > hg > truffle
annotate make/linux/makefiles/buildtree.make @ 270:b7f01ad69d30
Merge
author | jmasa |
---|---|
date | Mon, 04 Aug 2008 12:11:36 -0700 |
parents | 9c2ecc2ffb12 |
children | 354d3184f6b2 |
rev | line source |
---|---|
0 | 1 # |
196 | 2 # Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved. |
0 | 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. | |
8 # | |
9 # This code is distributed in the hope that it will be useful, but WITHOUT | |
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 # version 2 for more details (a copy is included in the LICENSE file that | |
13 # accompanied this code). | |
14 # | |
15 # You should have received a copy of the GNU General Public License version | |
16 # 2 along with this work; if not, write to the Free Software Foundation, | |
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 # | |
19 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 # CA 95054 USA or visit www.sun.com if you need additional information or | |
21 # have any questions. | |
22 # | |
23 # | |
24 | |
25 # Usage: | |
26 # | |
27 # $(MAKE) -f buildtree.make ARCH=arch BUILDARCH=buildarch LIBARCH=libarch | |
28 # GAMMADIR=dir OS_FAMILY=os VARIANT=variant | |
29 # | |
30 # The macros ARCH, GAMMADIR, OS_FAMILY and VARIANT must be defined in the | |
31 # environment or on the command-line: | |
32 # | |
33 # ARCH - sparc, i486, ... HotSpot cpu and os_cpu source directory | |
34 # BUILDARCH - build directory | |
35 # LIBARCH - the corresponding directory in JDK/JRE | |
36 # GAMMADIR - top of workspace | |
37 # OS_FAMILY - operating system | |
38 # VARIANT - core, compiler1, compiler2, or tiered | |
39 # HOTSPOT_RELEASE_VERSION - <major>.<minor>-b<nn> (11.0-b07) | |
40 # HOTSPOT_BUILD_VERSION - internal, PRTjob ID, JPRTjob ID | |
41 # JRE_RELEASE_VERSION - <major>.<minor>.<micro> (1.7.0) | |
42 # | |
43 # Builds the directory trees with makefiles plus some convenience files in | |
44 # each directory: | |
45 # | |
46 # Makefile - for "make foo" | |
47 # flags.make - with macro settings | |
48 # vm.make - to support making "$(MAKE) -v vm.make" in makefiles | |
49 # adlc.make - | |
50 # jvmti.make - generate JVMTI bindings from the spec (JSR-163) | |
51 # sa.make - generate SA jar file and natives | |
52 # env.[ck]sh - environment settings | |
53 # test_gamma - script to run the Queens program | |
54 # | |
55 # The makefiles are split this way so that "make foo" will run faster by not | |
56 # having to read the dependency files for the vm. | |
57 | |
58 include $(GAMMADIR)/make/scm.make | |
59 | |
60 # 'gmake MAKE_VERBOSE=y' or 'gmake QUIETLY=' gives all the gory details. | |
61 QUIETLY$(MAKE_VERBOSE) = @ | |
62 | |
63 # For now, until the compiler is less wobbly: | |
64 TESTFLAGS = -Xbatch -showversion | |
65 | |
50
485d403e94e1
6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents:
0
diff
changeset
|
66 ifdef USE_SUNCC |
91
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
50
diff
changeset
|
67 PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH).suncc |
50
485d403e94e1
6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents:
0
diff
changeset
|
68 else |
91
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
50
diff
changeset
|
69 PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH) |
50
485d403e94e1
6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents:
0
diff
changeset
|
70 endif |
0 | 71 |
72 ifdef FORCE_TIERED | |
73 ifeq ($(VARIANT),tiered) | |
74 PLATFORM_DIR = $(OS_FAMILY)_$(BUILDARCH)_compiler2 | |
75 else | |
76 PLATFORM_DIR = $(OS_FAMILY)_$(BUILDARCH)_$(VARIANT) | |
77 endif | |
78 else | |
79 PLATFORM_DIR = $(OS_FAMILY)_$(BUILDARCH)_$(VARIANT) | |
80 endif | |
81 | |
82 # | |
83 # We do two levels of exclusion in the shared directory. | |
84 # TOPLEVEL excludes are pruned, they are not recursively searched, | |
85 # but lower level directories can be named without fear of collision. | |
86 # ALWAYS excludes are excluded at any level in the directory tree. | |
87 # | |
88 | |
89 ALWAYS_EXCLUDE_DIRS = $(SCM_DIRS) | |
90 | |
91 ifeq ($(VARIANT),tiered) | |
92 TOPLEVEL_EXCLUDE_DIRS = $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name agent | |
93 else | |
94 ifeq ($(VARIANT),compiler2) | |
95 TOPLEVEL_EXCLUDE_DIRS = $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name c1 -o -name agent | |
96 else | |
97 # compiler1 and core use the same exclude list | |
98 TOPLEVEL_EXCLUDE_DIRS = $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name opto -o -name libadt -o -name agent | |
99 endif | |
100 endif | |
101 | |
102 # Get things from the platform file. | |
103 COMPILER = $(shell sed -n 's/^compiler[ ]*=[ ]*//p' $(PLATFORM_FILE)) | |
104 | |
105 SIMPLE_DIRS = \ | |
106 $(PLATFORM_DIR)/generated/incls \ | |
107 $(PLATFORM_DIR)/generated/adfiles \ | |
108 $(PLATFORM_DIR)/generated/jvmtifiles | |
109 | |
110 TARGETS = debug fastdebug jvmg optimized product profiled | |
111 SUBMAKE_DIRS = $(addprefix $(PLATFORM_DIR)/,$(TARGETS)) | |
112 | |
113 # For dependencies and recursive makes. | |
91
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
50
diff
changeset
|
114 BUILDTREE_MAKE = $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make |
0 | 115 |
116 BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make sa.make \ | |
117 env.sh env.csh .dbxrc test_gamma | |
118 | |
119 BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \ | |
120 ARCH=$(ARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT) | |
121 | |
122 # Define variables to be set in flags.make. | |
123 # Default values are set in make/defs.make. | |
124 ifeq ($(HOTSPOT_BUILD_VERSION),) | |
125 HS_BUILD_VER=$(HOTSPOT_RELEASE_VERSION) | |
126 else | |
127 HS_BUILD_VER=$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION) | |
128 endif | |
129 # Set BUILD_USER from system-dependent hints: $LOGNAME, $(whoami) | |
130 ifndef HOTSPOT_BUILD_USER | |
131 HOTSPOT_BUILD_USER := $(shell echo $$LOGNAME) | |
132 endif | |
133 ifndef HOTSPOT_BUILD_USER | |
134 HOTSPOT_BUILD_USER := $(shell whoami) | |
135 endif | |
91
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
50
diff
changeset
|
136 # Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro |
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
50
diff
changeset
|
137 # or make/hotspot_distro. |
0 | 138 ifndef HOTSPOT_VM_DISTRO |
139 CLOSED_DIR_EXISTS := $(shell \ | |
91
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
50
diff
changeset
|
140 if [ -d $(GAMMADIR)/src/closed ] ; then \ |
0 | 141 echo true; \ |
142 else \ | |
143 echo false; \ | |
144 fi) | |
145 ifeq ($(CLOSED_DIR_EXISTS), true) | |
91
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
50
diff
changeset
|
146 include $(GAMMADIR)/make/hotspot_distro |
0 | 147 else |
91
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
50
diff
changeset
|
148 include $(GAMMADIR)/make/openjdk_distro |
0 | 149 endif |
150 endif | |
151 | |
152 BUILDTREE_VARS += HOTSPOT_RELEASE_VERSION=$(HS_BUILD_VER) HOTSPOT_BUILD_VERSION= JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) | |
153 | |
154 BUILDTREE = \ | |
155 $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_TARGETS) $(BUILDTREE_VARS) | |
156 | |
157 BUILDTREE_COMMENT = echo "\# Generated by $(BUILDTREE_MAKE)" | |
158 | |
159 all: $(SUBMAKE_DIRS) | |
160 | |
161 # Run make in each subdirectory recursively. | |
162 $(SUBMAKE_DIRS): $(SIMPLE_DIRS) FORCE | |
163 $(QUIETLY) [ -d $@ ] || { mkdir -p $@; } | |
164 $(QUIETLY) cd $@ && $(BUILDTREE) TARGET=$(@F) | |
165 $(QUIETLY) touch $@ | |
166 | |
167 $(SIMPLE_DIRS): | |
168 $(QUIETLY) mkdir -p $@ | |
169 | |
170 flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst | |
171 @echo Creating $@ ... | |
172 $(QUIETLY) ( \ | |
173 $(BUILDTREE_COMMENT); \ | |
174 echo; \ | |
175 echo "Platform_file = $(PLATFORM_FILE)" | sed 's|$(GAMMADIR)|$$(GAMMADIR)|'; \ | |
176 sed -n '/=/s/^ */Platform_/p' < $(PLATFORM_FILE); \ | |
177 echo; \ | |
178 echo "GAMMADIR = $(GAMMADIR)"; \ | |
179 echo "SYSDEFS = \$$(Platform_sysdefs)"; \ | |
180 echo "SRCARCH = $(ARCH)"; \ | |
181 echo "BUILDARCH = $(BUILDARCH)"; \ | |
182 echo "LIBARCH = $(LIBARCH)"; \ | |
183 echo "TARGET = $(TARGET)"; \ | |
184 echo "HS_BUILD_VER = $(HS_BUILD_VER)"; \ | |
185 echo "JRE_RELEASE_VER = $(JRE_RELEASE_VERSION)"; \ | |
186 echo "SA_BUILD_VERSION = $(HS_BUILD_VER)"; \ | |
187 echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \ | |
188 echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \ | |
189 echo; \ | |
190 echo "Src_Dirs = \\"; \ | |
191 sed 's/$$/ \\/;s|$(GAMMADIR)|$$(GAMMADIR)|' ../shared_dirs.lst; \ | |
192 echo "\$$(GAMMADIR)/src/cpu/$(ARCH)/vm \\"; \ | |
193 echo "\$$(GAMMADIR)/src/os/$(OS_FAMILY)/vm \\"; \ | |
194 echo "\$$(GAMMADIR)/src/os_cpu/$(OS_FAMILY)_$(ARCH)/vm"; \ | |
195 [ -n "$(CFLAGS_BROWSE)" ] && \ | |
196 echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \ | |
197 [ -n "$(HOTSPOT_EXTRA_SYSDEFS)" ] && \ | |
198 echo && \ | |
199 echo "HOTSPOT_EXTRA_SYSDEFS\$$(HOTSPOT_EXTRA_SYSDEFS) = $(HOTSPOT_EXTRA_SYSDEFS)" && \ | |
200 echo "SYSDEFS += \$$(HOTSPOT_EXTRA_SYSDEFS)"; \ | |
201 echo; \ | |
91
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
50
diff
changeset
|
202 echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(VARIANT).make"; \ |
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
50
diff
changeset
|
203 echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(COMPILER).make"; \ |
0 | 204 ) > $@ |
205 | |
206 flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst | |
207 @echo Creating $@ ... | |
208 $(QUIETLY) ( \ | |
209 $(BUILDTREE_COMMENT); \ | |
210 echo; \ | |
211 [ "$(TARGET)" = profiled ] && \ | |
91
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
50
diff
changeset
|
212 echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/optimized.make"; \ |
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
50
diff
changeset
|
213 echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(TARGET).make"; \ |
0 | 214 ) > $@ |
215 | |
216 ../shared_dirs.lst: $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm | |
217 @echo Creating directory list $@ | |
218 $(QUIETLY) find $(GAMMADIR)/src/share/vm/* -prune \ | |
219 -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \ | |
220 \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; > $@ | |
221 | |
222 Makefile: $(BUILDTREE_MAKE) | |
223 @echo Creating $@ ... | |
224 $(QUIETLY) ( \ | |
225 $(BUILDTREE_COMMENT); \ | |
226 echo; \ | |
227 echo include flags.make; \ | |
228 echo; \ | |
91
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
50
diff
changeset
|
229 echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/top.make"; \ |
0 | 230 ) > $@ |
231 | |
232 vm.make: $(BUILDTREE_MAKE) | |
233 @echo Creating $@ ... | |
234 $(QUIETLY) ( \ | |
235 $(BUILDTREE_COMMENT); \ | |
236 echo; \ | |
237 echo include flags.make; \ | |
238 echo include flags_vm.make; \ | |
239 echo; \ | |
91
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
50
diff
changeset
|
240 echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ |
0 | 241 ) > $@ |
242 | |
243 adlc.make: $(BUILDTREE_MAKE) | |
244 @echo Creating $@ ... | |
245 $(QUIETLY) ( \ | |
246 $(BUILDTREE_COMMENT); \ | |
247 echo; \ | |
248 echo include flags.make; \ | |
249 echo; \ | |
91
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
50
diff
changeset
|
250 echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ |
0 | 251 ) > $@ |
252 | |
253 jvmti.make: $(BUILDTREE_MAKE) | |
254 @echo Creating $@ ... | |
255 $(QUIETLY) ( \ | |
256 $(BUILDTREE_COMMENT); \ | |
257 echo; \ | |
258 echo include flags.make; \ | |
259 echo; \ | |
91
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
50
diff
changeset
|
260 echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ |
0 | 261 ) > $@ |
262 | |
263 sa.make: $(BUILDTREE_MAKE) | |
264 @echo Creating $@ ... | |
265 $(QUIETLY) ( \ | |
266 $(BUILDTREE_COMMENT); \ | |
267 echo; \ | |
268 echo include flags.make; \ | |
269 echo; \ | |
91
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
50
diff
changeset
|
270 echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ |
0 | 271 ) > $@ |
272 | |
273 env.sh: $(BUILDTREE_MAKE) | |
274 @echo Creating $@ ... | |
275 $(QUIETLY) ( \ | |
276 $(BUILDTREE_COMMENT); \ | |
277 [ -n "$$JAVA_HOME" ] && { echo ": \$${JAVA_HOME:=$${JAVA_HOME}}"; }; \ | |
278 { \ | |
279 echo "LD_LIBRARY_PATH=.:$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}\$${JAVA_HOME}/jre/lib/${LIBARCH}/native_threads:\$${JAVA_HOME}/jre/lib/${LIBARCH}:${GCC_LIB}"; \ | |
280 echo "CLASSPATH=$${CLASSPATH:+$$CLASSPATH:}.:\$${JAVA_HOME}/jre/lib/rt.jar:\$${JAVA_HOME}/jre/lib/i18n.jar"; \ | |
281 } | sed s:$${JAVA_HOME:--------}:\$${JAVA_HOME}:g; \ | |
282 echo "HOTSPOT_BUILD_USER=\"$${LOGNAME:-$$USER} in `basename $(GAMMADIR)`\""; \ | |
283 echo "export JAVA_HOME LD_LIBRARY_PATH CLASSPATH HOTSPOT_BUILD_USER"; \ | |
284 ) > $@ | |
285 | |
286 env.csh: env.sh | |
287 @echo Creating $@ ... | |
288 $(QUIETLY) ( \ | |
289 $(BUILDTREE_COMMENT); \ | |
290 [ -n "$$JAVA_HOME" ] && \ | |
291 { echo "if (! \$$?JAVA_HOME) setenv JAVA_HOME \"$$JAVA_HOME\""; }; \ | |
292 sed -n 's/^\([A-Za-z_][A-Za-z0-9_]*\)=/setenv \1 /p' $?; \ | |
293 ) > $@ | |
294 | |
295 .dbxrc: $(BUILDTREE_MAKE) | |
296 @echo Creating $@ ... | |
297 $(QUIETLY) ( \ | |
298 echo "echo '# Loading $(PLATFORM_DIR)/$(TARGET)/.dbxrc'"; \ | |
299 echo "if [ -f \"\$${HOTSPOT_DBXWARE}\" ]"; \ | |
300 echo "then"; \ | |
301 echo " source \"\$${HOTSPOT_DBXWARE}\""; \ | |
302 echo "elif [ -f \"\$$HOME/.dbxrc\" ]"; \ | |
303 echo "then"; \ | |
304 echo " source \"\$$HOME/.dbxrc\""; \ | |
305 echo "fi"; \ | |
306 ) > $@ | |
307 | |
308 # Skip the test for product builds (which only work when installed in a JDK), to | |
309 # avoid exiting with an error and causing make to halt. | |
310 NO_TEST_MSG = \ | |
311 echo "$@: skipping the test--this build must be tested in a JDK." | |
312 | |
313 NO_JAVA_HOME_MSG = \ | |
314 echo "JAVA_HOME must be set to run this test." | |
315 | |
316 DATA_MODE = $(DATA_MODE/$(BUILDARCH)) | |
317 JAVA_FLAG = $(JAVA_FLAG/$(DATA_MODE)) | |
318 | |
319 DATA_MODE/i486 = 32 | |
320 DATA_MODE/sparc = 32 | |
321 DATA_MODE/sparcv9 = 64 | |
322 DATA_MODE/amd64 = 64 | |
323 DATA_MODE/ia64 = 64 | |
324 | |
325 JAVA_FLAG/32 = -d32 | |
326 JAVA_FLAG/64 = -d64 | |
327 | |
328 WRONG_DATA_MODE_MSG = \ | |
329 echo "JAVA_HOME must point to $(DATA_MODE)bit JDK." | |
330 | |
232
551f4309f476
6695777: Queens.class should be built from source, not put in source repo
ohair
parents:
91
diff
changeset
|
331 test_gamma: $(BUILDTREE_MAKE) $(GAMMADIR)/make/test/Queens.java |
0 | 332 @echo Creating $@ ... |
333 $(QUIETLY) ( \ | |
334 echo '#!/bin/sh'; \ | |
335 $(BUILDTREE_COMMENT); \ | |
336 echo '. ./env.sh'; \ | |
337 echo "if [ -z \$$JAVA_HOME ]; then { $(NO_JAVA_HOME_MSG); exit 0; }; fi"; \ | |
233
17c572e2697c
6723762: Fix shell command that gets java version (uses 2>1)
ohair
parents:
91
diff
changeset
|
338 echo "if ! \$${JAVA_HOME}/bin/java $(JAVA_FLAG) -fullversion 2>&1 > /dev/null"; \ |
0 | 339 echo "then"; \ |
340 echo " $(WRONG_DATA_MODE_MSG); exit 0;"; \ | |
341 echo "fi"; \ | |
232
551f4309f476
6695777: Queens.class should be built from source, not put in source repo
ohair
parents:
91
diff
changeset
|
342 echo "rm -f Queens.class"; \ |
551f4309f476
6695777: Queens.class should be built from source, not put in source repo
ohair
parents:
91
diff
changeset
|
343 echo "\$${JAVA_HOME}/bin/javac -d . $(GAMMADIR)/make/test/Queens.java"; \ |
0 | 344 echo '[ -f gamma_g ] && { gamma=gamma_g; }'; \ |
345 echo './$${gamma:-gamma} $(TESTFLAGS) Queens < /dev/null'; \ | |
346 ) > $@ | |
347 $(QUIETLY) chmod +x $@ | |
348 | |
349 FORCE: | |
350 | |
351 .PHONY: all FORCE |