MakeBase.gmk 17.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

################################################################
#
# Check that GNU make and cygwin are recent enough.
# Setup common utility functions.
#
################################################################

ifndef _MAKEBASE_GMK
_MAKEBASE_GMK := 1

# If the variable that you want to send to stdout for piping into a file or otherwise,
# is potentially long, for example the a list of file paths, eg a list of all package directories.
# Then you need to use ListPathsSafely, which optimistically splits the output into several shell
# calls as well as use compression on recurrent file paths segments, to get around the potential
# command line length problem that exists in cygwin and other shells.
O
ohair 已提交
41 42
compress_pre:=$(strip $(shell $(CAT) $(SRC_ROOT)/common/makefiles/support/ListPathsSafely-pre-compress.incl))
compress_post:=$(strip $(shell $(CAT) $(SRC_ROOT)/common/makefiles/support/ListPathsSafely-post-compress.incl))
43 44 45 46 47 48 49
compress_paths=$(compress_pre)\
$(subst $(SRC_ROOT),X97,\
$(subst $(OUTPUT_ROOT),X98,\
$(subst X,X00,\
$(subst $(SPACE),\n,$(strip $1)))))\
$(compress_post)

O
ohair 已提交
50
decompress_paths=$(SED) -f $(SRC_ROOT)/common/makefiles/support/ListPathsSafely-uncompress.sed -e 's|X99|\\n|g' \
51 52 53
		     -e 's|X98|$(OUTPUT_ROOT)|g' -e 's|X97|$(SRC_ROOT)|g' \
		     -e 's|X00|X|g' | tr '\n' '$2'

J
jjg 已提交
54
# Subst in an extra $ to prevent it from disappearing.
55
define ListPathsSafely_If
J
jjg 已提交
56
    $(if $(word $3,$($1)),$(eval $1_LPS$3:=$(call compress_paths,$(subst $$,$$$$,$(wordlist $3,$4,$($1))))))
57 58 59 60 61 62 63 64 65 66 67 68
endef

define ListPathsSafely_Printf
    $(if $(strip $($1_LPS$4)),printf -- "$(strip $($1_LPS$4))\n" | $(decompress_paths) $3)
endef

# Receipt example:
#    rm -f thepaths
#    $(call ListPathsSafely,THEPATHS,\n, >> thepaths)
#    The \n argument means translate spaces into \n
#    if instead , , (a space) is supplied, then spaces remain spaces.
define ListPathsSafely
69
    $(if $(word 16001,$($1)),$(error Cannot list safely more than 16000 paths. $1 has $(words $($1)) paths!))
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
    $(call ListPathsSafely_If,$1,$2,1,250)
    $(call ListPathsSafely_If,$1,$2,251,500)
    $(call ListPathsSafely_If,$1,$2,501,750)
    $(call ListPathsSafely_If,$1,$2,751,1000)

    $(call ListPathsSafely_If,$1,$2,1001,1250)
    $(call ListPathsSafely_If,$1,$2,1251,1500)
    $(call ListPathsSafely_If,$1,$2,1501,1750)
    $(call ListPathsSafely_If,$1,$2,1751,2000)

    $(call ListPathsSafely_If,$1,$2,2001,2250)
    $(call ListPathsSafely_If,$1,$2,2251,2500)
    $(call ListPathsSafely_If,$1,$2,2501,2750)
    $(call ListPathsSafely_If,$1,$2,2751,3000)

    $(call ListPathsSafely_If,$1,$2,3001,3250)
    $(call ListPathsSafely_If,$1,$2,3251,3500)
    $(call ListPathsSafely_If,$1,$2,3501,3750)
    $(call ListPathsSafely_If,$1,$2,3751,4000)

    $(call ListPathsSafely_If,$1,$2,4001,4250)
    $(call ListPathsSafely_If,$1,$2,4251,4500)
    $(call ListPathsSafely_If,$1,$2,4501,4750)
    $(call ListPathsSafely_If,$1,$2,4751,5000)

    $(call ListPathsSafely_If,$1,$2,5001,5250)
    $(call ListPathsSafely_If,$1,$2,5251,5500)
    $(call ListPathsSafely_If,$1,$2,5501,5750)
    $(call ListPathsSafely_If,$1,$2,5751,6000)

    $(call ListPathsSafely_If,$1,$2,6001,6250)
    $(call ListPathsSafely_If,$1,$2,6251,6500)
    $(call ListPathsSafely_If,$1,$2,6501,6750)
    $(call ListPathsSafely_If,$1,$2,6751,7000)

    $(call ListPathsSafely_If,$1,$2,7001,7250)
    $(call ListPathsSafely_If,$1,$2,7251,7500)
    $(call ListPathsSafely_If,$1,$2,7501,7750)
    $(call ListPathsSafely_If,$1,$2,7751,8000)

    $(call ListPathsSafely_If,$1,$2,8001,8250)
    $(call ListPathsSafely_If,$1,$2,8251,8500)
    $(call ListPathsSafely_If,$1,$2,8501,8750)
    $(call ListPathsSafely_If,$1,$2,8751,9000)

    $(call ListPathsSafely_If,$1,$2,9001,9250)
    $(call ListPathsSafely_If,$1,$2,9251,9500)
    $(call ListPathsSafely_If,$1,$2,9501,9750)
    $(call ListPathsSafely_If,$1,$2,9751,10000)

120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
    $(call ListPathsSafely_If,$1,$2,10001,10250)
    $(call ListPathsSafely_If,$1,$2,10251,10500)
    $(call ListPathsSafely_If,$1,$2,10501,10750)
    $(call ListPathsSafely_If,$1,$2,10751,11000)

    $(call ListPathsSafely_If,$1,$2,11001,11250)
    $(call ListPathsSafely_If,$1,$2,11251,11500)
    $(call ListPathsSafely_If,$1,$2,11501,11750)
    $(call ListPathsSafely_If,$1,$2,11751,12000)

    $(call ListPathsSafely_If,$1,$2,12001,12250)
    $(call ListPathsSafely_If,$1,$2,12251,12500)
    $(call ListPathsSafely_If,$1,$2,12501,12750)
    $(call ListPathsSafely_If,$1,$2,12751,13000)

    $(call ListPathsSafely_If,$1,$2,13001,13250)
    $(call ListPathsSafely_If,$1,$2,13251,13500)
    $(call ListPathsSafely_If,$1,$2,13501,13750)
    $(call ListPathsSafely_If,$1,$2,13751,14000)

    $(call ListPathsSafely_If,$1,$2,14001,14250)
    $(call ListPathsSafely_If,$1,$2,14251,14500)
    $(call ListPathsSafely_If,$1,$2,14501,14750)
    $(call ListPathsSafely_If,$1,$2,14751,15000)

    $(call ListPathsSafely_If,$1,$2,15001,15250)
    $(call ListPathsSafely_If,$1,$2,15251,15500)
    $(call ListPathsSafely_If,$1,$2,15501,15750)
    $(call ListPathsSafely_If,$1,$2,15751,16000)

150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
    $(call ListPathsSafely_Printf,$1,$2,$3,1)
    $(call ListPathsSafely_Printf,$1,$2,$3,251)
    $(call ListPathsSafely_Printf,$1,$2,$3,501)
    $(call ListPathsSafely_Printf,$1,$2,$3,751)

    $(call ListPathsSafely_Printf,$1,$2,$3,1001)
    $(call ListPathsSafely_Printf,$1,$2,$3,1251)
    $(call ListPathsSafely_Printf,$1,$2,$3,1501)
    $(call ListPathsSafely_Printf,$1,$2,$3,1751)

    $(call ListPathsSafely_Printf,$1,$2,$3,2001)
    $(call ListPathsSafely_Printf,$1,$2,$3,2251)
    $(call ListPathsSafely_Printf,$1,$2,$3,2501)
    $(call ListPathsSafely_Printf,$1,$2,$3,2751)

    $(call ListPathsSafely_Printf,$1,$2,$3,3001)
    $(call ListPathsSafely_Printf,$1,$2,$3,3251)
    $(call ListPathsSafely_Printf,$1,$2,$3,3501)
    $(call ListPathsSafely_Printf,$1,$2,$3,3751)

    $(call ListPathsSafely_Printf,$1,$2,$3,4001)
    $(call ListPathsSafely_Printf,$1,$2,$3,4251)
    $(call ListPathsSafely_Printf,$1,$2,$3,4501)
    $(call ListPathsSafely_Printf,$1,$2,$3,4751)

    $(call ListPathsSafely_Printf,$1,$2,$3,5001)
    $(call ListPathsSafely_Printf,$1,$2,$3,5251)
    $(call ListPathsSafely_Printf,$1,$2,$3,5501)
    $(call ListPathsSafely_Printf,$1,$2,$3,5751)

    $(call ListPathsSafely_Printf,$1,$2,$3,6001)
    $(call ListPathsSafely_Printf,$1,$2,$3,6251)
    $(call ListPathsSafely_Printf,$1,$2,$3,6501)
    $(call ListPathsSafely_Printf,$1,$2,$3,6751)

    $(call ListPathsSafely_Printf,$1,$2,$3,7001)
    $(call ListPathsSafely_Printf,$1,$2,$3,7251)
    $(call ListPathsSafely_Printf,$1,$2,$3,7501)
    $(call ListPathsSafely_Printf,$1,$2,$3,7751)

    $(call ListPathsSafely_Printf,$1,$2,$3,8001)
    $(call ListPathsSafely_Printf,$1,$2,$3,8251)
    $(call ListPathsSafely_Printf,$1,$2,$3,8501)
    $(call ListPathsSafely_Printf,$1,$2,$3,8751)

    $(call ListPathsSafely_Printf,$1,$2,$3,9001)
    $(call ListPathsSafely_Printf,$1,$2,$3,9251)
    $(call ListPathsSafely_Printf,$1,$2,$3,9501)
    $(call ListPathsSafely_Printf,$1,$2,$3,9751)
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228

    $(call ListPathsSafely_Printf,$1,$2,$3,10001)
    $(call ListPathsSafely_Printf,$1,$2,$3,10251)
    $(call ListPathsSafely_Printf,$1,$2,$3,10501)
    $(call ListPathsSafely_Printf,$1,$2,$3,10751)

    $(call ListPathsSafely_Printf,$1,$2,$3,11001)
    $(call ListPathsSafely_Printf,$1,$2,$3,11251)
    $(call ListPathsSafely_Printf,$1,$2,$3,11501)
    $(call ListPathsSafely_Printf,$1,$2,$3,11751)

    $(call ListPathsSafely_Printf,$1,$2,$3,12001)
    $(call ListPathsSafely_Printf,$1,$2,$3,12251)
    $(call ListPathsSafely_Printf,$1,$2,$3,12501)
    $(call ListPathsSafely_Printf,$1,$2,$3,12751)

    $(call ListPathsSafely_Printf,$1,$2,$3,13001)
    $(call ListPathsSafely_Printf,$1,$2,$3,13251)
    $(call ListPathsSafely_Printf,$1,$2,$3,13501)
    $(call ListPathsSafely_Printf,$1,$2,$3,13751)

    $(call ListPathsSafely_Printf,$1,$2,$3,14001)
    $(call ListPathsSafely_Printf,$1,$2,$3,14251)
    $(call ListPathsSafely_Printf,$1,$2,$3,14501)
    $(call ListPathsSafely_Printf,$1,$2,$3,14751)

    $(call ListPathsSafely_Printf,$1,$2,$3,15001)
    $(call ListPathsSafely_Printf,$1,$2,$3,15251)
    $(call ListPathsSafely_Printf,$1,$2,$3,15501)
    $(call ListPathsSafely_Printf,$1,$2,$3,15751)
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294
endef

define ListPathsSafelyNow_IfPrintf
    ifneq (,$$(word $4,$$($1)))
        $$(eval $1_LPS$4:=$$(call compress_paths,$$(wordlist $4,$5,$$($1))))
        $$(shell printf -- "$$(strip $$($1_LPS$4))\n" | $(decompress_paths) $3)
    endif
endef

# And an non-receipt version:
define ListPathsSafelyNow
    ifneq (,$$(word 10001,$$($1)))
        $$(error Cannot list safely more than 10000 paths. $1 has $$(words $$($1)) paths!)
    endif
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1,250)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,251,500)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,501,750)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,751,1000)

    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1001,1250)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1251,1500)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1501,1750)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1751,2000)

    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2001,2250)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2251,2500)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2501,2750)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2751,3000)

    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3001,3250)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3251,3500)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3501,3750)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3751,4000)

    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4001,4250)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4251,4500)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4501,4750)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4751,5000)

    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5001,5250)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5251,5500)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5501,5750)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5751,6000)

    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6001,6250)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6251,6500)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6501,6750)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6751,7000)

    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7001,7250)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7251,7500)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7501,7750)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7751,8000)

    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8001,8250)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8251,8500)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8501,8750)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8751,9000)

    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9001,9250)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9251,9500)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9501,9750)
    $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9751,10000)

endef

295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331
# The source tips can come from the Mercurial repository, or in the files
#   $(HGTIP_FILENAME) which contains the tip but is also positioned in the same
#   directory as the original $(HGDIR) directory.
#   These should not be := assignments, only used from the root Makefile.
HG_VERSION = $(shell $(HG) version 2> /dev/null)
HG_DIRECTORY=.hg
HGTIP_FILENAME=.hgtip
HG_SEARCH = ./REPO ./*/REPO ./*/*/REPO ./*/*/*/REPO
REPO_LIST = $(patsubst ./%,%,$(patsubst %/,%,$(sort $(dir \
    $(shell $(CD) $(SRC_ROOT) ; ( $(LS) -d $(HG_SEARCH:%/REPO=%/$(HG_DIRECTORY)) ; \
                                   $(LS)    $(HG_SEARCH:%/REPO=%/$(HGTIP_FILENAME)) ) \
	        2> /dev/null)))))

# Emit the repo:tip pairs to $@
define GetSourceTips
$(CD) $(SRC_ROOT) ; \
for i in $(REPO_LIST) IGNORE ; do \
  if [ "$${i}" = "IGNORE" ] ; then \
    continue; \
  elif [ -d $${i}/$(HG_DIRECTORY) -a "$(HG_VERSION)" != "" ] ; then \
    $(PRINTF) " %s:%s" \
      "$${i}" `$(HG) tip --repository $${i} --template '{node|short}\n'` ; \
  elif [ -f $${i}/$(HGTIP_FILENAME) ] ; then \
    $(PRINTF) " %s:%s" \
      "$${i}" `$(CAT) $${i}/$(HGTIP_FILENAME)` ; \
  fi; \
done >> $@
$(PRINTF) "\n" >> $@
endef

# Create the HGTIP_FILENAME file. Called from jdk/make/closed/bundles.gmk
define CreateHgTip
$(HG) tip --repository $1 --template '{node|short}\n' > $1/$(HGTIP_FILENAME);\
$(ECHO) $1/$(HGTIP_FILENAME)
endef

define SetupLogging
O
ohair 已提交
332
    ifeq ($$(LOG), trace)
333
        # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
O
ohair 已提交
334 335 336
        # For each target executed, will print
        # Building <TARGET> (from <FIRST PREREQUISITE>) (<ALL NEWER PREREQUISITES> newer)
        # but with a limit of 20 on <ALL NEWER PREREQUISITES>, to avoid cluttering logs too much (and causing a crash on Cygwin).
337
        OLD_SHELL:=$$(SHELL)
O
ohair 已提交
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356
        WRAPPER_SHELL:=$$(OLD_SHELL) $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(TIME),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log $$(OLD_SHELL)
        SHELL=$$(warning $$(if $$@,Building $$@,Running shell command) $$(if $$<, (from $$<))$$(if $$?, ($$(wordlist 1, 20, $$?) $$(if $$(wordlist 21, 22, $$?), ... [in total $$(words $$?) files]) newer)))$$(WRAPPER_SHELL)
    endif
    # Never remove warning messages; this is just for completeness
    LOG_WARN= 
    ifneq ($$(findstring $$(LOG),info debug trace),)
        LOG_INFO=
    else
        LOG_INFO=> /dev/null
    endif
    ifneq ($$(findstring $$(LOG),debug trace),)
        LOG_DEBUG=
    else
        LOG_DEBUG=> /dev/null
    endif
    ifneq ($$(findstring $$(LOG),trace),)
        LOG_TRACE=
    else
        LOG_TRACE=> /dev/null
357 358 359 360 361 362
    endif
endef

# Make sure logging is setup for everyone that includes MakeBase.gmk.
$(eval $(call SetupLogging))

O
ohair 已提交
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394
# This is to be called by all SetupFoo macros
define LogSetupMacroEntry
    $(if $(26),$(error Internal makefile error: Too many arguments to LogSetupMacroEntry, please update MakeBase.gmk))
    $(if $(findstring $(LOG),debug trace), $(info $1 $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25,$(if $($i),$(NEWLINE) $(strip [$i] $($i))))))
endef

# Make directory without forking mkdir if not needed
define MakeDir
    ifneq ($$(wildcard $1 $2 $3 $4 $5 $6 $7 $8 $9),$$(strip $1 $2 $3 $4 $5 $6 $7 $8 $9))
        $$(shell $(MKDIR) -p $1 $2 $3 $4 $5 $6 $7 $8 $9)
    endif
endef

ifeq ($(OPENJDK_TARGET_OS),solaris)
# On Solaris, if the target is a symlink and exists, cp won't overwrite.
define install-file
	$(MKDIR) -p $(@D)
	$(RM) '$@'
	$(CP) -f -r -P '$<' '$(@D)'
endef
else ifeq ($(OPENJDK_TARGET_OS),macosx)
define install-file
	$(MKDIR) -p $(@D)
	$(CP) -fpRP '$<' '$@'
endef
else
define install-file
	$(MKDIR) -p $(@D)
	$(CP) -fP '$<' '$@'
endef
endif

395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436
# Convenience functions for working around make's limitations with $(filter ).
containing = $(foreach v,$2,$(if $(findstring $1,$v),$v))
not-containing = $(foreach v,$2,$(if $(findstring $1,$v),,$v))

################################################################################
# In Cygwin, finds are very costly, both because of expensive forks and because
# of bad file system caching. Find is used extensively in $(shell) commands to
# find source files. This makes rerunning make with no or few changes rather 
# expensive. To speed this up, these two macros are used to cache the results
# of simple find commands for reuse.
# 
# Runs a find and stores both the directories where it was run and the results.
# This macro can be called multiple times to add to the cache. Only finds files
# with no filters.
#
# Needs to be called with $(eval )
# 
# Param 1 - Dir to find in
ifeq ($(OPENJDK_BUILD_OS),windows)
define FillCacheFind
    FIND_CACHE_DIR += $1
    FIND_CACHE := $$(sort $$(FIND_CACHE) $$(shell $(FIND) $1 -type f -o -type l))
endef
else
define FillCacheFind
endef
endif

# Mimics find by looking in the cache if all of the directories have been cached.
# Otherwise reverts to shell find. This is safe to call on all platforms, even if
# cache is deactivated.
#
# The extra - is needed when FIND_CACHE_DIR is empty but should be harmless.
# Param 1 - Dirs to find in
define CacheFind
    $(if $(filter-out $(addsuffix %,- $(FIND_CACHE_DIR)),$1),\
        $(shell $(FIND) $1 -type f -o -type l),\
        $(filter $(addsuffix %,$1),$(FIND_CACHE)))
endef

################################################################################

437
endif # _MAKEBASE_GMK