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