common/makefiles/MakeBase.gmk

changeset 557
d2c1f80118de
parent 501
e20ffc02e437
child 645
5b0b6ef58dbf
equal deleted inserted replaced
556:77f062a41850 557:d2c1f80118de
389 $(MKDIR) -p $(@D) 389 $(MKDIR) -p $(@D)
390 $(CP) -fP '$<' '$@' 390 $(CP) -fP '$<' '$@'
391 endef 391 endef
392 endif 392 endif
393 393
394 # Convenience functions for working around make's limitations with $(filter ).
395 containing = $(foreach v,$2,$(if $(findstring $1,$v),$v))
396 not-containing = $(foreach v,$2,$(if $(findstring $1,$v),,$v))
397
398 ################################################################################
399 # In Cygwin, finds are very costly, both because of expensive forks and because
400 # of bad file system caching. Find is used extensively in $(shell) commands to
401 # find source files. This makes rerunning make with no or few changes rather
402 # expensive. To speed this up, these two macros are used to cache the results
403 # of simple find commands for reuse.
404 #
405 # Runs a find and stores both the directories where it was run and the results.
406 # This macro can be called multiple times to add to the cache. Only finds files
407 # with no filters.
408 #
409 # Needs to be called with $(eval )
410 #
411 # Param 1 - Dir to find in
412 ifeq ($(OPENJDK_BUILD_OS),windows)
413 define FillCacheFind
414 FIND_CACHE_DIR += $1
415 FIND_CACHE := $$(sort $$(FIND_CACHE) $$(shell $(FIND) $1 -type f -o -type l))
416 endef
417 else
418 define FillCacheFind
419 endef
420 endif
421
422 # Mimics find by looking in the cache if all of the directories have been cached.
423 # Otherwise reverts to shell find. This is safe to call on all platforms, even if
424 # cache is deactivated.
425 #
426 # The extra - is needed when FIND_CACHE_DIR is empty but should be harmless.
427 # Param 1 - Dirs to find in
428 define CacheFind
429 $(if $(filter-out $(addsuffix %,- $(FIND_CACHE_DIR)),$1),\
430 $(shell $(FIND) $1 -type f -o -type l),\
431 $(filter $(addsuffix %,$1),$(FIND_CACHE)))
432 endef
433
434 ################################################################################
435
394 endif # _MAKEBASE_GMK 436 endif # _MAKEBASE_GMK

mercurial