make/common/Utils.gmk
author ihse
Tue, 22 Oct 2019 09:51:52 +0200
branchihse-cflags-rewrite-branch
changeset 58736 e878a0b7cff0
parent 55166 2ae056696b15
permissions -rw-r--r--
Add doubunder on solaris in two places.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     1
#
53484
8c296eedfb04 8217730: Split up MakeBase.gmk
ihse
parents: 52186
diff changeset
     2
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     4
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    10
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    15
# accompanied this code).
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    16
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    20
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    23
# questions.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    24
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    25
53484
8c296eedfb04 8217730: Split up MakeBase.gmk
ihse
parents: 52186
diff changeset
    26
ifeq (,$(_MAKEBASE_GMK))
8c296eedfb04 8217730: Split up MakeBase.gmk
ihse
parents: 52186
diff changeset
    27
  $(error You must include MakeBase.gmk prior to including Utils.gmk)
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 29312
diff changeset
    28
endif
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 29312
diff changeset
    29
32460
9e9bffb3029a 8065912: Better handling of classpath in build-infra
ihse
parents: 32344
diff changeset
    30
################################################################################
53484
8c296eedfb04 8217730: Split up MakeBase.gmk
ihse
parents: 52186
diff changeset
    31
#
8c296eedfb04 8217730: Split up MakeBase.gmk
ihse
parents: 52186
diff changeset
    32
# Common utility functions
8c296eedfb04 8217730: Split up MakeBase.gmk
ihse
parents: 52186
diff changeset
    33
#
32460
9e9bffb3029a 8065912: Better handling of classpath in build-infra
ihse
parents: 32344
diff changeset
    34
################################################################################
9e9bffb3029a 8065912: Better handling of classpath in build-infra
ihse
parents: 32344
diff changeset
    35
30095
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29866
diff changeset
    36
### Debug functions
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29866
diff changeset
    37
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29866
diff changeset
    38
# Prints the name and value of a variable
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29866
diff changeset
    39
PrintVar = \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29866
diff changeset
    40
    $(info $(strip $1) >$($(strip $1))<)
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 29312
diff changeset
    41
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 23984
diff changeset
    42
################################################################################
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 23984
diff changeset
    43
# This macro translates $ into \$ to protect the $ from expansion in the shell.
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 23984
diff changeset
    44
# To make this macro resilient against already escaped strings, first remove
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 23984
diff changeset
    45
# any present escapes before escaping so that no double escapes are added.
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 23984
diff changeset
    46
EscapeDollar = $(subst $$,\$$,$(subst \$$,$$,$(strip $1)))
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 23984
diff changeset
    47
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 23984
diff changeset
    48
################################################################################
42134
bbcdb49521b1 8169860: Clean up and unify the refactored Javadoc generation
ihse
parents: 41875
diff changeset
    49
# This macro works just like EscapeDollar above, but for #.
bbcdb49521b1 8169860: Clean up and unify the refactored Javadoc generation
ihse
parents: 41875
diff changeset
    50
EscapeHash = $(subst \#,\\\#,$(subst \\\#,\#,$(strip $1)))
bbcdb49521b1 8169860: Clean up and unify the refactored Javadoc generation
ihse
parents: 41875
diff changeset
    51
bbcdb49521b1 8169860: Clean up and unify the refactored Javadoc generation
ihse
parents: 41875
diff changeset
    52
################################################################################
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 23984
diff changeset
    53
# This macro translates $ into $$ to protect the string from make itself.
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 23984
diff changeset
    54
DoubleDollar = $(subst $$,$$$$,$(strip $1))
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 23984
diff changeset
    55
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 23984
diff changeset
    56
################################################################################
29312
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29304
diff changeset
    57
# Creates a sequence of increasing numbers (inclusive).
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29304
diff changeset
    58
# Param 1 - starting number
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29304
diff changeset
    59
# Param 2 - ending number
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29304
diff changeset
    60
sequence = \
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29304
diff changeset
    61
    $(wordlist $1, $2, $(strip \
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29304
diff changeset
    62
        $(eval SEQUENCE_COUNT :=) \
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29304
diff changeset
    63
        $(call _sequence-do,$(strip $2))))
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29304
diff changeset
    64
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29304
diff changeset
    65
_sequence-do = \
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29304
diff changeset
    66
    $(if $(word $1, $(SEQUENCE_COUNT)),, \
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29304
diff changeset
    67
      $(eval SEQUENCE_COUNT += .) \
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29304
diff changeset
    68
      $(words $(SEQUENCE_COUNT)) \
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29304
diff changeset
    69
      $(call _sequence-do,$1))
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29304
diff changeset
    70
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29304
diff changeset
    71
################################################################################
47334
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents: 47314
diff changeset
    72
# Replace question marks with space in string. This macro needs to be called on
54380
e297c7bb6469 8189861: Refactor CacheFind
erikj
parents: 53683
diff changeset
    73
# files from FindFiles in case any of them contains space in their file name,
e297c7bb6469 8189861: Refactor CacheFind
erikj
parents: 53683
diff changeset
    74
# since FindFiles replaces space with ?.
47334
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents: 47314
diff changeset
    75
# Param 1 - String to replace in
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents: 47314
diff changeset
    76
DecodeSpace = \
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents: 47314
diff changeset
    77
    $(subst ?,$(SPACE),$(strip $1))
53484
8c296eedfb04 8217730: Split up MakeBase.gmk
ihse
parents: 52186
diff changeset
    78
47334
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents: 47314
diff changeset
    79
EncodeSpace = \
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents: 47314
diff changeset
    80
    $(subst $(SPACE),?,$(strip $1))
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents: 47314
diff changeset
    81
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents: 47314
diff changeset
    82
################################################################################
29866
6cecef2d84ab 8077824: Introduce DefineNativeToolchain to handle toolchain configurations
erikj
parents: 29861
diff changeset
    83
# Assign a variable only if it is empty
6cecef2d84ab 8077824: Introduce DefineNativeToolchain to handle toolchain configurations
erikj
parents: 29861
diff changeset
    84
# Param 1 - Variable to assign
6cecef2d84ab 8077824: Introduce DefineNativeToolchain to handle toolchain configurations
erikj
parents: 29861
diff changeset
    85
# Param 2 - Value to assign
6cecef2d84ab 8077824: Introduce DefineNativeToolchain to handle toolchain configurations
erikj
parents: 29861
diff changeset
    86
SetIfEmpty = \
6cecef2d84ab 8077824: Introduce DefineNativeToolchain to handle toolchain configurations
erikj
parents: 29861
diff changeset
    87
    $(if $($(strip $1)),,$(eval $(strip $1) := $2))
6cecef2d84ab 8077824: Introduce DefineNativeToolchain to handle toolchain configurations
erikj
parents: 29861
diff changeset
    88
6cecef2d84ab 8077824: Introduce DefineNativeToolchain to handle toolchain configurations
erikj
parents: 29861
diff changeset
    89
################################################################################
41260
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
    90
# Take two paths and return the path of the last common directory.
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
    91
# Ex: /foo/bar/baz, /foo/bar/banan -> /foo/bar
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
    92
#     foo/bar/baz, /foo/bar -> <empty>
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
    93
#
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
    94
# The x prefix is used to preserve the presence of the initial slash
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
    95
#
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
    96
# $1 - Path to compare
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
    97
# $2 - Other path to compare
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
    98
FindCommonPathPrefix = \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
    99
    $(patsubst x%,%,$(subst $(SPACE),/,$(strip \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   100
        $(call FindCommonPathPrefixHelper, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   101
            $(subst /,$(SPACE),x$(strip $1)), $(subst /,$(SPACE),x$(strip $2))) \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   102
    )))
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   103
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   104
FindCommonPathPrefixHelper = \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   105
    $(if $(call equals, $(firstword $1), $(firstword $2)), \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   106
      $(firstword $1) \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   107
      $(call FindCommonPathPrefixHelper, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   108
          $(wordlist 2, $(words $1), $1), $(wordlist 2, $(words $2), $2) \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   109
      ) \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   110
    )
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   111
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   112
# Convert a partial path into as many directory levels of ../, removing
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   113
# leading and following /.
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   114
# Ex: foo/bar/baz/ -> ../../..
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   115
#     foo/bar -> ../..
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   116
#     /foo -> ..
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   117
DirToDotDot = \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   118
    $(subst $(SPACE),/,$(foreach d, $(subst /,$(SPACE),$1),..))
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   119
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   120
# Computes the relative path from a directory to a file
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   121
# $1 - File to compute the relative path to
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   122
# $2 - Directory to compute the relative path from
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   123
RelativePath = \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   124
    $(eval $1_prefix := $(call FindCommonPathPrefix, $1, $2)) \
55166
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents: 54380
diff changeset
   125
    $(eval $1_dotdots := $(call DirToDotDot, $(patsubst $($(strip $1)_prefix)%, %, $2))) \
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents: 54380
diff changeset
   126
    $(eval $1_dotdots := $(if $($(strip $1)_dotdots),$($(strip $1)_dotdots),.)) \
41260
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   127
    $(eval $1_suffix := $(patsubst $($(strip $1)_prefix)/%, %, $1)) \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   128
    $($(strip $1)_dotdots)/$($(strip $1)_suffix)
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   129
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40241
diff changeset
   130
################################################################################
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 23984
diff changeset
   131
# Filter out duplicate sub strings while preserving order. Keeps the first occurance.
29156
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 28906
diff changeset
   132
uniq = \
50471
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49270
diff changeset
   133
    $(strip $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1))))
29156
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 28906
diff changeset
   134
32553
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 32460
diff changeset
   135
# Returns all whitespace-separated words in $2 where at least one of the
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 32460
diff changeset
   136
# whitespace-separated words in $1 is a substring.
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 32460
diff changeset
   137
containing = \
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 32460
diff changeset
   138
    $(strip \
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 32460
diff changeset
   139
        $(foreach v,$(strip $2),\
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 32460
diff changeset
   140
          $(call uniq,$(foreach p,$(strip $1),$(if $(findstring $p,$v),$v)))))
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 32460
diff changeset
   141
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 32460
diff changeset
   142
# Returns all whitespace-separated words in $2 where none of the
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 32460
diff changeset
   143
# whitespace-separated words in $1 is a substring.
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 32460
diff changeset
   144
not-containing = \
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 32460
diff changeset
   145
    $(strip $(filter-out $(call containing,$1,$2),$2))
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 32460
diff changeset
   146
29156
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 28906
diff changeset
   147
# Return a list of all string elements that are duplicated in $1.
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 28906
diff changeset
   148
dups = \
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 28906
diff changeset
   149
    $(strip $(foreach v, $(sort $1), $(if $(filter-out 1, \
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 28906
diff changeset
   150
        $(words $(filter $v, $1))), $v)))
15051
d32ad37472e6 8005540: build-infra: Improve incremental build speed on windows by caching find results
erikj
parents: 14279
diff changeset
   151
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 27595
diff changeset
   152
# String equals
28607
380f123263d8 8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents: 28606
diff changeset
   153
equals = \
52186
0dac3131b0fd 8212587: equals in MakeBase does not handle empty strings correctly
ihse
parents: 52125
diff changeset
   154
    $(if $(strip $1)$(strip $2),$(strip \
0dac3131b0fd 8212587: equals in MakeBase does not handle empty strings correctly
ihse
parents: 52125
diff changeset
   155
      $(and $(findstring $(strip $1),$(strip $2)),\
0dac3131b0fd 8212587: equals in MakeBase does not handle empty strings correctly
ihse
parents: 52125
diff changeset
   156
        $(findstring $(strip $2),$(strip $1)))), \
0dac3131b0fd 8212587: equals in MakeBase does not handle empty strings correctly
ihse
parents: 52125
diff changeset
   157
      true \
0dac3131b0fd 8212587: equals in MakeBase does not handle empty strings correctly
ihse
parents: 52125
diff changeset
   158
    )
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 27595
diff changeset
   159
30095
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29866
diff changeset
   160
# Remove a whole list of prefixes
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29866
diff changeset
   161
# $1 - List of prefixes
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29866
diff changeset
   162
# $2 - List of elements to process
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29866
diff changeset
   163
remove-prefixes = \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29866
diff changeset
   164
    $(strip $(if $1,$(patsubst $(firstword $1)%,%,\
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29866
diff changeset
   165
      $(call remove-prefixes,$(filter-out $(firstword $1),$1),$2)),$2))
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29866
diff changeset
   166
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 33394
diff changeset
   167
# Convert the string given to upper case, without any $(shell)
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 33394
diff changeset
   168
# Inspired by http://lists.gnu.org/archive/html/help-make/2013-09/msg00009.html
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 33394
diff changeset
   169
uppercase_table := a,A b,B c,C d,D e,E f,F g,G h,H i,I j,J k,K l,L m,M n,N o,O \
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 33394
diff changeset
   170
    p,P q,Q r,R s,S t,T u,U v,V w,W x,X y,Y z,Z
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 33394
diff changeset
   171
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 33394
diff changeset
   172
uppercase_internal = \
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 33394
diff changeset
   173
  $(if $(strip $1), $$(subst $(firstword $1), $(call uppercase_internal, \
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 33394
diff changeset
   174
      $(wordlist 2, $(words $1), $1), $2)), $2)
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 33394
diff changeset
   175
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 33394
diff changeset
   176
# Convert a string to upper case. Works only on a-z.
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 33394
diff changeset
   177
# $1 - The string to convert
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 33394
diff changeset
   178
uppercase = \
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 33394
diff changeset
   179
  $(strip \
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 33394
diff changeset
   180
    $(eval uppercase_result := $(call uppercase_internal, $(uppercase_table), $1)) \
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 33394
diff changeset
   181
    $(uppercase_result) \
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 33394
diff changeset
   182
  )
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 33394
diff changeset
   183
29312
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 29304
diff changeset
   184
################################################################################
53683
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   185
# Boolean operators.
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   186
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   187
# Return the word "true" if all the boolean words given as argument is "true",
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   188
# and returns "false" otherwise. Boolean words must be "true" or "false". It is
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   189
# an error to supply a non-boolean word. An empty string is considered "true".
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   190
And = \
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   191
  $(strip $(if $(filter-out true false, $1), $(error Non-boolean values: $1)) \
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   192
  $(if $(strip $(filter-out true, $1)), false, true))
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   193
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   194
# Return the word "false" if all the boolean words given as argument is "false",
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   195
# and returns "true" otherwise. Boolean words must be "true" or "false". It is
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   196
# an error to supply a non-boolean word.  An empty string is considered "false".
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   197
Or = \
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   198
  $(strip $(if $(filter-out true false, $1), $(error Non-boolean values: $1)) \
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   199
  $(if $(strip $(filter-out false, $1)), true, false))
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   200
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   201
################################################################################
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   202
# Parse a multiple-keyword variable, like FOO="KEYWORD1=val1;KEYWORD2=val2;..."
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   203
# These will be converted into a series of variables like FOO_KEYWORD1=val1,
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   204
# FOO_KEYWORD2=val2, etc. Unknown keywords will cause an error.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   205
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   206
# Parameter 1 is the name of the rule, and is also the name of the variable.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   207
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   208
# Remaining parameters are named arguments. These include:
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51676
diff changeset
   209
#   SINGLE_KEYWORDS   A list of valid keywords with single string values
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   210
#   STRING_KEYWORDS   A list of valid keywords, processed as string. This means
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   211
#       that '%20' will be replaced by ' ' to allow for multi-word strings.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   212
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   213
ParseKeywordVariable = $(NamedParamsMacroTemplate)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   214
define ParseKeywordVariableBody
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   215
  ifneq ($$($1), )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   216
    # To preserve spaces, substitute them with a hopefully unique pattern
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   217
    # before splitting and then re-substitute spaces back.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   218
    $1_MANGLED := $$(subst $$(SPACE),||||,$$($1))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   219
    $$(foreach mangled_part, $$(subst ;, , $$($1_MANGLED)), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   220
      $$(eval mangled_part_eval := $$(call DoubleDollar, $$(mangled_part))) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   221
      $$(eval part := $$$$(subst ||||,$$$$(SPACE),$$$$(mangled_part_eval))) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   222
      $$(eval $1_NO_MATCH := true) \
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51676
diff changeset
   223
      $$(foreach keyword, $$($1_SINGLE_KEYWORDS), \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   224
        $$(eval keyword_eval := $$(call DoubleDollar, $$(keyword))) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   225
        $$(if $$(filter $$(keyword)=%, $$(part)), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   226
          $$(eval $(strip $1)_$$$$(keyword_eval) := $$$$(strip $$$$(patsubst $$$$(keyword_eval)=%, %, $$$$(part)))) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   227
          $$(eval $1_NO_MATCH := ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   228
        ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   229
      ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   230
      $$(foreach keyword, $$($1_STRING_KEYWORDS), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   231
        $$(eval keyword_eval := $$(call DoubleDollar, $$(keyword))) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   232
        $$(if $$(filter $$(keyword)=%, $$(part)), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   233
          $$(eval $(strip $1)_$$$$(keyword_eval) := $$$$(strip $$$$(subst %20, , $$$$(patsubst $$$$(keyword_eval)=%, %, $$$$(part))))) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   234
          $$(eval $1_NO_MATCH := ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   235
        ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   236
      ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   237
      $$(if $$($1_NO_MATCH), \
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51676
diff changeset
   238
        $$(if $$(filter $$(part), $$($1_SINGLE_KEYWORDS) $$($1_STRING_KEYWORDS)), \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   239
          $$(info Keyword $$(part) for $1 needs to be assigned a value.) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   240
        , \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   241
          $$(info $$(part) is not a valid keyword for $1.) \
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51676
diff changeset
   242
          $$(info Valid keywords: $$($1_SINGLE_KEYWORDS) $$($1_STRING_KEYWORDS).) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   243
        ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   244
        $$(error Cannot continue) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   245
      ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   246
    )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   247
  endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   248
endef
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   249
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43173
diff changeset
   250
################################################################################
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 27595
diff changeset
   251
# ShellQuote
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 27595
diff changeset
   252
#
29156
bd932374081c 8072842: Add support for building native JTReg tests
ihse
parents: 28906
diff changeset
   253
# Quotes a string with single quotes and replaces single quotes with '\'' so
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 27595
diff changeset
   254
# that the contents survives being given to the shell.
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 27595
diff changeset
   255
ShellQuote = \
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 27595
diff changeset
   256
    $(SQUOTE)$(subst $(SQUOTE),$(SQUOTE)\$(SQUOTE)$(SQUOTE),$(strip $1))$(SQUOTE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 27595
diff changeset
   257
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 27595
diff changeset
   258
################################################################################
31310
481585782338 8081814: Modularize the deploy build
erikj
parents: 30095
diff changeset
   259
# Find lib dir for module
481585782338 8081814: Modularize the deploy build
erikj
parents: 30095
diff changeset
   260
# Param 1 - module name
42528
125bc97e7569 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 41875
diff changeset
   261
FindLibDirForModule = \
125bc97e7569 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 41875
diff changeset
   262
    $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
31310
481585782338 8081814: Modularize the deploy build
erikj
parents: 30095
diff changeset
   263
481585782338 8081814: Modularize the deploy build
erikj
parents: 30095
diff changeset
   264
################################################################################
49244
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents: 49205
diff changeset
   265
# Find executable dir for module
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents: 49205
diff changeset
   266
# Param 1 - module name
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents: 49205
diff changeset
   267
FindExecutableDirForModule = \
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents: 49205
diff changeset
   268
    $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents: 49205
diff changeset
   269
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents: 49205
diff changeset
   270
################################################################################
40241
59abac94e4f2 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 39607
diff changeset
   271
# Return a string suitable for use after a -classpath or --module-path option. It
37030
e047c2f3f510 8153969: Clean up module src dir logic
erikj
parents: 36506
diff changeset
   272
# will be correct and safe to use on all platforms. Arguments are given as space
e047c2f3f510 8153969: Clean up module src dir logic
erikj
parents: 36506
diff changeset
   273
# separate classpath entries. Safe for multiple nested calls.
32460
9e9bffb3029a 8065912: Better handling of classpath in build-infra
ihse
parents: 32344
diff changeset
   274
# param 1 : A space separated list of classpath entries
9e9bffb3029a 8065912: Better handling of classpath in build-infra
ihse
parents: 32344
diff changeset
   275
# The surrounding strip is needed to keep additional whitespace out
9e9bffb3029a 8065912: Better handling of classpath in build-infra
ihse
parents: 32344
diff changeset
   276
PathList = \
37030
e047c2f3f510 8153969: Clean up module src dir logic
erikj
parents: 36506
diff changeset
   277
  "$(subst $(SPACE),$(PATH_SEP),$(strip $(subst $(DQUOTE),,$1)))"
32460
9e9bffb3029a 8065912: Better handling of classpath in build-infra
ihse
parents: 32344
diff changeset
   278
9e9bffb3029a 8065912: Better handling of classpath in build-infra
ihse
parents: 32344
diff changeset
   279
################################################################################
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36506
diff changeset
   280
# Check if a specified hotspot variant is being built, or at least one of a
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36506
diff changeset
   281
# list of variants. Will return 'true' or 'false'.
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36506
diff changeset
   282
# $1 - the variant to test for
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36506
diff changeset
   283
check-jvm-variant = \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36506
diff changeset
   284
  $(strip \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36506
diff changeset
   285
    $(if $(filter-out $(VALID_JVM_VARIANTS), $1), \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36506
diff changeset
   286
      $(error Internal error: Invalid variant tested: $1)) \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36506
diff changeset
   287
    $(if $(filter $1, $(JVM_VARIANTS)), true, false))
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36506
diff changeset
   288
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36506
diff changeset
   289
################################################################################
53683
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   290
# Check if our build or target conforms to certain restrictions. This set of
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   291
# functions all work in similar ways, testing the property that the name
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   292
# implies, so e.g. isTargetCpu test the CPU of the target system.
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   293
#
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   294
# $1 - A property, or a space separated list of properties to test for.
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   295
#
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   296
# Returns true if the actual property matches one of the properties in the list,
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   297
# and false otherwise.
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   298
#
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   299
# Examples: $(call isTargetOs, linux solaris) will return true when executed
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   300
# on either linux or solaris, and false otherwise.
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   301
# $(call isBuildCpuArch, x86) will return true iff the build CPU Arch is x86.
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   302
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   303
isTargetOs = \
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   304
  $(strip $(if $(filter $(OPENJDK_TARGET_OS), $1), true, false))
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   305
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   306
isTargetOsType = \
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   307
  $(strip $(if $(filter $(OPENJDK_TARGET_OS_TYPE), $1), true, false))
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   308
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   309
isTargetCpu = \
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   310
  $(strip $(if $(filter $(OPENJDK_TARGET_CPU), $1), true, false))
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   311
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   312
isTargetCpuArch = \
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   313
  $(strip $(if $(filter $(OPENJDK_TARGET_CPU_ARCH), $1), true, false))
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   314
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   315
isTargetCpuBits = \
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   316
  $(strip $(if $(filter $(OPENJDK_TARGET_CPU_BITS), $1), true, false))
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   317
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   318
isBuildOs = \
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   319
  $(strip $(if $(filter $(OPENJDK_BUILD_OS), $1), true, false))
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   320
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   321
isBuildOsType = \
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   322
  $(strip $(if $(filter $(OPENJDK_BUILD_OS_TYPE), $1), true, false))
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   323
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   324
isBuildOsEnv = \
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   325
  $(strip $(if $(filter $(OPENJDK_BUILD_OS_ENV), $1), true, false))
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   326
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   327
isBuildCpu = \
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   328
  $(strip $(if $(filter $(OPENJDK_BUILD_CPU), $1), true, false))
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   329
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   330
isBuildCpuArch = \
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   331
  $(strip $(if $(filter $(OPENJDK_BUILD_CPU_ARCH), $1), true, false))
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   332
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 53484
diff changeset
   333
################################################################################
37770
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37410
diff changeset
   334
# Converts a space separated list to a comma separated list.
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37410
diff changeset
   335
#
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37410
diff changeset
   336
# Replacing double-comma with a single comma is to workaround the issue with
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37410
diff changeset
   337
# some version of make on windows that doesn't substitute spaces with one comma
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37410
diff changeset
   338
# properly.
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37410
diff changeset
   339
CommaList = \
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37410
diff changeset
   340
  $(strip \
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37410
diff changeset
   341
      $(subst $(COMMA)$(COMMA),$(COMMA),$(subst $(SPACE),$(COMMA),$(strip $1))) \
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37410
diff changeset
   342
  )
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37410
diff changeset
   343
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37410
diff changeset
   344
################################################################################
45323
52500c1d7f1f 8175824: Adapt javadoc generation to different requirements for JDK and JavaSE
ihse
parents: 44725
diff changeset
   345
# Converts a space separated list to a colon separated list.
52500c1d7f1f 8175824: Adapt javadoc generation to different requirements for JDK and JavaSE
ihse
parents: 44725
diff changeset
   346
#
52500c1d7f1f 8175824: Adapt javadoc generation to different requirements for JDK and JavaSE
ihse
parents: 44725
diff changeset
   347
# Replacing double-colon with a single colon is to workaround the issue with
52500c1d7f1f 8175824: Adapt javadoc generation to different requirements for JDK and JavaSE
ihse
parents: 44725
diff changeset
   348
# some version of make on windows that doesn't substitute spaces with one colon
52500c1d7f1f 8175824: Adapt javadoc generation to different requirements for JDK and JavaSE
ihse
parents: 44725
diff changeset
   349
# properly.
52500c1d7f1f 8175824: Adapt javadoc generation to different requirements for JDK and JavaSE
ihse
parents: 44725
diff changeset
   350
ColonList = \
52500c1d7f1f 8175824: Adapt javadoc generation to different requirements for JDK and JavaSE
ihse
parents: 44725
diff changeset
   351
  $(strip \
52500c1d7f1f 8175824: Adapt javadoc generation to different requirements for JDK and JavaSE
ihse
parents: 44725
diff changeset
   352
      $(subst ::,:,$(subst $(SPACE),:,$(strip $1))) \
52500c1d7f1f 8175824: Adapt javadoc generation to different requirements for JDK and JavaSE
ihse
parents: 44725
diff changeset
   353
  )
52500c1d7f1f 8175824: Adapt javadoc generation to different requirements for JDK and JavaSE
ihse
parents: 44725
diff changeset
   354
52500c1d7f1f 8175824: Adapt javadoc generation to different requirements for JDK and JavaSE
ihse
parents: 44725
diff changeset
   355
################################################################################
50590
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50471
diff changeset
   356
# Given a list of files, filters out locale specific files for translations
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50471
diff changeset
   357
# that should be excluded from this build.
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50471
diff changeset
   358
# $1 - The list of files to filter
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50471
diff changeset
   359
# $2 - The suffix of the files that should be considered (.java or .properties)
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50471
diff changeset
   360
FilterExcludedTranslations = \
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50471
diff changeset
   361
  $(strip $(if $(EXCLUDE_TRANSLATIONS), \
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50471
diff changeset
   362
    $(filter-out \
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50471
diff changeset
   363
        $(foreach suffix, $2, \
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50471
diff changeset
   364
          $(addprefix %_, $(addsuffix $(suffix), $(EXCLUDE_TRANSLATIONS))) \
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50471
diff changeset
   365
        ), \
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50471
diff changeset
   366
        $1 \
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50471
diff changeset
   367
    ), \
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50471
diff changeset
   368
    $1 \
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50471
diff changeset
   369
  ))