source: trunk/openjdk/Makefile@ 21

Last change on this file since 21 was 2, checked in by dmik, 15 years ago

Imported OpenJDK 6 b19 sources from Oracle.

File size: 14.5 KB
Line 
1#
2# Copyright 1995-2007 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#
25
26BUILD_PARENT_DIRECTORY=.
27
28ifndef TOPDIR
29 TOPDIR:=$(shell \
30 if [ -r ./j2se/make/Makefile -o -r ./jdk/make/Makefile ]; then \
31 echo "."; \
32 else \
33 echo "../.."; \
34 fi)
35endif
36
37ifndef CONTROL_TOPDIR
38 CONTROL_TOPDIR=$(TOPDIR)/control
39 CONTROL_TOPDIR:=$(shell \
40 if [ -r $(TOPDIR)/control/make/Makefile ]; then \
41 echo "$(TOPDIR)/control"; \
42 else \
43 echo "$(TOPDIR)"; \
44 fi)
45endif
46
47# Openjdk sources (only used if SKIP_OPENJDK_BUILD!=true)
48OPENJDK_SOURCETREE=$(TOPDIR)/openjdk
49OPENJDK_BUILDDIR:=$(shell \
50 if [ -r $(OPENJDK_SOURCETREE)/control/make/Makefile ]; then \
51 echo "$(OPENJDK_SOURCETREE)/control/make"; \
52 elif [ -r $(OPENJDK_SOURCETREE)/Makefile ]; then \
53 echo "$(OPENJDK_SOURCETREE)"; \
54 else \
55 echo "."; \
56 fi)
57
58ifndef JDK_TOPDIR
59 JDK_TOPDIR=$(TOPDIR)/jdk
60endif
61ifndef JDK_MAKE_SHARED_DIR
62 JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared
63endif
64
65include $(JDK_MAKE_SHARED_DIR)/Defs-control.gmk
66
67include ./make/Defs-internal.gmk
68
69all::
70 @$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build started: `$(DATE) '+%y-%m-%d %H:%M'`
71 $(MKDIR) -p $(OUTPUTDIR)
72
73# Rules for sanity checks
74include ./make/sanity-rules.gmk
75
76dev : dev-build
77
78dev-build:
79 $(MAKE) DEV_ONLY=true all
80dev-sanity:
81 $(MAKE) DEV_ONLY=true sanity
82dev-clobber:
83 $(MAKE) DEV_ONLY=true clobber
84
85# Rules for various components
86include ./make/hotspot-rules.gmk
87include ./make/motif-rules.gmk
88include ./make/langtools-rules.gmk
89include ./make/corba-rules.gmk
90include ./make/jaxp-rules.gmk
91include ./make/jaxws-rules.gmk
92include ./make/jdk-rules.gmk
93include ./make/install-rules.gmk
94include ./make/sponsors-rules.gmk
95include ./make/deploy-rules.gmk
96
97all:: setup build
98
99setup: openjdk_check
100 $(MKDIR) -p $(OUTPUTDIR)/j2sdk-image
101
102# Check on whether we really can build the openjdk, need source etc.
103openjdk_check: FRC
104ifneq ($(SKIP_OPENJDK_BUILD), true)
105 @$(ECHO) " "
106 @$(ECHO) "================================================="
107 @if [ ! -r $(OPENJDK_BUILDDIR)/Makefile ] ; then \
108 $(ECHO) "ERROR: No openjdk source tree available at: $(OPENJDK_BUILDDIR)"; \
109 exit 1; \
110 else \
111 $(ECHO) "OpenJDK will be built after JDK is built"; \
112 $(ECHO) " OPENJDK_BUILDDIR=$(OPENJDK_BUILDDIR)"; \
113 fi
114 @$(ECHO) "================================================="
115 @$(ECHO) " "
116endif
117
118build:: sanity
119
120clobber::
121
122ifeq ($(BUILD_LANGTOOLS), true)
123 build:: langtools
124 clobber:: langtools-clobber
125endif
126
127ifeq ($(BUILD_CORBA), true)
128 build:: corba
129 clobber:: corba-clobber
130endif
131
132ifeq ($(BUILD_JAXP), true)
133 build:: jaxp
134 clobber:: jaxp-clobber
135endif
136
137ifeq ($(BUILD_JAXWS), true)
138 build:: jaxws
139 clobber:: jaxws-clobber
140endif
141
142ifeq ($(BUILD_HOTSPOT), true)
143 build:: $(HOTSPOT)
144 clobber:: hotspot-clobber
145endif
146
147ifeq ($(BUILD_MOTIF), true)
148 build:: $(MOTIF)
149 clobber:: motif-clobber
150endif
151
152ifeq ($(BUILD_JDK), true)
153 build:: $(JDK_JAVA_EXE)
154 clobber:: jdk-clobber
155endif
156
157ifeq ($(BUILD_DEPLOY), true)
158 build:: $(DEPLOY)
159 clobber:: deploy-clobber
160endif
161
162#
163# Generic debug build, fastdebug or debug. Needs special handling.
164# Note that debug builds do NOT do INSTALL steps, but must be done
165# after the product build and before the INSTALL step of the product build.
166#
167# DEBUG_NAME is fastdebug or debug
168# ALT_OUTPUTDIR is changed to have -debug or -fastdebug suffix
169# The resulting j2sdk-image is used by the install makefiles to create a
170# debug install bundle jdk-*-debug-** bundle (tar or zip)
171# which will install in the debug or fastdebug subdirectory of the
172# normal product install area.
173# The install process needs to know what the DEBUG_NAME is, so
174# look for INSTALL_DEBUG_NAME in the install rules.
175#
176
177COMMON_DEBUG_FLAGS= \
178 DEBUG_NAME=$(DEBUG_NAME) \
179 ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)-$(DEBUG_NAME) \
180 NO_DOCS=true
181
182product_build: setup
183 @$(ECHO) $@ build started: `$(DATE) '+%y-%m-%d %H:%M'`
184 $(MAKE) SKIP_FASTDEBUG_BUILD=true SKIP_DEBUG_BUILD=true all
185 @$(ECHO) $@ build finished: `$(DATE) '+%y-%m-%d %H:%M'`
186
187generic_debug_build:
188 @$(ECHO) $@ build started: `$(DATE) '+%y-%m-%d %H:%M'`
189 $(MAKE) $(COMMON_DEBUG_FLAGS) setup build
190 @$(ECHO) $@ build finished: `$(DATE) '+%y-%m-%d %H:%M'`
191
192debug_build: setup
193 $(MAKE) DEBUG_NAME=debug generic_debug_build
194
195fastdebug_build: setup
196 $(MAKE) DEBUG_NAME=fastdebug generic_debug_build
197
198ifeq ($(SKIP_FASTDEBUG_BUILD), false)
199 all:: fastdebug_build
200endif
201
202ifeq ($(SKIP_DEBUG_BUILD), false)
203 all:: debug_build
204endif
205
206ifeq ($(BUILD_JDK), true)
207 ifeq ($(BUNDLE_RULES_AVAILABLE), true)
208 all:: openjdk-binary-plugs-bundles
209 endif
210endif
211
212ifeq ($(BUILD_INSTALL), true)
213 all :: $(INSTALL)
214 clobber:: install-clobber
215endif
216
217ifeq ($(BUILD_SPONSORS), true)
218 all :: $(SPONSORS)
219 clobber:: sponsors-clobber
220endif
221
222ifneq ($(SKIP_COMPARE_IMAGES), true)
223 all :: compare-image
224endif
225
226ifneq ($(SKIP_OPENJDK_BUILD), true)
227 all :: openjdk_build
228endif
229
230# If we have bundle rules, we have a chance here to do a complete cycle
231# build, of production and open build.
232# FIXUP: We should create the openjdk source bundle and build that?
233# But how do we reliable create or get at a formal openjdk source tree?
234# The one we have needs to be trimmed of built bits and closed dirs.
235# The repositories might not be available.
236# The openjdk source bundle is probably not available.
237
238ifneq ($(SKIP_OPENJDK_BUILD), true)
239 ifeq ($(BUILD_JDK), true)
240 ifeq ($(BUNDLE_RULES_AVAILABLE), true)
241
242OPENJDK_PLUGS=$(ABS_OUTPUTDIR)/$(OPENJDK_BINARY_PLUGS_INAME)
243OPENJDK_OUTPUTDIR=$(ABS_OUTPUTDIR)/open-output
244OPENJDK_BUILD_NAME \
245 = openjdk-$(JDK_MINOR_VERSION)-$(BUILD_NUMBER)-$(PLATFORM)-$(ARCH)-$(BUNDLE_DATE)
246OPENJDK_BUILD_BINARY_ZIP=$(ABS_BIN_BUNDLEDIR)/$(OPENJDK_BUILD_NAME).zip
247BUILT_IMAGE=$(ABS_OUTPUTDIR)/j2sdk-image
248ifeq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64)
249 OPENJDK_BOOTDIR=$(BOOTDIR)
250 OPENJDK_IMPORTJDK=$(JDK_IMPORT_PATH)
251else
252 OPENJDK_BOOTDIR=$(BUILT_IMAGE)
253 OPENJDK_IMPORTJDK=$(BUILT_IMAGE)
254endif
255
256openjdk_build:
257 @$(ECHO) " "
258 @$(ECHO) "================================================="
259 @$(ECHO) "Starting openjdk build"
260 @$(ECHO) " Using: ALT_JDK_DEVTOOLS_DIR=$(JDK_DEVTOOLS_DIR)"
261 @$(ECHO) "================================================="
262 @$(ECHO) " "
263 $(RM) -r $(OPENJDK_OUTPUTDIR)
264 $(MKDIR) -p $(OPENJDK_OUTPUTDIR)
265 ($(CD) $(OPENJDK_BUILDDIR) && $(MAKE) \
266 OPENJDK=true \
267 ALT_JDK_DEVTOOLS_DIR=$(JDK_DEVTOOLS_DIR) \
268 ALT_OUTPUTDIR=$(OPENJDK_OUTPUTDIR) \
269 ALT_BINARY_PLUGS_PATH=$(OPENJDK_PLUGS) \
270 ALT_BOOTDIR=$(OPENJDK_BOOTDIR) \
271 ALT_JDK_IMPORT_PATH=$(OPENJDK_IMPORTJDK) \
272 product_build )
273 $(RM) $(OPENJDK_BUILD_BINARY_ZIP)
274 ( $(CD) $(OPENJDK_OUTPUTDIR)/j2sdk-image && \
275 $(ZIPEXE) -q -r $(OPENJDK_BUILD_BINARY_ZIP) .)
276 $(RM) -r $(OPENJDK_OUTPUTDIR)
277 @$(ECHO) " "
278 @$(ECHO) "================================================="
279 @$(ECHO) "Finished openjdk build"
280 @$(ECHO) " Binary Bundle: $(OPENJDK_BUILD_BINARY_ZIP)"
281 @$(ECHO) "================================================="
282 @$(ECHO) " "
283
284 endif
285 endif
286endif
287
288clobber::
289 $(RM) -r $(OUTPUTDIR)/*
290 $(RM) -r $(OUTPUTDIR)-debug/*
291 $(RM) -r $(OUTPUTDIR)-fastdebug/*
292 -($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE))
293
294clean: clobber
295
296all::
297 @$(ECHO) Control build finished: `$(DATE) '+%y-%m-%d %H:%M'`
298
299#
300# Quick jdk verification build
301#
302jdk_only:
303 $(MAKE) SKIP_FASTDEBUG_BUILD=true BUILD_HOTSPOT=false all
304
305
306#
307# Quick jdk verification fastdebug build
308#
309jdk_fastdebug_only:
310 $(MAKE) DEBUG_NAME=fastdebug BUILD_HOTSPOT=false BUILD_DEPLOY=false \
311 BUILD_INSTALL=false BUILD_SPONSORS=false generic_debug_build
312
313#
314# Quick deploy verification fastdebug build
315#
316deploy_fastdebug_only:
317 $(MAKE) \
318 DEBUG_NAME=fastdebug \
319 BUILD_HOTSPOT=false \
320 BUILD_JDK=false \
321 BUILD_LANGTOOLS=false \
322 BUILD_CORBA=false \
323 BUILD_JAXP=false \
324 BUILD_JAXWS=false \
325 BUILD_INSTALL=false \
326 BUILD_SPONSORS=false \
327 generic_debug_build
328
329#
330# Product build (skip debug builds)
331#
332product_only:
333 $(MAKE) SKIP_FASTDEBUG_BUILD=true all
334
335#
336# Check target
337#
338
339check: variable_check
340
341#
342# Help target
343#
344help: intro_help target_help variable_help notes_help examples_help
345
346# Intro help message
347intro_help:
348 @$(ECHO) "\
349Makefile for the JDK builds (all the JDK). \n\
350"
351
352# Target help
353target_help:
354 @$(ECHO) "\
355--- Common Targets --- \n\
356all -- build the core JDK (default target) \n\
357help -- Print out help information \n\
358check -- Check make variable values for correctness \n\
359sanity -- Perform detailed sanity checks on system and settings \n\
360fastdebug_build -- build the core JDK in 'fastdebug' mode (-g -O) \n\
361debug_build -- build the core JDK in 'debug' mode (-g) \n\
362clean -- remove all built and imported files \n\
363clobber -- same as clean \n\
364"
365
366# Variable help (only common ones used by this Makefile)
367variable_help: variable_help_intro variable_list variable_help_end
368variable_help_intro:
369 @$(ECHO) "--- Common Variables ---"
370variable_help_end:
371 @$(ECHO) " "
372
373# One line descriptions for the variables
374OUTPUTDIR.desc = Output directory
375PARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count
376SLASH_JAVA.desc = Root of all build tools, e.g. /java or J:
377BOOTDIR.desc = JDK used to boot the build
378JDK_IMPORT_PATH.desc = JDK used to import components of the build
379COMPILER_PATH.desc = Compiler install directory
380CACERTS_FILE.desc = Location of certificates file
381DEVTOOLS_PATH.desc = Directory containing zip and gnumake
382CUPS_HEADERS_PATH.desc = Include directory location for CUPS header files
383DXSDK_PATH.desc = Root directory of DirectX SDK
384MSDEVTOOLS_PATH.desc = Root directory of VC++ tools (e.g. rc.exe)
385MSVCRT_DLL_PATH.desc = Directory containing mscvrt.dll
386
387# Make variables to print out (description and value)
388VARIABLE_PRINTVAL_LIST += \
389 OUTPUTDIR \
390 PARALLEL_COMPILE_JOBS \
391 SLASH_JAVA \
392 BOOTDIR \
393 JDK_IMPORT_PATH \
394 COMPILER_PATH \
395 CACERTS_FILE \
396 DEVTOOLS_PATH
397
398# Make variables that should refer to directories that exist
399VARIABLE_CHECKDIR_LIST += \
400 SLASH_JAVA \
401 BOOTDIR \
402 JDK_IMPORT_PATH \
403 COMPILER_PATH \
404 DEVTOOLS_PATH
405
406# Make variables that should refer to files that exist
407VARIABLE_CHECKFIL_LIST += \
408 CACERTS_FILE
409
410# Some are windows specific
411ifeq ($(PLATFORM), windows)
412
413VARIABLE_PRINTVAL_LIST += \
414 DXSDK_PATH \
415 MSDEVTOOLS_PATH \
416 MSVCRT_DLL_PATH
417
418VARIABLE_CHECKDIR_LIST += \
419 DXSDK_PATH \
420 MSDEVTOOLS_PATH \
421 MSVCRT_DLL_PATH
422
423endif
424
425# For pattern rules below, so all are treated the same
426DO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval)
427DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir)
428DO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil)
429
430# Complete variable check
431variable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST)
432variable_list: $(DO_PRINTVAL_LIST) variable_check
433
434# Pattern rule for printing out a variable
435%.printval:
436 @$(ECHO) " ALT_$* - $($*.desc)"
437 @$(ECHO) " \t $*=$($*)"
438
439# Pattern rule for checking to see if a variable with a directory exists
440%.checkdir:
441 @if [ ! -d $($*) ] ; then \
442 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
443 fi
444
445# Pattern rule for checking to see if a variable with a file exists
446%.checkfil:
447 @if [ ! -f $($*) ] ; then \
448 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
449 fi
450
451# Misc notes on help
452notes_help:
453 @$(ECHO) "\
454--- Notes --- \n\
455- All builds use same output directory unless overridden with \n\
456 \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\
457 \t to use the clean target first. \n\
458- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\
459 \t builds or previous release JDK builds will work. \n\
460- The fastest builds have been when the sources and the BOOTDIR are on \n\
461 \t local disk. \n\
462"
463
464examples_help:
465 @$(ECHO) "\
466--- Examples --- \n\
467 $(MAKE) fastdebug_build \n\
468 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\
469 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug_build \n\
470 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\
471 $(MAKE) ALT_BOOTDIR=/opt/java/jdk1.5.0 \n\
472 $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.6.0 \n\
473"
474
475################################################################
476# Source and binary plug bundling
477################################################################
478ifeq ($(BUNDLE_RULES_AVAILABLE), true)
479 include $(BUNDLE_RULES)
480endif
481
482################################################################
483# Cycle build. Build the jdk, use it to build the jdk again.
484################################################################
485
486ABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk
487
488boot_cycle:
489 $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) product_build
490 $(MAKE) ALT_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image product_build
491
492################################################################
493# JPRT rule to build
494################################################################
495
496include ./make/jprt.gmk
497
498################################################################
499# PHONY
500################################################################
501
502.PHONY: all build what clobber insane \
503 fastdebug_build debug_build product_build setup \
504 dev dev-build dev-sanity dev-clobber
505
506# FIXUP: Old j2se targets
507j2se_fastdebug_only: jdk_fastdebug_only
508j2se_only: jdk_only
509
510# Force target
511FRC:
512
Note: See TracBrowser for help on using the repository browser.