make/MainSupport.gmk
author dlong
Fri, 01 Dec 2017 11:17:45 -0800
changeset 48190 25cfedf27edc
parent 47253 92fd0e04e0e1
child 52342 9341b077bd55
permissions -rw-r--r--
8192814: Update Graal Reviewed-by: kvn
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
#
46196
822ca950ddaa 8175300: Enable artifact resolution for jtreg tests
ctornqvi
parents: 41652
diff changeset
     2
# Copyright (c) 2011, 2017, 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
37974
05e1a65c1d56 8157028: Add make target for running gtest tests
ehelin
parents: 37034
diff changeset
    33
# Run the tests specified by $1, with PRODUCT_HOME specified by $2
41047
de6f69208f82 8164301: jib should provide a JDK for running jtreg with
erikj
parents: 37974
diff changeset
    34
# JT_JAVA is picked up by the jtreg launcher and used to run Jtreg itself.
29156
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    35
define RunTests
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
    36
	($(CD) $(TOPDIR)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \
37974
05e1a65c1d56 8157028: Add make target for running gtest tests
ehelin
parents: 37034
diff changeset
    37
	    JT_HOME=$(JT_HOME) PRODUCT_HOME=$(strip $2) \
29156
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    38
	    TEST_IMAGE_DIR=$(TEST_IMAGE_DIR) \
47253
92fd0e04e0e1 8187544: Replace BUILD_OUTPUT and OUTPUT_ROOT with OUTPUTDIR
ihse
parents: 47217
diff changeset
    39
	    ALT_OUTPUTDIR=$(OUTPUTDIR) TEST_JOBS=$(TEST_JOBS) \
46196
822ca950ddaa 8175300: Enable artifact resolution for jtreg tests
ctornqvi
parents: 41652
diff changeset
    40
	    JT_JAVA=$(BOOT_JDK) JIB_JAR=$(JIB_JAR) \
34594
7e0595aab028 8139272: Add configure variable to set concurrency for jtreg tests
ehelin
parents: 33437
diff changeset
    41
	    JOBS=$(JOBS) $1) || true
29156
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    42
endef
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    43
41652
a0664e2b49a1 8168772: Convert javadoc generation to build-infra standards
ihse
parents: 41260
diff changeset
    44
define CleanDocs
a0664e2b49a1 8168772: Convert javadoc generation to build-infra standards
ihse
parents: 41260
diff changeset
    45
	@$(PRINTF) "Cleaning docs ..."
a0664e2b49a1 8168772: Convert javadoc generation to build-infra standards
ihse
parents: 41260
diff changeset
    46
	@$(PRINTF) "\n" $(LOG_DEBUG)
a0664e2b49a1 8168772: Convert javadoc generation to build-infra standards
ihse
parents: 41260
diff changeset
    47
	$(RM) -r $(SUPPORT_OUTPUTDIR)/docs
a0664e2b49a1 8168772: Convert javadoc generation to build-infra standards
ihse
parents: 41260
diff changeset
    48
	$(RM) -r $(SUPPORT_OUTPUTDIR)/javadoc
a0664e2b49a1 8168772: Convert javadoc generation to build-infra standards
ihse
parents: 41260
diff changeset
    49
	$(RM) -r $(IMAGES_OUTPUTDIR)/docs
a0664e2b49a1 8168772: Convert javadoc generation to build-infra standards
ihse
parents: 41260
diff changeset
    50
	@$(PRINTF) " done\n"
a0664e2b49a1 8168772: Convert javadoc generation to build-infra standards
ihse
parents: 41260
diff changeset
    51
endef
a0664e2b49a1 8168772: Convert javadoc generation to build-infra standards
ihse
parents: 41260
diff changeset
    52
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    53
# Cleans the dir given as $1
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    54
define CleanDir
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 22031
diff changeset
    55
	@$(PRINTF) "Cleaning $(strip $1) build artifacts ..."
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    56
	@$(PRINTF) "\n" $(LOG_DEBUG)
47253
92fd0e04e0e1 8187544: Replace BUILD_OUTPUT and OUTPUT_ROOT with OUTPUTDIR
ihse
parents: 47217
diff changeset
    57
	($(CD) $(OUTPUTDIR) && $(RM) -r $1)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 16583
diff changeset
    58
	@$(PRINTF) " done\n"
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    59
endef
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    60
33437
1cf150337073 8141261: Clean up building of demos
ihse
parents: 33052
diff changeset
    61
define CleanSupportDir
1cf150337073 8141261: Clean up building of demos
ihse
parents: 33052
diff changeset
    62
	@$(PRINTF) "Cleaning $(strip $1) build artifacts ..."
1cf150337073 8141261: Clean up building of demos
ihse
parents: 33052
diff changeset
    63
	@$(PRINTF) "\n" $(LOG_DEBUG)
1cf150337073 8141261: Clean up building of demos
ihse
parents: 33052
diff changeset
    64
	$(RM) -r $(SUPPORT_OUTPUTDIR)/$(strip $1)
1cf150337073 8141261: Clean up building of demos
ihse
parents: 33052
diff changeset
    65
	@$(PRINTF) " done\n"
1cf150337073 8141261: Clean up building of demos
ihse
parents: 33052
diff changeset
    66
endef
1cf150337073 8141261: Clean up building of demos
ihse
parents: 33052
diff changeset
    67
29156
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    68
define CleanTest
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    69
	@$(PRINTF) "Cleaning test $(strip $1) ..."
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    70
	@$(PRINTF) "\n" $(LOG_DEBUG)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    71
	$(RM) -r $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1))
33052
4da63d511320 8140282: Remove test directories on clean-test-*
ihse
parents: 33045
diff changeset
    72
        # Remove as much of the test directory structure as is empty
4da63d511320 8140282: Remove test directories on clean-test-*
ihse
parents: 33045
diff changeset
    73
	$(RMDIR) -p $(dir $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1))) 2> /dev/null || true
29156
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    74
	@$(PRINTF) " done\n"
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    75
endef
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 29060
diff changeset
    76
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    77
define Clean-gensrc
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    78
	@$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..."
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    79
	@$(PRINTF) "\n" $(LOG_DEBUG)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    80
	$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1)
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    81
	@$(PRINTF) " done\n"
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    82
endef
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    83
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    84
define Clean-java
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    85
	@$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..."
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    86
	@$(PRINTF) "\n" $(LOG_DEBUG)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    87
	$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1)
31310
481585782338 8081814: Modularize the deploy build
erikj
parents: 29790
diff changeset
    88
	$(RM) -r $(SUPPORT_OUTPUTDIR)/special_classes/$(strip $1)
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    89
	$(PRINTF) " done\n"
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    90
	$(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..."
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    91
	$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1)
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    92
	@$(PRINTF) " done\n"
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    93
endef
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    94
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    95
define Clean-native
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
    96
	@$(PRINTF) "Cleaning native $(if $1,for $(strip $1) )..."
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    97
	@$(PRINTF) "\n" $(LOG_DEBUG)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    98
	$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
    99
	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
   100
	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1)
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   101
	@$(PRINTF) " done\n"
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   102
endef
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   103
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   104
define Clean-include
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   105
	@$(PRINTF) "Cleaning include $(if $1,for $(strip $1) )..."
29790
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
   106
	@$(PRINTF) "\n" $(LOG_DEBUG)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
   107
	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1)
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
   108
	@$(PRINTF) " done\n"
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
   109
endef
79641c886929 8073634: Improve clean targets
erikj
parents: 29662
diff changeset
   110
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   111
define CleanModule
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   112
  $(call Clean-gensrc, $1)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   113
  $(call Clean-java, $1)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   114
  $(call Clean-native, $1)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   115
  $(call Clean-include, $1)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   116
endef
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   117
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   118
26116
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents: 25854
diff changeset
   119
################################################################################
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents: 25854
diff changeset
   120
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   121
PHASE_MAKEDIRS := $(TOPDIR)/make
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   122
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   123
# Helper macro for DeclareRecipesForPhase
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   124
# Declare a recipe for calling the module and phase specific makefile.
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   125
# 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
   126
# that contains a makefile with the target $module-$suffix-$repodir,
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   127
# (i.e: java.base-gensrc-src)
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   128
# Normally there is only one makefile, and the target will just be
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   129
# $module-$suffix
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   130
# Param 1: Name of list to add targets to
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   131
# Param 2: Module name
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   132
define DeclareRecipeForModuleMakefile
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   133
  $2-$$($1_TARGET_SUFFIX):
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   134
        ifeq ($$($1_USE_WRAPPER), true)
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   135
	  +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   136
	      -f ModuleWrapper.gmk \
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   137
	      $$(addprefix -I, $$(PHASE_MAKEDIRS) \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   138
	          $$(addsuffix /$$($1_MAKE_SUBDIR), $$(PHASE_MAKEDIRS)) \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   139
	      ) \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   140
	      MODULE=$2 MAKEFILE_PREFIX=$$($1_FILE_PREFIX))
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   141
        else
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   142
	  +($(CD) $$(dir $$(firstword $$(wildcard $$(addsuffix \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   143
	      /$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $$(PHASE_MAKEDIRS))))) \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   144
	  && $(MAKE) $(MAKE_ARGS) \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   145
	      -f $$($1_FILE_PREFIX)-$2.gmk \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   146
	      $$(addprefix -I, $$(PHASE_MAKEDIRS) \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   147
	          $$(addsuffix /$$($1_MAKE_SUBDIR), $$(PHASE_MAKEDIRS)) \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   148
	      ) \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   149
	      MODULE=$2 \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   150
	  )
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   151
        endif
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   152
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   153
endef
26116
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents: 25854
diff changeset
   154
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   155
# Helper macro for DeclareRecipesForPhase
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   156
# Param 1: Name of list to add targets to
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   157
# Param 2: Module name
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   158
define DeclareRecipesForPhaseAndModule
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   159
  $1_$2_MAKEFILES := $$(strip $$(wildcard \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   160
      $$(addsuffix /$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $$(PHASE_MAKEDIRS))))
27560
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
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   163
  ifneq ($$($1_$2_MAKEFILES), )
41172
1de8867db5a3 8166965: Some small java build tools are still running with big JVM configuration
erikj
parents: 41047
diff changeset
   164
    # Add the top dir specific target to target list regardless of if recipe
1de8867db5a3 8166965: Some small java build tools are still running with big JVM configuration
erikj
parents: 41047
diff changeset
   165
    # generation is disabled.
1de8867db5a3 8166965: Some small java build tools are still running with big JVM configuration
erikj
parents: 41047
diff changeset
   166
    ifeq ($$($1_MULTIPLE_MAKEFILES), true)
1de8867db5a3 8166965: Some small java build tools are still running with big JVM configuration
erikj
parents: 41047
diff changeset
   167
      $$(foreach d, $$($1_$2_TOPDIRS), \
1de8867db5a3 8166965: Some small java build tools are still running with big JVM configuration
erikj
parents: 41047
diff changeset
   168
        $$(eval $1 += $2-$$($1_TARGET_SUFFIX)-$$(notdir $$d)))
1de8867db5a3 8166965: Some small java build tools are still running with big JVM configuration
erikj
parents: 41047
diff changeset
   169
    endif
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 29156
diff changeset
   170
    ifeq ($(NO_RECIPES),)
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   171
      $$(eval $$(call DeclareRecipeForModuleMakefile,$1,$2))
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 29156
diff changeset
   172
    endif
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   173
    $1 += $2-$$($1_TARGET_SUFFIX)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   174
    $1_MODULES += $2
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   175
  endif
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   176
endef
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   177
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   178
# Declare recipes for a specific module and build phase if there are makefiles
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   179
# present for the specific combination.
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   180
# Param 1: Name of list to add targets to
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   181
# Named params:
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   182
# TARGET_SUFFIX : Suffix of target to create for recipe
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   183
# MAKE_SUBDIR : Subdir for this build phase
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   184
# FILE_PREFIX : File prefix for this build phase
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   185
# USE_WRAPPER : Set to true to use ModuleWrapper.gmk
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   186
# CHECK_MODULES : List of modules to try
33045
00f484891bcf 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 31310
diff changeset
   187
# MULTIPLE_MAKEFILES : Set to true to handle makefiles for the same module and
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   188
#                      phase in multiple repos
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   189
# Exported variables:
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   190
# $1_MODULES : All modules that had rules generated
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   191
# $1_TARGETS : All targets generated
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   192
define DeclareRecipesForPhase
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 46196
diff changeset
   193
  $(foreach i,2 3 4 5 6 7, $(if $(strip $($i)),$(strip $1)_$(strip $($i)))$(NEWLINE))
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   194
  $(if $(8),$(error Internal makefile error: Too many arguments to \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   195
      DeclareRecipesForPhase, please update MakeHelper.gmk))
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   196
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   197
  $$(foreach m, $$($(strip $1)_CHECK_MODULES), \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   198
      $$(eval $$(call DeclareRecipesForPhaseAndModule,$(strip $1),$$m)))
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   199
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27000
diff changeset
   200
  $(strip $1)_TARGETS := $$($(strip $1))
26116
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents: 25854
diff changeset
   201
endef
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents: 25854
diff changeset
   202
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents: 25854
diff changeset
   203
################################################################################
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents: 25854
diff changeset
   204
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 29156
diff changeset
   205
endif # _MAINSUPPORT_GMK