Makefile revision 18:2dab2f712e18
1# 2# Copyright 1995-2008 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:=. 30endif 31 32ifndef CONTROL_TOPDIR 33 CONTROL_TOPDIR=$(TOPDIR) 34endif 35 36# Openjdk sources (only used if SKIP_OPENJDK_BUILD!=true) 37OPENJDK_SOURCETREE=$(TOPDIR)/openjdk 38OPENJDK_BUILDDIR:=$(shell \ 39 if [ -r $(OPENJDK_SOURCETREE)/Makefile ]; then \ 40 echo "$(OPENJDK_SOURCETREE)"; \ 41 else \ 42 echo "."; \ 43 fi) 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 $(MKDIR) -p $(OUTPUTDIR) 59 60# Rules for sanity checks 61include ./make/sanity-rules.gmk 62 63dev : dev-build 64 65dev-build: 66 $(MAKE) DEV_ONLY=true all 67dev-sanity: 68 $(MAKE) DEV_ONLY=true sanity 69dev-clobber: 70 $(MAKE) DEV_ONLY=true clobber 71 72# Rules for various components 73include ./make/hotspot-rules.gmk 74include ./make/langtools-rules.gmk 75include ./make/corba-rules.gmk 76include ./make/jaxp-rules.gmk 77include ./make/jaxws-rules.gmk 78include ./make/jdk-rules.gmk 79include ./make/install-rules.gmk 80include ./make/sponsors-rules.gmk 81include ./make/deploy-rules.gmk 82 83all:: setup build 84 85setup: openjdk_check 86 $(MKDIR) -p $(OUTPUTDIR)/j2sdk-image 87 88# Check on whether we really can build the openjdk, need source etc. 89openjdk_check: FRC 90ifneq ($(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) " " 102endif 103 104build:: sanity 105 106clobber:: 107 108ifeq ($(BUILD_LANGTOOLS), true) 109 build:: langtools 110 clobber:: langtools-clobber 111endif 112 113ifeq ($(BUILD_CORBA), true) 114 build:: corba 115 clobber:: corba-clobber 116endif 117 118ifeq ($(BUILD_JAXP), true) 119 build:: jaxp 120 clobber:: jaxp-clobber 121endif 122 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