Wed, 06 Aug 2008 14:57:13 -0700
6728161: Add SKIP_BOOT_CYCLE feature to create boot jdk and use it during build
Reviewed-by: tbell
1 #
2 # Copyright 1995-2008 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 #
26 BUILD_PARENT_DIRECTORY=.
28 ifndef TOPDIR
29 TOPDIR:=.
30 endif
32 ifndef CONTROL_TOPDIR
33 CONTROL_TOPDIR=$(TOPDIR)
34 endif
36 # Openjdk sources (only used if SKIP_OPENJDK_BUILD!=true)
37 OPENJDK_SOURCETREE=$(TOPDIR)/openjdk
38 OPENJDK_BUILDDIR:=$(shell \
39 if [ -r $(OPENJDK_SOURCETREE)/Makefile ]; then \
40 echo "$(OPENJDK_SOURCETREE)"; \
41 else \
42 echo "."; \
43 fi)
45 ifndef JDK_TOPDIR
46 JDK_TOPDIR=$(TOPDIR)/jdk
47 endif
48 ifndef JDK_MAKE_SHARED_DIR
49 JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared
50 endif
52 # For start and finish echo lines
53 TITLE_TEXT = Control $(PLATFORM) $(ARCH) $(RELEASE)
54 DAYE_STAMP = `$(DATE) '+%y-%m-%d %H:%M'`
55 START_ECHO = echo "$(TITLE_TEXT) $@ build started: $(DATE_STAMP)"
56 FINISH_ECHO = echo "$(TITLE_TEXT) $@ build finished: $(DATE_STAMP)"
58 default: all
60 include $(JDK_MAKE_SHARED_DIR)/Defs-control.gmk
61 include ./make/Defs-internal.gmk
62 include ./make/sanity-rules.gmk
63 include ./make/hotspot-rules.gmk
64 include ./make/langtools-rules.gmk
65 include ./make/corba-rules.gmk
66 include ./make/jaxp-rules.gmk
67 include ./make/jaxws-rules.gmk
68 include ./make/jdk-rules.gmk
69 include ./make/install-rules.gmk
70 include ./make/sponsors-rules.gmk
71 include ./make/deploy-rules.gmk
73 # What "all" means
74 all::
75 @$(START_ECHO)
77 all:: openjdk_check sanity all_product_build
79 ifeq ($(SKIP_FASTDEBUG_BUILD), false)
80 all:: fastdebug_build
81 endif
83 ifeq ($(SKIP_DEBUG_BUILD), false)
84 all:: debug_build
85 endif
87 ifneq ($(SKIP_OPENJDK_BUILD), true)
88 all:: openjdk_build
89 endif
91 all::
92 @$(FINISH_ECHO)
94 # Everything for a full product build
95 all_product_build::
96 @$(START_ECHO)
98 ifeq ($(SKIP_PRODUCT_BUILD), false)
100 all_product_build:: product_build
102 ifeq ($(BUILD_INSTALL), true)
103 all_product_build:: $(INSTALL)
104 clobber:: install-clobber
105 endif
107 ifeq ($(BUILD_SPONSORS), true)
108 all_product_build:: $(SPONSORS)
109 clobber:: sponsors-clobber
110 endif
112 ifneq ($(SKIP_COMPARE_IMAGES), true)
113 all_product_build:: compare-image
114 endif
116 endif
118 all_product_build::
119 @$(FINISH_ECHO)
121 # Generis build of basic repo series
122 generic_build_repo_series::
123 $(MKDIR) -p $(OUTPUTDIR)
124 $(MKDIR) -p $(OUTPUTDIR)/j2sdk-image
126 ifeq ($(BUILD_LANGTOOLS), true)
127 generic_build_repo_series:: langtools
128 clobber:: langtools-clobber
129 endif
131 ifeq ($(BUILD_CORBA), true)
132 generic_build_repo_series:: corba
133 clobber:: corba-clobber
134 endif
136 ifeq ($(BUILD_JAXP), true)
137 generic_build_repo_series:: jaxp
138 clobber:: jaxp-clobber
139 endif
141 ifeq ($(BUILD_JAXWS), true)
142 generic_build_repo_series:: jaxws
143 clobber:: jaxws-clobber
144 endif
146 ifeq ($(BUILD_HOTSPOT), true)
147 generic_build_repo_series:: $(HOTSPOT)
148 clobber:: hotspot-clobber
149 endif
151 ifeq ($(BUILD_JDK), true)
152 generic_build_repo_series:: $(JDK_JAVA_EXE)
153 clobber:: jdk-clobber
154 endif
156 ifeq ($(BUILD_DEPLOY), true)
157 generic_build_repo_series:: $(DEPLOY)
158 clobber:: deploy-clobber
159 endif
161 ifeq ($(BUILD_JDK), true)
162 ifeq ($(BUNDLE_RULES_AVAILABLE), true)
163 generic_build_repo_series:: openjdk-binary-plugs-bundles
164 endif
165 endif
167 # The debug build, fastdebug or debug. Needs special handling.
168 # Note that debug builds do NOT do INSTALL steps, but must be done
169 # after the product build and before the INSTALL step of the product build.
170 #
171 # DEBUG_NAME is fastdebug or debug
172 # ALT_OUTPUTDIR is changed to have -debug or -fastdebug suffix
173 # The resulting j2sdk-image is used by the install makefiles to create a
174 # debug install bundle jdk-*-debug-** bundle (tar or zip)
175 # which will install in the debug or fastdebug subdirectory of the
176 # normal product install area.
177 # The install process needs to know what the DEBUG_NAME is, so
178 # look for INSTALL_DEBUG_NAME in the install rules.
179 #
181 # Location of fresh bootdir output
182 ABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk
183 FRESH_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image
184 FRESH_DEBUG_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)-$(DEBUG_NAME)/j2sdk-image
186 create_fresh_product_bootdir: FRC
187 @$(START_ECHO)
188 $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
189 NO_DOCS=true \
190 BOOT_CYCLE_SETTINGS= \
191 build_product_image
192 @$(FINISH_ECHO)
194 create_fresh_debug_bootdir: FRC
195 @$(START_ECHO)
196 $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
197 NO_DOCS=true \
198 BOOT_CYCLE_DEBUG_SETTINGS= \
199 build_debug_image
200 @$(FINISH_ECHO)
202 create_fresh_fastdebug_bootdir: FRC
203 @$(START_ECHO)
204 $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
205 NO_DOCS=true \
206 BOOT_CYCLE_DEBUG_SETTINGS= \
207 build_fastdebug_image
208 @$(FINISH_ECHO)
210 # Create boot image?
211 ifeq ($(SKIP_BOOT_CYCLE),false)
212 ifneq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64)
213 DO_BOOT_CYCLE=true
214 endif
215 endif
217 ifeq ($(DO_BOOT_CYCLE),true)
219 # Create the bootdir to use in the build
220 product_build:: create_fresh_product_bootdir
221 debug_build:: create_fresh_debug_bootdir
222 fastdebug_build:: create_fresh_fastdebug_bootdir
224 # Define variables to be used now for the boot jdk
225 BOOT_CYCLE_SETTINGS= \
226 ALT_BOOTDIR=$(FRESH_BOOTDIR) \
227 ALT_JDK_IMPORT_PATH=$(FRESH_BOOTDIR)
228 BOOT_CYCLE_DEBUG_SETTINGS= \
229 ALT_BOOTDIR=$(FRESH_DEBUG_BOOTDIR) \
230 ALT_JDK_IMPORT_PATH=$(FRESH_DEBUG_BOOTDIR)
232 else
234 # Use the supplied ALT_BOOTDIR as the boot
235 BOOT_CYCLE_SETTINGS=
236 BOOT_CYCLE_DEBUG_SETTINGS=
238 endif
240 build_product_image:
241 @$(START_ECHO)
242 $(MAKE) \
243 SKIP_FASTDEBUG_BUILD=true \
244 SKIP_DEBUG_BUILD=true \
245 $(BOOT_CYCLE_SETTINGS) \
246 generic_build_repo_series
247 @$(FINISH_ECHO)
249 generic_debug_build:
250 @$(START_ECHO)
251 $(MAKE) \
252 ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)-$(DEBUG_NAME) \
253 DEBUG_NAME=$(DEBUG_NAME) \
254 NO_DOCS=true \
255 $(BOOT_CYCLE_DEBUG_SETTINGS) \
256 generic_build_repo_series
257 @$(FINISH_ECHO)
259 build_debug_image:
260 $(MAKE) DEBUG_NAME=debug generic_debug_build
262 build_fastdebug_image:
263 $(MAKE) DEBUG_NAME=fastdebug generic_debug_build
265 # Build final image
266 product_build:: build_product_image
267 debug_build:: build_debug_image
268 fastdebug_build:: build_fastdebug_image
270 # Check on whether we really can build the openjdk, need source etc.
271 openjdk_check: FRC
272 ifneq ($(SKIP_OPENJDK_BUILD), true)
273 @$(ECHO) " "
274 @$(ECHO) "================================================="
275 @if [ ! -r $(OPENJDK_BUILDDIR)/Makefile ] ; then \
276 $(ECHO) "ERROR: No openjdk source tree available at: $(OPENJDK_BUILDDIR)"; \
277 exit 1; \
278 else \
279 $(ECHO) "OpenJDK will be built after JDK is built"; \
280 $(ECHO) " OPENJDK_BUILDDIR=$(OPENJDK_BUILDDIR)"; \
281 fi
282 @$(ECHO) "================================================="
283 @$(ECHO) " "
284 endif
286 # If we have bundle rules, we have a chance here to do a complete cycle
287 # build, of production and open build.
288 # FIXUP: We should create the openjdk source bundle and build that?
289 # But how do we reliable create or get at a formal openjdk source tree?
290 # The one we have needs to be trimmed of built bits and closed dirs.
291 # The repositories might not be available.
292 # The openjdk source bundle is probably not available.
294 ifneq ($(SKIP_OPENJDK_BUILD), true)
295 ifeq ($(BUILD_JDK), true)
296 ifeq ($(BUNDLE_RULES_AVAILABLE), true)
298 OPENJDK_PLUGS=$(ABS_OUTPUTDIR)/$(OPENJDK_BINARY_PLUGS_INAME)
299 OPENJDK_OUTPUTDIR=$(ABS_OUTPUTDIR)/open-output
300 OPENJDK_BUILD_NAME \
301 = openjdk-$(JDK_MINOR_VERSION)-$(BUILD_NUMBER)-$(PLATFORM)-$(ARCH)-$(BUNDLE_DATE)
302 OPENJDK_BUILD_BINARY_ZIP=$(ABS_BIN_BUNDLEDIR)/$(OPENJDK_BUILD_NAME).zip
303 BUILT_IMAGE=$(ABS_OUTPUTDIR)/j2sdk-image
304 ifeq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64)
305 OPENJDK_BOOTDIR=$(BOOTDIR)
306 OPENJDK_IMPORTJDK=$(JDK_IMPORT_PATH)
307 else
308 OPENJDK_BOOTDIR=$(BUILT_IMAGE)
309 OPENJDK_IMPORTJDK=$(BUILT_IMAGE)
310 endif
312 openjdk_build:
313 @$(START_ECHO)
314 @$(ECHO) " "
315 @$(ECHO) "================================================="
316 @$(ECHO) "Starting openjdk build"
317 @$(ECHO) " Using: ALT_JDK_DEVTOOLS_DIR=$(JDK_DEVTOOLS_DIR)"
318 @$(ECHO) "================================================="
319 @$(ECHO) " "
320 $(RM) -r $(OPENJDK_OUTPUTDIR)
321 $(MKDIR) -p $(OPENJDK_OUTPUTDIR)
322 ($(CD) $(OPENJDK_BUILDDIR) && $(MAKE) \
323 OPENJDK=true \
324 NO_DOCS=true \
325 ALT_JDK_DEVTOOLS_DIR=$(JDK_DEVTOOLS_DIR) \
326 ALT_OUTPUTDIR=$(OPENJDK_OUTPUTDIR) \
327 ALT_BINARY_PLUGS_PATH=$(OPENJDK_PLUGS) \
328 ALT_BOOTDIR=$(OPENJDK_BOOTDIR) \
329 ALT_JDK_IMPORT_PATH=$(OPENJDK_IMPORTJDK) \
330 product_build )
331 $(RM) $(OPENJDK_BUILD_BINARY_ZIP)
332 ( $(CD) $(OPENJDK_OUTPUTDIR)/j2sdk-image && \
333 $(ZIPEXE) -q -r $(OPENJDK_BUILD_BINARY_ZIP) .)
334 $(RM) -r $(OPENJDK_OUTPUTDIR)
335 @$(ECHO) " "
336 @$(ECHO) "================================================="
337 @$(ECHO) "Finished openjdk build"
338 @$(ECHO) " Binary Bundle: $(OPENJDK_BUILD_BINARY_ZIP)"
339 @$(ECHO) "================================================="
340 @$(ECHO) " "
341 @$(FINISH_ECHO)
343 endif
344 endif
345 endif
347 clobber::
348 $(RM) -r $(OUTPUTDIR)/*
349 $(RM) -r $(OUTPUTDIR)-debug/*
350 $(RM) -r $(OUTPUTDIR)-fastdebug/*
351 -($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE))
353 clean: clobber
355 #
356 # Dev builds
357 #
359 dev : dev-build
361 dev-build:
362 $(MAKE) DEV_ONLY=true all
363 dev-sanity:
364 $(MAKE) DEV_ONLY=true sanity
365 dev-clobber:
366 $(MAKE) DEV_ONLY=true clobber
368 #
369 # Quick jdk verification build
370 #
371 jdk_only:
372 $(MAKE) SKIP_FASTDEBUG_BUILD=true BUILD_HOTSPOT=false all
375 #
376 # Quick jdk verification fastdebug build
377 #
378 jdk_fastdebug_only:
379 $(MAKE) DEBUG_NAME=fastdebug BUILD_HOTSPOT=false BUILD_DEPLOY=false \
380 BUILD_INSTALL=false BUILD_SPONSORS=false generic_debug_build
382 #
383 # Quick deploy verification fastdebug build
384 #
385 deploy_fastdebug_only:
386 $(MAKE) \
387 DEBUG_NAME=fastdebug \
388 BUILD_HOTSPOT=false \
389 BUILD_JDK=false \
390 BUILD_LANGTOOLS=false \
391 BUILD_CORBA=false \
392 BUILD_JAXP=false \
393 BUILD_JAXWS=false \
394 BUILD_INSTALL=false \
395 BUILD_SPONSORS=false \
396 generic_debug_build
398 #
399 # Product build (skip debug builds)
400 #
401 product_only:
402 $(MAKE) SKIP_FASTDEBUG_BUILD=true all
404 #
405 # Check target
406 #
408 check: variable_check
410 #
411 # Help target
412 #
413 help: intro_help target_help variable_help notes_help examples_help
415 # Intro help message
416 intro_help:
417 @$(ECHO) "\
418 Makefile for the JDK builds (all the JDK). \n\
419 "
421 # Target help
422 target_help:
423 @$(ECHO) "\
424 --- Common Targets --- \n\
425 all -- build the core JDK (default target) \n\
426 help -- Print out help information \n\
427 check -- Check make variable values for correctness \n\
428 sanity -- Perform detailed sanity checks on system and settings \n\
429 fastdebug_build -- build the core JDK in 'fastdebug' mode (-g -O) \n\
430 debug_build -- build the core JDK in 'debug' mode (-g) \n\
431 clean -- remove all built and imported files \n\
432 clobber -- same as clean \n\
433 "
435 # Variable help (only common ones used by this Makefile)
436 variable_help: variable_help_intro variable_list variable_help_end
437 variable_help_intro:
438 @$(ECHO) "--- Common Variables ---"
439 variable_help_end:
440 @$(ECHO) " "
442 # One line descriptions for the variables
443 OUTPUTDIR.desc = Output directory
444 PARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count
445 SLASH_JAVA.desc = Root of all build tools, e.g. /java or J:
446 BOOTDIR.desc = JDK used to boot the build
447 JDK_IMPORT_PATH.desc = JDK used to import components of the build
448 COMPILER_PATH.desc = Compiler install directory
449 CACERTS_FILE.desc = Location of certificates file
450 DEVTOOLS_PATH.desc = Directory containing zip and gnumake
451 CUPS_HEADERS_PATH.desc = Include directory location for CUPS header files
452 DXSDK_PATH.desc = Root directory of DirectX SDK
453 MSDEVTOOLS_PATH.desc = Root directory of VC++ tools (e.g. rc.exe)
454 MSVCRT_DLL_PATH.desc = Directory containing mscvrt.dll
456 # Make variables to print out (description and value)
457 VARIABLE_PRINTVAL_LIST += \
458 OUTPUTDIR \
459 PARALLEL_COMPILE_JOBS \
460 SLASH_JAVA \
461 BOOTDIR \
462 JDK_IMPORT_PATH \
463 COMPILER_PATH \
464 CACERTS_FILE \
465 DEVTOOLS_PATH
467 # Make variables that should refer to directories that exist
468 VARIABLE_CHECKDIR_LIST += \
469 SLASH_JAVA \
470 BOOTDIR \
471 JDK_IMPORT_PATH \
472 COMPILER_PATH \
473 DEVTOOLS_PATH
475 # Make variables that should refer to files that exist
476 VARIABLE_CHECKFIL_LIST += \
477 CACERTS_FILE
479 # Some are windows specific
480 ifeq ($(PLATFORM), windows)
482 VARIABLE_PRINTVAL_LIST += \
483 DXSDK_PATH \
484 MSDEVTOOLS_PATH \
485 MSVCRT_DLL_PATH
487 VARIABLE_CHECKDIR_LIST += \
488 DXSDK_PATH \
489 MSDEVTOOLS_PATH \
490 MSVCRT_DLL_PATH
492 endif
494 # For pattern rules below, so all are treated the same
495 DO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval)
496 DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir)
497 DO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil)
499 # Complete variable check
500 variable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST)
501 variable_list: $(DO_PRINTVAL_LIST) variable_check
503 # Pattern rule for printing out a variable
504 %.printval:
505 @$(ECHO) " ALT_$* - $($*.desc)"
506 @$(ECHO) " \t $*=$($*)"
508 # Pattern rule for checking to see if a variable with a directory exists
509 %.checkdir:
510 @if [ ! -d $($*) ] ; then \
511 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
512 fi
514 # Pattern rule for checking to see if a variable with a file exists
515 %.checkfil:
516 @if [ ! -f $($*) ] ; then \
517 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
518 fi
520 # Misc notes on help
521 notes_help:
522 @$(ECHO) "\
523 --- Notes --- \n\
524 - All builds use same output directory unless overridden with \n\
525 \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\
526 \t to use the clean target first. \n\
527 - JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\
528 \t builds or previous release JDK builds will work. \n\
529 - The fastest builds have been when the sources and the BOOTDIR are on \n\
530 \t local disk. \n\
531 "
533 examples_help:
534 @$(ECHO) "\
535 --- Examples --- \n\
536 $(MAKE) fastdebug_build \n\
537 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\
538 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug_build \n\
539 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\
540 $(MAKE) ALT_BOOTDIR=/opt/java/jdk1.5.0 \n\
541 $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.6.0 \n\
542 "
544 ################################################################
545 # Source and binary plug bundling
546 ################################################################
547 ifeq ($(BUNDLE_RULES_AVAILABLE), true)
548 include $(BUNDLE_RULES)
549 endif
551 ################################################################
552 # JPRT rule to build
553 ################################################################
555 include ./make/jprt.gmk
557 ################################################################
558 # PHONY
559 ################################################################
561 .PHONY: all \
562 generic_build_repo_series \
563 what clobber insane \
564 dev dev-build dev-sanity dev-clobber \
565 product_build \
566 fastdebug_build \
567 debug_build \
568 build_product_image \
569 build_debug_image \
570 build_fastdebug_image \
571 create_fresh_product_bootdir \
572 create_fresh_debug_bootdir \
573 create_fresh_fastdebug_bootdir \
574 generic_debug_build
576 # Force target
577 FRC: