source: trunk/openjdk/Makefile@ 407

Last change on this file since 407 was 310, checked in by dmik, 14 years ago

Tailor makefiles for the new Odin 8.x build layout.

File size: 14.8 KB
Line 
1#
2# Copyright (c) 1995, 2011, 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_HEADERS_PATH.desc = Include directory of Odin32 SDK (OS/2)
335ODINSDK_LIB_PATH.desc = Library directory of Odin32 SDK (OS/2)
336ODINSDK_DBGLIB_PATH.desc = Debug Library directory of Odin32 SDK (OS/2, optional)
337
338# Make variables to print out (description and value)
339VARIABLE_PRINTVAL_LIST += \
340 OUTPUTDIR \
341 PARALLEL_COMPILE_JOBS \
342 SLASH_JAVA \
343 BOOTDIR \
344 JDK_IMPORT_PATH \
345 COMPILER_PATH \
346 CACERTS_FILE \
347 DEVTOOLS_PATH
348
349# Make variables that should refer to directories that exist
350VARIABLE_CHECKDIR_LIST += \
351 SLASH_JAVA \
352 BOOTDIR \
353 JDK_IMPORT_PATH \
354 COMPILER_PATH \
355 DEVTOOLS_PATH
356
357# Make variables that should refer to files that exist
358VARIABLE_CHECKFIL_LIST += \
359 CACERTS_FILE
360
361# Some are windows specific
362ifeq ($(PLATFORM), windows)
363
364VARIABLE_PRINTVAL_LIST += \
365 DXSDK_PATH \
366 MSDEVTOOLS_PATH \
367 MSVCRT_DLL_PATH
368
369VARIABLE_CHECKDIR_LIST += \
370 DXSDK_PATH \
371 MSDEVTOOLS_PATH \
372 MSVCRT_DLL_PATH
373
374endif
375
376# Some are OS/2 specific
377ifeq ($(PLATFORM), os2)
378
379VARIABLE_PRINTVAL_LIST += \
380 ODINSDK_HEADERS_PATH \
381 ODINSDK_LIB_PATH
382
383VARIABLE_CHECKDIR_LIST += \
384 ODINSDK_HEADERS_PATH \
385 ODINSDK_LIB_PATH
386
387endif
388
389# For pattern rules below, so all are treated the same
390DO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval)
391DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir)
392DO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil)
393
394# Complete variable check
395variable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST)
396variable_list: $(DO_PRINTVAL_LIST) variable_check
397
398# Pattern rule for printing out a variable
399%.printval:
400 @$(ECHO) " ALT_$* - $($*.desc)"
401 @$(ECHO) " \t $*=$($*)"
402
403# Pattern rule for checking to see if a variable with a directory exists
404%.checkdir:
405 @if [ ! -d $($*) ] ; then \
406 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
407 fi
408
409# Pattern rule for checking to see if a variable with a file exists
410%.checkfil:
411 @if [ ! -f $($*) ] ; then \
412 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
413 fi
414
415# Misc notes on help
416notes_help:
417 @$(ECHO) "\
418--- Notes --- \n\
419- All builds use same output directory unless overridden with \n\
420 \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\
421 \t to use the clean target first. \n\
422- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\
423 \t builds or previous release JDK builds will work. \n\
424- The fastest builds have been when the sources and the BOOTDIR are on \n\
425 \t local disk. \n\
426"
427
428examples_help:
429 @$(ECHO) "\
430--- Examples --- \n\
431 $(MAKE) fastdebug_build \n\
432 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\
433 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug_build \n\
434 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\
435 $(MAKE) ALT_BOOTDIR=/opt/java/jdk1.5.0 \n\
436 $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.6.0 \n\
437"
438
439################################################################
440# Cycle build. Build the jdk, use it to build the jdk again.
441################################################################
442
443ABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk
444
445boot_cycle:
446 $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) product_build
447 $(MAKE) ALT_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image product_build
448
449################################################################
450# rule to test
451################################################################
452
453.NOTPARALLEL: test
454
455test: test_clean test_start test_summary
456
457test_start:
458 @$(ECHO) "Tests started at `$(DATE)`"
459
460test_clean:
461 $(RM) $(OUTPUTDIR)/test_failures.txt $(OUTPUTDIR)/test_log.txt
462
463test_summary: $(OUTPUTDIR)/test_failures.txt
464 @$(ECHO) "#################################################"
465 @$(ECHO) "Tests completed at `$(DATE)`"
466 @( $(EGREP) '^TEST STATS:' $(OUTPUTDIR)/test_log.txt \
467 || $(ECHO) "No TEST STATS seen in log" )
468 @$(ECHO) "For complete details see: $(OUTPUTDIR)/test_log.txt"
469 @$(ECHO) "#################################################"
470 @if [ -s $< ] ; then \
471 $(ECHO) "ERROR: Test failure count: `$(CAT) $< | $(WC) -l`"; \
472 $(CAT) $<; \
473 exit 1; \
474 else \
475 $(ECHO) "Success! No failures detected"; \
476 fi
477
478# Get failure list from log
479$(OUTPUTDIR)/test_failures.txt: $(OUTPUTDIR)/test_log.txt
480 @$(RM) $@
481 @( $(EGREP) '^FAILED:' $< || $(ECHO) "" ) | $(NAWK) 'length>0' > $@
482
483# Get log file of all tests run
484JDK_TO_TEST := $(shell \
485 if [ -d "$(ABS_OUTPUTDIR)/j2sdk-image" ] ; then \
486 $(ECHO) "$(ABS_OUTPUTDIR)/j2sdk-image"; \
487 elif [ -d "$(ABS_OUTPUTDIR)/bin" ] ; then \
488 $(ECHO) "$(ABS_OUTPUTDIR)"; \
489 elif [ "$(PRODUCT_HOME)" != "" -a -d "$(PRODUCT_HOME)/bin" ] ; then \
490 $(ECHO) "$(PRODUCT_HOME)"; \
491 fi \
492)
493$(OUTPUTDIR)/test_log.txt:
494 $(RM) $@
495 ( $(CD) test && \
496 $(MAKE) NO_STOPPING=- \
497 ALT_OUTPUTDIR=$(ABS_OUTPUTDIR) \
498 ALT_JDK_IMPORT_PATH=$(JDK_TO_TEST) \
499 PRODUCT_HOME=$(JDK_TO_TEST) \
500 LANGTOOLS_PRODUCT_HOME=$(ABS_OUTPUTDIR)/langtools \
501 ) | tee $@
502
503################################################################
504# JPRT rule to build
505################################################################
506
507include ./make/jprt.gmk
508
509################################################################
510# PHONY
511################################################################
512
513.PHONY: all test test_start test_summary test_clean \
514 generic_build_repo_series \
515 what clobber insane \
516 dev dev-build dev-sanity dev-clobber \
517 product_build \
518 fastdebug_build \
519 debug_build \
520 build_product_image \
521 build_debug_image \
522 build_fastdebug_image \
523 create_fresh_product_bootdir \
524 create_fresh_debug_bootdir \
525 create_fresh_fastdebug_bootdir \
526 generic_debug_build
527
528# Force target
529FRC:
530
Note: See TracBrowser for help on using the repository browser.