Thu, 03 Feb 2011 15:10:07 -0800
7014634: By default, only build the product bits with a closed jdk build (like openjdk does)
Reviewed-by: katleman, cl, igor, trims
1 #
2 # Copyright (c) 1995, 2010, Oracle and/or its affiliates. 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. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle 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 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.
24 #
26 BUILD_PARENT_DIRECTORY=.
28 ifndef TOPDIR
29 TOPDIR:=.
30 endif
32 ifndef JDK_TOPDIR
33 JDK_TOPDIR=$(TOPDIR)/jdk
34 endif
35 ifndef JDK_MAKE_SHARED_DIR
36 JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared
37 endif
39 # For start and finish echo lines
40 TITLE_TEXT = Control $(PLATFORM) $(ARCH) $(RELEASE)
41 DATE_STAMP = `$(DATE) '+%y-%m-%d %H:%M'`
42 START_ECHO = echo "$(TITLE_TEXT) $@ build started: $(DATE_STAMP)"
43 FINISH_ECHO = echo "$(TITLE_TEXT) $@ build finished: $(DATE_STAMP)"
45 default: all
47 include $(JDK_MAKE_SHARED_DIR)/Defs-control.gmk
48 include ./make/Defs-internal.gmk
49 include ./make/sanity-rules.gmk
50 include ./make/hotspot-rules.gmk
51 include ./make/langtools-rules.gmk
52 include ./make/corba-rules.gmk
53 include ./make/jaxp-rules.gmk
54 include ./make/jaxws-rules.gmk
55 include ./make/jdk-rules.gmk
56 include ./make/install-rules.gmk
57 include ./make/sponsors-rules.gmk
58 include ./make/deploy-rules.gmk
60 # What "all" means
61 all::
62 @$(START_ECHO)
64 all:: sanity
66 ifeq ($(SKIP_FASTDEBUG_BUILD), false)
67 all:: fastdebug_build
68 endif
70 ifeq ($(SKIP_DEBUG_BUILD), false)
71 all:: debug_build
72 endif
74 all:: all_product_build
76 all::
77 @$(FINISH_ECHO)
79 # Everything for a full product build
80 all_product_build::
81 @$(START_ECHO)
83 ifeq ($(SKIP_PRODUCT_BUILD), false)
85 all_product_build:: product_build
87 ifeq ($(BUILD_INSTALL), true)
88 all_product_build:: $(INSTALL)
89 clobber:: install-clobber
90 endif
92 ifeq ($(BUILD_SPONSORS), true)
93 all_product_build:: $(SPONSORS)
94 clobber:: sponsors-clobber
95 endif
97 ifneq ($(SKIP_COMPARE_IMAGES), true)
98 all_product_build:: compare-image
99 endif
101 endif
103 all_product_build::
104 @$(FINISH_ECHO)
106 # Generic build of basic repo series
107 generic_build_repo_series::
108 $(MKDIR) -p $(OUTPUTDIR)
109 $(MKDIR) -p $(OUTPUTDIR)/j2sdk-image
111 ifeq ($(BUILD_LANGTOOLS), true)
112 generic_build_repo_series:: langtools
113 clobber:: langtools-clobber
114 endif
116 ifeq ($(BUILD_CORBA), true)
117 generic_build_repo_series:: corba
118 clobber:: corba-clobber
119 endif
121 ifeq ($(BUILD_JAXP), true)
122 generic_build_repo_series:: jaxp
123 clobber:: jaxp-clobber
124 endif
126 ifeq ($(BUILD_JAXWS), true)
127 generic_build_repo_series:: jaxws
128 clobber:: jaxws-clobber
129 endif
131 ifeq ($(BUILD_HOTSPOT), true)
132 generic_build_repo_series:: $(HOTSPOT)
133 clobber:: hotspot-clobber
134 endif
136 ifeq ($(BUILD_JDK), true)
137 generic_build_repo_series:: $(JDK_JAVA_EXE)
138 clobber:: jdk-clobber
139 endif
141 ifeq ($(BUILD_DEPLOY), true)
142 generic_build_repo_series:: $(DEPLOY)
143 clobber:: deploy-clobber
144 endif
146 # The debug build, fastdebug or debug. Needs special handling.
147 # Note that debug builds do NOT do INSTALL steps, but must be done
148 # after the product build and before the INSTALL step of the product build.
149 #
150 # DEBUG_NAME is fastdebug or debug
151 # ALT_OUTPUTDIR is changed to have -debug or -fastdebug suffix
152 # The resulting j2sdk-image is used by the install makefiles to create a
153 # debug install bundle jdk-*-debug-** bundle (tar or zip)
154 # which will install in the debug or fastdebug subdirectory of the
155 # normal product install area.
156 # The install process needs to know what the DEBUG_NAME is, so
157 # look for INSTALL_DEBUG_NAME in the install rules.
158 #
159 # NOTE: On windows, do not use $(ABS_BOOTDIR_OUTPUTDIR)-$(DEBUG_NAME).
160 # Due to the use of short paths in $(ABS_OUTPUTDIR), this may
161 # not be the same location.
162 #
164 # Location of fresh bootdir output
165 ABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk
166 FRESH_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image
167 FRESH_DEBUG_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME)/j2sdk-image
169 create_fresh_product_bootdir: FRC
170 @$(START_ECHO)
171 $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
172 GENERATE_DOCS=false \
173 BOOT_CYCLE_SETTINGS= \
174 build_product_image
175 @$(FINISH_ECHO)
177 create_fresh_debug_bootdir: FRC
178 @$(START_ECHO)
179 $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
180 GENERATE_DOCS=false \
181 BOOT_CYCLE_DEBUG_SETTINGS= \
182 build_debug_image
183 @$(FINISH_ECHO)
185 create_fresh_fastdebug_bootdir: FRC
186 @$(START_ECHO)
187 $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
188 GENERATE_DOCS=false \
189 BOOT_CYCLE_DEBUG_SETTINGS= \
190 build_fastdebug_image
191 @$(FINISH_ECHO)
193 # Create boot image?
194 ifeq ($(SKIP_BOOT_CYCLE),false)
195 ifneq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64)
196 DO_BOOT_CYCLE=true
197 endif
198 endif
200 ifeq ($(DO_BOOT_CYCLE),true)
202 # Create the bootdir to use in the build
203 product_build:: create_fresh_product_bootdir
204 debug_build:: create_fresh_debug_bootdir
205 fastdebug_build:: create_fresh_fastdebug_bootdir
207 # Define variables to be used now for the boot jdk
208 BOOT_CYCLE_SETTINGS= \
209 ALT_BOOTDIR=$(FRESH_BOOTDIR) \
210 ALT_JDK_IMPORT_PATH=$(FRESH_BOOTDIR)
211 BOOT_CYCLE_DEBUG_SETTINGS= \
212 ALT_BOOTDIR=$(FRESH_DEBUG_BOOTDIR) \
213 ALT_JDK_IMPORT_PATH=$(FRESH_DEBUG_BOOTDIR)
215 else
217 # Use the supplied ALT_BOOTDIR as the boot
218 BOOT_CYCLE_SETTINGS=
219 BOOT_CYCLE_DEBUG_SETTINGS=
221 endif
223 build_product_image:
224 @$(START_ECHO)
225 $(MAKE) \
226 SKIP_FASTDEBUG_BUILD=true \
227 SKIP_DEBUG_BUILD=true \
228 $(BOOT_CYCLE_SETTINGS) \
229 generic_build_repo_series
230 @$(FINISH_ECHO)
232 # NOTE: On windows, do not use $(ABS_OUTPUTDIR)-$(DEBUG_NAME).
233 # Due to the use of short paths in $(ABS_OUTPUTDIR), this may
234 # not be the same location.
236 generic_debug_build:
237 @$(START_ECHO)
238 $(MAKE) \
239 ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME) \
240 DEBUG_NAME=$(DEBUG_NAME) \
241 GENERATE_DOCS=false \
242 $(BOOT_CYCLE_DEBUG_SETTINGS) \
243 generic_build_repo_series
244 @$(FINISH_ECHO)
246 build_debug_image:
247 $(MAKE) DEBUG_NAME=debug generic_debug_build
249 build_fastdebug_image:
250 $(MAKE) DEBUG_NAME=fastdebug generic_debug_build
252 # Build final image
253 product_build:: build_product_image
254 debug_build:: build_debug_image
255 fastdebug_build:: build_fastdebug_image
257 clobber::
258 $(RM) -r $(OUTPUTDIR)/*
259 $(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-debug/*
260 $(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-fastdebug/*
261 -($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE))
263 clean: clobber
265 #
266 # Dev builds
267 #
269 dev : dev-build
271 dev-build:
272 $(MAKE) DEV_ONLY=true all
273 dev-sanity:
274 $(MAKE) DEV_ONLY=true sanity
275 dev-clobber:
276 $(MAKE) DEV_ONLY=true clobber
278 #
279 # Quick jdk verification build
280 #
281 jdk_only:
282 $(MAKE) SKIP_FASTDEBUG_BUILD=true BUILD_HOTSPOT=false all
285 #
286 # Quick jdk verification fastdebug build
287 #
288 jdk_fastdebug_only:
289 $(MAKE) DEBUG_NAME=fastdebug BUILD_HOTSPOT=false BUILD_DEPLOY=false \
290 BUILD_INSTALL=false BUILD_SPONSORS=false generic_debug_build
292 #
293 # Quick deploy verification fastdebug build
294 #
295 deploy_fastdebug_only:
296 $(MAKE) \
297 DEBUG_NAME=fastdebug \
298 BUILD_HOTSPOT=false \
299 BUILD_JDK=false \
300 BUILD_LANGTOOLS=false \
301 BUILD_CORBA=false \
302 BUILD_JAXP=false \
303 BUILD_JAXWS=false \
304 BUILD_INSTALL=false \
305 BUILD_SPONSORS=false \
306 generic_debug_build
308 #
309 # Product build (skip debug builds)
310 #
311 product_only:
312 $(MAKE) SKIP_FASTDEBUG_BUILD=true all
314 #
315 # Check target
316 #
318 check: variable_check
320 #
321 # Help target
322 #
323 help: intro_help target_help variable_help notes_help examples_help
325 # Intro help message
326 intro_help:
327 @$(ECHO) "\
328 Makefile for the JDK builds (all the JDK). \n\
329 "
331 # Target help
332 target_help:
333 @$(ECHO) "\
334 --- Common Targets --- \n\
335 all -- build the core JDK (default target) \n\
336 help -- Print out help information \n\
337 check -- Check make variable values for correctness \n\
338 sanity -- Perform detailed sanity checks on system and settings \n\
339 fastdebug_build -- build the core JDK in 'fastdebug' mode (-g -O) \n\
340 debug_build -- build the core JDK in 'debug' mode (-g) \n\
341 clean -- remove all built and imported files \n\
342 clobber -- same as clean \n\
343 "
345 # Variable help (only common ones used by this Makefile)
346 variable_help: variable_help_intro variable_list variable_help_end
347 variable_help_intro:
348 @$(ECHO) "--- Common Variables ---"
349 variable_help_end:
350 @$(ECHO) " "
352 # One line descriptions for the variables
353 OUTPUTDIR.desc = Output directory
354 PARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count
355 SLASH_JAVA.desc = Root of all build tools, e.g. /java or J:
356 BOOTDIR.desc = JDK used to boot the build
357 JDK_IMPORT_PATH.desc = JDK used to import components of the build
358 COMPILER_PATH.desc = Compiler install directory
359 CACERTS_FILE.desc = Location of certificates file
360 DEVTOOLS_PATH.desc = Directory containing zip and gnumake
361 CUPS_HEADERS_PATH.desc = Include directory location for CUPS header files
362 DXSDK_PATH.desc = Root directory of DirectX SDK
364 # Make variables to print out (description and value)
365 VARIABLE_PRINTVAL_LIST += \
366 OUTPUTDIR \
367 PARALLEL_COMPILE_JOBS \
368 SLASH_JAVA \
369 BOOTDIR \
370 JDK_IMPORT_PATH \
371 COMPILER_PATH \
372 CACERTS_FILE \
373 DEVTOOLS_PATH
375 # Make variables that should refer to directories that exist
376 VARIABLE_CHECKDIR_LIST += \
377 SLASH_JAVA \
378 BOOTDIR \
379 JDK_IMPORT_PATH \
380 COMPILER_PATH \
381 DEVTOOLS_PATH
383 # Make variables that should refer to files that exist
384 VARIABLE_CHECKFIL_LIST += \
385 CACERTS_FILE
387 # Some are windows specific
388 ifeq ($(PLATFORM), windows)
390 VARIABLE_PRINTVAL_LIST += \
391 DXSDK_PATH
393 VARIABLE_CHECKDIR_LIST += \
394 DXSDK_PATH
396 endif
398 # For pattern rules below, so all are treated the same
399 DO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval)
400 DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir)
401 DO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil)
403 # Complete variable check
404 variable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST)
405 variable_list: $(DO_PRINTVAL_LIST) variable_check
407 # Pattern rule for printing out a variable
408 %.printval:
409 @$(ECHO) " ALT_$* - $($*.desc)"
410 @$(ECHO) " \t $*=$($*)"
412 # Pattern rule for checking to see if a variable with a directory exists
413 %.checkdir:
414 @if [ ! -d $($*) ] ; then \
415 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
416 fi
418 # Pattern rule for checking to see if a variable with a file exists
419 %.checkfil:
420 @if [ ! -f $($*) ] ; then \
421 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
422 fi
424 # Misc notes on help
425 notes_help:
426 @$(ECHO) "\
427 --- Notes --- \n\
428 - All builds use same output directory unless overridden with \n\
429 \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\
430 \t to use the clean target first. \n\
431 - JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\
432 \t builds or previous release JDK builds will work. \n\
433 - The fastest builds have been when the sources and the BOOTDIR are on \n\
434 \t local disk. \n\
435 "
437 examples_help:
438 @$(ECHO) "\
439 --- Examples --- \n\
440 $(MAKE) fastdebug_build \n\
441 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\
442 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug_build \n\
443 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\
444 $(MAKE) ALT_BOOTDIR=/opt/java/jdk1.5.0 \n\
445 $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.6.0 \n\
446 "
448 ################################################################
449 # Source bundling
450 ################################################################
451 ifeq ($(BUNDLE_RULES_AVAILABLE), true)
452 include $(BUNDLE_RULES)
453 endif
455 ################################################################
456 # rule to test
457 ################################################################
459 .NOTPARALLEL: test_run
461 test:
462 $(MAKE) test_run
464 test_run: test_clean test_start test_summary
466 test_start:
467 @$(ECHO) "Tests started at `$(DATE)`"
469 test_clean:
470 $(RM) $(OUTPUTDIR)/test_failures.txt $(OUTPUTDIR)/test_log.txt
472 test_summary: $(OUTPUTDIR)/test_failures.txt
473 @$(ECHO) "#################################################"
474 @$(ECHO) "Tests completed at `$(DATE)`"
475 @( $(EGREP) '^TEST STATS:' $(OUTPUTDIR)/test_log.txt \
476 || $(ECHO) "No TEST STATS seen in log" )
477 @$(ECHO) "For complete details see: $(OUTPUTDIR)/test_log.txt"
478 @$(ECHO) "#################################################"
479 @if [ -s $< ] ; then \
480 $(ECHO) "ERROR: Test failure count: `$(CAT) $< | $(WC) -l`"; \
481 $(CAT) $<; \
482 exit 1; \
483 else \
484 $(ECHO) "Success! No failures detected"; \
485 fi
487 # Get failure list from log
488 $(OUTPUTDIR)/test_failures.txt: $(OUTPUTDIR)/test_log.txt
489 @$(RM) $@
490 @( $(EGREP) '^FAILED:' $< || $(ECHO) "" ) | $(NAWK) 'length>0' > $@
492 # Get log file of all tests run
493 JDK_TO_TEST := $(shell \
494 if [ -d "$(ABS_OUTPUTDIR)/j2sdk-image" ] ; then \
495 $(ECHO) "$(ABS_OUTPUTDIR)/j2sdk-image"; \
496 elif [ -d "$(ABS_OUTPUTDIR)/bin" ] ; then \
497 $(ECHO) "$(ABS_OUTPUTDIR)"; \
498 elif [ "$(PRODUCT_HOME)" != "" -a -d "$(PRODUCT_HOME)/bin" ] ; then \
499 $(ECHO) "$(PRODUCT_HOME)"; \
500 fi \
501 )
502 TEST_TARGETS=all
503 $(OUTPUTDIR)/test_log.txt:
504 $(RM) $@
505 ( $(CD) test && \
506 $(MAKE) NO_STOPPING=- PRODUCT_HOME=$(JDK_TO_TEST) $(TEST_TARGETS) \
507 ) | tee $@
509 ################################################################
510 # JPRT rule to build
511 ################################################################
513 include ./make/jprt.gmk
515 ################################################################
516 # PHONY
517 ################################################################
519 .PHONY: all test test_run test_start test_summary test_clean \
520 generic_build_repo_series \
521 what clobber insane \
522 dev dev-build dev-sanity dev-clobber \
523 product_build \
524 fastdebug_build \
525 debug_build \
526 build_product_image \
527 build_debug_image \
528 build_fastdebug_image \
529 create_fresh_product_bootdir \
530 create_fresh_debug_bootdir \
531 create_fresh_fastdebug_bootdir \
532 generic_debug_build
534 # Force target
535 FRC: