Makefile revision 315:c6f380693342
1184251Smarcel#
2184251Smarcel# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
3184251Smarcel# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4184251Smarcel#
5184251Smarcel# This code is free software; you can redistribute it and/or modify it
6184251Smarcel# under the terms of the GNU General Public License version 2 only, as
7184251Smarcel# published by the Free Software Foundation.  Oracle designates this
8184251Smarcel# particular file as subject to the "Classpath" exception as provided
9184251Smarcel# by Oracle in the LICENSE file that accompanied this code.
10184251Smarcel#
11184251Smarcel# This code is distributed in the hope that it will be useful, but WITHOUT
12184251Smarcel# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13184251Smarcel# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14184251Smarcel# version 2 for more details (a copy is included in the LICENSE file that
15184251Smarcel# accompanied this code).
16184251Smarcel#
17184251Smarcel# You should have received a copy of the GNU General Public License version
18184251Smarcel# 2 along with this work; if not, write to the Free Software Foundation,
19184251Smarcel# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20184251Smarcel#
21184251Smarcel# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22184251Smarcel# or visit www.oracle.com if you need additional information or have any
23184251Smarcel# questions.
24184251Smarcel#
25184251Smarcel
26184251SmarcelBUILD_PARENT_DIRECTORY=.
27184251Smarcel
28184251Smarcelifndef TOPDIR
29184251Smarcel  TOPDIR:=.
30184251Smarcelendif
31184251Smarcel
32184251Smarcelifndef JDK_TOPDIR
33188156Ssam  JDK_TOPDIR=$(TOPDIR)/jdk
34188156Ssamendif
35184251Smarcelifndef JDK_MAKE_SHARED_DIR
36184251Smarcel  JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared
37184251Smarcelendif
38184251Smarcel
39184251Smarceldefault: all
40184251Smarcel
41184251Smarcelinclude $(JDK_MAKE_SHARED_DIR)/Defs-control.gmk
42184251Smarcelinclude ./make/Defs-internal.gmk
43184251Smarcelinclude ./make/sanity-rules.gmk
44184251Smarcelinclude ./make/hotspot-rules.gmk
45184251Smarcelinclude ./make/langtools-rules.gmk
46184251Smarcelinclude ./make/corba-rules.gmk
47184251Smarcelinclude ./make/jaxp-rules.gmk
48184251Smarcelinclude ./make/jaxws-rules.gmk
49184251Smarcelinclude ./make/jdk-rules.gmk
50184251Smarcelinclude ./make/install-rules.gmk
51184251Smarcelinclude ./make/sponsors-rules.gmk
52184251Smarcelinclude ./make/deploy-rules.gmk
53184251Smarcel
54184251Smarcelall:: sanity
55184251Smarcel
56184251Smarcelifeq ($(SKIP_FASTDEBUG_BUILD), false)
57184251Smarcel  all:: fastdebug_build
58184251Smarcelendif
59184251Smarcel
60184251Smarcelifeq ($(SKIP_DEBUG_BUILD), false)
61184251Smarcel  all:: debug_build
62184251Smarcelendif
63184251Smarcel
64184251Smarcelall:: all_product_build 
65184251Smarcel
66184251Smarcelall_product_build::
67184251Smarcel
68184251Smarcel# Everything for a full product build
69184251Smarcelifeq ($(SKIP_PRODUCT_BUILD), false)
70184251Smarcel
71184251Smarcel  all_product_build:: product_build
72184251Smarcel
73184251Smarcel  ifeq ($(BUILD_INSTALL), true)
74184251Smarcel    all_product_build:: $(INSTALL)
75184251Smarcel    clobber:: install-clobber
76184251Smarcel  endif
77184251Smarcel
78184251Smarcel  ifeq ($(BUILD_SPONSORS), true)
79184251Smarcel    all_product_build:: $(SPONSORS)
80184251Smarcel    clobber:: sponsors-clobber
81184251Smarcel  endif
82184251Smarcel
83184251Smarcel  ifneq ($(SKIP_COMPARE_IMAGES), true)
84184251Smarcel    all_product_build:: compare-image
85184251Smarcel  endif
86184251Smarcel
87184251Smarcelendif
88184251Smarcel
89184251Smarceldefine StartTimer
90184251Smarcel	$(MKDIR) -p $(BUILDTIMESDIR)
91184251Smarcel	$(RM) $(BUILDTIMESDIR)/build_time_*
92184251Smarcel	$(call RecordStartTime,TOTAL)
93184251Smarcelendef
94184251Smarcel
95184251Smarceldefine StopTimer
96184251Smarcel	$(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,TOTAL) && $(call ReportBuildTimes,$1),)
97184251Smarcelendef
98184251Smarcel
99184251Smarcel# Generic build of basic repo series
100184251Smarcelgeneric_build_repo_series::
101184251Smarcel	$(MKDIR) -p $(OUTPUTDIR)
102184251Smarcel	$(MKDIR) -p $(OUTPUTDIR)/j2sdk-image
103184251Smarcel	@$(call StartTimer)
104184251Smarcel
105184251Smarcelifeq ($(BUILD_LANGTOOLS), true)
106184251Smarcel  generic_build_repo_series:: langtools
107184251Smarcel  clobber:: langtools-clobber
108184251Smarcelendif
109184251Smarcel
110184251Smarcelifeq ($(BUILD_CORBA), true)
111184251Smarcel  generic_build_repo_series:: corba
112184251Smarcel  clobber:: corba-clobber
113184251Smarcelendif
114184251Smarcel
115184251Smarcelifeq ($(BUILD_JAXP), true)
116184251Smarcel  generic_build_repo_series:: jaxp
117184251Smarcel  clobber:: jaxp-clobber
118184251Smarcelendif
119184251Smarcel
120184251Smarcelifeq ($(BUILD_JAXWS), true)
121184251Smarcel  generic_build_repo_series:: jaxws
122184251Smarcel  clobber:: jaxws-clobber
123184251Smarcelendif
124184251Smarcel
125184251Smarcelifeq ($(BUILD_HOTSPOT), true)
126184251Smarcel  generic_build_repo_series:: $(HOTSPOT) 
127184251Smarcel  clobber:: hotspot-clobber
128184251Smarcelendif
129184251Smarcel
130184251Smarcelifeq ($(BUILD_JDK), true)
131184251Smarcel  generic_build_repo_series:: $(JDK_JAVA_EXE)
132184251Smarcel  clobber:: jdk-clobber
133184251Smarcelendif
134184251Smarcel
135184251Smarcelifeq ($(BUILD_DEPLOY), true)
136184251Smarcel  generic_build_repo_series:: $(DEPLOY)
137184251Smarcel  clobber:: deploy-clobber
138184251Smarcelendif
139184251Smarcel
140184251Smarcelgeneric_build_repo_series::
141184251Smarcel	@$(call StopTimer,$(if $(DEBUG_NAME),$(DEBUG_NAME)_build,all_product_build))
142184251Smarcel
143184251Smarcel# The debug build, fastdebug or debug. Needs special handling.
144184251Smarcel#  Note that debug builds do NOT do INSTALL steps, but must be done
145184251Smarcel#  after the product build and before the INSTALL step of the product build.
146184251Smarcel#
147184251Smarcel#   DEBUG_NAME is fastdebug or debug
148184251Smarcel#   ALT_OUTPUTDIR is changed to have -debug or -fastdebug suffix
149184251Smarcel#   The resulting j2sdk-image is used by the install makefiles to create a
150184251Smarcel#     debug install bundle jdk-*-debug-** bundle (tar or zip) 
151184251Smarcel#     which will install in the debug or fastdebug subdirectory of the
152184251Smarcel#     normal product install area.
153184251Smarcel#     The install process needs to know what the DEBUG_NAME is, so
154188087Ssam#     look for INSTALL_DEBUG_NAME in the install rules.
155188087Ssam#
156188087Ssam#   NOTE: On windows, do not use $(ABS_BOOTDIR_OUTPUTDIR)-$(DEBUG_NAME).
157188087Ssam#         Due to the use of short paths in $(ABS_OUTPUTDIR), this may 
158188087Ssam#         not be the same location.
159188087Ssam#
160188087Ssam
161188087Ssam# Location of fresh bootdir output
162188087SsamABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk
163188087SsamFRESH_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image
164184251SmarcelFRESH_DEBUG_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME)/j2sdk-image
165184251Smarcel  
166184251Smarcelcreate_fresh_product_bootdir: FRC
167184251Smarcel	$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
168184251Smarcel		GENERATE_DOCS=false \
169184251Smarcel		BOOT_CYCLE_SETTINGS= \
170184251Smarcel		build_product_image
171184251Smarcel
172184251Smarcelcreate_fresh_debug_bootdir: FRC
173184251Smarcel	$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
174184251Smarcel		GENERATE_DOCS=false \
175184251Smarcel		BOOT_CYCLE_DEBUG_SETTINGS= \
176184251Smarcel		build_debug_image
177184251Smarcel
178184251Smarcelcreate_fresh_fastdebug_bootdir: FRC
179184251Smarcel	$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
180184251Smarcel		GENERATE_DOCS=false \
181184251Smarcel		BOOT_CYCLE_DEBUG_SETTINGS= \
182184251Smarcel		build_fastdebug_image
183184251Smarcel
184184251Smarcel# Create boot image?
185184251Smarcelifeq ($(SKIP_BOOT_CYCLE),false)
186184251Smarcel  ifneq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64)
187184251Smarcel    DO_BOOT_CYCLE=true
188184251Smarcel  endif
189184251Smarcelendif
190184251Smarcel
191184251Smarcel
192184251Smarcel
193184251Smarcelifeq ($(DO_BOOT_CYCLE),true)
194184251Smarcel  
195184251Smarcel  # Create the bootdir to use in the build
196184251Smarcel  product_build:: create_fresh_product_bootdir
197184251Smarcel  debug_build:: create_fresh_debug_bootdir
198184251Smarcel  fastdebug_build:: create_fresh_fastdebug_bootdir
199184251Smarcel
200184251Smarcel  # Define variables to be used now for the boot jdk
201184251Smarcel  BOOT_CYCLE_SETTINGS= \
202184251Smarcel     ALT_BOOTDIR=$(FRESH_BOOTDIR) \
203184251Smarcel     ALT_JDK_IMPORT_PATH=$(FRESH_BOOTDIR)
204184251Smarcel  BOOT_CYCLE_DEBUG_SETTINGS= \
205184251Smarcel     ALT_BOOTDIR=$(FRESH_DEBUG_BOOTDIR) \
206184251Smarcel     ALT_JDK_IMPORT_PATH=$(FRESH_DEBUG_BOOTDIR)
207184251Smarcel
208184251Smarcelelse
209184251Smarcel
210184251Smarcel  # Use the supplied ALT_BOOTDIR as the boot
211184251Smarcel  BOOT_CYCLE_SETTINGS=
212184251Smarcel  BOOT_CYCLE_DEBUG_SETTINGS=
213184251Smarcel
214184251Smarcelendif
215184251Smarcel
216184251Smarcelbuild_product_image:
217184251Smarcel	$(MAKE) \
218184251Smarcel	        SKIP_FASTDEBUG_BUILD=true \
219184251Smarcel	        SKIP_DEBUG_BUILD=true \
220184251Smarcel	        $(BOOT_CYCLE_SETTINGS) \
221184251Smarcel	        generic_build_repo_series
222184251Smarcel
223184251Smarcel#   NOTE: On windows, do not use $(ABS_OUTPUTDIR)-$(DEBUG_NAME).
224184251Smarcel#         Due to the use of short paths in $(ABS_OUTPUTDIR), this may 
225184251Smarcel#         not be the same location.
226184251Smarcel
227184251Smarcelgeneric_debug_build:
228184251Smarcel	$(MAKE) \
229184251Smarcel		ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME) \
230184251Smarcel	        DEBUG_NAME=$(DEBUG_NAME) \
231184251Smarcel		GENERATE_DOCS=false \
232184251Smarcel	        $(BOOT_CYCLE_DEBUG_SETTINGS) \
233184251Smarcel		generic_build_repo_series
234184251Smarcel
235184251Smarcelbuild_debug_image:
236184251Smarcel	$(MAKE) DEBUG_NAME=debug generic_debug_build
237184251Smarcel
238184251Smarcelbuild_fastdebug_image:
239184251Smarcel	$(MAKE) DEBUG_NAME=fastdebug generic_debug_build
240184251Smarcel
241184251Smarcel# Build final image
242184251Smarcelproduct_build:: build_product_image
243184251Smarceldebug_build:: build_debug_image
244184251Smarcelfastdebug_build:: build_fastdebug_image
245184251Smarcel
246184251Smarcelclobber:: REPORT_BUILD_TIMES=
247184251Smarcelclobber:: 
248184251Smarcel	$(RM) -r $(OUTPUTDIR)/*
249184251Smarcel	$(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-debug/*
250184251Smarcel	$(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-fastdebug/*
251184251Smarcel	-($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE))
252184251Smarcel
253184251Smarcelclean: clobber
254184251Smarcel
255184251Smarcel#
256184251Smarcel# Dev builds
257184251Smarcel#
258184251Smarcel
259184251Smarceldev : dev-build
260184251Smarcel
261184251Smarceldev-build:
262184251Smarcel	$(MAKE) DEV_ONLY=true all
263184251Smarceldev-sanity:
264184251Smarcel	$(MAKE) DEV_ONLY=true sanity
265184251Smarceldev-clobber:
266184251Smarcel	$(MAKE) DEV_ONLY=true clobber
267184251Smarcel
268184251Smarcel#
269184251Smarcel# Quick jdk verification build
270184251Smarcel#
271184251Smarceljdk_only:
272184251Smarcel	$(MAKE) SKIP_FASTDEBUG_BUILD=true BUILD_HOTSPOT=false all
273184251Smarcel
274184251Smarcel
275184251Smarcel#
276184251Smarcel# Quick jdk verification fastdebug build
277184251Smarcel#
278184251Smarceljdk_fastdebug_only:
279184251Smarcel	$(MAKE) DEBUG_NAME=fastdebug BUILD_HOTSPOT=false BUILD_DEPLOY=false \
280184251Smarcel	    BUILD_INSTALL=false BUILD_SPONSORS=false generic_debug_build
281184251Smarcel
282184251Smarcel#
283184251Smarcel# Quick deploy verification fastdebug build
284184251Smarcel#
285184251Smarceldeploy_fastdebug_only:
286184251Smarcel	$(MAKE) \
287184251Smarcel	    DEBUG_NAME=fastdebug \
288184251Smarcel	    BUILD_HOTSPOT=false \
289184251Smarcel	    BUILD_JDK=false \
290184251Smarcel	    BUILD_LANGTOOLS=false \
291184251Smarcel	    BUILD_CORBA=false \
292184251Smarcel	    BUILD_JAXP=false \
293184251Smarcel	    BUILD_JAXWS=false \
294184251Smarcel	    BUILD_INSTALL=false \
295184251Smarcel	    BUILD_SPONSORS=false \
296184251Smarcel	    generic_debug_build
297184251Smarcel
298184251Smarcel#
299184251Smarcel# Product build (skip debug builds)
300184251Smarcel#
301184251Smarcelproduct_only:
302184251Smarcel	$(MAKE) SKIP_FASTDEBUG_BUILD=true all
303184251Smarcel
304188156Ssam#
305184251Smarcel# Check target
306184251Smarcel#
307188156Ssam
308184251Smarcelcheck: variable_check
309184251Smarcel
310184251Smarcel#
311184251Smarcel# Help target
312184251Smarcel#
313184251Smarcelhelp: intro_help target_help variable_help notes_help examples_help
314184251Smarcel
315184251Smarcel# Intro help message
316184251Smarcelintro_help:
317184251Smarcel	@$(ECHO) "\
318184251SmarcelMakefile for the JDK builds (all the JDK). \n\
319188156Ssam"
320188156Ssam
321184251Smarcel# Target help
322188156Ssamtarget_help:
323188156Ssam	@$(ECHO) "\
324188156Ssam--- Common Targets ---  \n\
325188156Ssamall               -- build the core JDK (default target) \n\
326188156Ssamhelp              -- Print out help information \n\
327184251Smarcelcheck             -- Check make variable values for correctness \n\
328188156Ssamsanity            -- Perform detailed sanity checks on system and settings \n\
329184251Smarcelfastdebug_build   -- build the core JDK in 'fastdebug' mode (-g -O) \n\
330188156Ssamdebug_build       -- build the core JDK in 'debug' mode (-g) \n\
331184251Smarcelclean             -- remove all built and imported files \n\
332188156Ssamclobber           -- same as clean \n\
333188156Ssam"
334184251Smarcel
335184251Smarcel# Variable help (only common ones used by this Makefile)
336184251Smarcelvariable_help: variable_help_intro variable_list variable_help_end
337184251Smarcelvariable_help_intro:
338188156Ssam	@$(ECHO) "--- Common Variables ---"
339188156Ssamvariable_help_end:
340184251Smarcel	@$(ECHO) " "
341184251Smarcel
342184251Smarcel# One line descriptions for the variables
343184251SmarcelOUTPUTDIR.desc             = Output directory
344184251SmarcelPARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count
345184251SmarcelSLASH_JAVA.desc            = Root of all build tools, e.g. /java or J:
346184251SmarcelBOOTDIR.desc               = JDK used to boot the build
347188156SsamJDK_IMPORT_PATH.desc       = JDK used to import components of the build
348184251SmarcelCOMPILER_PATH.desc         = Compiler install directory
349184251SmarcelCACERTS_FILE.desc          = Location of certificates file
350184251SmarcelDEVTOOLS_PATH.desc         = Directory containing zip and gnumake
351184251SmarcelCUPS_HEADERS_PATH.desc     = Include directory location for CUPS header files
352184251SmarcelDXSDK_PATH.desc            = Root directory of DirectX SDK
353184251Smarcel
354184251Smarcel# Make variables to print out (description and value)
355184251SmarcelVARIABLE_PRINTVAL_LIST +=       \
356184251Smarcel    OUTPUTDIR                   \
357184251Smarcel    PARALLEL_COMPILE_JOBS       \
358184251Smarcel    SLASH_JAVA                  \
359184251Smarcel    BOOTDIR                     \
360184251Smarcel    JDK_IMPORT_PATH             \
361184251Smarcel    COMPILER_PATH               \
362184251Smarcel    CACERTS_FILE                \
363184251Smarcel    DEVTOOLS_PATH
364184251Smarcel
365184251Smarcel# Make variables that should refer to directories that exist
366184251SmarcelVARIABLE_CHECKDIR_LIST +=       \
367184251Smarcel    SLASH_JAVA                  \
368184251Smarcel    BOOTDIR                     \
369184251Smarcel    JDK_IMPORT_PATH             \
370184251Smarcel    COMPILER_PATH               \
371184251Smarcel    DEVTOOLS_PATH 
372184251Smarcel
373184251Smarcel# Make variables that should refer to files that exist
374184251SmarcelVARIABLE_CHECKFIL_LIST +=       \
375184251Smarcel    CACERTS_FILE
376184251Smarcel
377184251Smarcel# Some are windows specific
378184251Smarcelifeq ($(PLATFORM), windows)
379188156Ssam
380184251SmarcelVARIABLE_PRINTVAL_LIST +=       \
381184251Smarcel    DXSDK_PATH
382184251Smarcel
383184251SmarcelVARIABLE_CHECKDIR_LIST +=       \
384184251Smarcel    DXSDK_PATH
385184251Smarcel
386184251Smarcelendif
387184251Smarcel
388184251Smarcel# For pattern rules below, so all are treated the same
389184251SmarcelDO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval)
390184251SmarcelDO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir)
391184251SmarcelDO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil)
392184251Smarcel
393184251Smarcel# Complete variable check
394184251Smarcelvariable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST)
395184251Smarcelvariable_list: $(DO_PRINTVAL_LIST) variable_check
396184251Smarcel
397184251Smarcel# Pattern rule for printing out a variable
398184251Smarcel%.printval:
399184251Smarcel	@$(ECHO) "  ALT_$* - $($*.desc)"
400184251Smarcel	@$(ECHO) "  \t $*=$($*)"
401184251Smarcel
402184251Smarcel# Pattern rule for checking to see if a variable with a directory exists
403184251Smarcel%.checkdir:
404184251Smarcel	@if [ ! -d $($*) ] ; then \
405184251Smarcel	    $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
406184251Smarcel	fi
407184251Smarcel
408184251Smarcel# Pattern rule for checking to see if a variable with a file exists
409184251Smarcel%.checkfil:
410184251Smarcel	@if [ ! -f $($*) ] ; then \
411184251Smarcel	    $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
412184251Smarcel	fi
413184251Smarcel
414184251Smarcel# Misc notes on help
415184251Smarcelnotes_help:
416184251Smarcel	@$(ECHO) "\
417184251Smarcel--- Notes --- \n\
418184251Smarcel- All builds use same output directory unless overridden with \n\
419184251Smarcel \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\
420184251Smarcel \t to use the clean target first. \n\
421188156Ssam- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\
422184251Smarcel \t builds or previous release JDK builds will work. \n\
423184251Smarcel- The fastest builds have been when the sources and the BOOTDIR are on \n\
424184251Smarcel \t local disk. \n\
425184251Smarcel"
426184251Smarcel
427184251Smarcelexamples_help:
428184251Smarcel	@$(ECHO) "\
429184251Smarcel--- Examples --- \n\
430184251Smarcel  $(MAKE) fastdebug_build \n\
431184251Smarcel  $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\
432188156Ssam  $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug_build \n\
433188156Ssam  $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\
434188156Ssam  $(MAKE) ALT_BOOTDIR=/opt/java/jdk1.5.0 \n\
435188156Ssam  $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.6.0 \n\
436188156Ssam"
437188156Ssam
438188156Ssam################################################################
439188156Ssam# Source bundling
440188156Ssam################################################################
441188156Ssamifeq ($(BUNDLE_RULES_AVAILABLE), true)
442188156Ssam  include $(BUNDLE_RULES)
443188156Ssamendif
444188156Ssam
445188156Ssam################################################################
446188156Ssam# rule to test
447188156Ssam################################################################
448188156Ssam
449188156Ssam.NOTPARALLEL: test_run
450188156Ssam
451188156Ssamtest:
452188156Ssam	$(MAKE) test_run
453188156Ssam
454188156Ssamtest_run: test_clean test_start test_summary
455188156Ssam
456188156Ssamtest_start:
457188156Ssam	@$(ECHO) "Tests started at `$(DATE)`"
458188156Ssam
459188156Ssamtest_clean:
460188156Ssam	$(RM) $(OUTPUTDIR)/test_failures.txt $(OUTPUTDIR)/test_log.txt
461188156Ssam
462188156Ssamtest_summary: $(OUTPUTDIR)/test_failures.txt
463188156Ssam	@$(ECHO) "#################################################"
464188156Ssam	@$(ECHO) "Tests completed at `$(DATE)`"
465188156Ssam	@( $(EGREP) '^TEST STATS:' $(OUTPUTDIR)/test_log.txt \
466188156Ssam          || $(ECHO) "No TEST STATS seen in log" )
467188156Ssam	@$(ECHO) "For complete details see: $(OUTPUTDIR)/test_log.txt"
468188156Ssam	@$(ECHO) "#################################################"
469188156Ssam	@if [ -s $< ] ; then                                           \
470188156Ssam          $(ECHO) "ERROR: Test failure count: `$(CAT) $< | $(WC) -l`"; \
471188156Ssam          $(CAT) $<;                                                   \
472188156Ssam          exit 1;                                                      \
473188156Ssam        else                                                           \
474188156Ssam          $(ECHO) "Success! No failures detected";                     \
475188156Ssam        fi
476188156Ssam
477188156Ssam# Get failure list from log
478188156Ssam$(OUTPUTDIR)/test_failures.txt: $(OUTPUTDIR)/test_log.txt
479188156Ssam	@$(RM) $@
480188156Ssam	@( $(EGREP) '^FAILED:' $< || $(ECHO) "" ) | $(NAWK) 'length>0' > $@
481188156Ssam
482188156Ssam# Get log file of all tests run
483188156SsamJDK_TO_TEST := $(shell 							\
484188156Ssam  if [ -d "$(ABS_OUTPUTDIR)/j2sdk-image" ] ; then 			\
485188156Ssam    $(ECHO) "$(ABS_OUTPUTDIR)/j2sdk-image"; 				\
486188156Ssam  elif [ -d "$(ABS_OUTPUTDIR)/bin" ] ; then 				\
487188156Ssam    $(ECHO) "$(ABS_OUTPUTDIR)"; 					\
488188156Ssam  elif [ "$(PRODUCT_HOME)" != "" -a -d "$(PRODUCT_HOME)/bin" ] ; then 	\
489188156Ssam    $(ECHO) "$(PRODUCT_HOME)"; 						\
490188156Ssam  fi 									\
491188156Ssam)
492188156SsamTEST_TARGETS=all
493188156Ssam$(OUTPUTDIR)/test_log.txt:
494188156Ssam	$(RM) $@
495188156Ssam	( $(CD) test &&                                                     \
496188156Ssam          $(MAKE) NO_STOPPING=- PRODUCT_HOME=$(JDK_TO_TEST) $(TEST_TARGETS) \
497188156Ssam        ) | tee $@
498188156Ssam
499188156Ssam################################################################
500188156Ssam# JPRT rule to build
501188156Ssam################################################################
502188156Ssam
503188156Ssaminclude ./make/jprt.gmk
504188156Ssam
505188156Ssam################################################################
506188156Ssam#  PHONY
507188156Ssam################################################################
508188156Ssam
509188156Ssam.PHONY: all  test test_run test_start test_summary test_clean \
510188156Ssam	generic_build_repo_series \
511188156Ssam	what clobber insane \
512188156Ssam        dev dev-build dev-sanity dev-clobber \
513188156Ssam        product_build \
514188156Ssam        fastdebug_build \
515188156Ssam        debug_build  \
516188156Ssam        build_product_image  \
517188156Ssam        build_debug_image  \
518188156Ssam        build_fastdebug_image \
519188156Ssam        create_fresh_product_bootdir \
520188156Ssam        create_fresh_debug_bootdir \
521188156Ssam        create_fresh_fastdebug_bootdir \
522188156Ssam        generic_debug_build
523188156Ssam
524188156Ssam# Force target
525188156SsamFRC:
526188156Ssam
527188156Ssam