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