24 # 25 26 ################################################################################ 27 # This file contains helper functions for Main.gmk. 28 ################################################################################ 29 30 ifndef _MAINSUPPORT_GMK 31 _MAINSUPPORT_GMK := 1 32 33 # Run the tests specified by $1. 34 define RunTests 35 ($(CD) $(SRC_ROOT)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \ 36 JT_HOME=$(JT_HOME) PRODUCT_HOME=$(JDK_IMAGE_DIR) \ 37 TEST_IMAGE_DIR=$(TEST_IMAGE_DIR) \ 38 ALT_OUTPUTDIR=$(OUTPUT_ROOT) CONCURRENCY=$(JOBS) $1) || true 39 endef 40 41 # Cleans the dir given as $1 42 define CleanDir 43 @$(PRINTF) "Cleaning $(strip $1) build artifacts ..." 44 @($(CD) $(OUTPUT_ROOT) && $(RM) -r $1) 45 @$(PRINTF) " done\n" 46 endef 47 48 define CleanTest 49 @$(PRINTF) "Cleaning test $(strip $1) ..." 50 @$(RM) -r $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1)) 51 @$(PRINTF) " done\n" 52 endef 53 54 define Clean-gensrc 55 @$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..." 56 @$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1) 57 @$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$(strip $1) 58 @$(PRINTF) " done\n" 59 endef 60 61 define Clean-java 62 @$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..." 63 @$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1) 64 @$(RM) -r $(SUPPORT_OUTPUTDIR)/misc/$(strip $1) 65 @$(PRINTF) " done\n" 66 @$(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..." 67 @$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1) 68 @$(PRINTF) " done\n" 69 endef 70 71 define Clean-native 72 @$(PRINTF) "Cleaning native $(if $1,for $(strip $1) )..." 73 @$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1) 74 @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1) 75 @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1) 76 @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1) 77 @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(strip $1) 78 @$(PRINTF) " done\n" 79 endef 80 81 define Clean-include 82 @$(PRINTF) "Cleaning include $(if $1,for $(strip $1) )..." 83 @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1) 84 @$(PRINTF) " done\n" 85 endef 86 87 define CleanModule 88 $(call Clean-gensrc, $1) 89 $(call Clean-java, $1) 90 $(call Clean-native, $1) 91 $(call Clean-include, $1) 92 endef 93 94 95 ################################################################################ 96 97 MAKE_TOPDIR_LIST := $(JDK_TOPDIR) $(CORBA_TOPDIR) $(LANGTOOLS_TOPDIR) 98 MAKE_MAKEDIR_LIST := make 99 100 # Helper macro for DeclareRecipesForPhase 101 # Declare a recipe for calling the module and phase specific makefile. 102 # If there are multiple makefiles to call, create a rule for each topdir 103 # that contains a makefile with the target $module-$suffix-$repodir, | 24 # 25 26 ################################################################################ 27 # This file contains helper functions for Main.gmk. 28 ################################################################################ 29 30 ifndef _MAINSUPPORT_GMK 31 _MAINSUPPORT_GMK := 1 32 33 # Run the tests specified by $1. 34 define RunTests 35 ($(CD) $(SRC_ROOT)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \ 36 JT_HOME=$(JT_HOME) PRODUCT_HOME=$(JDK_IMAGE_DIR) \ 37 TEST_IMAGE_DIR=$(TEST_IMAGE_DIR) \ 38 ALT_OUTPUTDIR=$(OUTPUT_ROOT) CONCURRENCY=$(JOBS) $1) || true 39 endef 40 41 # Cleans the dir given as $1 42 define CleanDir 43 @$(PRINTF) "Cleaning $(strip $1) build artifacts ..." 44 @$(PRINTF) "\n" $(LOG_DEBUG) 45 ($(CD) $(OUTPUT_ROOT) && $(RM) -r $1) 46 @$(PRINTF) " done\n" 47 endef 48 49 define CleanTest 50 @$(PRINTF) "Cleaning test $(strip $1) ..." 51 @$(PRINTF) "\n" $(LOG_DEBUG) 52 $(RM) -r $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1)) 53 @$(PRINTF) " done\n" 54 endef 55 56 define Clean-gensrc 57 @$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..." 58 @$(PRINTF) "\n" $(LOG_DEBUG) 59 $(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1) 60 $(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$(strip $1) 61 @$(PRINTF) " done\n" 62 endef 63 64 define Clean-java 65 @$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..." 66 @$(PRINTF) "\n" $(LOG_DEBUG) 67 $(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1) 68 $(RM) -r $(SUPPORT_OUTPUTDIR)/misc/$(strip $1) 69 $(PRINTF) " done\n" 70 $(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..." 71 $(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1) 72 @$(PRINTF) " done\n" 73 endef 74 75 define Clean-native 76 @$(PRINTF) "Cleaning native $(if $1,for $(strip $1) )..." 77 @$(PRINTF) "\n" $(LOG_DEBUG) 78 $(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1) 79 $(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1) 80 $(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1) 81 $(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1) 82 $(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(strip $1) 83 @$(PRINTF) " done\n" 84 endef 85 86 define Clean-include 87 @$(PRINTF) "Cleaning include $(if $1,for $(strip $1) )..." 88 @$(PRINTF) "\n" $(LOG_DEBUG) 89 $(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1) 90 @$(PRINTF) " done\n" 91 endef 92 93 define Clean-docs 94 @$(PRINTF) "Cleaning docs ..." 95 @$(PRINTF) "\n" $(LOG_DEBUG) 96 $(RM) -r $(SUPPORT_OUTPUTDIR)/docs 97 $(RM) -r $(IMAGES_OUTPUTDIR)/docs 98 @$(PRINTF) " done\n" 99 endef 100 101 define CleanModule 102 $(call Clean-gensrc, $1) 103 $(call Clean-java, $1) 104 $(call Clean-native, $1) 105 $(call Clean-include, $1) 106 endef 107 108 109 ################################################################################ 110 111 MAKE_TOPDIR_LIST := $(JDK_TOPDIR) $(CORBA_TOPDIR) $(LANGTOOLS_TOPDIR) 112 MAKE_MAKEDIR_LIST := make 113 114 # Helper macro for DeclareRecipesForPhase 115 # Declare a recipe for calling the module and phase specific makefile. 116 # If there are multiple makefiles to call, create a rule for each topdir 117 # that contains a makefile with the target $module-$suffix-$repodir, |