make/MainSupport.gmk
author jwilhelm
Wed, 17 Jun 2015 14:44:54 +0200
changeset 31358 693058672cc6
parent 29790 79641c886929
child 31310 481585782338
permissions -rw-r--r--
8077842: Remove the level parameter passed around in GenCollectedHeap Reviewed-by: kbarrett, mgerdin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     1
#
29156
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
     2
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     4
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    10
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    15
# accompanied this code).
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    16
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    20
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    23
# questions.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    24
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    25
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 29156
diff changeset
    26
################################################################################
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 29156
diff changeset
    27
# This file contains helper functions for Main.gmk.
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 29156
diff changeset
    28
################################################################################
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    29
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 29156
diff changeset
    30
ifndef _MAINSUPPORT_GMK
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 29156
diff changeset
    31
_MAINSUPPORT_GMK := 1
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    32
29156
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    33
# Run the tests specified by $1.
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    34
define RunTests
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    35
	($(CD) $(SRC_ROOT)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    36
	    JT_HOME=$(JT_HOME) PRODUCT_HOME=$(JDK_IMAGE_DIR) \
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    37
	    TEST_IMAGE_DIR=$(TEST_IMAGE_DIR) \
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    38
	    ALT_OUTPUTDIR=$(OUTPUT_ROOT) CONCURRENCY=$(JOBS) $1) || true
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    39
endef
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    40
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    41
# Cleans the dir given as $1
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    42
define CleanDir
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 22031
diff changeset
    43
	@$(PRINTF) "Cleaning $(strip $1) build artifacts ..."
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    44
	@$(PRINTF) "\n" $(LOG_DEBUG)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    45
	($(CD) $(OUTPUT_ROOT) && $(RM) -r $1)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 16583
diff changeset
    46
	@$(PRINTF) " done\n"
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    47
endef
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    48
29156
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    49
define CleanTest
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    50
	@$(PRINTF) "Cleaning test $(strip $1) ..."
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    51
	@$(PRINTF) "\n" $(LOG_DEBUG)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    52
	$(RM) -r $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1))
29156
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    53
	@$(PRINTF) " done\n"
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    54
endef
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    55
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    56
define Clean-gensrc
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    57
	@$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..."
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    58
	@$(PRINTF) "\n" $(LOG_DEBUG)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    59
	$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    60
	$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$(strip $1)
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    61
	@$(PRINTF) " done\n"
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    62
endef
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    63
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    64
define Clean-java
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    65
	@$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..."
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    66
	@$(PRINTF) "\n" $(LOG_DEBUG)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    67
	$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    68
	$(RM) -r $(SUPPORT_OUTPUTDIR)/misc/$(strip $1)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    69
	$(PRINTF) " done\n"
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    70
	$(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..."
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    71
	$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1)
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    72
	@$(PRINTF) " done\n"
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    73
endef
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    74
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    75
define Clean-native
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    76
	@$(PRINTF) "Cleaning native $(if $1,for $(strip $1) )..."
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    77
	@$(PRINTF) "\n" $(LOG_DEBUG)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    78
	$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    79
	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    80
	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    81
	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    82
	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(strip $1)
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    83
	@$(PRINTF) " done\n"
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    84
endef
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    85
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    86
define Clean-include
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    87
	@$(PRINTF) "Cleaning include $(if $1,for $(strip $1) )..."
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    88
	@$(PRINTF) "\n" $(LOG_DEBUG)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    89
	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    90
	@$(PRINTF) " done\n"
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    91
endef
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    92
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    93
define Clean-docs
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    94
	@$(PRINTF) "Cleaning docs ..."
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    95
	@$(PRINTF) "\n" $(LOG_DEBUG)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    96
	$(RM) -r $(SUPPORT_OUTPUTDIR)/docs
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    97
	$(RM) -r $(IMAGES_OUTPUTDIR)/docs
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    98
	@$(PRINTF) " done\n"
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    99
endef
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   100
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   101
define CleanModule
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   102
  $(call Clean-gensrc, $1)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   103
  $(call Clean-java, $1)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   104
  $(call Clean-native, $1)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   105
  $(call Clean-include, $1)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   106
endef
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   107
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   108
26116
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents: 25854
diff changeset
   109
################################################################################
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents: 25854
diff changeset
   110
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   111
MAKE_TOPDIR_LIST := $(JDK_TOPDIR) $(CORBA_TOPDIR) $(LANGTOOLS_TOPDIR)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   112
MAKE_MAKEDIR_LIST := make
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   113
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   114
# Helper macro for DeclareRecipesForPhase
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   115
# Declare a recipe for calling the module and phase specific makefile.
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   116
# If there are multiple makefiles to call, create a rule for each topdir
28356
3b985eeacb08 8066769: Fix merge errors following JDK-8049367
ihse
parents: 27602
diff changeset
   117
# that contains a makefile with the target $module-$suffix-$repodir,
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   118
# (i.e: java.base-gensrc-jdk)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   119
# Normally there is only one makefile, and the target will just be
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   120
# $module-$suffix
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   121
# Param 1: Name of list to add targets to
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   122
# Param 2: Module name
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   123
# Param 3: Topdir
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   124
define DeclareRecipeForModuleMakefile
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   125
  ifeq ($$($1_MULTIPLE_MAKEFILES), true)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   126
    $2-$$($1_TARGET_SUFFIX): $2-$$($1_TARGET_SUFFIX)-$$(notdir $3)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   127
    $1 += $2-$$($1_TARGET_SUFFIX)-$$(notdir $3)
26116
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents: 25854
diff changeset
   128
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   129
    $2-$$($1_TARGET_SUFFIX)-$$(notdir $3):
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   130
  else
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   131
    $2-$$($1_TARGET_SUFFIX):
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   132
  endif
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   133
	$(ECHO) $(LOG_INFO) "Building $$@"
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   134
        ifeq ($$($1_USE_WRAPPER), true)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   135
	  +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   136
	      -f ModuleWrapper.gmk \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   137
	          $$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   138
	          $$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   139
	          MODULE=$2 MAKEFILE_PREFIX=$$($1_FILE_PREFIX))
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   140
        else
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   141
	  +($(CD) $$(dir $$(firstword $$(wildcard $$(patsubst %, \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   142
	          $3/%/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $(MAKE_MAKEDIR_LIST))))) \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   143
	    && $(MAKE) $(MAKE_ARGS) \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   144
	          -f $$($1_FILE_PREFIX)-$2.gmk \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   145
	          $$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \
29060
baa66d2b7e95 8073498: Enhance GensrcProperties.gmk to allow an alternative source root
erikj
parents: 28356
diff changeset
   146
	          $$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   147
	          MODULE=$2)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   148
        endif
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   149
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   150
endef
26116
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents: 25854
diff changeset
   151
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   152
# Helper macro for DeclareRecipesForPhase
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   153
# Param 1: Name of list to add targets to
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   154
# Param 2: Module name
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   155
define DeclareRecipesForPhaseAndModule
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   156
  $1_$2_TOPDIRS := $$(strip $$(sort $$(foreach d, $(MAKE_TOPDIR_LIST), \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   157
      $$(patsubst $$d/%, $$d, $$(filter $$d/%, \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   158
          $$(wildcard $$(patsubst %, %/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   159
          $$(foreach s, $(MAKE_MAKEDIR_LIST), \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   160
              $$(addsuffix /$$s, $(MAKE_TOPDIR_LIST))))))))))
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   161
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   162
  # Only declare recipes if there are makefiles to call
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   163
  ifneq ($$($1_$2_TOPDIRS), )
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 29156
diff changeset
   164
    ifeq ($(NO_RECIPES),)
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 29156
diff changeset
   165
      $$(foreach d, $$($1_$2_TOPDIRS), \
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 29156
diff changeset
   166
          $$(eval $$(call DeclareRecipeForModuleMakefile,$1,$2,$$d)))
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 29156
diff changeset
   167
    endif
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   168
    $1 += $2-$$($1_TARGET_SUFFIX)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   169
    $1_MODULES += $2
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   170
  endif
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   171
endef
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   172
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   173
# Declare recipes for a specific module and build phase if there are makefiles
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   174
# present for the specific combination.
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   175
# Param 1: Name of list to add targets to
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   176
# Named params:
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   177
# TARGET_SUFFIX : Suffix of target to create for recipe
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   178
# MAKE_SUBDIR : Subdir for this build phase
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   179
# FILE_PREFIX : File prefix for this build phase
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   180
# USE_WRAPPER : Set to true to use ModuleWrapper.gmk
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   181
# CHECK_MODULES : List of modules to try
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   182
# MULTIPLE_MAKEFILES : Set to true to handle makefils for the same module in
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   183
#                      phase in multiple repos
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   184
# Exported variables:
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   185
# $1_MODULES : All modules that had rules generated
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   186
# $1_TARGETS : All targets generated
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   187
define DeclareRecipesForPhase
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   188
  $(foreach i,2 3 4 5 6 7, $(if $($i),$(strip $1)_$(strip $($i)))$(NEWLINE))
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   189
  $(if $(8),$(error Internal makefile error: Too many arguments to \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   190
      DeclareRecipesForPhase, please update MakeHelper.gmk))
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   191
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   192
  $$(foreach m, $$($(strip $1)_CHECK_MODULES), \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   193
      $$(eval $$(call DeclareRecipesForPhaseAndModule,$(strip $1),$$m)))
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   194
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   195
  $(strip $1)_TARGETS := $$($(strip $1))
26116
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents: 25854
diff changeset
   196
endef
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents: 25854
diff changeset
   197
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents: 25854
diff changeset
   198
################################################################################
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents: 25854
diff changeset
   199
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 29156
diff changeset
   200
endif # _MAINSUPPORT_GMK