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