common/makefiles/MakeBase.gmk

Mon, 25 Feb 2013 15:08:11 -0800

author
jjg
date
Mon, 25 Feb 2013 15:08:11 -0800
changeset 645
5b0b6ef58dbf
parent 557
d2c1f80118de
child 660
19a59a13b3ef
permissions
-rw-r--r--

8008914: Add nashorn to the tl build
Reviewed-by: mr, tbell, jjh
Contributed-by: erik.joelsson@oracle.com, james.laskey@oracle.com

     1 #
     2 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 #
     5 # This code is free software; you can redistribute it and/or modify it
     6 # under the terms of the GNU General Public License version 2 only, as
     7 # published by the Free Software Foundation.  Oracle designates this
     8 # particular file as subject to the "Classpath" exception as provided
     9 # by Oracle in the LICENSE file that accompanied this code.
    10 #
    11 # This code is distributed in the hope that it will be useful, but WITHOUT
    12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14 # version 2 for more details (a copy is included in the LICENSE file that
    15 # accompanied this code).
    16 #
    17 # You should have received a copy of the GNU General Public License version
    18 # 2 along with this work; if not, write to the Free Software Foundation,
    19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20 #
    21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22 # or visit www.oracle.com if you need additional information or have any
    23 # questions.
    24 #
    26 ################################################################
    27 #
    28 # Check that GNU make and cygwin are recent enough.
    29 # Setup common utility functions.
    30 #
    31 ################################################################
    33 ifndef _MAKEBASE_GMK
    34 _MAKEBASE_GMK := 1
    36 # If the variable that you want to send to stdout for piping into a file or otherwise,
    37 # is potentially long, for example the a list of file paths, eg a list of all package directories.
    38 # Then you need to use ListPathsSafely, which optimistically splits the output into several shell
    39 # calls as well as use compression on recurrent file paths segments, to get around the potential
    40 # command line length problem that exists in cygwin and other shells.
    41 compress_pre:=$(strip $(shell $(CAT) $(SRC_ROOT)/common/makefiles/support/ListPathsSafely-pre-compress.incl))
    42 compress_post:=$(strip $(shell $(CAT) $(SRC_ROOT)/common/makefiles/support/ListPathsSafely-post-compress.incl))
    43 compress_paths=$(compress_pre)\
    44 $(subst $(SRC_ROOT),X97,\
    45 $(subst $(OUTPUT_ROOT),X98,\
    46 $(subst X,X00,\
    47 $(subst $(SPACE),\n,$(strip $1)))))\
    48 $(compress_post)
    50 decompress_paths=$(SED) -f $(SRC_ROOT)/common/makefiles/support/ListPathsSafely-uncompress.sed -e 's|X99|\\n|g' \
    51 		     -e 's|X98|$(OUTPUT_ROOT)|g' -e 's|X97|$(SRC_ROOT)|g' \
    52 		     -e 's|X00|X|g' | tr '\n' '$2'
    54 # Subst in an extra $ to prevent it from disappearing.
    55 define ListPathsSafely_If
    56     $(if $(word $3,$($1)),$(eval $1_LPS$3:=$(call compress_paths,$(subst $$,$$$$,$(wordlist $3,$4,$($1))))))
    57 endef
    59 define ListPathsSafely_Printf
    60     $(if $(strip $($1_LPS$4)),printf -- "$(strip $($1_LPS$4))\n" | $(decompress_paths) $3)
    61 endef
    63 # Receipt example:
    64 #    rm -f thepaths
    65 #    $(call ListPathsSafely,THEPATHS,\n, >> thepaths)
    66 #    The \n argument means translate spaces into \n
    67 #    if instead , , (a space) is supplied, then spaces remain spaces.
    68 define ListPathsSafely
    69     $(if $(word 16001,$($1)),$(error Cannot list safely more than 16000 paths. $1 has $(words $($1)) paths!))
    70     $(call ListPathsSafely_If,$1,$2,1,250)
    71     $(call ListPathsSafely_If,$1,$2,251,500)
    72     $(call ListPathsSafely_If,$1,$2,501,750)
    73     $(call ListPathsSafely_If,$1,$2,751,1000)
    75     $(call ListPathsSafely_If,$1,$2,1001,1250)
    76     $(call ListPathsSafely_If,$1,$2,1251,1500)
    77     $(call ListPathsSafely_If,$1,$2,1501,1750)
    78     $(call ListPathsSafely_If,$1,$2,1751,2000)
    80     $(call ListPathsSafely_If,$1,$2,2001,2250)
    81     $(call ListPathsSafely_If,$1,$2,2251,2500)
    82     $(call ListPathsSafely_If,$1,$2,2501,2750)
    83     $(call ListPathsSafely_If,$1,$2,2751,3000)
    85     $(call ListPathsSafely_If,$1,$2,3001,3250)
    86     $(call ListPathsSafely_If,$1,$2,3251,3500)
    87     $(call ListPathsSafely_If,$1,$2,3501,3750)
    88     $(call ListPathsSafely_If,$1,$2,3751,4000)
    90     $(call ListPathsSafely_If,$1,$2,4001,4250)
    91     $(call ListPathsSafely_If,$1,$2,4251,4500)
    92     $(call ListPathsSafely_If,$1,$2,4501,4750)
    93     $(call ListPathsSafely_If,$1,$2,4751,5000)
    95     $(call ListPathsSafely_If,$1,$2,5001,5250)
    96     $(call ListPathsSafely_If,$1,$2,5251,5500)
    97     $(call ListPathsSafely_If,$1,$2,5501,5750)
    98     $(call ListPathsSafely_If,$1,$2,5751,6000)
   100     $(call ListPathsSafely_If,$1,$2,6001,6250)
   101     $(call ListPathsSafely_If,$1,$2,6251,6500)
   102     $(call ListPathsSafely_If,$1,$2,6501,6750)
   103     $(call ListPathsSafely_If,$1,$2,6751,7000)
   105     $(call ListPathsSafely_If,$1,$2,7001,7250)
   106     $(call ListPathsSafely_If,$1,$2,7251,7500)
   107     $(call ListPathsSafely_If,$1,$2,7501,7750)
   108     $(call ListPathsSafely_If,$1,$2,7751,8000)
   110     $(call ListPathsSafely_If,$1,$2,8001,8250)
   111     $(call ListPathsSafely_If,$1,$2,8251,8500)
   112     $(call ListPathsSafely_If,$1,$2,8501,8750)
   113     $(call ListPathsSafely_If,$1,$2,8751,9000)
   115     $(call ListPathsSafely_If,$1,$2,9001,9250)
   116     $(call ListPathsSafely_If,$1,$2,9251,9500)
   117     $(call ListPathsSafely_If,$1,$2,9501,9750)
   118     $(call ListPathsSafely_If,$1,$2,9751,10000)
   120     $(call ListPathsSafely_If,$1,$2,10001,10250)
   121     $(call ListPathsSafely_If,$1,$2,10251,10500)
   122     $(call ListPathsSafely_If,$1,$2,10501,10750)
   123     $(call ListPathsSafely_If,$1,$2,10751,11000)
   125     $(call ListPathsSafely_If,$1,$2,11001,11250)
   126     $(call ListPathsSafely_If,$1,$2,11251,11500)
   127     $(call ListPathsSafely_If,$1,$2,11501,11750)
   128     $(call ListPathsSafely_If,$1,$2,11751,12000)
   130     $(call ListPathsSafely_If,$1,$2,12001,12250)
   131     $(call ListPathsSafely_If,$1,$2,12251,12500)
   132     $(call ListPathsSafely_If,$1,$2,12501,12750)
   133     $(call ListPathsSafely_If,$1,$2,12751,13000)
   135     $(call ListPathsSafely_If,$1,$2,13001,13250)
   136     $(call ListPathsSafely_If,$1,$2,13251,13500)
   137     $(call ListPathsSafely_If,$1,$2,13501,13750)
   138     $(call ListPathsSafely_If,$1,$2,13751,14000)
   140     $(call ListPathsSafely_If,$1,$2,14001,14250)
   141     $(call ListPathsSafely_If,$1,$2,14251,14500)
   142     $(call ListPathsSafely_If,$1,$2,14501,14750)
   143     $(call ListPathsSafely_If,$1,$2,14751,15000)
   145     $(call ListPathsSafely_If,$1,$2,15001,15250)
   146     $(call ListPathsSafely_If,$1,$2,15251,15500)
   147     $(call ListPathsSafely_If,$1,$2,15501,15750)
   148     $(call ListPathsSafely_If,$1,$2,15751,16000)
   150     $(call ListPathsSafely_Printf,$1,$2,$3,1)
   151     $(call ListPathsSafely_Printf,$1,$2,$3,251)
   152     $(call ListPathsSafely_Printf,$1,$2,$3,501)
   153     $(call ListPathsSafely_Printf,$1,$2,$3,751)
   155     $(call ListPathsSafely_Printf,$1,$2,$3,1001)
   156     $(call ListPathsSafely_Printf,$1,$2,$3,1251)
   157     $(call ListPathsSafely_Printf,$1,$2,$3,1501)
   158     $(call ListPathsSafely_Printf,$1,$2,$3,1751)
   160     $(call ListPathsSafely_Printf,$1,$2,$3,2001)
   161     $(call ListPathsSafely_Printf,$1,$2,$3,2251)
   162     $(call ListPathsSafely_Printf,$1,$2,$3,2501)
   163     $(call ListPathsSafely_Printf,$1,$2,$3,2751)
   165     $(call ListPathsSafely_Printf,$1,$2,$3,3001)
   166     $(call ListPathsSafely_Printf,$1,$2,$3,3251)
   167     $(call ListPathsSafely_Printf,$1,$2,$3,3501)
   168     $(call ListPathsSafely_Printf,$1,$2,$3,3751)
   170     $(call ListPathsSafely_Printf,$1,$2,$3,4001)
   171     $(call ListPathsSafely_Printf,$1,$2,$3,4251)
   172     $(call ListPathsSafely_Printf,$1,$2,$3,4501)
   173     $(call ListPathsSafely_Printf,$1,$2,$3,4751)
   175     $(call ListPathsSafely_Printf,$1,$2,$3,5001)
   176     $(call ListPathsSafely_Printf,$1,$2,$3,5251)
   177     $(call ListPathsSafely_Printf,$1,$2,$3,5501)
   178     $(call ListPathsSafely_Printf,$1,$2,$3,5751)
   180     $(call ListPathsSafely_Printf,$1,$2,$3,6001)
   181     $(call ListPathsSafely_Printf,$1,$2,$3,6251)
   182     $(call ListPathsSafely_Printf,$1,$2,$3,6501)
   183     $(call ListPathsSafely_Printf,$1,$2,$3,6751)
   185     $(call ListPathsSafely_Printf,$1,$2,$3,7001)
   186     $(call ListPathsSafely_Printf,$1,$2,$3,7251)
   187     $(call ListPathsSafely_Printf,$1,$2,$3,7501)
   188     $(call ListPathsSafely_Printf,$1,$2,$3,7751)
   190     $(call ListPathsSafely_Printf,$1,$2,$3,8001)
   191     $(call ListPathsSafely_Printf,$1,$2,$3,8251)
   192     $(call ListPathsSafely_Printf,$1,$2,$3,8501)
   193     $(call ListPathsSafely_Printf,$1,$2,$3,8751)
   195     $(call ListPathsSafely_Printf,$1,$2,$3,9001)
   196     $(call ListPathsSafely_Printf,$1,$2,$3,9251)
   197     $(call ListPathsSafely_Printf,$1,$2,$3,9501)
   198     $(call ListPathsSafely_Printf,$1,$2,$3,9751)
   200     $(call ListPathsSafely_Printf,$1,$2,$3,10001)
   201     $(call ListPathsSafely_Printf,$1,$2,$3,10251)
   202     $(call ListPathsSafely_Printf,$1,$2,$3,10501)
   203     $(call ListPathsSafely_Printf,$1,$2,$3,10751)
   205     $(call ListPathsSafely_Printf,$1,$2,$3,11001)
   206     $(call ListPathsSafely_Printf,$1,$2,$3,11251)
   207     $(call ListPathsSafely_Printf,$1,$2,$3,11501)
   208     $(call ListPathsSafely_Printf,$1,$2,$3,11751)
   210     $(call ListPathsSafely_Printf,$1,$2,$3,12001)
   211     $(call ListPathsSafely_Printf,$1,$2,$3,12251)
   212     $(call ListPathsSafely_Printf,$1,$2,$3,12501)
   213     $(call ListPathsSafely_Printf,$1,$2,$3,12751)
   215     $(call ListPathsSafely_Printf,$1,$2,$3,13001)
   216     $(call ListPathsSafely_Printf,$1,$2,$3,13251)
   217     $(call ListPathsSafely_Printf,$1,$2,$3,13501)
   218     $(call ListPathsSafely_Printf,$1,$2,$3,13751)
   220     $(call ListPathsSafely_Printf,$1,$2,$3,14001)
   221     $(call ListPathsSafely_Printf,$1,$2,$3,14251)
   222     $(call ListPathsSafely_Printf,$1,$2,$3,14501)
   223     $(call ListPathsSafely_Printf,$1,$2,$3,14751)
   225     $(call ListPathsSafely_Printf,$1,$2,$3,15001)
   226     $(call ListPathsSafely_Printf,$1,$2,$3,15251)
   227     $(call ListPathsSafely_Printf,$1,$2,$3,15501)
   228     $(call ListPathsSafely_Printf,$1,$2,$3,15751)
   229 endef
   231 define ListPathsSafelyNow_IfPrintf
   232     ifneq (,$$(word $4,$$($1)))
   233         $$(eval $1_LPS$4:=$$(call compress_paths,$$(wordlist $4,$5,$$($1))))
   234         $$(shell printf -- "$$(strip $$($1_LPS$4))\n" | $(decompress_paths) $3)
   235     endif
   236 endef
   238 # And an non-receipt version:
   239 define ListPathsSafelyNow
   240     ifneq (,$$(word 10001,$$($1)))
   241         $$(error Cannot list safely more than 10000 paths. $1 has $$(words $$($1)) paths!)
   242     endif
   243     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1,250)
   244     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,251,500)
   245     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,501,750)
   246     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,751,1000)
   248     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1001,1250)
   249     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1251,1500)
   250     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1501,1750)
   251     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1751,2000)
   253     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2001,2250)
   254     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2251,2500)
   255     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2501,2750)
   256     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2751,3000)
   258     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3001,3250)
   259     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3251,3500)
   260     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3501,3750)
   261     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3751,4000)
   263     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4001,4250)
   264     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4251,4500)
   265     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4501,4750)
   266     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4751,5000)
   268     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5001,5250)
   269     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5251,5500)
   270     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5501,5750)
   271     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5751,6000)
   273     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6001,6250)
   274     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6251,6500)
   275     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6501,6750)
   276     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6751,7000)
   278     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7001,7250)
   279     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7251,7500)
   280     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7501,7750)
   281     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7751,8000)
   283     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8001,8250)
   284     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8251,8500)
   285     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8501,8750)
   286     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8751,9000)
   288     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9001,9250)
   289     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9251,9500)
   290     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9501,9750)
   291     $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9751,10000)
   293 endef
   295 # The source tips can come from the Mercurial repository, or in the files
   296 #   $(HGTIP_FILENAME) which contains the tip but is also positioned in the same
   297 #   directory as the original $(HGDIR) directory.
   298 #   These should not be := assignments, only used from the root Makefile.
   299 HG_VERSION = $(shell $(HG) version 2> /dev/null)
   300 HG_DIRECTORY=.hg
   301 HGTIP_FILENAME=.hgtip
   302 HG_SEARCH = ./REPO ./*/REPO ./*/*/REPO ./*/*/*/REPO
   303 REPO_LIST = $(patsubst ./%,%,$(patsubst %/,%,$(sort $(dir \
   304     $(shell $(CD) $(SRC_ROOT) ; ( $(LS) -d $(HG_SEARCH:%/REPO=%/$(HG_DIRECTORY)) ; \
   305                                    $(LS)    $(HG_SEARCH:%/REPO=%/$(HGTIP_FILENAME)) ) \
   306 	        2> /dev/null)))))
   308 # Emit the repo:tip pairs to $@
   309 define GetSourceTips
   310 $(CD) $(SRC_ROOT) ; \
   311 for i in $(REPO_LIST) IGNORE ; do \
   312   if [ "$${i}" = "IGNORE" ] ; then \
   313     continue; \
   314   elif [ -d $${i}/$(HG_DIRECTORY) -a "$(HG_VERSION)" != "" ] ; then \
   315     $(PRINTF) " %s:%s" \
   316       "$${i}" `$(HG) tip --repository $${i} --template '{node|short}\n'` ; \
   317   elif [ -f $${i}/$(HGTIP_FILENAME) ] ; then \
   318     $(PRINTF) " %s:%s" \
   319       "$${i}" `$(CAT) $${i}/$(HGTIP_FILENAME)` ; \
   320   fi; \
   321 done >> $@
   322 $(PRINTF) "\n" >> $@
   323 endef
   325 # Create the HGTIP_FILENAME file. Called from jdk/make/closed/bundles.gmk
   326 define CreateHgTip
   327 $(HG) tip --repository $1 --template '{node|short}\n' > $1/$(HGTIP_FILENAME);\
   328 $(ECHO) $1/$(HGTIP_FILENAME)
   329 endef
   331 define SetupLogging
   332     ifeq ($$(LOG), trace)
   333         # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
   334         # For each target executed, will print
   335         # Building <TARGET> (from <FIRST PREREQUISITE>) (<ALL NEWER PREREQUISITES> newer)
   336         # 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)
   338         WRAPPER_SHELL:=$$(OLD_SHELL) $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(TIME),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log $$(OLD_SHELL)
   339         SHELL=$$(warning $$(if $$@,Building $$@,Running shell command) $$(if $$<, (from $$<))$$(if $$?, ($$(wordlist 1, 20, $$?) $$(if $$(wordlist 21, 22, $$?), ... [in total $$(words $$?) files]) newer)))$$(WRAPPER_SHELL)
   340     endif
   341     # Never remove warning messages; this is just for completeness
   342     LOG_WARN= 
   343     ifneq ($$(findstring $$(LOG),info debug trace),)
   344         LOG_INFO=
   345     else
   346         LOG_INFO=> /dev/null
   347     endif
   348     ifneq ($$(findstring $$(LOG),debug trace),)
   349         LOG_DEBUG=
   350     else
   351         LOG_DEBUG=> /dev/null
   352     endif
   353     ifneq ($$(findstring $$(LOG),trace),)
   354         LOG_TRACE=
   355     else
   356         LOG_TRACE=> /dev/null
   357     endif
   358 endef
   360 # Make sure logging is setup for everyone that includes MakeBase.gmk.
   361 $(eval $(call SetupLogging))
   363 # This is to be called by all SetupFoo macros
   364 define LogSetupMacroEntry
   365     $(if $(26),$(error Internal makefile error: Too many arguments to LogSetupMacroEntry, please update MakeBase.gmk))
   366     $(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))))))
   367 endef
   369 # Make directory without forking mkdir if not needed
   370 define MakeDir
   371     ifneq ($$(wildcard $1 $2 $3 $4 $5 $6 $7 $8 $9),$$(strip $1 $2 $3 $4 $5 $6 $7 $8 $9))
   372         $$(shell $(MKDIR) -p $1 $2 $3 $4 $5 $6 $7 $8 $9)
   373     endif
   374 endef
   376 ifeq ($(OPENJDK_TARGET_OS),solaris)
   377 # On Solaris, if the target is a symlink and exists, cp won't overwrite.
   378 define install-file
   379 	$(MKDIR) -p $(@D)
   380 	$(RM) '$@'
   381 	$(CP) -f -r -P '$<' '$(@D)'
   382 endef
   383 else ifeq ($(OPENJDK_TARGET_OS),macosx)
   384 define install-file
   385 	$(MKDIR) -p $(@D)
   386 	$(CP) -fpRP '$<' '$@'
   387 endef
   388 else
   389 define install-file
   390 	$(MKDIR) -p $(@D)
   391 	$(CP) -fP '$<' '$@'
   392 endef
   393 endif
   395 # Convenience functions for working around make's limitations with $(filter ).
   396 containing = $(foreach v,$2,$(if $(findstring $1,$v),$v))
   397 not-containing = $(foreach v,$2,$(if $(findstring $1,$v),,$v))
   399 ################################################################################
   400 # In Cygwin, finds are very costly, both because of expensive forks and because
   401 # of bad file system caching. Find is used extensively in $(shell) commands to
   402 # find source files. This makes rerunning make with no or few changes rather 
   403 # expensive. To speed this up, these two macros are used to cache the results
   404 # of simple find commands for reuse.
   405 # 
   406 # Runs a find and stores both the directories where it was run and the results.
   407 # This macro can be called multiple times to add to the cache. Only finds files
   408 # with no filters.
   409 #
   410 # Needs to be called with $(eval )
   411 # 
   412 # Param 1 - Dir to find in
   413 ifeq ($(OPENJDK_BUILD_OS),windows)
   414 define FillCacheFind
   415     FIND_CACHE_DIR += $1
   416     FIND_CACHE := $$(sort $$(FIND_CACHE) $$(shell $(FIND) $1 -type f -o -type l))
   417 endef
   418 else
   419 define FillCacheFind
   420 endef
   421 endif
   423 # Mimics find by looking in the cache if all of the directories have been cached.
   424 # Otherwise reverts to shell find. This is safe to call on all platforms, even if
   425 # cache is deactivated.
   426 #
   427 # The extra - is needed when FIND_CACHE_DIR is empty but should be harmless.
   428 # Param 1 - Dirs to find in
   429 define CacheFind
   430     $(if $(filter-out $(addsuffix %,- $(FIND_CACHE_DIR)),$1),\
   431         $(shell $(FIND) $1 -type f -o -type l),\
   432         $(filter $(addsuffix %,$1),$(FIND_CACHE)))
   433 endef
   435 ################################################################################
   437 endif # _MAKEBASE_GMK

mercurial