Makefile

changeset 2
cfeea66a3fa8
child 6
d83470fdf495
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Makefile	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,458 @@
     1.4 +#
     1.5 +# Copyright 1995-2007 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 +#
     1.8 +# This code is free software; you can redistribute it and/or modify it
     1.9 +# under the terms of the GNU General Public License version 2 only, as
    1.10 +# published by the Free Software Foundation.  Sun designates this
    1.11 +# particular file as subject to the "Classpath" exception as provided
    1.12 +# by Sun in the LICENSE file that accompanied this code.
    1.13 +#
    1.14 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 +# version 2 for more details (a copy is included in the LICENSE file that
    1.18 +# accompanied this code).
    1.19 +#
    1.20 +# You should have received a copy of the GNU General Public License version
    1.21 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 +#
    1.24 +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.25 +# CA 95054 USA or visit www.sun.com if you need additional information or
    1.26 +# have any questions.
    1.27 +#
    1.28 +
    1.29 +ifndef TOPDIR
    1.30 +  TOPDIR:=$(shell \
    1.31 +    if [ -r ./j2se/make/Makefile -o -r ./jdk/make/Makefile ]; then \
    1.32 +      echo "."; \
    1.33 +    else \
    1.34 +      echo "../.."; \
    1.35 +    fi)
    1.36 +endif
    1.37 +
    1.38 +ifndef CONTROL_TOPDIR
    1.39 +  CONTROL_TOPDIR=$(TOPDIR)/control
    1.40 +  CONTROL_TOPDIR:=$(shell \
    1.41 +    if [ -r $(TOPDIR)/control/make/Makefile ]; then \
    1.42 +      echo "$(TOPDIR)/control"; \
    1.43 +    else \
    1.44 +      echo "$(TOPDIR)"; \
    1.45 +    fi)
    1.46 +endif
    1.47 +
    1.48 +ifndef JDK_TOPDIR
    1.49 +  JDK_TOPDIR=$(TOPDIR)/jdk
    1.50 +endif
    1.51 +ifndef JDK_MAKE_SHARED_DIR
    1.52 +  JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared
    1.53 +endif
    1.54 +
    1.55 +include $(JDK_MAKE_SHARED_DIR)/Defs-control.gmk
    1.56 +
    1.57 +include ./make/Defs-internal.gmk
    1.58 +
    1.59 +all::
    1.60 +	@$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build started: `$(DATE) '+%y-%m-%d %H:%M'`
    1.61 +
    1.62 +# Rules for sanity checks
    1.63 +include ./make/sanity-rules.gmk
    1.64 +
    1.65 +dev : dev-build
    1.66 +
    1.67 +dev-build:
    1.68 +	$(MAKE) DEV_ONLY=true all
    1.69 +dev-sanity:
    1.70 +	$(MAKE) DEV_ONLY=true sanity
    1.71 +dev-clobber:
    1.72 +	$(MAKE) DEV_ONLY=true clobber
    1.73 +
    1.74 +# Rules for various components
    1.75 +include ./make/hotspot-rules.gmk
    1.76 +include ./make/langtools-rules.gmk
    1.77 +include ./make/corba-rules.gmk
    1.78 +include ./make/jaxp-rules.gmk
    1.79 +include ./make/jaxws-rules.gmk
    1.80 +include ./make/jdk-rules.gmk
    1.81 +include ./make/install-rules.gmk
    1.82 +include ./make/sponsors-rules.gmk
    1.83 +include ./make/deploy-rules.gmk
    1.84 +
    1.85 +all:: setup build
    1.86 +
    1.87 +setup:
    1.88 +	$(MKDIR) -p $(OUTPUTDIR)/j2sdk-image
    1.89 +	$(MKDIR) -p $(ABS_OUTPUTDIR)/j2sdk-image
    1.90 +	$(MKDIR) -p $(OUTPUTDIR)-fastdebug/j2sdk-image
    1.91 +	$(MKDIR) -p $(ABS_OUTPUTDIR)-fastdebug/j2sdk-image
    1.92 +
    1.93 +build:: sanity 
    1.94 +
    1.95 +clobber::
    1.96 +
    1.97 +ifeq ($(BUILD_LANGTOOLS), true)
    1.98 +  build:: langtools
    1.99 +  clobber:: langtools-clobber
   1.100 +endif
   1.101 +
   1.102 +ifeq ($(BUILD_CORBA), true)
   1.103 +  build:: corba
   1.104 +  clobber:: corba-clobber
   1.105 +endif
   1.106 +
   1.107 +ifeq ($(BUILD_JAXP), true)
   1.108 +  build:: jaxp
   1.109 +  clobber:: jaxp-clobber
   1.110 +endif
   1.111 +
   1.112 +ifeq ($(BUILD_JAXWS), true)
   1.113 +  build:: jaxws
   1.114 +  clobber:: jaxws-clobber
   1.115 +endif
   1.116 +
   1.117 +ifeq ($(BUILD_HOTSPOT), true)
   1.118 +  build:: $(HOTSPOT) 
   1.119 +  clobber:: hotspot-clobber
   1.120 +endif
   1.121 +
   1.122 +ifeq ($(BUILD_JDK), true)
   1.123 +  build:: $(JDK_JAVA_EXE)
   1.124 +  clobber:: jdk-clobber
   1.125 +endif
   1.126 +
   1.127 +ifeq ($(BUILD_DEPLOY), true)
   1.128 +  build:: $(DEPLOY)
   1.129 +  clobber:: deploy-clobber
   1.130 +endif
   1.131 +
   1.132 +#
   1.133 +# Generic debug build, fastdebug or debug. Needs special handling.
   1.134 +#  Note that debug builds do NOT do INSTALL steps, but must be done
   1.135 +#  after the product build and before the INSTALL step of the product build.
   1.136 +#
   1.137 +#   DEBUG_NAME is fastdebug or debug
   1.138 +#   ALT_OUTPUTDIR is changed to have -debug or -fastdebug suffix
   1.139 +#   The resulting j2sdk-image is used by the install makefiles to create a
   1.140 +#     debug install bundle jdk-*-debug-** bundle (tar or zip) 
   1.141 +#     which will install in the debug or fastdebug subdirectory of the
   1.142 +#     normal product install area.
   1.143 +#     The install process needs to know what the DEBUG_NAME is, so
   1.144 +#     look for INSTALL_DEBUG_NAME in the install rules.
   1.145 +#
   1.146 +
   1.147 +COMMON_DEBUG_FLAGS= \
   1.148 +	DEBUG_NAME=$(DEBUG_NAME) \
   1.149 +	ALT_OUTPUTDIR=$(_OUTPUTDIR)-$(DEBUG_NAME) \
   1.150 +	NO_DOCS=true
   1.151 +
   1.152 +product_build: setup
   1.153 +	@$(ECHO) $@ build started: `$(DATE) '+%y-%m-%d %H:%M'`
   1.154 +	$(MAKE) SKIP_FASTDEBUG_BUILD=true SKIP_DEBUG_BUILD=true all
   1.155 +	@$(ECHO) $@ build finished: `$(DATE) '+%y-%m-%d %H:%M'`
   1.156 +
   1.157 +generic_debug_build:
   1.158 +	@$(ECHO) $@ build started: `$(DATE) '+%y-%m-%d %H:%M'`
   1.159 +	$(MAKE) $(COMMON_DEBUG_FLAGS) setup build
   1.160 +	@$(ECHO) $@ build finished: `$(DATE) '+%y-%m-%d %H:%M'`
   1.161 +
   1.162 +debug_build: setup
   1.163 +	$(MAKE) DEBUG_NAME=debug generic_debug_build
   1.164 +
   1.165 +fastdebug_build: setup
   1.166 +	$(MAKE) DEBUG_NAME=fastdebug generic_debug_build
   1.167 +
   1.168 +ifeq ($(SKIP_FASTDEBUG_BUILD), false)
   1.169 +  all:: fastdebug_build
   1.170 +endif
   1.171 +
   1.172 +ifeq ($(SKIP_DEBUG_BUILD), false)
   1.173 +  all:: debug_build
   1.174 +endif
   1.175 +
   1.176 +ifeq ($(BUILD_JDK), true)
   1.177 +  ifeq ($(BUNDLE_RULES_AVAILABLE), true)
   1.178 +    all:: openjdk-binary-plugs-bundles
   1.179 +  endif
   1.180 +endif
   1.181 +
   1.182 +ifeq ($(BUILD_INSTALL), true)
   1.183 +  all :: $(INSTALL)
   1.184 +  clobber:: install-clobber
   1.185 +endif
   1.186 +
   1.187 +ifeq ($(BUILD_SPONSORS), true)
   1.188 +  all :: $(SPONSORS)
   1.189 +  clobber:: sponsors-clobber
   1.190 +endif
   1.191 +
   1.192 +ifneq ($(SKIP_COMPARE_IMAGES), true)
   1.193 +  all :: compare-image
   1.194 +endif
   1.195 +
   1.196 +ifeq ($(SKIP_OPENJDK_BUILD), false)
   1.197 +  ifeq ($(BUILD_JDK), true)
   1.198 +    ifeq ($(BUNDLE_RULES_AVAILABLE), true)
   1.199 +      # If we have bundle rules, we have a chance here to do a complete cycle
   1.200 +      #   build, of closed and open build.
   1.201 +      # FIXUP: We should create the openjdk source bundle and build that?
   1.202 +      ABS_OPENJDK_PLUGS=$(ABS_OUTPUTDIR)/$(OPENJDK_BINARY_PLUGS_INAME)
   1.203 +      ABS_OPENJDK_OUTPUTDIR=$(ABS_OUTPUTDIR)/openjdk
   1.204 +      OPENJDK_BUILD_NAME_PREFIX \
   1.205 +	= $(J2SDK_NAME)-$(JDK_MKTG_UNDERSCORE_VERSION)-$(MILESTONE)
   1.206 +      OPENJDK_BUILD_NAME_SUFFIX \
   1.207 +	= $(BUILD_NUMBER)-$(PLATFORM)-$(ARCH)-$(BUNDLE_DATE)
   1.208 +      OPENJDK_BUILD_NAME \
   1.209 +	= $(OPENJDK_BUILD_NAME_PREFIX)-openjdk-$(OPENJDK_BUILD_NAME_SUFFIX)
   1.210 +      OPENJDK_BUILD_BINARY_ZIP \
   1.211 +	= $(ABS_BIN_BUNDLEDIR)/$(OPENJDK_BUILD_NAME).zip
   1.212 +  all :: openjdk-build
   1.213 +  openjdk-build:
   1.214 +	@$(ECHO) " "
   1.215 +	@$(ECHO) "================================================="
   1.216 +	@$(ECHO) "Starting openjdk build"
   1.217 +	@$(ECHO) "================================================="
   1.218 +	@$(ECHO) " "
   1.219 +	$(RM) -r $(ABS_OPENJDK_OUTPUTDIR)
   1.220 +	$(MKDIR) -p $(ABS_OPENJDK_OUTPUTDIR)
   1.221 +	$(MAKE) OPENJDK=true \
   1.222 +	  BUILD_LANGTOOLS=$(BUILD_LANGTOOLS) \
   1.223 +	  BUILD_CORBA=$(BUILD_CORBA) \
   1.224 +	  BUILD_JAXP=$(BUILD_JAXP) \
   1.225 +	  BUILD_JAXWS=$(BUILD_JAXWS) \
   1.226 +	  BUILD_HOTSPOT=$(BUILD_HOTSPOT) \
   1.227 +	  ALT_OUTPUTDIR=$(ABS_OPENJDK_OUTPUTDIR) \
   1.228 +	  ALT_BINARY_PLUGS_PATH=$(ABS_OUTPUTDIR)/$(OPENJDK_BINARY_PLUGS_INAME) \
   1.229 +	  ALT_BOOTDIR=$(ABS_OUTPUTDIR)/j2sdk-image \
   1.230 +	  ALT_JDK_IMPORT_PATH=$(ABS_OUTPUTDIR)/j2sdk-image \
   1.231 +		product_build
   1.232 +	$(RM) $(OPENJDK_BUILD_BINARY_ZIP)
   1.233 +	( $(CD) $(ABS_OPENJDK_OUTPUTDIR)/j2sdk-image && \
   1.234 +	  $(ZIPEXE) -q -r $(OPENJDK_BUILD_BINARY_ZIP) .)
   1.235 +	$(RM) -r $(ABS_OPENJDK_OUTPUTDIR)
   1.236 +    endif
   1.237 +  endif
   1.238 +endif
   1.239 +
   1.240 +clobber::
   1.241 +	$(RM) -r $(OUTPUTDIR)/*
   1.242 +	$(RM) -r $(OUTPUTDIR)-debug/*
   1.243 +	$(RM) -r $(OUTPUTDIR)-fastdebug/*
   1.244 +	-($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE))
   1.245 +
   1.246 +clean: clobber
   1.247 +
   1.248 +all:: 
   1.249 +	@$(ECHO) Control build finished: `$(DATE) '+%y-%m-%d %H:%M'`
   1.250 +
   1.251 +#
   1.252 +# Quick jdk verification build
   1.253 +#
   1.254 +jdk_only:
   1.255 +	$(MAKE) SKIP_FASTDEBUG_BUILD=true BUILD_HOTSPOT=false all
   1.256 +
   1.257 +
   1.258 +#
   1.259 +# Quick jdk verification fastdebug build
   1.260 +#
   1.261 +jdk_fastdebug_only:
   1.262 +	$(MAKE) DEBUG_NAME=fastdebug BUILD_HOTSPOT=false BUILD_DEPLOY=false \
   1.263 +	    BUILD_INSTALL=false BUILD_SPONSORS=false generic_debug_build
   1.264 +
   1.265 +#
   1.266 +# Quick deploy verification fastdebug build
   1.267 +#
   1.268 +deploy_fastdebug_only:
   1.269 +	$(MAKE) \
   1.270 +	    DEBUG_NAME=fastdebug \
   1.271 +	    BUILD_HOTSPOT=false \
   1.272 +	    BUILD_JDK=false \
   1.273 +	    BUILD_LANGTOOLS=false \
   1.274 +	    BUILD_CORBA=false \
   1.275 +	    BUILD_JAXP=false \
   1.276 +	    BUILD_JAXWS=false \
   1.277 +	    BUILD_INSTALL=false \
   1.278 +	    BUILD_SPONSORS=false \
   1.279 +	    generic_debug_build
   1.280 +
   1.281 +#
   1.282 +# Product build (skip debug builds)
   1.283 +#
   1.284 +product_only:
   1.285 +	$(MAKE) SKIP_FASTDEBUG_BUILD=true all
   1.286 +
   1.287 +#
   1.288 +# Check target
   1.289 +#
   1.290 +
   1.291 +check: variable_check
   1.292 +
   1.293 +#
   1.294 +# Help target
   1.295 +#
   1.296 +help: intro_help target_help variable_help notes_help examples_help
   1.297 +
   1.298 +# Intro help message
   1.299 +intro_help:
   1.300 +	@$(ECHO) "\
   1.301 +Makefile for the JDK builds (all the JDK). \n\
   1.302 +"
   1.303 +
   1.304 +# Target help
   1.305 +target_help:
   1.306 +	@$(ECHO) "\
   1.307 +--- Common Targets ---  \n\
   1.308 +all               -- build the core JDK (default target) \n\
   1.309 +help              -- Print out help information \n\
   1.310 +check             -- Check make variable values for correctness \n\
   1.311 +sanity            -- Perform detailed sanity checks on system and settings \n\
   1.312 +fastdebug_build   -- build the core JDK in 'fastdebug' mode (-g -O) \n\
   1.313 +debug_build       -- build the core JDK in 'debug' mode (-g) \n\
   1.314 +clean             -- remove all built and imported files \n\
   1.315 +clobber           -- same as clean \n\
   1.316 +"
   1.317 +
   1.318 +# Variable help (only common ones used by this Makefile)
   1.319 +variable_help: variable_help_intro variable_list variable_help_end
   1.320 +variable_help_intro:
   1.321 +	@$(ECHO) "--- Common Variables ---"
   1.322 +variable_help_end:
   1.323 +	@$(ECHO) " "
   1.324 +
   1.325 +# One line descriptions for the variables
   1.326 +OUTPUTDIR.desc             = Output directory
   1.327 +PARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count
   1.328 +SLASH_JAVA.desc            = Root of all build tools, e.g. /java or J:
   1.329 +BOOTDIR.desc               = JDK used to boot the build
   1.330 +JDK_IMPORT_PATH.desc       = JDK used to import components of the build
   1.331 +COMPILER_PATH.desc         = Compiler install directory
   1.332 +CACERTS_FILE.desc          = Location of certificates file
   1.333 +DEVTOOLS_PATH.desc         = Directory containing zip and gnumake
   1.334 +CUPS_HEADERS_PATH.desc     = Include directory location for CUPS header files
   1.335 +DXSDK_PATH.desc            = Root directory of DirectX SDK
   1.336 +MSDEVTOOLS_PATH.desc       = Root directory of VC++ tools (e.g. rc.exe)
   1.337 +MSVCRT_DLL_PATH.desc       = Directory containing mscvrt.dll
   1.338 +
   1.339 +# Make variables to print out (description and value)
   1.340 +VARIABLE_PRINTVAL_LIST +=       \
   1.341 +    OUTPUTDIR                   \
   1.342 +    PARALLEL_COMPILE_JOBS       \
   1.343 +    SLASH_JAVA                  \
   1.344 +    BOOTDIR                     \
   1.345 +    JDK_IMPORT_PATH             \
   1.346 +    COMPILER_PATH               \
   1.347 +    CACERTS_FILE                \
   1.348 +    DEVTOOLS_PATH
   1.349 +
   1.350 +# Make variables that should refer to directories that exist
   1.351 +VARIABLE_CHECKDIR_LIST +=       \
   1.352 +    SLASH_JAVA                  \
   1.353 +    BOOTDIR                     \
   1.354 +    JDK_IMPORT_PATH             \
   1.355 +    COMPILER_PATH               \
   1.356 +    DEVTOOLS_PATH 
   1.357 +
   1.358 +# Make variables that should refer to files that exist
   1.359 +VARIABLE_CHECKFIL_LIST +=       \
   1.360 +    CACERTS_FILE
   1.361 +
   1.362 +# Some are windows specific
   1.363 +ifeq ($(PLATFORM), windows)
   1.364 +
   1.365 +VARIABLE_PRINTVAL_LIST +=       \
   1.366 +    DXSDK_PATH                  \
   1.367 +    MSDEVTOOLS_PATH             \
   1.368 +    MSVCRT_DLL_PATH
   1.369 +
   1.370 +VARIABLE_CHECKDIR_LIST +=       \
   1.371 +    DXSDK_PATH                  \
   1.372 +    MSDEVTOOLS_PATH             \
   1.373 +    MSVCRT_DLL_PATH
   1.374 +
   1.375 +endif
   1.376 +
   1.377 +# For pattern rules below, so all are treated the same
   1.378 +DO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval)
   1.379 +DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir)
   1.380 +DO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil)
   1.381 +
   1.382 +# Complete variable check
   1.383 +variable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST)
   1.384 +variable_list: $(DO_PRINTVAL_LIST) variable_check
   1.385 +
   1.386 +# Pattern rule for printing out a variable
   1.387 +%.printval:
   1.388 +	@$(ECHO) "  ALT_$* - $($*.desc)"
   1.389 +	@$(ECHO) "  \t $*=$($*)"
   1.390 +
   1.391 +# Pattern rule for checking to see if a variable with a directory exists
   1.392 +%.checkdir:
   1.393 +	@if [ ! -d $($*) ] ; then \
   1.394 +	    $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
   1.395 +	fi
   1.396 +
   1.397 +# Pattern rule for checking to see if a variable with a file exists
   1.398 +%.checkfil:
   1.399 +	@if [ ! -f $($*) ] ; then \
   1.400 +	    $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
   1.401 +	fi
   1.402 +
   1.403 +# Misc notes on help
   1.404 +notes_help:
   1.405 +	@$(ECHO) "\
   1.406 +--- Notes --- \n\
   1.407 +- All builds use same output directory unless overridden with \n\
   1.408 + \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\
   1.409 + \t to use the clean target first. \n\
   1.410 +- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\
   1.411 + \t builds or previous release JDK builds will work. \n\
   1.412 +- The fastest builds have been when the sources and the BOOTDIR are on \n\
   1.413 + \t local disk. \n\
   1.414 +"
   1.415 +
   1.416 +examples_help:
   1.417 +	@$(ECHO) "\
   1.418 +--- Examples --- \n\
   1.419 +  $(MAKE) fastdebug_build \n\
   1.420 +  $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\
   1.421 +  $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug_build \n\
   1.422 +  $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\
   1.423 +  $(MAKE) ALT_BOOTDIR=/opt/java/jdk1.5.0 \n\
   1.424 +  $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.6.0 \n\
   1.425 +"
   1.426 +
   1.427 +################################################################
   1.428 +# Source and binary plug bundling
   1.429 +################################################################
   1.430 +ifeq ($(BUNDLE_RULES_AVAILABLE), true)
   1.431 +  include $(BUNDLE_RULES)
   1.432 +endif
   1.433 +
   1.434 +################################################################
   1.435 +# Cycle build. Build the jdk, use it to build the jdk again.
   1.436 +################################################################
   1.437 +  
   1.438 +ABS_BOOTJDK_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk
   1.439 +  
   1.440 +boot_cycle:
   1.441 +	$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTJDK_OUTPUTDIR) product_build
   1.442 +	$(MAKE) ALT_BOOTDIR=$(ABS_BOOTJDK_OUTPUTDIR)/j2sdk-image product_build
   1.443 +
   1.444 +################################################################
   1.445 +# JPRT rule to build
   1.446 +################################################################
   1.447 +
   1.448 +include ./make/jprt.gmk
   1.449 +
   1.450 +################################################################
   1.451 +#  PHONY
   1.452 +################################################################
   1.453 +
   1.454 +.PHONY: all build what clobber insane \
   1.455 +	fastdebug_build debug_build product_build setup \
   1.456 +        dev dev-build dev-sanity dev-clobber
   1.457 +
   1.458 +# FIXUP: Old j2se targets
   1.459 +j2se_fastdebug_only: jdk_fastdebug_only
   1.460 +j2se_only: jdk_only
   1.461 +

mercurial