comparison make/Makefile @ 0:a61af66fc99e jdk7-b24

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children ba764ed4b6f2
comparison
equal deleted inserted replaced
-1:000000000000 0:a61af66fc99e
1 #
2 # Copyright 2005-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.
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 # Top level gnumake file for hotspot builds
26 #
27 # Default is to build the both product images and construct an export dir.
28 # The default export directory name is `pwd`/export-$(PLATFORM).
29 #
30 # Use: 'gnumake help' for more information.
31 #
32 # This makefile uses the default settings for where to find compilers and
33 # tools, and obeys the ALT_* variable settings used by the other JDK
34 # workspaces.
35 #
36
37 # Expected/optional make variables defined on make command line:
38 # LP64=1 or ARCH_DATA_MODEL=64 for 64bit build
39 #
40 # Expected/optional make variables or environment variables:
41 # ALT_SLASH_JAVA Location of /java or J:
42 # ALT_BOOTDIR Previous JDK home directory for javac compiler
43 # ALT_OUTPUTDIR Output directory to use for hotspot build
44 # ALT_EXPORT_PATH Directory to export hotspot build to
45 # ALT_JDK_IMPORT_PATH Current JDK build (only for create_jdk rules)
46 # ALT_BUILD_WIN_SA Building SA on Windows is disabled by default.
47 # Set ALT_BUILD_WIN_SA=1 to enable building SA on
48 # Windows.
49 # Version strings and numbers:
50 # JDK_VERSION Current JDK version (e.g. 1.6.0)
51 # PREVIOUS_JDK_VERSION Previous (bootdir) JDK version (e.g. 1.5.0)
52 # FULL_VERSION Full version string to use (e.g. "1.6.0-ea-b42")
53 #
54 # Version strings and numbers especially needed on Windows:
55 # COOKED_JDK_UPDATE_VERSION Just the update release number (e.g. 02)
56 # COOKED_BUILD_NUMBER Just the build number (e.g. 42)
57 # JDK_MKTG_VERSION Marketing JDK version (e.g. 6.0)
58 # JDK_MAJOR_VERSION Major number for version (e.g. 1) always 1?
59 # JDK_MINOR_VERSION Minor number for version (e.g. 6)
60 # JDK_MICRO_VERSION Micro number for version (e.g. 0)
61 #
62
63 # Default is build both product fastdebug and create export area
64
65 # Allow to build HotSpot in local directory from sources specified by GAMMADIR.
66 # After make/defs.make GAMMADIR is defined.
67 ifdef GAMMADIR
68 ifndef ALT_OUTPUTDIR
69 ALT_OUTPUTDIR := $(shell pwd)
70 endif
71 include $(GAMMADIR)/make/defs.make
72 else
73 include defs.make
74 endif
75
76
77 ifneq ($(ALT_OUTPUTDIR),)
78 ALT_OUT=ALT_OUTPUTDIR=$(ALT_OUTPUTDIR)
79 else
80 ALT_OUT=
81 endif
82
83 # Typical C1/C2 targets made available with this Makefile
84 C1_VM_TARGETS=product1 fastdebug1 optimized1 jvmg1
85 C2_VM_TARGETS=product fastdebug optimized jvmg
86 KERNEL_VM_TARGETS=productkernel fastdebugkernel optimizedkernel jvmgkernel
87
88 all: all_product all_fastdebug
89 all_product: product product1 productkernel docs export_product
90 all_fastdebug: fastdebug fastdebug1 fastdebugkernel docs export_fastdebug
91 all_debug: jvmg jvmg1 jvmgkernel docs export_debug
92 all_optimized: optimized optimized1 optimizedkernel docs export_optimized
93
94 # Do everything
95 world: all create_jdk
96
97 # Build or export docs
98 docs:
99 ifeq ($(OSNAME),windows)
100 @$(ECHO) "No docs ($(VM_TARGET)) for windows"
101 else
102 $(CD) $(OUTPUTDIR); \
103 $(MAKE) -f $(ABS_OS_MAKEFILE) \
104 $(MAKE_ARGS) docs
105 endif
106
107 # Build variation of hotspot
108 $(C1_VM_TARGETS):
109 $(CD) $(GAMMADIR)/make; \
110 $(MAKE) VM_TARGET=$@ generic_build1 $(ALT_OUT)
111
112 $(C2_VM_TARGETS):
113 $(CD) $(GAMMADIR)/make; \
114 $(MAKE) VM_TARGET=$@ generic_build2 $(ALT_OUT)
115
116 $(KERNEL_VM_TARGETS):
117 $(CD) $(GAMMADIR)/make; \
118 $(MAKE) VM_TARGET=$@ generic_buildkernel $(ALT_OUT)
119
120 # Build compiler1 (client) rule, different for platforms
121 generic_build1:
122 $(MKDIR) -p $(OUTPUTDIR)
123 ifeq ($(OSNAME),windows)
124 ifeq ($(ARCH_DATA_MODEL), 32)
125 $(CD) $(OUTPUTDIR); \
126 $(NMAKE) -f $(ABS_OS_MAKEFILE) \
127 Variant=compiler1 \
128 WorkSpace=$(ABS_GAMMADIR) \
129 BootStrapDir=$(ABS_BOOTDIR) \
130 BuildUser=$(USERNAME) \
131 $(MAKE_ARGS) $(VM_TARGET:%1=%)
132 else
133 @$(ECHO) "No compiler1 ($(VM_TARGET)) for ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)"
134 endif
135 else
136 ifeq ($(ARCH_DATA_MODEL), 32)
137 $(CD) $(OUTPUTDIR); \
138 $(MAKE) -f $(ABS_OS_MAKEFILE) \
139 $(MAKE_ARGS) $(VM_TARGET)
140 else
141 @$(ECHO) "No compiler1 ($(VM_TARGET)) for ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)"
142 endif
143 endif
144
145 # Build compiler2 (server) rule, different for platforms
146 generic_build2:
147 $(MKDIR) -p $(OUTPUTDIR)
148 ifeq ($(OSNAME),windows)
149 $(CD) $(OUTPUTDIR); \
150 $(NMAKE) -f $(ABS_OS_MAKEFILE) \
151 Variant=compiler2 \
152 WorkSpace=$(ABS_GAMMADIR) \
153 BootStrapDir=$(ABS_BOOTDIR) \
154 BuildUser=$(USERNAME) \
155 $(MAKE_ARGS) $(VM_TARGET)
156 else
157 $(CD) $(OUTPUTDIR); \
158 $(MAKE) -f $(ABS_OS_MAKEFILE) \
159 $(MAKE_ARGS) $(VM_TARGET)
160 endif
161
162 generic_buildkernel:
163 $(MKDIR) -p $(OUTPUTDIR)
164 ifeq ($(OSNAME),windows)
165 ifeq ($(ARCH_DATA_MODEL), 32)
166 $(CD) $(OUTPUTDIR); \
167 $(NMAKE) -f $(ABS_OS_MAKEFILE) \
168 Variant=kernel \
169 WorkSpace=$(ABS_GAMMADIR) \
170 BootStrapDir=$(ABS_BOOTDIR) \
171 BuildUser=$(USERNAME) \
172 $(MAKE_ARGS) $(VM_TARGET:%kernel=%)
173 else
174 @$(ECHO) "No kernel ($(VM_TARGET)) for ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)"
175 endif
176 else
177 @$(ECHO) "No kernel ($(VM_TARGET)) for OS_NAME=$(OSNAME)"
178 endif
179
180 # Export file rule
181 generic_export: $(EXPORT_LIST)
182 export_product:
183 $(MAKE) VM_SUBDIR=product generic_export
184 export_fastdebug:
185 $(MAKE) VM_SUBDIR=fastdebug EXPORT_SUBDIR=/fastdebug generic_export
186 export_debug:
187 $(MAKE) VM_SUBDIR=${VM_DEBUG} EXPORT_SUBDIR=/debug generic_export
188 export_optimized:
189 $(MAKE) VM_SUBDIR=optimized EXPORT_SUBDIR=/optimized generic_export
190 export_product_jdk:
191 $(MAKE) ALT_EXPORT_PATH=$(JDK_IMAGE_DIR) \
192 VM_SUBDIR=product generic_export
193 export_optimized_jdk:
194 $(MAKE) ALT_EXPORT_PATH=$(JDK_IMAGE_DIR) \
195 VM_SUBDIR=optimized generic_export
196 export_fastdebug_jdk:
197 $(MAKE) ALT_EXPORT_PATH=$(JDK_IMAGE_DIR)/fastdebug \
198 VM_SUBDIR=fastdebug generic_export
199 export_debug_jdk:
200 $(MAKE) ALT_EXPORT_PATH=$(JDK_IMAGE_DIR)/debug \
201 VM_SUBDIR=${VM_DEBUG} generic_export
202
203
204 # Export file copy rules
205 XUSAGE=$(HS_SRC_DIR)/share/vm/Xusage.txt
206 DOCS_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_docs
207 C1_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_compiler1
208 C2_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_compiler2
209 KERNEL_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_kernel
210 C1_DIR=$(C1_BASE_DIR)/$(VM_SUBDIR)
211 C2_DIR=$(C2_BASE_DIR)/$(VM_SUBDIR)
212 KERNEL_DIR=$(KERNEL_BASE_DIR)/$(VM_SUBDIR)
213
214 # Misc files and generated files need to come from C1 or C2 area
215 ifeq ($(ARCH_DATA_MODEL), 32)
216 MISC_DIR=$(C1_DIR)
217 GEN_DIR=$(C1_BASE_DIR)/generated
218 else
219 MISC_DIR=$(C2_DIR)
220 GEN_DIR=$(C2_BASE_DIR)/generated
221 endif
222
223 # Bin files (windows)
224 ifeq ($(OSNAME),windows)
225
226 # Get jvm.lib
227 $(EXPORT_LIB_DIR)/%.lib: $(MISC_DIR)/%.lib
228 $(install-file)
229
230 # Other libraries (like SA)
231 $(EXPORT_JRE_BIN_DIR)/%.dll: $(MISC_DIR)/%.dll
232 $(install-file)
233 $(EXPORT_JRE_BIN_DIR)/%.pdb: $(MISC_DIR)/%.pdb
234 $(install-file)
235 $(EXPORT_JRE_BIN_DIR)/%.map: $(MISC_DIR)/%.map
236 $(install-file)
237
238 # Client files always come from C1 area
239 $(EXPORT_CLIENT_DIR)/%.dll: $(C1_DIR)/%.dll
240 $(install-file)
241 $(EXPORT_CLIENT_DIR)/%.pdb: $(C1_DIR)/%.pdb
242 $(install-file)
243 $(EXPORT_CLIENT_DIR)/%.map: $(C1_DIR)/%.map
244 $(install-file)
245
246 # Server files always come from C2 area
247 $(EXPORT_SERVER_DIR)/%.dll: $(C2_DIR)/%.dll
248 $(install-file)
249 $(EXPORT_SERVER_DIR)/%.pdb: $(C2_DIR)/%.pdb
250 $(install-file)
251 $(EXPORT_SERVER_DIR)/%.map: $(C2_DIR)/%.map
252 $(install-file)
253
254 # Kernel files always come from kernel area
255 $(EXPORT_KERNEL_DIR)/%.dll: $(KERNEL_DIR)/%.dll
256 $(install-file)
257 $(EXPORT_KERNEL_DIR)/%.pdb: $(KERNEL_DIR)/%.pdb
258 $(install-file)
259 $(EXPORT_KERNEL_DIR)/%.map: $(KERNEL_DIR)/%.map
260 $(install-file)
261 endif
262
263 # Shared Library
264 ifneq ($(OSNAME),windows)
265 $(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(C2_DIR)/%.so
266 $(install-file)
267 $(EXPORT_CLIENT_DIR)/%.so: $(C1_DIR)/%.so
268 $(install-file)
269 $(EXPORT_CLIENT_DIR)/64/%.so: $(C1_DIR)/%.so
270 $(install-file)
271 $(EXPORT_SERVER_DIR)/%.so: $(C2_DIR)/%.so
272 $(install-file)
273 $(EXPORT_SERVER_DIR)/64/%.so: $(C2_DIR)/%.so
274 $(install-file)
275 endif
276
277 # Jar file (sa-jdi.jar)
278 $(EXPORT_LIB_DIR)/%.jar: $(GEN_DIR)/%.jar
279 $(install-file)
280
281 # Include files (jvmti.h, jni.h, $(JDK_INCLUDE_SUBDIR)/jni_md.h, jmm.h)
282 $(EXPORT_INCLUDE_DIR)/%: $(GEN_DIR)/jvmtifiles/%
283 $(install-file)
284
285 $(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/prims/%
286 $(install-file)
287
288 $(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h: $(HS_SRC_DIR)/cpu/$(HS_ARCH)/vm/jni_$(HS_ARCH).h
289 $(install-file)
290
291 $(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/services/%
292 $(install-file)
293
294 # Doc files (jvmti.html)
295 $(EXPORT_DOCS_DIR)/platform/jvmti/%: $(DOCS_DIR)/%
296 $(install-file)
297
298 # Xusage file
299 $(EXPORT_SERVER_DIR)/Xusage.txt $(EXPORT_CLIENT_DIR)/Xusage.txt $(EXPORT_KERNEL_DIR)/Xusage.txt: $(XUSAGE)
300 $(prep-target)
301 $(RM) $@.temp
302 $(SED) 's/\(separated by \)[;:]/\1$(PATH_SEP)/g' $< > $@.temp
303 $(MV) $@.temp $@
304
305 #
306 # Clean rules
307 #
308 clobber clean: clean_build clean_export clean_jdk
309 clean_build:
310 $(RM) -r $(C1_DIR)
311 $(RM) -r $(C2_DIR)
312 $(RM) -r $(KERNEL_DIR)
313 clean_export:
314 $(RM) -r $(EXPORT_PATH)
315 clean_jdk:
316 $(RM) -r $(JDK_IMAGE_DIR)
317
318 #
319 # Create JDK and place this build into it
320 #
321 create_jdk: copy_jdk update_jdk
322
323 update_jdk: export_product_jdk export_fastdebug_jdk test_jdk
324
325 copy_jdk: $(JDK_IMAGE_DIR)/jre/lib/rt.jar
326
327 $(JDK_IMAGE_DIR)/jre/lib/rt.jar:
328 $(RM) -r $(JDK_IMAGE_DIR)
329 $(MKDIR) -p $(JDK_IMAGE_DIR)
330 ($(CD) $(JDK_IMPORT_PATH) && \
331 $(TAR) -cf - *) | \
332 ($(CD) $(JDK_IMAGE_DIR) && $(TAR) -xf -)
333
334 test_jdk:
335 ifeq ($(ARCH_DATA_MODEL), 32)
336 $(JDK_IMAGE_DIR)/bin/java -client -version
337 endif
338 $(JDK_IMAGE_DIR)/bin/java -server -version
339
340 copy_product_jdk:
341 $(RM) -r $(JDK_IMAGE_DIR)
342 $(MKDIR) -p $(JDK_IMAGE_DIR)
343 ($(CD) $(JDK_IMPORT_PATH) && \
344 $(TAR) -cf - bin include jre lib) | \
345 ($(CD) $(JDK_IMAGE_DIR) && $(TAR) -xf -)
346
347 copy_fastdebug_jdk:
348 $(RM) -r $(JDK_IMAGE_DIR)/fastdebug
349 $(MKDIR) -p $(JDK_IMAGE_DIR)/fastdebug
350 if [ -d $(JDK_IMPORT_PATH)/fastdebug ] ; then \
351 ($(CD) $(JDK_IMPORT_PATH)/fastdebug && \
352 $(TAR) -cf - bin include jre lib) | \
353 ($(CD) $(JDK_IMAGE_DIR)/fastdebug && $(TAR) -xf -) ; \
354 else \
355 ($(CD) $(JDK_IMPORT_PATH) && \
356 $(TAR) -cf - bin include jre lib) | \
357 ($(CD) $(JDK_IMAGE_DIR)/fastdebug && $(TAR) -xf -) ; \
358 fi
359
360 copy_debug_jdk:
361 $(RM) -r $(JDK_IMAGE_DIR)/debug
362 $(MKDIR) -p $(JDK_IMAGE_DIR)/debug
363 if [ -d $(JDK_IMPORT_PATH)/debug ] ; then \
364 ($(CD) $(JDK_IMPORT_PATH)/debug && \
365 $(TAR) -cf - bin include jre lib) | \
366 ($(CD) $(JDK_IMAGE_DIR)/debug && $(TAR) -xf -) ; \
367 elif [ -d $(JDK_IMPORT_PATH)/fastdebug ] ; then \
368 ($(CD) $(JDK_IMPORT_PATH)/fastdebug && \
369 $(TAR) -cf - bin include jre lib) | \
370 ($(CD) $(JDK_IMAGE_DIR)/debug && $(TAR) -xf -) ; \
371 else \
372 ($(CD) $(JDK_IMPORT_PATH) && \
373 $(TAR) -cf - bin include jre lib) | \
374 ($(CD) $(JDK_IMAGE_DIR)/debug && $(TAR) -xf -) ; \
375 fi
376
377 #
378 # Check target
379 #
380 check: variable_check
381
382 #
383 # Help target
384 #
385 help: intro_help target_help variable_help notes_help examples_help
386
387 # Intro help message
388 intro_help:
389 @$(ECHO) \
390 "Makefile for the Hotspot workspace."
391 @$(ECHO) \
392 "Default behavior is to build and create an export area for the j2se builds."
393
394 # Target help
395 target_help:
396 @$(ECHO) "help: This help message"
397 @$(ECHO) "all: Same as: all_product all_fastdebug"
398 @$(ECHO) "world: Same as: all create_jdk"
399 @$(ECHO) "all_product: Same as: product product1 export_product"
400 @$(ECHO) "all_fastdebug: Same as: fastdebug fastdebug1 export_fastdebug"
401 @$(ECHO) "all_debug: Same as: jvmg jvmg1 export_debug"
402 @$(ECHO) "all_optimized: Same as: optimized optimized1 export_optimized"
403 @$(ECHO) "clean: Clean all areas"
404 @$(ECHO) "export_product: Export product files to EXPORT_PATH"
405 @$(ECHO) "export_fastdebug: Export fastdebug files to EXPORT_PATH"
406 @$(ECHO) "export_debug: Export debug files to EXPORT_PATH"
407 @$(ECHO) "export_optimized: Export optimized files to EXPORT_PATH"
408 @$(ECHO) "create_jdk: Create JDK image, export all files into it"
409 @$(ECHO) "update_jdk: Update JDK image with fresh exported files"
410 @$(ECHO) " "
411 @$(ECHO) "Others targets are:"
412 @$(ECHO) " $(C1_VM_TARGETS)"
413 @$(ECHO) " $(C2_VM_TARGETS)"
414 @$(ECHO) " $(KERNEL_VM_TARGETS)"
415
416 # Variable help (only common ones used by this workspace)
417 variable_help: variable_help_intro variable_list variable_help_end
418 variable_help_intro:
419 @$(ECHO) "--- Common Variables ---"
420 variable_help_end:
421 @$(ECHO) " "
422 @$(ECHO) "--- Make Arguments ---"
423 @$(ECHO) "MAKE_ARGS=$(MAKE_ARGS)"
424
425 # One line descriptions for the variables
426 SLASH_JAVA.desc = Root of all build tools, e.g. /java or J:
427 OUTPUTDIR.desc = Output directory, default is build/<osname>
428 BOOTDIR.desc = JDK used to compile agent java source and test with
429 JDK_IMPORT_PATH.desc = Promoted JDK to copy for 'create_jdk'
430 EXPORT_PATH.desc = Directory to place files to export for JDK build
431
432 # Make variables to print out (description and value)
433 VARIABLE_PRINTVAL_LIST += \
434 SLASH_JAVA \
435 OUTPUTDIR \
436 BOOTDIR \
437 JDK_IMPORT_PATH \
438 EXPORT_PATH
439
440 # Make variables that should refer to directories that exist
441 VARIABLE_CHECKDIR_LIST += \
442 SLASH_JAVA \
443 BOOTDIR \
444 JDK_IMPORT_PATH
445
446 # For pattern rules below, so all are treated the same
447 DO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval)
448 DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir)
449
450 # Complete variable check
451 variable_check: $(DO_CHECKDIR_LIST)
452 variable_list: $(DO_PRINTVAL_LIST) variable_check
453
454 # Pattern rule for printing out a variable
455 %.printval:
456 @$(ECHO) " ALT_$* - $($*.desc)"
457 @$(ECHO) " $*=$($*)"
458
459 # Pattern rule for checking to see if a variable with a directory exists
460 %.checkdir:
461 @if [ ! -d $($*) ] ; then \
462 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
463 fi
464
465 # Pattern rule for checking to see if a variable with a file exists
466 %.checkfil:
467 @if [ ! -f $($*) ] ; then \
468 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
469 fi
470
471 # Misc notes on help
472 notes_help:
473 @$(ECHO) \
474 "--- Notes --- "
475 @$(ECHO) \
476 "- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted"
477 @$(ECHO) \
478 " builds or previous release JDK builds will work."
479 @$(ECHO) \
480 "- The fastest builds have been when the workspace and the BOOTDIR are on"
481 @$(ECHO) \
482 " local disk."
483
484 examples_help:
485 @$(ECHO) \
486 "--- Examples --- "
487 @$(ECHO) \
488 " $(MAKE) all"
489 @$(ECHO) \
490 " $(MAKE) world"
491 @$(ECHO) \
492 " $(MAKE) ALT_BOOTDIR=/opt/java/jdk$(PREVIOUS_JDK_VERSION)"
493 @$(ECHO) \
494 " $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk$(JDK_VERSION)"
495
496 # JPRT rule to build this workspace
497 include $(GAMMADIR)/make/jprt.gmk
498
499 .PHONY: all world clobber clean help $(C1_VM_TARGETS) $(C2_VM_TARGETS) \
500 $(KERNEL_VM_TARGETS) \
501 generic_build1 generic_build2 generic_buildkernel generic_export \
502 export_product export_fastdebug export_debug export_optimized \
503 export_jdk_product export_jdk_fastdebug export_jdk_debug \
504 create_jdk copy_jdk update_jdk test_jdk \
505 copy_product_jdk copy_fastdebug_jdk copy_debug_jdk
506