source: trunk/openjdk/Makefile@ 304

Last change on this file since 304 was 287, checked in by dmik, 14 years ago

env.cmd: Added -t<target_list> flag to specify which targets to build in more elegant (and b22-compatible) way.

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