Makefile revision 8:cbc8ad9dd0e0
15300Szhouyx# 211926Sserb# Copyright 1995-2007 Sun Microsystems, Inc. All Rights Reserved. 35300Szhouyx# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 45300Szhouyx# 55300Szhouyx# This code is free software; you can redistribute it and/or modify it 65300Szhouyx# under the terms of the GNU General Public License version 2 only, as 75300Szhouyx# published by the Free Software Foundation. Sun designates this 85300Szhouyx# particular file as subject to the "Classpath" exception as provided 95300Szhouyx# by Sun in the LICENSE file that accompanied this code. 105300Szhouyx# 115300Szhouyx# This code is distributed in the hope that it will be useful, but WITHOUT 125300Szhouyx# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 135300Szhouyx# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 145300Szhouyx# version 2 for more details (a copy is included in the LICENSE file that 155300Szhouyx# accompanied this code). 165300Szhouyx# 175300Szhouyx# You should have received a copy of the GNU General Public License version 185300Szhouyx# 2 along with this work; if not, write to the Free Software Foundation, 195300Szhouyx# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 205300Szhouyx# 215300Szhouyx# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 225300Szhouyx# CA 95054 USA or visit www.sun.com if you need additional information or 235300Szhouyx# have any questions. 245300Szhouyx# 255300Szhouyx 265300SzhouyxBUILD_PARENT_DIRECTORY=. 275300Szhouyx 285300Szhouyxifndef TOPDIR 2915235Sgoetz TOPDIR:=. 3015235Sgoetzendif 3115235Sgoetz 325300Szhouyxifndef CONTROL_TOPDIR 335300Szhouyx CONTROL_TOPDIR=$(TOPDIR) 3415027Smcherkasendif 3512341Syan 3612341Syan# Openjdk sources (only used if SKIP_OPENJDK_BUILD!=true) 3716177SalanbOPENJDK_SOURCETREE=$(TOPDIR)/openjdk 385300SzhouyxOPENJDK_BUILDDIR:=$(shell \ 395300Szhouyx if [ -r $(OPENJDK_SOURCETREE)/Makefile ]; then \ 405300Szhouyx echo "$(OPENJDK_SOURCETREE)"; \ 415300Szhouyx else \ 425300Szhouyx echo "."; \ 4311017Syan fi) 445300Szhouyx 455300Szhouyxifndef JDK_TOPDIR 465300Szhouyx JDK_TOPDIR=$(TOPDIR)/jdk 475300Szhouyxendif 485300Szhouyxifndef JDK_MAKE_SHARED_DIR 495300Szhouyx JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared 505300Szhouyxendif 5111926Sserb 5211926Sserbinclude $(JDK_MAKE_SHARED_DIR)/Defs-control.gmk 5311926Sserb 545300Szhouyxinclude ./make/Defs-internal.gmk 555300Szhouyx 565300Szhouyxall:: 575300Szhouyx @$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build started: `$(DATE) '+%y-%m-%d %H:%M'` 585300Szhouyx $(MKDIR) -p $(OUTPUTDIR) 595300Szhouyx 605300Szhouyx# Rules for sanity checks 615300Szhouyxinclude ./make/sanity-rules.gmk 6211017Syan 635300Szhouyxdev : dev-build 645300Szhouyx 655300Szhouyxdev-build: 665300Szhouyx $(MAKE) DEV_ONLY=true all 675300Szhouyxdev-sanity: 685300Szhouyx $(MAKE) DEV_ONLY=true sanity 695300Szhouyxdev-clobber: 705300Szhouyx $(MAKE) DEV_ONLY=true clobber 715300Szhouyx 725300Szhouyx# Rules for various components 735300Szhouyxinclude ./make/hotspot-rules.gmk 745300Szhouyxinclude ./make/langtools-rules.gmk 755300Szhouyxinclude ./make/corba-rules.gmk 7611926Sserbinclude ./make/jaxp-rules.gmk 7711926Sserbinclude ./make/jaxws-rules.gmk 785300Szhouyxinclude ./make/jdk-rules.gmk 795300Szhouyxinclude ./make/install-rules.gmk 805300Szhouyxinclude ./make/sponsors-rules.gmk 815300Szhouyxinclude ./make/deploy-rules.gmk 825300Szhouyx 835300Szhouyxall:: setup build 845300Szhouyx 855300Szhouyxsetup: openjdk_check 8611926Sserb $(MKDIR) -p $(OUTPUTDIR)/j2sdk-image 875300Szhouyx 885300Szhouyx# Check on whether we really can build the openjdk, need source etc. 895300Szhouyxopenjdk_check: FRC 905300Szhouyxifneq ($(SKIP_OPENJDK_BUILD), true) 915300Szhouyx @$(ECHO) " " 925300Szhouyx @$(ECHO) "=================================================" 935300Szhouyx @if [ ! -r $(OPENJDK_BUILDDIR)/Makefile ] ; then \ 945300Szhouyx $(ECHO) "ERROR: No openjdk source tree available at: $(OPENJDK_BUILDDIR)"; \ 955300Szhouyx exit 1; \ 965300Szhouyx else \ 975300Szhouyx $(ECHO) "OpenJDK will be built after JDK is built"; \ 985300Szhouyx $(ECHO) " OPENJDK_BUILDDIR=$(OPENJDK_BUILDDIR)"; \ 995300Szhouyx fi 10011017Syan @$(ECHO) "=================================================" 1015300Szhouyx @$(ECHO) " " 1025300Szhouyxendif 1035300Szhouyx 1045300Szhouyxbuild:: sanity 1055300Szhouyx 1065300Szhouyxclobber:: 1075300Szhouyx 1085300Szhouyxifeq ($(BUILD_LANGTOOLS), true) 1095300Szhouyx build:: langtools 1105300Szhouyx clobber:: langtools-clobber 1115300Szhouyxendif 1125300Szhouyx 1135300Szhouyxifeq ($(BUILD_CORBA), true) 1145300Szhouyx build:: corba 1155300Szhouyx clobber:: corba-clobber 1165300Szhouyxendif 1175300Szhouyx 1185300Szhouyxifeq ($(BUILD_JAXP), true) 1195300Szhouyx build:: jaxp 1205300Szhouyx clobber:: jaxp-clobber 1215300Szhouyxendif 1225300Szhouyx 123ifeq ($(BUILD_JAXWS), true) 124 build:: jaxws 125 clobber:: jaxws-clobber 126endif 127 128ifeq ($(BUILD_HOTSPOT), true) 129 build:: $(HOTSPOT) 130 clobber:: hotspot-clobber 131endif 132 133ifeq ($(BUILD_JDK), true) 134 build:: $(JDK_JAVA_EXE) 135 clobber:: jdk-clobber 136endif 137 138ifeq ($(BUILD_DEPLOY), true) 139 build:: $(DEPLOY) 140 clobber:: deploy-clobber 141endif 142 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# 157 158COMMON_DEBUG_FLAGS= \ 159 DEBUG_NAME=$(DEBUG_NAME) \ 160 ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)-$(DEBUG_NAME) \ 161 NO_DOCS=true 162 163product_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'` 167 168generic_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'` 172 173debug_build: setup 174 $(MAKE) DEBUG_NAME=debug generic_debug_build 175 176fastdebug_build: setup 177 $(MAKE) DEBUG_NAME=fastdebug generic_debug_build 178 179ifeq ($(SKIP_FASTDEBUG_BUILD), false) 180 all:: fastdebug_build 181endif 182 183ifeq ($(SKIP_DEBUG_BUILD), false) 184 all:: debug_build 185endif 186 187ifeq ($(BUILD_JDK), true) 188 ifeq ($(BUNDLE_RULES_AVAILABLE), true) 189 all:: openjdk-binary-plugs-bundles 190 endif 191endif 192 193ifeq ($(BUILD_INSTALL), true) 194 all :: $(INSTALL) 195 clobber:: install-clobber 196endif 197 198ifeq ($(BUILD_SPONSORS), true) 199 all :: $(SPONSORS) 200 clobber:: sponsors-clobber 201endif 202 203ifneq ($(SKIP_COMPARE_IMAGES), true) 204 all :: compare-image 205endif 206 207ifneq ($(SKIP_OPENJDK_BUILD), true) 208 all :: openjdk_build 209endif 210 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. 218 219ifneq ($(SKIP_OPENJDK_BUILD), true) 220 ifeq ($(BUILD_JDK), true) 221 ifeq ($(BUNDLE_RULES_AVAILABLE), true) 222 223OPENJDK_PLUGS=$(ABS_OUTPUTDIR)/$(OPENJDK_BINARY_PLUGS_INAME) 224OPENJDK_OUTPUTDIR=$(ABS_OUTPUTDIR)/open-output 225OPENJDK_BUILD_NAME \ 226 = openjdk-$(JDK_MINOR_VERSION)-$(BUILD_NUMBER)-$(PLATFORM)-$(ARCH)-$(BUNDLE_DATE) 227OPENJDK_BUILD_BINARY_ZIP=$(ABS_BIN_BUNDLEDIR)/$(OPENJDK_BUILD_NAME).zip 228BUILT_IMAGE=$(ABS_OUTPUTDIR)/j2sdk-image 229ifeq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64) 230 OPENJDK_BOOTDIR=$(BOOTDIR) 231 OPENJDK_IMPORTJDK=$(JDK_IMPORT_PATH) 232else 233 OPENJDK_BOOTDIR=$(BUILT_IMAGE) 234 OPENJDK_IMPORTJDK=$(BUILT_IMAGE) 235endif 236 237openjdk_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) " " 264 265 endif 266 endif 267endif 268 269clobber:: 270 $(RM) -r $(OUTPUTDIR)/* 271 $(RM) -r $(OUTPUTDIR)-debug/* 272 $(RM) -r $(OUTPUTDIR)-fastdebug/* 273 -($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE)) 274 275clean: clobber 276 277all:: 278 @$(ECHO) Control build finished: `$(DATE) '+%y-%m-%d %H:%M'` 279 280# 281# Quick jdk verification build 282# 283jdk_only: 284 $(MAKE) SKIP_FASTDEBUG_BUILD=true BUILD_HOTSPOT=false all 285 286 287# 288# Quick jdk verification fastdebug build 289# 290jdk_fastdebug_only: 291 $(MAKE) DEBUG_NAME=fastdebug BUILD_HOTSPOT=false BUILD_DEPLOY=false \ 292 BUILD_INSTALL=false BUILD_SPONSORS=false generic_debug_build 293 294# 295# Quick deploy verification fastdebug build 296# 297deploy_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 309 310# 311# Product build (skip debug builds) 312# 313product_only: 314 $(MAKE) SKIP_FASTDEBUG_BUILD=true all 315 316# 317# Check target 318# 319 320check: variable_check 321 322# 323# Help target 324# 325help: intro_help target_help variable_help notes_help examples_help 326 327# Intro help message 328intro_help: 329 @$(ECHO) "\ 330Makefile for the JDK builds (all the JDK). \n\ 331" 332 333# Target help 334target_help: 335 @$(ECHO) "\ 336--- Common Targets --- \n\ 337all -- build the core JDK (default target) \n\ 338help -- Print out help information \n\ 339check -- Check make variable values for correctness \n\ 340sanity -- Perform detailed sanity checks on system and settings \n\ 341fastdebug_build -- build the core JDK in 'fastdebug' mode (-g -O) \n\ 342debug_build -- build the core JDK in 'debug' mode (-g) \n\ 343clean -- remove all built and imported files \n\ 344clobber -- same as clean \n\ 345" 346 347# Variable help (only common ones used by this Makefile) 348variable_help: variable_help_intro variable_list variable_help_end 349variable_help_intro: 350 @$(ECHO) "--- Common Variables ---" 351variable_help_end: 352 @$(ECHO) " " 353 354# One line descriptions for the variables 355OUTPUTDIR.desc = Output directory 356PARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count 357SLASH_JAVA.desc = Root of all build tools, e.g. /java or J: 358BOOTDIR.desc = JDK used to boot the build 359JDK_IMPORT_PATH.desc = JDK used to import components of the build 360COMPILER_PATH.desc = Compiler install directory 361CACERTS_FILE.desc = Location of certificates file 362DEVTOOLS_PATH.desc = Directory containing zip and gnumake 363CUPS_HEADERS_PATH.desc = Include directory location for CUPS header files 364DXSDK_PATH.desc = Root directory of DirectX SDK 365MSDEVTOOLS_PATH.desc = Root directory of VC++ tools (e.g. rc.exe) 366MSVCRT_DLL_PATH.desc = Directory containing mscvrt.dll 367 368# Make variables to print out (description and value) 369VARIABLE_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 378 379# Make variables that should refer to directories that exist 380VARIABLE_CHECKDIR_LIST += \ 381 SLASH_JAVA \ 382 BOOTDIR \ 383 JDK_IMPORT_PATH \ 384 COMPILER_PATH \ 385 DEVTOOLS_PATH 386 387# Make variables that should refer to files that exist 388VARIABLE_CHECKFIL_LIST += \ 389 CACERTS_FILE 390 391# Some are windows specific 392ifeq ($(PLATFORM), windows) 393 394VARIABLE_PRINTVAL_LIST += \ 395 DXSDK_PATH \ 396 MSDEVTOOLS_PATH \ 397 MSVCRT_DLL_PATH 398 399VARIABLE_CHECKDIR_LIST += \ 400 DXSDK_PATH \ 401 MSDEVTOOLS_PATH \ 402 MSVCRT_DLL_PATH 403 404endif 405 406# For pattern rules below, so all are treated the same 407DO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval) 408DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir) 409DO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil) 410 411# Complete variable check 412variable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST) 413variable_list: $(DO_PRINTVAL_LIST) variable_check 414 415# Pattern rule for printing out a variable 416%.printval: 417 @$(ECHO) " ALT_$* - $($*.desc)" 418 @$(ECHO) " \t $*=$($*)" 419 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 425 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 431 432# Misc notes on help 433notes_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" 444 445examples_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" 455 456################################################################ 457# Source and binary plug bundling 458################################################################ 459ifeq ($(BUNDLE_RULES_AVAILABLE), true) 460 include $(BUNDLE_RULES) 461endif 462 463################################################################ 464# Cycle build. Build the jdk, use it to build the jdk again. 465################################################################ 466 467ABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk 468 469boot_cycle: 470 $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) product_build 471 $(MAKE) ALT_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image product_build 472 473################################################################ 474# JPRT rule to build 475################################################################ 476 477include ./make/jprt.gmk 478 479################################################################ 480# PHONY 481################################################################ 482 483.PHONY: all build what clobber insane \ 484 fastdebug_build debug_build product_build setup \ 485 dev dev-build dev-sanity dev-clobber 486 487# Force target 488FRC: 489 490