Makefile

Sat, 01 Dec 2007 00:00:00 +0000

author
duke
date
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2
cfeea66a3fa8
child 6
d83470fdf495
permissions
-rw-r--r--

Initial load

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

mercurial