source: trunk/openjdk/Makefile@ 286

Last change on this file since 286 was 278, checked in by dmik, 14 years ago

trunk: Merged in openjdk6 b22 from branches/vendor/oracle.

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