source: trunk/openjdk/Makefile@ 199

Last change on this file since 199 was 175, checked in by dmik, 15 years ago

make: Fixed a regression after r111 when doing make debug_build. Also removed double setup steps.

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