Makefile revision 338:14b8e7eee105
18871Srgrimes#
21558Srgrimes# Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
31558Srgrimes# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
41558Srgrimes#
51558Srgrimes# This code is free software; you can redistribute it and/or modify it
61558Srgrimes# under the terms of the GNU General Public License version 2 only, as
71558Srgrimes# published by the Free Software Foundation.  Oracle designates this
81558Srgrimes# particular file as subject to the "Classpath" exception as provided
91558Srgrimes# by Oracle in the LICENSE file that accompanied this code.
101558Srgrimes#
111558Srgrimes# This code is distributed in the hope that it will be useful, but WITHOUT
121558Srgrimes# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
131558Srgrimes# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
141558Srgrimes# version 2 for more details (a copy is included in the LICENSE file that
151558Srgrimes# accompanied this code).
161558Srgrimes#
171558Srgrimes# You should have received a copy of the GNU General Public License version
181558Srgrimes# 2 along with this work; if not, write to the Free Software Foundation,
191558Srgrimes# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
201558Srgrimes#
211558Srgrimes# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
221558Srgrimes# or visit www.oracle.com if you need additional information or have any
231558Srgrimes# questions.
241558Srgrimes#
251558Srgrimes
261558SrgrimesBUILD_PARENT_DIRECTORY=.
271558Srgrimes
281558Srgrimes# Basename of any originally supplied ALT_OUTPUTDIR directory
291558Srgrimesifndef ORIG_OUTPUTDIR_BASENAME
30114589Sobrien  ifdef ALT_OUTPUTDIR
311558Srgrimes    ORIG_OUTPUTDIR_BASENAME := $(shell basename $(ALT_OUTPUTDIR))
3223675Speter  else
33114589Sobrien    ORIG_OUTPUTDIR_BASENAME  = $(PLATFORM)-$(ARCH)
3441477Sjulian  endif
35114589Sobrienendif
36114589Sobrienexport ORIG_OUTPUTDIR_BASENAME
371558Srgrimes
381558Srgrimes# The three possible directories created for output (3 build flavors)
3962668SmckusickOUTPUTDIR_BASENAME-          = $(ORIG_OUTPUTDIR_BASENAME)
4074556SmckusickOUTPUTDIR_BASENAME-debug     = $(ORIG_OUTPUTDIR_BASENAME)-debug
4123675SpeterOUTPUTDIR_BASENAME-fastdebug = $(ORIG_OUTPUTDIR_BASENAME)-fastdebug
421558Srgrimes
431558Srgrimes# Relative path to a debug output area
441558SrgrimesREL_JDK_OUTPUTDIR = ../$(OUTPUTDIR_BASENAME-$(DEBUG_NAME))
4523675Speter
4623675Speter# The created jdk image directory
47103949SmikeJDK_IMAGE_DIRNAME = j2sdk-image
48101037SmuxJDK_IMAGE_DIR     = $(OUTPUTDIR)/$(JDK_IMAGE_DIRNAME)
491558SrgrimesABS_JDK_IMAGE_DIR = $(ABS_OUTPUTDIR)/$(JDK_IMAGE_DIRNAME)
5023675Speter
511558Srgrimes# Relative path from an output directory to the image directory
521558SrgrimesREL_JDK_IMAGE_DIR = ../$(OUTPUTDIR_BASENAME-$(DEBUG_NAME))/$(JDK_IMAGE_DIRNAME)
5398542SmckusickREL_JDK_DEBUG_IMAGE_DIR = ../$(OUTPUTDIR_BASENAME-debug)/$(JDK_IMAGE_DIRNAME)
5498542SmckusickREL_JDK_FASTDEBUG_IMAGE_DIR = ../$(OUTPUTDIR_BASENAME-fastdebug)/$(JDK_IMAGE_DIRNAME)
5541474Sjulian
561558Srgrimesifndef TOPDIR
57188110Smckusick  TOPDIR:=.
587585Sbdeendif
597585Sbde
6092839Simpifndef JDK_TOPDIR
611558Srgrimes  JDK_TOPDIR=$(TOPDIR)/jdk
6241474Sjulianendif
631558Srgrimesifndef JDK_MAKE_SHARED_DIR
64248658Smckusick  JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared
65248658Smckusickendif
66188110Smckusick
6798542Smckusickdefault: all
6898542Smckusick
69188110Smckusickinclude $(JDK_MAKE_SHARED_DIR)/Defs-control.gmk
701558Srgrimesinclude ./make/Defs-internal.gmk
711558Srgrimesinclude ./make/sanity-rules.gmk
72102231Strhodesinclude ./make/hotspot-rules.gmk
731558Srgrimesinclude ./make/langtools-rules.gmk
741558Srgrimesinclude ./make/corba-rules.gmk
751558Srgrimesinclude ./make/jaxp-rules.gmk
761558Srgrimesinclude ./make/jaxws-rules.gmk
771558Srgrimesinclude ./make/jdk-rules.gmk
781558Srgrimesinclude ./make/install-rules.gmk
791558Srgrimesinclude ./make/sponsors-rules.gmk
801558Srgrimesinclude ./make/deploy-rules.gmk
811558Srgrimes
821558Srgrimesall:: sanity
8369800Stomsoft
8469800Stomsoftifeq ($(SKIP_FASTDEBUG_BUILD), false)
8569800Stomsoft  all:: fastdebug_build
8669800Stomsoftendif
8769800Stomsoft
881558Srgrimesifeq ($(SKIP_DEBUG_BUILD), false)
891558Srgrimes  all:: debug_build
901558Srgrimesendif
9123675Speter
921558Srgrimesall:: all_product_build 
931558Srgrimes
941558Srgrimesall_product_build::
9541474Sjulian
9641474Sjulian# Everything for a full product build
97248658Smckusickifeq ($(SKIP_PRODUCT_BUILD), false)
98248658Smckusick
99188110Smckusick  all_product_build:: product_build
100248658Smckusick
101188110Smckusick  ifeq ($(BUILD_INSTALL), true)
102188110Smckusick    all_product_build:: $(INSTALL)
103248658Smckusick    clobber:: install-clobber
104201708Smckusick  endif
105241035Smdf
106241035Smdf  ifeq ($(BUILD_SPONSORS), true)
107241012Smdf    all_product_build:: $(SPONSORS)
108241035Smdf    clobber:: sponsors-clobber
109176575Sdelphij  endif
110201708Smckusick
111201708Smckusick  ifneq ($(SKIP_COMPARE_IMAGES), true)
11298542Smckusick    all_product_build:: compare-image
113201708Smckusick  endif
11470050Siedowse
11570050Siedowseendif
11670050Siedowse
11770050Siedowsedefine StartTimer
11870050Siedowse	$(MKDIR) -p $(BUILDTIMESDIR)
11970050Siedowse	$(RM) $(BUILDTIMESDIR)/build_time_*
120126345Sscottl	$(call RecordStartTime,TOTAL)
121126345Sscottlendef
122126345Sscottl
123126345Sscottldefine StopTimer
124126345Sscottl	$(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,TOTAL) && $(call ReportBuildTimes,$1),)
12541474Sjulianendef
12641474Sjulian
12741474Sjulian# Generic build of basic repo series
12841474Sjuliangeneric_build_repo_series:: $(SOURCE_TIPS)
12941474Sjulian	$(MKDIR) -p $(JDK_IMAGE_DIR)
13041474Sjulian	@$(call StartTimer)
13141474Sjulian
132188110Smckusickifeq ($(BUILD_LANGTOOLS), true)
133248658Smckusick  generic_build_repo_series:: langtools
134103949Smike  clobber:: langtools-clobber
13541474Sjulianendif
13641474Sjulian
137103949Smikeifeq ($(BUILD_CORBA), true)
13841474Sjulian  generic_build_repo_series:: corba
13941474Sjulian  clobber:: corba-clobber
14041474Sjulianendif
14141474Sjulian
14241474Sjulianifeq ($(BUILD_JAXP), true)
14341474Sjulian  generic_build_repo_series:: jaxp
14441474Sjulian  clobber:: jaxp-clobber
14541474Sjulianendif
14641474Sjulian
14741474Sjulianifeq ($(BUILD_JAXWS), true)
14841474Sjulian  generic_build_repo_series:: jaxws
14941474Sjulian  clobber:: jaxws-clobber
15041474Sjulianendif
15141474Sjulian
15241474Sjulianifeq ($(BUILD_HOTSPOT), true)
15341474Sjulian  generic_build_repo_series:: $(HOTSPOT) 
15441474Sjulian  clobber:: hotspot-clobber
155248658Smckusickendif
15641474Sjulian
157125036Scpercivaifeq ($(BUILD_JDK), true)
15841474Sjulian  generic_build_repo_series:: $(JDK_JAVA_EXE)
15941474Sjulian  clobber:: jdk-clobber
16041474Sjulianendif
16141474Sjulian
16241474Sjulianifeq ($(BUILD_DEPLOY), true)
16341474Sjulian  generic_build_repo_series:: $(DEPLOY)
16441474Sjulian  clobber:: deploy-clobber
165188110Smckusickendif
1661558Srgrimes
16741474Sjuliangeneric_build_repo_series::
168188110Smckusick	@$(call StopTimer,$(if $(DEBUG_NAME),$(DEBUG_NAME)_build,all_product_build))
169188110Smckusick
170188110Smckusick# The debug build, fastdebug or debug. Needs special handling.
171188110Smckusick#  Note that debug builds do NOT do INSTALL steps, but must be done
172188110Smckusick#  after the product build and before the INSTALL step of the product build.
173188110Smckusick#
174188110Smckusick#   DEBUG_NAME is fastdebug or debug
175248658Smckusick#   ALT_OUTPUTDIR is changed to have -debug or -fastdebug suffix
176188110Smckusick#   The resulting image directory (j2sdk-image) is used by the install makefiles
1771558Srgrimes#     to create a debug install bundle jdk-*-debug-** bundle (tar or zip) 
178188110Smckusick#     which will install in the debug or fastdebug subdirectory of the
179188110Smckusick#     normal product install area.
180188110Smckusick#     The install process needs to know what the DEBUG_NAME is, so
181188110Smckusick#     look for INSTALL_DEBUG_NAME in the install rules.
182188110Smckusick#
183188110Smckusick#   NOTE: On windows, do not use $(ABS_BOOTDIR_OUTPUTDIR)-$(DEBUG_NAME).
184188110Smckusick#         Due to the use of short paths in $(ABS_OUTPUTDIR), this may 
185188110Smckusick#         not be the same location.
186188110Smckusick#
187248658Smckusick
188248658Smckusick# Location of fresh bootdir output
189248658SmckusickABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk
190188110SmckusickFRESH_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/$(JDK_IMAGE_DIRNAME)
191248658SmckusickFRESH_DEBUG_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/$(REL_JDK_IMAGE_DIR)
192188110Smckusick  
193248658Smckusickcreate_fresh_product_bootdir: FRC
194188110Smckusick	$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
195248658Smckusick		GENERATE_DOCS=false \
196248658Smckusick		BOOT_CYCLE_SETTINGS= \
197188110Smckusick		build_product_image
198188110Smckusick
199188110Smckusickcreate_fresh_debug_bootdir: FRC
20041474Sjulian	$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
201188110Smckusick		GENERATE_DOCS=false \
202188110Smckusick		BOOT_CYCLE_DEBUG_SETTINGS= \
203188110Smckusick		build_debug_image
204188110Smckusick
205248658Smckusickcreate_fresh_fastdebug_bootdir: FRC
206188110Smckusick	$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
207248658Smckusick		GENERATE_DOCS=false \
208188110Smckusick		BOOT_CYCLE_DEBUG_SETTINGS= \
209248658Smckusick		build_fastdebug_image
210188110Smckusick
21141474Sjulian# Create boot image?
21241474Sjulianifeq ($(SKIP_BOOT_CYCLE),false)
21341474Sjulian  ifneq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64)
21441474Sjulian    DO_BOOT_CYCLE=true
21541474Sjulian  endif
21641474Sjulianendif
217188110Smckusick
218188110Smckusick
21941474Sjulian
22041474Sjulianifeq ($(DO_BOOT_CYCLE),true)
22141474Sjulian  
22241474Sjulian  # Create the bootdir to use in the build
22341474Sjulian  product_build:: create_fresh_product_bootdir
22441474Sjulian  debug_build:: create_fresh_debug_bootdir
225248658Smckusick  fastdebug_build:: create_fresh_fastdebug_bootdir
22641474Sjulian
227125036Scperciva  # Define variables to be used now for the boot jdk
22841474Sjulian  BOOT_CYCLE_SETTINGS= \
22941474Sjulian     ALT_BOOTDIR=$(FRESH_BOOTDIR) \
23041474Sjulian     ALT_JDK_IMPORT_PATH=$(FRESH_BOOTDIR)
23141474Sjulian  BOOT_CYCLE_DEBUG_SETTINGS= \
2321558Srgrimes     ALT_BOOTDIR=$(FRESH_DEBUG_BOOTDIR) \
2331558Srgrimes     ALT_JDK_IMPORT_PATH=$(FRESH_DEBUG_BOOTDIR)
2341558Srgrimes
2351558Srgrimeselse
236188110Smckusick
237188110Smckusick  # Use the supplied ALT_BOOTDIR as the boot
2381558Srgrimes  BOOT_CYCLE_SETTINGS=
23998542Smckusick  BOOT_CYCLE_DEBUG_SETTINGS=
24098542Smckusick
24198542Smckusickendif
2421558Srgrimes
243103885Smckusickbuild_product_image:
2441558Srgrimes	$(MAKE) \
245188110Smckusick	        SKIP_FASTDEBUG_BUILD=true \
246188110Smckusick	        SKIP_DEBUG_BUILD=true \
24798542Smckusick	        $(BOOT_CYCLE_SETTINGS) \
2481558Srgrimes	        generic_build_repo_series
24998542Smckusick
25098542Smckusick#   NOTE: On windows, do not use $(ABS_OUTPUTDIR)-$(DEBUG_NAME).
25198542Smckusick#         Due to the use of short paths in $(ABS_OUTPUTDIR), this may 
25298542Smckusick#         not be the same location.
25398542Smckusick
25498542Smckusickgeneric_debug_build:
25598542Smckusick	$(MAKE) \
25698542Smckusick		ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)/$(REL_JDK_OUTPUTDIR) \
25798542Smckusick	        DEBUG_NAME=$(DEBUG_NAME) \
25898542Smckusick		GENERATE_DOCS=false \
25998542Smckusick	        $(BOOT_CYCLE_DEBUG_SETTINGS) \
26098542Smckusick		generic_build_repo_series
26186514Siedowse
26286514Siedowsebuild_debug_image:
2631558Srgrimes	$(MAKE) DEBUG_NAME=debug generic_debug_build
2641558Srgrimes
2651558Srgrimesbuild_fastdebug_image:
2661558Srgrimes	$(MAKE) DEBUG_NAME=fastdebug generic_debug_build
2671558Srgrimes
2681558Srgrimes# Build final image
26941474Sjulianproduct_build:: build_product_image
270188110Smckusickdebug_build:: build_debug_image
2711558Srgrimesfastdebug_build:: build_fastdebug_image
2721558Srgrimes
27371884Siedowse# The source tips are stored with the relative path to the repo.
27498888Siedowse#   This file will be used when constructing the jdk image.
27598888Siedowsesource_tips: $(SOURCE_TIPS)
27698888Siedowse	$(CAT) $<
27798888Siedowse$(SOURCE_TIPS): FRC
27898542Smckusick	@$(prep-target)
27998542Smckusick	@$(call GetSourceTips)
28098542Smckusick
2811558Srgrimesclobber:: REPORT_BUILD_TIMES=
282101037Smuxclobber:: 
2831558Srgrimes	$(RM) -r $(OUTPUTDIR)/*
2841558Srgrimes	-($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE))
2851558Srgrimes
2861558Srgrimesclean: clobber
287134589Sscottl
288134589Sscottl#
2891558Srgrimes# Dev builds
2901558Srgrimes#
29163003Smckusick
29298542Smckusickdev : dev-build
29363003Smckusick
294101037Smuxdev-build:
295101037Smux	$(MAKE) DEV_ONLY=true all
29663003Smckusickdev-sanity:
29763003Smckusick	$(MAKE) DEV_ONLY=true sanity
29898542Smckusickdev-clobber:
29998542Smckusick	$(MAKE) DEV_ONLY=true clobber
30072525Stegge
30172525Stegge#
30272525Stegge# Quick jdk verification build
30372525Stegge#
30498542Smckusickjdk_only:
3051558Srgrimes	$(MAKE) SKIP_FASTDEBUG_BUILD=true BUILD_HOTSPOT=false all
3061558Srgrimes
307101037Smux
308101037Smux#
3091558Srgrimes# Quick jdk verification fastdebug build
3101558Srgrimes#
3111558Srgrimesjdk_fastdebug_only:
3121558Srgrimes	$(MAKE) DEBUG_NAME=fastdebug BUILD_HOTSPOT=false BUILD_DEPLOY=false \
3131558Srgrimes	    BUILD_INSTALL=false BUILD_SPONSORS=false generic_debug_build
3141558Srgrimes
3151558Srgrimes#
3161558Srgrimes# Quick deploy verification fastdebug build
3171558Srgrimes#
31898542Smckusickdeploy_fastdebug_only:
31998542Smckusick	$(MAKE) \
32098542Smckusick	    DEBUG_NAME=fastdebug \
32198542Smckusick	    BUILD_HOTSPOT=false \
32298542Smckusick	    BUILD_JDK=false \
32398542Smckusick	    BUILD_LANGTOOLS=false \
32498542Smckusick	    BUILD_CORBA=false \
3251558Srgrimes	    BUILD_JAXP=false \
3261558Srgrimes	    BUILD_JAXWS=false \
3271558Srgrimes	    BUILD_INSTALL=false \
3281558Srgrimes	    BUILD_SPONSORS=false \
3291558Srgrimes	    generic_debug_build
3301558Srgrimes
3311558Srgrimes#
3321558Srgrimes# Product build (skip debug builds)
33398879Siedowse#
33498542Smckusickproduct_only:
3351558Srgrimes	$(MAKE) SKIP_FASTDEBUG_BUILD=true all
336101037Smux
337101037Smux#
3381558Srgrimes# Check target
3391558Srgrimes#
3401558Srgrimes
3411558Srgrimescheck: variable_check
3421558Srgrimes
34398542Smckusick#
3441558Srgrimes# Help target
345101037Smux#
346101037Smuxhelp: intro_help target_help variable_help notes_help examples_help
3471558Srgrimes
3481558Srgrimes# Intro help message
3491558Srgrimesintro_help:
3501558Srgrimes	@$(ECHO) "\
3511558SrgrimesMakefile for the JDK builds (all the JDK). \n\
35298542Smckusick"
3531558Srgrimes
35498542Smckusick# Target help
35541474Sjuliantarget_help:
356136281Struckman	@$(ECHO) "\
357136281Struckman--- Common Targets ---  \n\
3581558Srgrimesall               -- build the core JDK (default target) \n\
35941474Sjulianhelp              -- Print out help information \n\
3601558Srgrimescheck             -- Check make variable values for correctness \n\
36141474Sjuliansanity            -- Perform detailed sanity checks on system and settings \n\
362136281Struckmanfastdebug_build   -- build the core JDK in 'fastdebug' mode (-g -O) \n\
363136281Struckmandebug_build       -- build the core JDK in 'debug' mode (-g) \n\
364136281Struckmanclean             -- remove all built and imported files \n\
36541474Sjulianclobber           -- same as clean \n\
36641474Sjulian"
3671558Srgrimes
3681558Srgrimes# Variable help (only common ones used by this Makefile)
36998542Smckusickvariable_help: variable_help_intro variable_list variable_help_end
37062668Smckusickvariable_help_intro:
37162668Smckusick	@$(ECHO) "--- Common Variables ---"
37262668Smckusickvariable_help_end:
3731558Srgrimes	@$(ECHO) " "
374103885Smckusick
375103885Smckusick# One line descriptions for the variables
376103885SmckusickOUTPUTDIR.desc             = Output directory
377103885SmckusickPARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count
378103885SmckusickSLASH_JAVA.desc            = Root of all build tools, e.g. /java or J:
379103885SmckusickBOOTDIR.desc               = JDK used to boot the build
380103885SmckusickJDK_IMPORT_PATH.desc       = JDK used to import components of the build
381103885SmckusickCOMPILER_PATH.desc         = Compiler install directory
382103885SmckusickCACERTS_FILE.desc          = Location of certificates file
383103885SmckusickDEVTOOLS_PATH.desc         = Directory containing zip and gnumake
384103885SmckusickCUPS_HEADERS_PATH.desc     = Include directory location for CUPS header files
385103885SmckusickDXSDK_PATH.desc            = Root directory of DirectX SDK
386103885Smckusick
387103885Smckusick# Make variables to print out (description and value)
388103885SmckusickVARIABLE_PRINTVAL_LIST +=       \
389103885Smckusick    OUTPUTDIR                   \
390103885Smckusick    PARALLEL_COMPILE_JOBS       \
391103885Smckusick    SLASH_JAVA                  \
392103398Sphk    BOOTDIR                     \
393103398Sphk    JDK_IMPORT_PATH             \
3941558Srgrimes    COMPILER_PATH               \
39598542Smckusick    CACERTS_FILE                \
396101037Smux    DEVTOOLS_PATH
397101037Smux
398101037Smux# Make variables that should refer to directories that exist
3991558SrgrimesVARIABLE_CHECKDIR_LIST +=       \
4001558Srgrimes    SLASH_JAVA                  \
4011558Srgrimes    BOOTDIR                     \
402188110Smckusick    JDK_IMPORT_PATH             \
40374556Smckusick    COMPILER_PATH               \
40474556Smckusick    DEVTOOLS_PATH 
405134589Sscottl
40674556Smckusick# Make variables that should refer to files that exist
40774556SmckusickVARIABLE_CHECKFIL_LIST +=       \
40874556Smckusick    CACERTS_FILE
40998542Smckusick
41074556Smckusick# Some are windows specific
411101037Smuxifeq ($(PLATFORM), windows)
412101037Smux
41374556SmckusickVARIABLE_PRINTVAL_LIST +=       \
41474556Smckusick    DXSDK_PATH
41574556Smckusick
41674556SmckusickVARIABLE_CHECKDIR_LIST +=       \
4171558Srgrimes    DXSDK_PATH
418188110Smckusick
4191558Srgrimesendif
42086514Siedowse
42141474Sjulian# For pattern rules below, so all are treated the same
4221558SrgrimesDO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval)
42341474SjulianDO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir)
4241558SrgrimesDO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil)
4251558Srgrimes
4261558Srgrimes# Complete variable check
4271558Srgrimesvariable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST)
428188110Smckusickvariable_list: $(DO_PRINTVAL_LIST) variable_check
4291558Srgrimes
4301558Srgrimes# Pattern rule for printing out a variable
4317585Sbde%.printval:
43292839Simp	@$(ECHO) "  ALT_$* - $($*.desc)"
4331558Srgrimes	@$(ECHO) "  \t $*=$($*)"
4341558Srgrimes
4351558Srgrimes# Pattern rule for checking to see if a variable with a directory exists
43698542Smckusick%.checkdir:
43792806Sobrien	@if [ ! -d $($*) ] ; then \
4381558Srgrimes	    $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
4391558Srgrimes	fi
44062668Smckusick
44162668Smckusick# Pattern rule for checking to see if a variable with a file exists
44262668Smckusick%.checkfil:
44362668Smckusick	@if [ ! -f $($*) ] ; then \
44462668Smckusick	    $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
44562668Smckusick	fi
44662668Smckusick
44762668Smckusick# Misc notes on help
44862668Smckusicknotes_help:
44962668Smckusick	@$(ECHO) "\
45062668Smckusick--- Notes --- \n\
45162668Smckusick- All builds use same output directory unless overridden with \n\
45262668Smckusick \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\
45362668Smckusick \t to use the clean target first. \n\
45462668Smckusick- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\
4551558Srgrimes \t builds or previous release JDK builds will work. \n\
4561558Srgrimes- The fastest builds have been when the sources and the BOOTDIR are on \n\
4571558Srgrimes \t local disk. \n\
4581558Srgrimes"
45986514Siedowse
4601558Srgrimesexamples_help:
4611558Srgrimes	@$(ECHO) "\
46234266Sjulian--- Examples --- \n\
46334266Sjulian  $(MAKE) fastdebug_build \n\
46423675Speter  $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\
46534266Sjulian  $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug_build \n\
4661558Srgrimes  $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\
4671558Srgrimes  $(MAKE) ALT_BOOTDIR=/opt/java/jdk1.5.0 \n\
4681558Srgrimes  $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.6.0 \n\
4691558Srgrimes"
4701558Srgrimes
4711558Srgrimes################################################################
4721558Srgrimes# Source bundling
4731558Srgrimes################################################################
4741558Srgrimesifeq ($(BUNDLE_RULES_AVAILABLE), true)
4751558Srgrimes  include $(BUNDLE_RULES)
4761558Srgrimesendif
4771558Srgrimes
4781558Srgrimes################################################################
47986514Siedowse# rule to test
4801558Srgrimes################################################################
4811558Srgrimes
48234266Sjulian.NOTPARALLEL: test_run
48334266Sjulian
48423675Spetertest:
48534266Sjulian	$(MAKE) test_run
4861558Srgrimes
4871558Srgrimestest_run: test_clean test_start test_summary
488248658Smckusick
4891558Srgrimestest_start:
4901558Srgrimes	@$(ECHO) "Tests started at `$(DATE)`"
49134266Sjulian
49234266Sjuliantest_clean:
49323675Speter	$(RM) $(OUTPUTDIR)/test_failures.txt $(OUTPUTDIR)/test_log.txt
49434266Sjulian
4951558Srgrimestest_summary: $(OUTPUTDIR)/test_failures.txt
4961558Srgrimes	@$(ECHO) "#################################################"
4971558Srgrimes	@$(ECHO) "Tests completed at `$(DATE)`"
4981558Srgrimes	@( $(EGREP) '^TEST STATS:' $(OUTPUTDIR)/test_log.txt \
4991558Srgrimes          || $(ECHO) "No TEST STATS seen in log" )
5001558Srgrimes	@$(ECHO) "For complete details see: $(OUTPUTDIR)/test_log.txt"
5011558Srgrimes	@$(ECHO) "#################################################"
5021558Srgrimes	@if [ -s $< ] ; then                                           \
5031558Srgrimes          $(ECHO) "ERROR: Test failure count: `$(CAT) $< | $(WC) -l`"; \
5041558Srgrimes          $(CAT) $<;                                                   \
5051558Srgrimes          exit 1;                                                      \
5061558Srgrimes        else                                                           \
5071558Srgrimes          $(ECHO) "Success! No failures detected";                     \
5081558Srgrimes        fi
5091558Srgrimes
5101558Srgrimes# Get failure list from log
5111558Srgrimes$(OUTPUTDIR)/test_failures.txt: $(OUTPUTDIR)/test_log.txt
5121558Srgrimes	@$(RM) $@
5131558Srgrimes	@( $(EGREP) '^FAILED:' $< || $(ECHO) "" ) | $(NAWK) 'length>0' > $@
5141558Srgrimes
5151558Srgrimes# Get log file of all tests run
5161558SrgrimesJDK_TO_TEST := $(shell 							\
5171558Srgrimes  if [ -d "$(ABS_JDK_IMAGE_DIR)" ] ; then 				\
518    $(ECHO) "$(ABS_JDK_IMAGE_DIR)"; 					\
519  elif [ -d "$(ABS_OUTPUTDIR)/bin" ] ; then 				\
520    $(ECHO) "$(ABS_OUTPUTDIR)"; 					\
521  elif [ "$(PRODUCT_HOME)" != "" -a -d "$(PRODUCT_HOME)/bin" ] ; then 	\
522    $(ECHO) "$(PRODUCT_HOME)"; 						\
523  fi 									\
524)
525TEST_TARGETS=all
526$(OUTPUTDIR)/test_log.txt:
527	$(RM) $@
528	( $(CD) test &&                                                     \
529          $(MAKE) NO_STOPPING=- PRODUCT_HOME=$(JDK_TO_TEST) $(TEST_TARGETS) \
530        ) | tee $@
531
532################################################################
533# JPRT rule to build
534################################################################
535
536include ./make/jprt.gmk
537
538################################################################
539#  PHONY
540################################################################
541
542.PHONY: all  test test_run test_start test_summary test_clean \
543	generic_build_repo_series \
544	what clobber insane \
545        dev dev-build dev-sanity dev-clobber \
546        product_build \
547        fastdebug_build \
548        debug_build  \
549        build_product_image  \
550        build_debug_image  \
551        build_fastdebug_image \
552        create_fresh_product_bootdir \
553        create_fresh_debug_bootdir \
554        create_fresh_fastdebug_bootdir \
555        generic_debug_build
556
557# Force target
558FRC:
559
560