Makefile
changeset 5743 e14fbdea5504
parent 5499 eb0b3e373167
child 6623 b2e02fea81b0
equal deleted inserted replaced
5659:8d8830314274 5743:e14fbdea5504
     1 #
     1 #
     2 # Copyright (c) 1995, 2009, Oracle and/or its affiliates. All rights reserved.
     2 # Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 #
     4 #
     5 # This code is free software; you can redistribute it and/or modify it
     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
     6 # under the terms of the GNU General Public License version 2 only, as
     7 # published by the Free Software Foundation.  Oracle designates this
     7 # published by the Free Software Foundation.  Oracle designates this
    25 
    25 
    26 BUILD_PARENT_DIRECTORY=.
    26 BUILD_PARENT_DIRECTORY=.
    27 
    27 
    28 ifndef TOPDIR
    28 ifndef TOPDIR
    29   TOPDIR:=.
    29   TOPDIR:=.
    30 endif
       
    31 
       
    32 ifndef CONTROL_TOPDIR
       
    33   CONTROL_TOPDIR=$(TOPDIR)
       
    34 endif
    30 endif
    35 
    31 
    36 # Openjdk sources (only used if SKIP_OPENJDK_BUILD!=true)
    32 # Openjdk sources (only used if SKIP_OPENJDK_BUILD!=true)
    37 OPENJDK_SOURCETREE=$(TOPDIR)/openjdk
    33 OPENJDK_SOURCETREE=$(TOPDIR)/openjdk
    38 OPENJDK_BUILDDIR:=$(shell \
    34 OPENJDK_BUILDDIR:=$(shell \
   118 endif
   114 endif
   119 
   115 
   120 all_product_build:: 
   116 all_product_build:: 
   121 	@$(FINISH_ECHO)
   117 	@$(FINISH_ECHO)
   122 
   118 
   123 # Generis build of basic repo series
   119 # Generic build of basic repo series
   124 generic_build_repo_series::
   120 generic_build_repo_series::
   125 	$(MKDIR) -p $(OUTPUTDIR)
   121 	$(MKDIR) -p $(OUTPUTDIR)
   126 	$(MKDIR) -p $(OUTPUTDIR)/j2sdk-image
   122 	$(MKDIR) -p $(OUTPUTDIR)/j2sdk-image
   127 
   123 
   128 ifeq ($(BUILD_LANGTOOLS), true)
   124 ifeq ($(BUILD_LANGTOOLS), true)
   177 #     which will install in the debug or fastdebug subdirectory of the
   173 #     which will install in the debug or fastdebug subdirectory of the
   178 #     normal product install area.
   174 #     normal product install area.
   179 #     The install process needs to know what the DEBUG_NAME is, so
   175 #     The install process needs to know what the DEBUG_NAME is, so
   180 #     look for INSTALL_DEBUG_NAME in the install rules.
   176 #     look for INSTALL_DEBUG_NAME in the install rules.
   181 #
   177 #
       
   178 #   NOTE: On windows, do not use $(ABS_BOOTDIR_OUTPUTDIR)-$(DEBUG_NAME).
       
   179 #         Due to the use of short paths in $(ABS_OUTPUTDIR), this may 
       
   180 #         not be the same location.
       
   181 #
   182 
   182 
   183 # Location of fresh bootdir output
   183 # Location of fresh bootdir output
   184 ABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk
   184 ABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk
   185 FRESH_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image
   185 FRESH_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image
   186 FRESH_DEBUG_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)-$(DEBUG_NAME)/j2sdk-image
   186 FRESH_DEBUG_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME)/j2sdk-image
   187   
   187   
   188 create_fresh_product_bootdir: FRC
   188 create_fresh_product_bootdir: FRC
   189 	@$(START_ECHO)
   189 	@$(START_ECHO)
   190 	$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
   190 	$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
   191 		GENERATE_DOCS=false \
   191 		GENERATE_DOCS=false \
   246 	        SKIP_DEBUG_BUILD=true \
   246 	        SKIP_DEBUG_BUILD=true \
   247 	        $(BOOT_CYCLE_SETTINGS) \
   247 	        $(BOOT_CYCLE_SETTINGS) \
   248 	        generic_build_repo_series
   248 	        generic_build_repo_series
   249 	@$(FINISH_ECHO)
   249 	@$(FINISH_ECHO)
   250 
   250 
       
   251 #   NOTE: On windows, do not use $(ABS_OUTPUTDIR)-$(DEBUG_NAME).
       
   252 #         Due to the use of short paths in $(ABS_OUTPUTDIR), this may 
       
   253 #         not be the same location.
       
   254 
   251 generic_debug_build:
   255 generic_debug_build:
   252 	@$(START_ECHO)
   256 	@$(START_ECHO)
   253 	$(MAKE) \
   257 	$(MAKE) \
   254 		ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)-$(DEBUG_NAME) \
   258 		ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME) \
   255 	        DEBUG_NAME=$(DEBUG_NAME) \
   259 	        DEBUG_NAME=$(DEBUG_NAME) \
   256 		GENERATE_DOCS=false \
   260 		GENERATE_DOCS=false \
   257 	        $(BOOT_CYCLE_DEBUG_SETTINGS) \
   261 	        $(BOOT_CYCLE_DEBUG_SETTINGS) \
   258 		generic_build_repo_series
   262 		generic_build_repo_series
   259 	@$(FINISH_ECHO)
   263 	@$(FINISH_ECHO)
   346   endif
   350   endif
   347 endif
   351 endif
   348 
   352 
   349 clobber::
   353 clobber::
   350 	$(RM) -r $(OUTPUTDIR)/*
   354 	$(RM) -r $(OUTPUTDIR)/*
   351 	$(RM) -r $(OUTPUTDIR)-debug/*
   355 	$(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-debug/*
   352 	$(RM) -r $(OUTPUTDIR)-fastdebug/*
   356 	$(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-fastdebug/*
   353 	-($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE))
   357 	-($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE))
   354 
   358 
   355 clean: clobber
   359 clean: clobber
   356 
   360 
   357 #
   361 #
   549 ifeq ($(BUNDLE_RULES_AVAILABLE), true)
   553 ifeq ($(BUNDLE_RULES_AVAILABLE), true)
   550   include $(BUNDLE_RULES)
   554   include $(BUNDLE_RULES)
   551 endif
   555 endif
   552 
   556 
   553 ################################################################
   557 ################################################################
       
   558 # rule to test
       
   559 ################################################################
       
   560 
       
   561 .NOTPARALLEL: test
       
   562 
       
   563 test: test_clean test_start test_summary
       
   564 
       
   565 test_start:
       
   566 	@$(ECHO) "Tests started at `$(DATE)`"
       
   567 
       
   568 test_clean:
       
   569 	$(RM) $(OUTPUTDIR)/test_failures.txt $(OUTPUTDIR)/test_log.txt
       
   570 
       
   571 test_summary: $(OUTPUTDIR)/test_failures.txt
       
   572 	@$(ECHO) "#################################################"
       
   573 	@$(ECHO) "Tests completed at `$(DATE)`"
       
   574 	@( $(EGREP) '^TEST STATS:' $(OUTPUTDIR)/test_log.txt \
       
   575           || $(ECHO) "No TEST STATS seen in log" )
       
   576 	@$(ECHO) "For complete details see: $(OUTPUTDIR)/test_log.txt"
       
   577 	@$(ECHO) "#################################################"
       
   578 	@if [ -s $< ] ; then                                           \
       
   579           $(ECHO) "ERROR: Test failure count: `$(CAT) $< | $(WC) -l`"; \
       
   580           $(CAT) $<;                                                   \
       
   581           exit 1;                                                      \
       
   582         else                                                           \
       
   583           $(ECHO) "Success! No failures detected";                     \
       
   584         fi
       
   585 
       
   586 # Get failure list from log
       
   587 $(OUTPUTDIR)/test_failures.txt: $(OUTPUTDIR)/test_log.txt
       
   588 	@$(RM) $@
       
   589 	@( $(EGREP) '^FAILED:' $< || $(ECHO) "" ) > $@
       
   590 
       
   591 # Get log file of all tests run
       
   592 JDK_TO_TEST := $(shell 							\
       
   593   if [ -d "$(ABS_OUTPUTDIR)/j2sdk-image" ] ; then 			\
       
   594     $(ECHO) "$(ABS_OUTPUTDIR)/j2sdk-image"; 				\
       
   595   elif [ -d "$(ABS_OUTPUTDIR)/bin" ] ; then 				\
       
   596     $(ECHO) "$(ABS_OUTPUTDIR)"; 					\
       
   597   elif [ "$(PRODUCT_HOME)" != "" -a -d "$(PRODUCT_HOME)/bin" ] ; then 	\
       
   598     $(ECHO) "$(PRODUCT_HOME)"; 						\
       
   599   fi 									\
       
   600 )
       
   601 $(OUTPUTDIR)/test_log.txt:
       
   602 	$(RM) $@
       
   603 	( $(CD) test &&                                     \
       
   604           $(MAKE) NO_STOPPING=- PRODUCT_HOME=$(JDK_TO_TEST) \
       
   605         ) | tee $@
       
   606 
       
   607 ################################################################
   554 # JPRT rule to build
   608 # JPRT rule to build
   555 ################################################################
   609 ################################################################
   556 
   610 
   557 include ./make/jprt.gmk
   611 include ./make/jprt.gmk
   558 
   612 
   559 ################################################################
   613 ################################################################
   560 #  PHONY
   614 #  PHONY
   561 ################################################################
   615 ################################################################
   562 
   616 
   563 .PHONY: all \
   617 .PHONY: all  test test_start test_summary test_clean \
   564 	generic_build_repo_series \
   618 	generic_build_repo_series \
   565 	what clobber insane \
   619 	what clobber insane \
   566         dev dev-build dev-sanity dev-clobber \
   620         dev dev-build dev-sanity dev-clobber \
   567         product_build \
   621         product_build \
   568         fastdebug_build \
   622         fastdebug_build \