提交 2e37e080 编写于 作者: C clanger

8189861: Refactor CacheFind

Reviewed-by: sgehwolf
上级 dc628d78
...@@ -71,7 +71,7 @@ define SetupBundleFileBody ...@@ -71,7 +71,7 @@ define SetupBundleFileBody
$$(call SetIfEmpty, $1_UNZIP_DEBUGINFO, false) $$(call SetIfEmpty, $1_UNZIP_DEBUGINFO, false)
$(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME): $$($1_FILES) $(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME): $$($1_FILES)
# If any of the files contain a space in the file name, CacheFind # If any of the files contain a space in the file name, FindFiles
# will have replaced it with ?. Tar does not accept that so need to # will have replaced it with ?. Tar does not accept that so need to
# switch it back. # switch it back.
$$(foreach d, $$($1_BASE_DIRS), \ $$(foreach d, $$($1_BASE_DIRS), \
...@@ -166,11 +166,12 @@ endif ...@@ -166,11 +166,12 @@ endif
################################################################################ ################################################################################
ifneq ($(filter product-bundles legacy-bundles, $(MAKECMDGOALS)), ) ifneq ($(filter product-bundles legacy-bundles, $(MAKECMDGOALS)), )
$(eval $(call FillCacheFind, $(IMAGES_OUTPUTDIR)))
SYMBOLS_EXCLUDE_PATTERN := %.debuginfo %.diz %.pdb %.map SYMBOLS_EXCLUDE_PATTERN := %.debuginfo %.diz %.pdb %.map
ALL_JDK_FILES := $(call CacheFind, $(JDK_IMAGE_DIR)) # There may be files with spaces in the names, so use ShellFindFiles
# explicitly.
ALL_JDK_FILES := $(call ShellFindFiles, $(JDK_IMAGE_DIR))
# Create special filter rules when dealing with unzipped .dSYM directories on # Create special filter rules when dealing with unzipped .dSYM directories on
# macosx # macosx
...@@ -201,11 +202,11 @@ ifneq ($(filter product-bundles legacy-bundles, $(MAKECMDGOALS)), ) ...@@ -201,11 +202,11 @@ ifneq ($(filter product-bundles legacy-bundles, $(MAKECMDGOALS)), )
$(ALL_JDK_FILES) \ $(ALL_JDK_FILES) \
) \ ) \
) \ ) \
$(call CacheFind, $(SYMBOLS_IMAGE_DIR)) $(call FindFiles, $(SYMBOLS_IMAGE_DIR))
TEST_DEMOS_BUNDLE_FILES := $(filter $(JDK_IMAGE_HOMEDIR)/demo/%, $(ALL_JDK_FILES)) TEST_DEMOS_BUNDLE_FILES := $(filter $(JDK_IMAGE_HOMEDIR)/demo/%, $(ALL_JDK_FILES))
ALL_JRE_FILES := $(call CacheFind, $(JRE_IMAGE_DIR)) ALL_JRE_FILES := $(call ShellFindFiles, $(JRE_IMAGE_DIR))
# Create special filter rules when dealing with unzipped .dSYM directories on # Create special filter rules when dealing with unzipped .dSYM directories on
# macosx # macosx
...@@ -338,7 +339,7 @@ endif ...@@ -338,7 +339,7 @@ endif
################################################################################ ################################################################################
ifneq ($(filter test-bundles, $(MAKECMDGOALS)), ) ifneq ($(filter test-bundles, $(MAKECMDGOALS)), )
TEST_BUNDLE_FILES := $(call CacheFind, $(TEST_IMAGE_DIR)) TEST_BUNDLE_FILES := $(call FindFiles, $(TEST_IMAGE_DIR))
$(eval $(call SetupBundleFile, BUILD_TEST_BUNDLE, \ $(eval $(call SetupBundleFile, BUILD_TEST_BUNDLE, \
BUNDLE_NAME := $(TEST_BUNDLE_NAME), \ BUNDLE_NAME := $(TEST_BUNDLE_NAME), \
...@@ -352,7 +353,7 @@ endif ...@@ -352,7 +353,7 @@ endif
################################################################################ ################################################################################
ifneq ($(filter docs-bundles, $(MAKECMDGOALS)), ) ifneq ($(filter docs-bundles, $(MAKECMDGOALS)), )
DOCS_BUNDLE_FILES := $(call CacheFind, $(DOCS_IMAGE_DIR)) DOCS_BUNDLE_FILES := $(call FindFiles, $(DOCS_IMAGE_DIR))
$(eval $(call SetupBundleFile, BUILD_DOCS_BUNDLE, \ $(eval $(call SetupBundleFile, BUILD_DOCS_BUNDLE, \
BUNDLE_NAME := $(DOCS_BUNDLE_NAME), \ BUNDLE_NAME := $(DOCS_BUNDLE_NAME), \
......
# #
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -43,7 +43,7 @@ $(eval $(call IncludeCustomExtension, CompileDemos-pre.gmk)) ...@@ -43,7 +43,7 @@ $(eval $(call IncludeCustomExtension, CompileDemos-pre.gmk))
# Prepare the find cache. # Prepare the find cache.
DEMO_SRC_DIRS += $(TOPDIR)/src/demo DEMO_SRC_DIRS += $(TOPDIR)/src/demo
$(eval $(call FillCacheFind, $(wildcard $(DEMO_SRC_DIRS)))) $(call FillFindCache, $(DEMO_SRC_DIRS))
# Append demo goals to this variable. # Append demo goals to this variable.
TARGETS = TARGETS =
...@@ -237,11 +237,11 @@ $(SUPPORT_OUTPUTDIR)/demos/image/nbproject/%: $(DEMO_SHARE_SRC)/nbproject/% ...@@ -237,11 +237,11 @@ $(SUPPORT_OUTPUTDIR)/demos/image/nbproject/%: $(DEMO_SHARE_SRC)/nbproject/%
ifeq ($(OPENJDK_TARGET_OS), solaris) ifeq ($(OPENJDK_TARGET_OS), solaris)
TARGETS += $(patsubst $(DEMO_SHARE_SRC)/nbproject/%, \ TARGETS += $(patsubst $(DEMO_SHARE_SRC)/nbproject/%, \
$(SUPPORT_OUTPUTDIR)/demos/image/nbproject/%, \ $(SUPPORT_OUTPUTDIR)/demos/image/nbproject/%, \
$(call CacheFind, $(DEMO_SHARE_SRC)/nbproject)) $(call FindFiles, $(DEMO_SHARE_SRC)/nbproject))
else else
TARGETS += $(patsubst $(DEMO_SHARE_SRC)/nbproject/%, \ TARGETS += $(patsubst $(DEMO_SHARE_SRC)/nbproject/%, \
$(SUPPORT_OUTPUTDIR)/demos/image/nbproject/%, \ $(SUPPORT_OUTPUTDIR)/demos/image/nbproject/%, \
$(call CacheFind, $(DEMO_SHARE_SRC)/nbproject)) $(call FindFiles, $(DEMO_SHARE_SRC)/nbproject))
endif endif
################################################################################ ################################################################################
...@@ -250,7 +250,7 @@ ifneq ($(filter images, $(MAKECMDGOALS)), ) ...@@ -250,7 +250,7 @@ ifneq ($(filter images, $(MAKECMDGOALS)), )
$(eval $(call SetupCopyFiles, COPY_TO_TEST_IMAGE, \ $(eval $(call SetupCopyFiles, COPY_TO_TEST_IMAGE, \
SRC := $(SUPPORT_OUTPUTDIR)/demos/image, \ SRC := $(SUPPORT_OUTPUTDIR)/demos/image, \
DEST := $(TEST_IMAGE_DIR)/jdk/demos, \ DEST := $(TEST_IMAGE_DIR)/jdk/demos, \
FILES := $(call CacheFind, $(SUPPORT_OUTPUTDIR)/demos/image), \ FILES := $(call FindFiles, $(SUPPORT_OUTPUTDIR)/demos/image), \
)) ))
IMAGES_TARGETS := $(COPY_TO_TEST_IMAGE) IMAGES_TARGETS := $(COPY_TO_TEST_IMAGE)
......
...@@ -644,7 +644,7 @@ endif ...@@ -644,7 +644,7 @@ endif
ifneq ($(wildcard $(IMPORT_MODULES_CLASSES)/$(MODULE)), ) ifneq ($(wildcard $(IMPORT_MODULES_CLASSES)/$(MODULE)), )
$(JDK_OUTPUTDIR)/modules/$(MODULE)/_imported.marker: \ $(JDK_OUTPUTDIR)/modules/$(MODULE)/_imported.marker: \
$(call CacheFind, $(IMPORT_MODULES_CLASSES)/$(MODULE)) $(call FindFiles, $(IMPORT_MODULES_CLASSES)/$(MODULE))
$(call MakeDir, $(@D)) $(call MakeDir, $(@D))
# Do not delete marker and build meta data files # Do not delete marker and build meta data files
$(RM) -r $(filter-out $(@D)/_%, $(wildcard $(@D)/*)) $(RM) -r $(filter-out $(@D)/_%, $(wildcard $(@D)/*))
......
# #
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -35,7 +35,7 @@ LIBS_DIR := $(wildcard $(addsuffix /$(MODULE), $(IMPORT_MODULES_LIBS))) ...@@ -35,7 +35,7 @@ LIBS_DIR := $(wildcard $(addsuffix /$(MODULE), $(IMPORT_MODULES_LIBS)))
CMDS_DIR := $(wildcard $(addsuffix /$(MODULE), $(IMPORT_MODULES_CMDS))) CMDS_DIR := $(wildcard $(addsuffix /$(MODULE), $(IMPORT_MODULES_CMDS)))
CONF_DIR := $(wildcard $(addsuffix /$(MODULE), $(IMPORT_MODULES_CONF))) CONF_DIR := $(wildcard $(addsuffix /$(MODULE), $(IMPORT_MODULES_CONF)))
$(eval $(call FillCacheFind, $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR))) $(call FillFindCache, $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR))
ifneq ($(LIBS_DIR), ) ifneq ($(LIBS_DIR), )
ifeq ($(OPENJDK_TARGET_OS), windows) ifeq ($(OPENJDK_TARGET_OS), windows)
...@@ -45,21 +45,21 @@ ifneq ($(LIBS_DIR), ) ...@@ -45,21 +45,21 @@ ifneq ($(LIBS_DIR), )
SRC := $(LIBS_DIR), \ SRC := $(LIBS_DIR), \
DEST := $(JDK_OUTPUTDIR)/bin, \ DEST := $(JDK_OUTPUTDIR)/bin, \
FILES := $(filter $(TO_BIN_FILTER), \ FILES := $(filter $(TO_BIN_FILTER), \
$(call CacheFind, $(LIBS_DIR))) \ $(call FindFiles, $(LIBS_DIR))) \
)) ))
$(eval $(call SetupCopyFiles, COPY_LIBS_TO_LIB, \ $(eval $(call SetupCopyFiles, COPY_LIBS_TO_LIB, \
SRC := $(LIBS_DIR), \ SRC := $(LIBS_DIR), \
DEST := $(JDK_OUTPUTDIR)/lib, \ DEST := $(JDK_OUTPUTDIR)/lib, \
FILES := $(filter-out $(TO_BIN_FILTER), \ FILES := $(filter-out $(TO_BIN_FILTER), \
$(call CacheFind, $(LIBS_DIR))) \ $(call FindFiles, $(LIBS_DIR))) \
)) ))
TARGETS += $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB) TARGETS += $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB)
else else
$(eval $(call SetupCopyFiles, COPY_LIBS, \ $(eval $(call SetupCopyFiles, COPY_LIBS, \
SRC := $(LIBS_DIR), \ SRC := $(LIBS_DIR), \
DEST := $(JDK_OUTPUTDIR)/lib, \ DEST := $(JDK_OUTPUTDIR)/lib, \
FILES := $(filter %$(SHARED_LIBRARY_SUFFIX), $(call CacheFind, $(LIBS_DIR))), \ FILES := $(filter %$(SHARED_LIBRARY_SUFFIX), $(call FindFiles, $(LIBS_DIR))), \
)) ))
# Use relative links if the import dir is inside the OUTPUTDIR, otherwise # Use relative links if the import dir is inside the OUTPUTDIR, otherwise
...@@ -75,7 +75,7 @@ ifneq ($(LIBS_DIR), ) ...@@ -75,7 +75,7 @@ ifneq ($(LIBS_DIR), )
$(eval $(call SetupCopyFiles, LINK_LIBS, \ $(eval $(call SetupCopyFiles, LINK_LIBS, \
SRC := $(LIBS_DIR), \ SRC := $(LIBS_DIR), \
DEST := $(JDK_OUTPUTDIR)/lib, \ DEST := $(JDK_OUTPUTDIR)/lib, \
FILES := $(filter-out %$(SHARED_LIBRARY_SUFFIX), $(call CacheFind, $(LIBS_DIR))), \ FILES := $(filter-out %$(SHARED_LIBRARY_SUFFIX), $(call FindFiles, $(LIBS_DIR))), \
MACRO := $(LINK_MACRO), \ MACRO := $(LINK_MACRO), \
LOG_ACTION := $(LOG_ACTION), \ LOG_ACTION := $(LOG_ACTION), \
)) ))
...@@ -87,7 +87,7 @@ ifneq ($(CMDS_DIR), ) ...@@ -87,7 +87,7 @@ ifneq ($(CMDS_DIR), )
$(eval $(call SetupCopyFiles, COPY_CMDS, \ $(eval $(call SetupCopyFiles, COPY_CMDS, \
SRC := $(CMDS_DIR), \ SRC := $(CMDS_DIR), \
DEST := $(JDK_OUTPUTDIR)/bin, \ DEST := $(JDK_OUTPUTDIR)/bin, \
FILES := $(call CacheFind, $(CMDS_DIR)), \ FILES := $(call FindFiles, $(CMDS_DIR)), \
)) ))
TARGETS += $(COPY_CMDS) TARGETS += $(COPY_CMDS)
endif endif
...@@ -96,7 +96,7 @@ ifneq ($(CONF_DIR), ) ...@@ -96,7 +96,7 @@ ifneq ($(CONF_DIR), )
$(eval $(call SetupCopyFiles, COPY_CONF, \ $(eval $(call SetupCopyFiles, COPY_CONF, \
SRC := $(CONF_DIR), \ SRC := $(CONF_DIR), \
DEST := $(JDK_OUTPUTDIR)/lib, \ DEST := $(JDK_OUTPUTDIR)/lib, \
FILES := $(call CacheFind, $(CONF_DIR)), \ FILES := $(call FindFiles, $(CONF_DIR)), \
)) ))
TARGETS += $(COPY_CONF) TARGETS += $(COPY_CONF)
endif endif
......
# #
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -39,7 +39,7 @@ MODULES_TO_COPY := $(sort \ ...@@ -39,7 +39,7 @@ MODULES_TO_COPY := $(sort \
COPY_CLASSES_TARGET := $(BUILDJDK_OUTPUTDIR)/jdk/modules/java.base/_the.buildjdk-copy-marker COPY_CLASSES_TARGET := $(BUILDJDK_OUTPUTDIR)/jdk/modules/java.base/_the.buildjdk-copy-marker
$(COPY_CLASSES_TARGET): $(call CacheFind, $(wildcard \ $(COPY_CLASSES_TARGET): $(call FindFiles, $(wildcard \
$(addprefix $(JDK_OUTPUTDIR)/modules/, $(MODULES_TO_COPY)))) $(addprefix $(JDK_OUTPUTDIR)/modules/, $(MODULES_TO_COPY))))
$(ECHO) $(LOG_INFO) "Copying java modules to buildjdk: $(MODULES_TO_COPY)" $(ECHO) $(LOG_INFO) "Copying java modules to buildjdk: $(MODULES_TO_COPY)"
$(RM) -r $(BUILDJDK_OUTPUTDIR)/jdk/modules $(RM) -r $(BUILDJDK_OUTPUTDIR)/jdk/modules
...@@ -56,7 +56,7 @@ TARGETS += $(COPY_CLASSES_TARGET) ...@@ -56,7 +56,7 @@ TARGETS += $(COPY_CLASSES_TARGET)
$(eval $(call SetupCopyFiles, COPY_SUPPORT_HEADERS, \ $(eval $(call SetupCopyFiles, COPY_SUPPORT_HEADERS, \
SRC := $(OUTPUTDIR), \ SRC := $(OUTPUTDIR), \
DEST := $(BUILDJDK_OUTPUTDIR), \ DEST := $(BUILDJDK_OUTPUTDIR), \
FILES := $(call CacheFind, $(wildcard \ FILES := $(call FindFiles, $(wildcard \
$(addprefix $(SUPPORT_OUTPUTDIR)/headers/, $(MODULES_TO_COPY)))), \ $(addprefix $(SUPPORT_OUTPUTDIR)/headers/, $(MODULES_TO_COPY)))), \
)) ))
......
...@@ -51,33 +51,33 @@ INCLUDE_HEADERS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \ ...@@ -51,33 +51,33 @@ INCLUDE_HEADERS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
MAN_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \ MAN_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
$(SUPPORT_OUTPUTDIR)/modules_man $(IMPORT_MODULES_MAN)))) $(SUPPORT_OUTPUTDIR)/modules_man $(IMPORT_MODULES_MAN))))
$(eval $(call FillCacheFind, \ $(call FillFindCache, \
$(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR) $(CLASSES_DIR) \ $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR) $(CLASSES_DIR) \
)) )
ifneq ($(LIBS_DIR), ) ifneq ($(LIBS_DIR), )
JMOD_FLAGS += --libs $(LIBS_DIR) JMOD_FLAGS += --libs $(LIBS_DIR)
DEPS += $(call CacheFind, $(LIBS_DIR)) DEPS += $(call FindFiles, $(LIBS_DIR))
endif endif
ifneq ($(CMDS_DIR), ) ifneq ($(CMDS_DIR), )
JMOD_FLAGS += --cmds $(CMDS_DIR) JMOD_FLAGS += --cmds $(CMDS_DIR)
DEPS += $(call CacheFind, $(CMDS_DIR)) DEPS += $(call FindFiles, $(CMDS_DIR))
endif endif
ifneq ($(CONF_DIR), ) ifneq ($(CONF_DIR), )
JMOD_FLAGS += --config $(CONF_DIR) JMOD_FLAGS += --config $(CONF_DIR)
DEPS += $(call CacheFind, $(CONF_DIR)) DEPS += $(call FindFiles, $(CONF_DIR))
endif endif
ifneq ($(CLASSES_DIR), ) ifneq ($(CLASSES_DIR), )
JMOD_FLAGS += --class-path $(CLASSES_DIR) JMOD_FLAGS += --class-path $(CLASSES_DIR)
DEPS += $(call CacheFind, $(CLASSES_DIR)) DEPS += $(call FindFiles, $(CLASSES_DIR))
endif endif
ifneq ($(INCLUDE_HEADERS_DIR), ) ifneq ($(INCLUDE_HEADERS_DIR), )
JMOD_FLAGS += --header-files $(INCLUDE_HEADERS_DIR) JMOD_FLAGS += --header-files $(INCLUDE_HEADERS_DIR)
DEPS += $(call CacheFind, $(INCLUDE_HEADERS_DIR)) DEPS += $(call FindFiles, $(INCLUDE_HEADERS_DIR))
endif endif
ifneq ($(MAN_DIR), ) ifneq ($(MAN_DIR), )
JMOD_FLAGS += --man-pages $(MAN_DIR) JMOD_FLAGS += --man-pages $(MAN_DIR)
DEPS += $(call CacheFind, $(MAN_DIR)) DEPS += $(call FindFiles, $(MAN_DIR))
endif endif
# If a specific modules_legal dir exists for this module, only pick up files # If a specific modules_legal dir exists for this module, only pick up files
...@@ -91,7 +91,7 @@ LEGAL_NOTICES := \ ...@@ -91,7 +91,7 @@ LEGAL_NOTICES := \
) )
LEGAL_NOTICES_PATH := $(call PathList, $(LEGAL_NOTICES)) LEGAL_NOTICES_PATH := $(call PathList, $(LEGAL_NOTICES))
DEPS += $(call CacheFind, $(LEGAL_NOTICES)) DEPS += $(call FindFiles, $(LEGAL_NOTICES))
JMOD_FLAGS += --legal-notices $(LEGAL_NOTICES_PATH) JMOD_FLAGS += --legal-notices $(LEGAL_NOTICES_PATH)
...@@ -145,7 +145,7 @@ endif ...@@ -145,7 +145,7 @@ endif
# the actual command. Filter that out using wildcard before adding to DEPS. # the actual command. Filter that out using wildcard before adding to DEPS.
DEPS += $(wildcard $(JMOD_CMD)) DEPS += $(wildcard $(JMOD_CMD))
ifeq ($(EXTERNAL_BUILDJDK), false) ifeq ($(EXTERNAL_BUILDJDK), false)
DEPS += $(call CacheFind, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod) DEPS += $(call FindFiles, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod)
endif endif
# If creating interim versions of jmods, certain files need to be filtered out # If creating interim versions of jmods, certain files need to be filtered out
......
...@@ -341,7 +341,7 @@ define SetupApiDocsGenerationBody ...@@ -341,7 +341,7 @@ define SetupApiDocsGenerationBody
$$(SUPPORT_OUTPUTDIR)/docs/$1.vardeps) $$(SUPPORT_OUTPUTDIR)/docs/$1.vardeps)
# Get a list of all files in all the source dirs for all included modules # Get a list of all files in all the source dirs for all included modules
$1_SOURCE_DEPS := $$(call CacheFind, $$(wildcard $$(foreach module, \ $1_SOURCE_DEPS := $$(call FindFiles, $$(wildcard $$(foreach module, \
$$($1_ALL_MODULES), $$(call FindModuleSrcDirs, $$(module))))) $$($1_ALL_MODULES), $$(call FindModuleSrcDirs, $$(module)))))
# Javadoc creates a lot of files but use index.html as a marker # Javadoc creates a lot of files but use index.html as a marker
...@@ -496,7 +496,7 @@ JDK_INDEX_TARGETS += $(JDK_INDEX_HTML) ...@@ -496,7 +496,7 @@ JDK_INDEX_TARGETS += $(JDK_INDEX_HTML)
GLOBAL_SPECS_RESOURCES_DIR := $(TOPDIR)/make/data/docs-resources/ GLOBAL_SPECS_RESOURCES_DIR := $(TOPDIR)/make/data/docs-resources/
$(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \ $(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \
SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \ SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \
FILES := $(call CacheFind, $(GLOBAL_SPECS_RESOURCES_DIR)), \ FILES := $(call FindFiles, $(GLOBAL_SPECS_RESOURCES_DIR)), \
DEST := $(DOCS_OUTPUTDIR), \ DEST := $(DOCS_OUTPUTDIR), \
)) ))
JDK_INDEX_TARGETS += $(COPY_GLOBAL_RESOURCES) JDK_INDEX_TARGETS += $(COPY_GLOBAL_RESOURCES)
...@@ -521,10 +521,10 @@ COPY_SPEC_FILTER := %.html %.gif %.jpg %.mib %.css ...@@ -521,10 +521,10 @@ COPY_SPEC_FILTER := %.html %.gif %.jpg %.mib %.css
$(foreach m, $(ALL_MODULES), \ $(foreach m, $(ALL_MODULES), \
$(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \ $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
$(foreach d, $(SPECS_$m), \ $(foreach d, $(SPECS_$m), \
$(if $(filter $(COPY_SPEC_FILTER), $(call CacheFind, $d)), \ $(if $(filter $(COPY_SPEC_FILTER), $(call FindFiles, $d)), \
$(eval $(call SetupCopyFiles, COPY_$m, \ $(eval $(call SetupCopyFiles, COPY_$m, \
SRC := $d, \ SRC := $d, \
FILES := $(filter $(COPY_SPEC_FILTER), $(call CacheFind, $d)), \ FILES := $(filter $(COPY_SPEC_FILTER), $(call FindFiles, $d)), \
DEST := $(DOCS_OUTPUTDIR)/specs/, \ DEST := $(DOCS_OUTPUTDIR)/specs/, \
)) \ )) \
$(eval JDK_SPECS_TARGETS += $(COPY_$m)) \ $(eval JDK_SPECS_TARGETS += $(COPY_$m)) \
...@@ -541,11 +541,11 @@ ifeq ($(ENABLE_FULL_DOCS), true) ...@@ -541,11 +541,11 @@ ifeq ($(ENABLE_FULL_DOCS), true)
$(foreach m, $(ALL_MODULES), \ $(foreach m, $(ALL_MODULES), \
$(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \ $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
$(foreach d, $(SPECS_$m), \ $(foreach d, $(SPECS_$m), \
$(if $(filter %.md, $(call CacheFind, $d)), \ $(if $(filter %.md, $(call FindFiles, $d)), \
$(eval $m_$d_NAME := CONVERT_MARKDOWN_$m_$(strip $(call RelativePath, $d, $(TOPDIR)))) \ $(eval $m_$d_NAME := CONVERT_MARKDOWN_$m_$(strip $(call RelativePath, $d, $(TOPDIR)))) \
$(eval $(call SetupProcessMarkdown, $($m_$d_NAME), \ $(eval $(call SetupProcessMarkdown, $($m_$d_NAME), \
SRC := $d, \ SRC := $d, \
FILES := $(filter %.md, $(call CacheFind, $d)), \ FILES := $(filter %.md, $(call FindFiles, $d)), \
DEST := $(DOCS_OUTPUTDIR)/specs/, \ DEST := $(DOCS_OUTPUTDIR)/specs/, \
CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \ CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
)) \ )) \
......
...@@ -276,21 +276,14 @@ endif ...@@ -276,21 +276,14 @@ endif
ifeq ($(GCOV_ENABLED), true) ifeq ($(GCOV_ENABLED), true)
GCOV_FIND_EXPR := -type f -name "*.gcno" $(eval $(call SetupCopyFiles,COPY_GCOV_GCNO, \
$(eval $(call SetupCopyFiles,COPY_HOTSPOT_GCOV_GCNO, \
SRC := $(OUTPUTDIR), \
DEST := $(SYMBOLS_IMAGE_DIR)/gcov, \
FILES := $(shell $(FIND) $(HOTSPOT_OUTPUTDIR) $(GCOV_FIND_EXPR))))
SYMBOLS_TARGETS += $(COPY_HOTSPOT_GCOV_GCNO)
$(eval $(call SetupCopyFiles,COPY_JDK_GCOV_GCNO, \
SRC := $(OUTPUTDIR), \ SRC := $(OUTPUTDIR), \
DEST := $(SYMBOLS_IMAGE_DIR)/gcov, \ DEST := $(SYMBOLS_IMAGE_DIR)/gcov, \
FILES := $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/native $(GCOV_FIND_EXPR)))) FILES := $(call FindFiles, $(HOTSPOT_OUTPUTDIR) \
$(SUPPORT_OUTPUTDIR)/native, *.gcno) \
))
SYMBOLS_TARGETS += $(COPY_JDK_GCOV_GCNO) SYMBOLS_TARGETS += $(COPY_GCOV_GCNO)
endif endif
...@@ -323,10 +316,10 @@ else ...@@ -323,10 +316,10 @@ else
# On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM # On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM
# dirs. # dirs.
ifeq ($(OPENJDK_TARGET_OS), macosx) ifeq ($(OPENJDK_TARGET_OS), macosx)
$(eval $(call FillCacheFind, \ $(call FillFindCache, \
$(SUPPORT_OUTPUTDIR)/modules_cmds $(SUPPORT_OUTPUTDIR)/modules_libs)) $(SUPPORT_OUTPUTDIR)/modules_cmds $(SUPPORT_OUTPUTDIR)/modules_libs)
FindDebuginfoFiles = \ FindDebuginfoFiles = \
$(if $(wildcard $1), $(call containing, .dSYM/, $(call CacheFind, $1))) $(if $(wildcard $1), $(call containing, .dSYM/, $(call FindFiles, $1)))
endif endif
endif endif
......
# #
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -52,13 +52,13 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) ...@@ -52,13 +52,13 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
$(eval $(call SetupCopyFiles, COPY_JDK_IMAGE, \ $(eval $(call SetupCopyFiles, COPY_JDK_IMAGE, \
SRC := $(JDK_IMAGE_DIR), \ SRC := $(JDK_IMAGE_DIR), \
DEST := $(JDK_MACOSX_CONTENTS_DIR)/Home, \ DEST := $(JDK_MACOSX_CONTENTS_DIR)/Home, \
FILES := $(call CacheFind, $(JDK_IMAGE_DIR)), \ FILES := $(call FindFiles, $(JDK_IMAGE_DIR)), \
)) ))
$(eval $(call SetupCopyFiles, COPY_JRE_IMAGE, \ $(eval $(call SetupCopyFiles, COPY_JRE_IMAGE, \
SRC := $(JRE_IMAGE_DIR), \ SRC := $(JRE_IMAGE_DIR), \
DEST := $(JRE_MACOSX_CONTENTS_DIR)/Home, \ DEST := $(JRE_MACOSX_CONTENTS_DIR)/Home, \
FILES := $(call CacheFind, $(JRE_IMAGE_DIR)), \ FILES := $(call FindFiles, $(JRE_IMAGE_DIR)), \
)) ))
$(eval $(call SetupCopyFiles, COPY_LIBJLI_JDK, \ $(eval $(call SetupCopyFiles, COPY_LIBJLI_JDK, \
......
# #
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -87,6 +87,7 @@ ifeq ($(SRC_GENERATED), true) ...@@ -87,6 +87,7 @@ ifeq ($(SRC_GENERATED), true)
EXCLUDE_FILES := $(SRC_ZIP_EXCLUDE_FILES), \ EXCLUDE_FILES := $(SRC_ZIP_EXCLUDE_FILES), \
SUFFIXES := .java, \ SUFFIXES := .java, \
ZIP := $(SUPPORT_OUTPUTDIR)/src.zip, \ ZIP := $(SUPPORT_OUTPUTDIR)/src.zip, \
FOLLOW_SYMLINKS := true, \
)) ))
do-zip: $(BUILD_SRC_ZIP) do-zip: $(BUILD_SRC_ZIP)
......
# #
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -122,9 +122,9 @@ define SetupJarArchiveBody ...@@ -122,9 +122,9 @@ define SetupJarArchiveBody
ifeq ($$($1_DEPENDENCIES), ) ifeq ($$($1_DEPENDENCIES), )
# Add all source roots to the find cache since we are likely going to run find # Add all source roots to the find cache since we are likely going to run find
# on these more than once. The cache will only be updated if necessary. # on these more than once. The cache will only be updated if necessary.
$$(eval $$(call FillCacheFind, $$($1_FIND_LIST))) $$(call FillFindCache, $$($1_FIND_LIST))
$1_DEPENDENCIES:=$$(filter $$(addprefix %,$$($1_SUFFIXES)), \ $1_DEPENDENCIES:=$$(filter $$(addprefix %,$$($1_SUFFIXES)), \
$$(call CacheFind,$$($1_SRCS))) $$(call FindFiles,$$($1_SRCS)))
ifneq (,$$($1_GREP_INCLUDE_PATTERNS)) ifneq (,$$($1_GREP_INCLUDE_PATTERNS))
$1_DEPENDENCIES:=$$(filter $$(addsuffix %,$$($1_GREP_INCLUDE_PATTERNS)),$$($1_DEPENDENCIES)) $1_DEPENDENCIES:=$$(filter $$(addsuffix %,$$($1_GREP_INCLUDE_PATTERNS)),$$($1_DEPENDENCIES))
endif endif
...@@ -135,7 +135,7 @@ define SetupJarArchiveBody ...@@ -135,7 +135,7 @@ define SetupJarArchiveBody
$1_DEPENDENCIES+=$$(wildcard $$(foreach src, $$($1_SRCS), \ $1_DEPENDENCIES+=$$(wildcard $$(foreach src, $$($1_SRCS), \
$$(addprefix $$(src)/, $$($1_EXTRA_FILES))) $$($1_EXTRA_FILES)) $$(addprefix $$(src)/, $$($1_EXTRA_FILES))) $$($1_EXTRA_FILES))
ifeq (,$$($1_SKIP_METAINF)) ifeq (,$$($1_SKIP_METAINF))
$1_DEPENDENCIES+=$$(call CacheFind,$$(wildcard $$(addsuffix /META-INF,$$($1_SRCS)))) $1_DEPENDENCIES+=$$(call FindFiles,$$(wildcard $$(addsuffix /META-INF,$$($1_SRCS))))
endif endif
endif endif
# The dependency list should never be empty # The dependency list should never be empty
......
# #
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -221,13 +221,12 @@ define SetupJavaCompilationBody ...@@ -221,13 +221,12 @@ define SetupJavaCompilationBody
) \ ) \
) )
$$(call MakeDir,$$($1_BIN)) $$(call MakeDir,$$($1_BIN))
# Add all source roots to the find cache since we are likely going to run find # Order src files according to the order of the src dirs. Correct odering is
# on these more than once. The cache will only be updated if necessary. # needed for correct overriding between different source roots.
$$(eval $$(call FillCacheFind, $$($1_SRC))) $1_ALL_SRC_RAW := $$(call FindFiles, $$($1_SRC))
# Find all files in the source trees. Preserve order of source roots so that $1_ALL_SRCS := $$($1_EXTRA_FILES) \
# the first version in case of multiple instances of the same file is selected. $$(foreach d, $$($1_SRC), $$(filter $$d%, $$($1_ALL_SRC_RAW)))
# CacheFind does not preserve order so need to call it for each root.
$1_ALL_SRCS += $$($1_EXTRA_FILES) $$(foreach s, $$($1_SRC), $$(call CacheFind, $$s))
# Extract the java files. # Extract the java files.
$1_SRCS := $$(filter %.java, $$($1_ALL_SRCS)) $1_SRCS := $$(filter %.java, $$($1_ALL_SRCS))
......
...@@ -64,10 +64,12 @@ define NEWLINE ...@@ -64,10 +64,12 @@ define NEWLINE
endef endef
# In GNU Make 4.0 and higher, there is a file function for writing to files. # Certain features only work in newer version of GNU Make. The build will still
# function in 3.81, but will be less performant.
ifeq (4.0, $(firstword $(sort 4.0 $(MAKE_VERSION)))) ifeq (4.0, $(firstword $(sort 4.0 $(MAKE_VERSION))))
HAS_FILE_FUNCTION := true HAS_FILE_FUNCTION := true
CORRECT_FUNCTION_IN_RECIPE_EVALUATION := true CORRECT_FUNCTION_IN_RECIPE_EVALUATION := true
RWILDCARD_WORKS := true
endif endif
############################## ##############################
...@@ -466,8 +468,8 @@ endef ...@@ -466,8 +468,8 @@ endef
################################################################################ ################################################################################
# Replace question marks with space in string. This macro needs to be called on # Replace question marks with space in string. This macro needs to be called on
# files from CacheFind in case any of them contains space in their file name, # files from FindFiles in case any of them contains space in their file name,
# since CacheFind replaces space with ?. # since FindFiles replaces space with ?.
# Param 1 - String to replace in # Param 1 - String to replace in
DecodeSpace = \ DecodeSpace = \
$(subst ?,$(SPACE),$(strip $1)) $(subst ?,$(SPACE),$(strip $1))
...@@ -685,73 +687,116 @@ uppercase = \ ...@@ -685,73 +687,116 @@ uppercase = \
################################################################################ ################################################################################
ifneq ($(DISABLE_CACHE_FIND), true) # Recursive wildcard function. Walks down directories recursively and matches
# In Cygwin, finds are very costly, both because of expensive forks and because # files with the search patterns. Patterns use standard file wildcards (* and
# 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 # $1 - Directories to start search in
# of simple find commands for reuse. # $2 - Search patterns
# rwildcard = \
# Runs a find and stores both the directories where it was run and the results. $(strip \
# This macro can be called multiple times to add to the cache. Only finds files $(foreach d, \
# with no filters. $(patsubst %/,%,$(sort $(dir $(wildcard $(addsuffix /*/*, $(strip $1)))))), \
# $(call rwildcard,$d,$2) \
# Files containing space will get spaces replaced with ? because GNU Make ) \
# cannot handle lists of files with space in them. By using ?, make will match $(call DoubleDollar, $(wildcard $(foreach p, $2, $(addsuffix /$(strip $p), $(strip $1))))) \
# the wildcard to space in many situations so we don't need to replace back )
# to space on every use. While not a complete solution it does allow some uses
# of CacheFind to function with spaces in file names, including for
# SetupCopyFiles.
#
# Needs to be called with $(eval )
#
# Even if the performance benifit is negligible on other platforms, keep the
# functionality active unless explicitly disabled to exercise it more.
#
# Initialize FIND_CACHE_DIRS with := to make it a non recursively-expanded variable
FIND_CACHE_DIRS :=
# Param 1 - Dirs to find in
# Param 2 - (optional) specialization. Normally "-a \( ... \)" expression.
define FillCacheFind
# Filter out already cached dirs. The - is needed when FIND_CACHE_DIRS is empty
# since filter out will then return empty.
FIND_CACHE_NEW_DIRS := $$(filter-out $$(addsuffix /%,\
- $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS), $1)
ifneq ($$(FIND_CACHE_NEW_DIRS), )
# Remove any trailing slash from dirs in the cache dir list
FIND_CACHE_DIRS += $$(patsubst %/,%, $$(FIND_CACHE_NEW_DIRS))
FIND_CACHE := $$(sort $$(FIND_CACHE) \
$$(shell $(FIND) $$(wildcard $$(FIND_CACHE_NEW_DIRS)) \
\( -type f -o -type l \) $2 | $(TR) ' ' '?'))
endif
endef
# Mimics find by looking in the cache if all of the directories have been cached. # Find non directories using recursive wildcard function. This function may
# Otherwise reverts to shell find. This is safe to call on all platforms, even if # be used directly when a small amount of directories is expected to be
# cache is deactivated. # searched and caching is not expected to be of use.
# #
# $1 can be either a directory or a file. If it's a directory, make # $1 - Directory to start search in
# sure we have exactly one trailing slash before the wildcard. # $2 - Optional search patterns, defaults to '*'.
# The extra - is needed when FIND_CACHE_DIRS is empty but should be harmless. WildcardFindFiles = \
# $(sort $(strip \
# Param 1 - Dirs to find in $(eval WildcardFindFiles_result := $(call rwildcard,$(patsubst %/,%,$1),$(if $(strip $2),$2,*))) \
# Param 2 - (optional) specialization. Normally "-a \( ... \)" expression. $(filter-out $(patsubst %/,%,$(sort $(dir $(WildcardFindFiles_result)))), \
define CacheFind $(WildcardFindFiles_result) \
$(if $(filter-out $(addsuffix /%,- $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS),$1), \ ) \
$(if $(wildcard $1), $(shell $(FIND) $(wildcard $1) \( -type f -o -type l \) $2 \ ))
| $(TR) ' ' '?')), \
$(filter $(addsuffix /%,$(patsubst %/,%,$1)) $1,$(FIND_CACHE))) # Find non directories using the find utility in the shell. Safe to call for
endef # non existing directories, or directories containing wildcards.
#
# Files containing space will get spaces replaced with ? because GNU Make
# cannot handle lists of files with space in them. By using ?, make will match
# the wildcard to space in many situations so we don't need to replace back
# to space on every use. While not a complete solution it does allow some uses
# of FindFiles to function with spaces in file names, including for
# SetupCopyFiles. Unfortunately this does not work for WildcardFindFiles so
# if files with spaces are anticipated, use ShellFindFiles directly.
#
# $1 - Directories to start search in.
# $2 - Optional search patterns, empty means find everything. Patterns use
# standard file wildcards (* and ?) and should not be quoted.
# $3 - Optional options to find.
ShellFindFiles = \
$(if $(wildcard $1), \
$(sort \
$(shell $(FIND) $3 $(patsubst %/,%,$(wildcard $1)) \( -type f -o -type l \) \
$(if $(strip $2), -a \( -name "$(firstword $2)" \
$(foreach p, $(filter-out $(firstword $2), $2), -o -name "$(p)") \)) \
| $(TR) ' ' '?' \
) \
) \
)
# Find non directories using the method most likely to work best for the
# current build host
#
# $1 - Directory to start search in
# $2 - Optional search patterns, defaults to '*'.
ifeq ($(OPENJDK_BUILD_OS)-$(RWILDCARD_WORKS), windows-true)
DirectFindFiles = $(WildcardFindFiles)
else else
# If CacheFind is disabled, just run the find command. DirectFindFiles = $(ShellFindFiles)
# Param 1 - Dirs to find in endif
# Param 2 - (optional) specialization. Normally "-a \( ... \)" expression.
define CacheFind # Finds files using a cache that is populated by FillFindCache below. If any of
$(if $(wildcard $1, \ # the directories given have not been cached, DirectFindFiles is used for
$(shell $(FIND) $(wildcard $1) \( -type f -o -type l \) $2 | $(TR) ' ' '?') \ # everything. Caching is especially useful in Cygwin, where file finds are very
# costly.
#
# $1 - Directories to start search in.
# $2 - Optional search patterns. If used, no caching is done.
CacheFindFiles_CACHED_DIRS :=
CacheFindFiles_CACHED_FILES :=
CacheFindFiles = \
$(if $2, \
$(call DirectFindFiles, $1, $2) \
, \
$(if $(filter-out $(addsuffix /%, $(CacheFindFiles_CACHED_DIRS)) \
$(CacheFindFiles_CACHED_DIRS), $1), \
$(call DirectFindFiles, $1) \
, \
$(filter $(addsuffix /%,$(patsubst %/,%,$1)) $1,$(CacheFindFiles_CACHED_FILES)) \
) \
) )
endef
# Explicitly adds files to the find cache used by CacheFindFiles.
#
# $1 - Directories to start search in
FillFindCache = \
$(eval CacheFindFiles_NEW_DIRS := $$(filter-out $$(addsuffix /%,\
$$(CacheFindFiles_CACHED_DIRS)) $$(CacheFindFiles_CACHED_DIRS), $1)) \
$(if $(CacheFindFiles_NEW_DIRS), \
$(eval CacheFindFiles_CACHED_DIRS += $$(patsubst %/,%,$$(CacheFindFiles_NEW_DIRS))) \
$(eval CacheFindFiles_CACHED_FILES := $$(sort $$(CacheFindFiles_CACHED_FILES) \
$$(call DirectFindFiles, $$(CacheFindFiles_NEW_DIRS)))) \
)
# Findfiles is the default macro that should be used to find files in the file
# system. This function does not always support files with spaces in the names.
# If files with spaces are anticipated, use ShellFindFiles directly.
#
# $1 - Directories to start search in.
# $2 - Optional search patterns, empty means find everything. Patterns use
# standard file wildcards (* and ?) and should not be quoted.
ifeq ($(DISABLE_CACHE_FIND), true)
FindFiles = $(DirectFindFiles)
else
FindFiles = $(CacheFindFiles)
endif endif
################################################################################ ################################################################################
......
# #
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -519,7 +519,7 @@ define SetupNativeCompilationBody ...@@ -519,7 +519,7 @@ define SetupNativeCompilationBody
$$(error SRC specified to SetupNativeCompilation $1 contains missing directory $$d))) $$(error SRC specified to SetupNativeCompilation $1 contains missing directory $$d)))
# Find all files in the source trees. Preserve order. # Find all files in the source trees. Preserve order.
$1_SRCS := $$(foreach s, $$($1_SRC), $$(call CacheFind, $$(s))) $1_SRCS := $$(foreach s, $$($1_SRC), $$(call FindFiles, $$(s)))
$1_SRCS := $$(filter $$(NATIVE_SOURCE_EXTENSIONS), $$($1_SRCS)) $1_SRCS := $$(filter $$(NATIVE_SOURCE_EXTENSIONS), $$($1_SRCS))
# Extract the C/C++ files. # Extract the C/C++ files.
ifneq ($$($1_EXCLUDE_PATTERNS), ) ifneq ($$($1_EXCLUDE_PATTERNS), )
......
# #
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -75,7 +75,7 @@ define SetupTestFilesCompilationBody ...@@ -75,7 +75,7 @@ define SetupTestFilesCompilationBody
# Locate all files with the matching prefix # Locate all files with the matching prefix
$1_FILE_LIST := \ $1_FILE_LIST := \
$$(shell $$(FIND) $$($1_SOURCE_DIRS) -type f -name "$$($1_PREFIX)*.c") $$(call FindFiles, $$($1_SOURCE_DIRS), $$($1_PREFIX)*.c)
$1_EXCLUDE_PATTERN := $$(addprefix %/, $$($1_EXCLUDE)) $1_EXCLUDE_PATTERN := $$(addprefix %/, $$($1_EXCLUDE))
$1_FILTERED_FILE_LIST := $$(filter-out $$($1_EXCLUDE_PATTERN), $$($1_FILE_LIST)) $1_FILTERED_FILE_LIST := $$(filter-out $$($1_EXCLUDE_PATTERN), $$($1_FILE_LIST))
......
# #
# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -103,7 +103,7 @@ define SetupTextFileProcessingBody ...@@ -103,7 +103,7 @@ define SetupTextFileProcessingBody
$$(error SOURCE_DIRS contains directory $$(src) outside \ $$(error SOURCE_DIRS contains directory $$(src) outside \
SOURCE_BASE_DIR $$($1_SOURCE_BASE_DIR) (in $1)))) SOURCE_BASE_DIR $$($1_SOURCE_BASE_DIR) (in $1))))
endif endif
$1_SOURCE_FILES := $$(sort $$(call CacheFind,$$($1_SOURCE_DIRS))) $1_SOURCE_FILES := $$(sort $$(call FindFiles,$$($1_SOURCE_DIRS)))
$1_EXCLUDE_FILES:=$$(foreach i,$$($1_SOURCE_DIRS),$$(addprefix $$i/,$$($1_EXCLUDE_FILES))) $1_EXCLUDE_FILES:=$$(foreach i,$$($1_SOURCE_DIRS),$$(addprefix $$i/,$$($1_EXCLUDE_FILES)))
$1_INCLUDE_FILES:=$$(foreach i,$$($1_SOURCE_DIRS),$$(addprefix $$i/,$$($1_INCLUDE_FILES))) $1_INCLUDE_FILES:=$$(foreach i,$$($1_SOURCE_DIRS),$$(addprefix $$i/,$$($1_INCLUDE_FILES)))
$1_SOURCE_FILES := $$(filter-out $$($1_EXCLUDE_FILES),$$($1_SOURCE_FILES)) $1_SOURCE_FILES := $$(filter-out $$($1_EXCLUDE_FILES),$$($1_SOURCE_FILES))
......
# #
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -48,6 +48,8 @@ endif ...@@ -48,6 +48,8 @@ endif
# src dir # src dir
# SUFFIXES # SUFFIXES
# EXTRA_DEPS # EXTRA_DEPS
# FOLLOW_SYMLINKS - Set to explicitly follow symlinks. Affects performance of
# finding files.
# ZIP_OPTIONS extra options to pass to zip # ZIP_OPTIONS extra options to pass to zip
SetupZipArchive = $(NamedParamsMacroTemplate) SetupZipArchive = $(NamedParamsMacroTemplate)
define SetupZipArchiveBody define SetupZipArchiveBody
...@@ -63,7 +65,13 @@ define SetupZipArchiveBody ...@@ -63,7 +65,13 @@ define SetupZipArchiveBody
endif endif
# Find all files in the source tree. # Find all files in the source tree.
$1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST))) # If asked to, follow symlinks in this find since that is what zip does. To do
# this, we need to call ShellFindFiles directly.
ifeq ($$($1_FOLLOW_SYMLINKS), true)
$1_ALL_SRCS := $$(call not-containing,_the.,$$(call ShellFindFiles,$$($1_FIND_LIST), , -L))
else
$1_ALL_SRCS := $$(call not-containing,_the.,$$(call FindFiles,$$($1_FIND_LIST)))
endif
# Filter on suffixes if set # Filter on suffixes if set
ifneq ($$($1_SUFFIXES),) ifneq ($$($1_SUFFIXES),)
......
# #
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -40,7 +40,7 @@ ifneq ($(wildcard $(INCLUDE_SOURCE_DIR)/*), ) ...@@ -40,7 +40,7 @@ ifneq ($(wildcard $(INCLUDE_SOURCE_DIR)/*), )
$(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE, \ $(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE, \
SRC := $(INCLUDE_SOURCE_DIR), \ SRC := $(INCLUDE_SOURCE_DIR), \
DEST := $(INCLUDE_TARGET_DIR), \ DEST := $(INCLUDE_TARGET_DIR), \
FILES := $(filter %.h, $(call CacheFind, $(INCLUDE_SOURCE_DIR))), \ FILES := $(filter %.h, $(call FindFiles, $(INCLUDE_SOURCE_DIR))), \
)) ))
TARGETS += $(COPY_EXPORTED_INCLUDE) TARGETS += $(COPY_EXPORTED_INCLUDE)
...@@ -56,7 +56,7 @@ ifneq ($(wildcard $(INCLUDE_SOURCE_OS_DIR)/*), ) ...@@ -56,7 +56,7 @@ ifneq ($(wildcard $(INCLUDE_SOURCE_OS_DIR)/*), )
$(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE_OS, \ $(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE_OS, \
SRC := $(INCLUDE_SOURCE_OS_DIR), \ SRC := $(INCLUDE_SOURCE_OS_DIR), \
DEST := $(INCLUDE_TARGET_DIR)/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR), \ DEST := $(INCLUDE_TARGET_DIR)/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR), \
FILES := $(filter %.h, $(call CacheFind, $(INCLUDE_SOURCE_OS_DIR))), \ FILES := $(filter %.h, $(call FindFiles, $(INCLUDE_SOURCE_OS_DIR))), \
)) ))
TARGETS += $(COPY_EXPORTED_INCLUDE_OS) TARGETS += $(COPY_EXPORTED_INCLUDE_OS)
......
# #
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -65,7 +65,7 @@ PROC_SRC_SUBDIRS := \ ...@@ -65,7 +65,7 @@ PROC_SRC_SUBDIRS := \
PROC_SRC_DIRS := $(patsubst %, $(SRC_DIR)/%/src, $(PROC_SRC_SUBDIRS)) PROC_SRC_DIRS := $(patsubst %, $(SRC_DIR)/%/src, $(PROC_SRC_SUBDIRS))
PROC_SRCS := $(filter %.java, $(call CacheFind, $(PROC_SRC_DIRS))) PROC_SRCS := $(filter %.java, $(call FindFiles, $(PROC_SRC_DIRS)))
ALL_SRC_DIRS := $(SRC_DIR) $(wildcard $(SRC_DIR)/*/src) ALL_SRC_DIRS := $(SRC_DIR) $(wildcard $(SRC_DIR)/*/src)
SOURCEPATH := $(call PathList, $(ALL_SRC_DIRS)) SOURCEPATH := $(call PathList, $(ALL_SRC_DIRS))
......
# #
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -39,7 +39,7 @@ PROC_SRC_SUBDIRS := \ ...@@ -39,7 +39,7 @@ PROC_SRC_SUBDIRS := \
PROC_SRC_DIRS := $(patsubst %, $(SRC_DIR)/%/src, $(PROC_SRC_SUBDIRS)) PROC_SRC_DIRS := $(patsubst %, $(SRC_DIR)/%/src, $(PROC_SRC_SUBDIRS))
PROC_SRCS := $(filter %.java, $(call CacheFind, $(PROC_SRC_DIRS))) PROC_SRCS := $(filter %.java, $(call FindFiles, $(PROC_SRC_DIRS)))
ALL_SRC_DIRS := $(SRC_DIR) $(wildcard $(SRC_DIR)/*/src) ALL_SRC_DIRS := $(SRC_DIR) $(wildcard $(SRC_DIR)/*/src)
SOURCEPATH := $(call PathList, $(ALL_SRC_DIRS)) SOURCEPATH := $(call PathList, $(ALL_SRC_DIRS))
......
# #
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -64,7 +64,7 @@ endef ...@@ -64,7 +64,7 @@ endef
define SetupCompileProperties define SetupCompileProperties
# Lookup the properties that need to be compiled into resource bundles. # Lookup the properties that need to be compiled into resource bundles.
PROPSOURCES := $2 \ PROPSOURCES := $2 \
$$(shell $(FIND) $(TOPDIR)/src/$(MODULE)/share/classes -name "*.properties") $$(call FindFiles, $(TOPDIR)/src/$(MODULE)/share/classes, *.properties)
# Filter out any excluded translations # Filter out any excluded translations
PROPSOURCES := $$(call FilterExcludedTranslations, $$(PROPSOURCES), .properties) PROPSOURCES := $$(call FilterExcludedTranslations, $$(PROPSOURCES), .properties)
......
# #
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -28,16 +28,16 @@ ...@@ -28,16 +28,16 @@
# into LocaleDataMetaInfo.java # into LocaleDataMetaInfo.java
# First go look for all locale files # First go look for all locale files
LOCALE_FILES := $(shell $(FIND) \ LOCALE_FILES := $(call FindFiles, \
$(TOPDIR)/src/$(MODULE)/share/classes/sun/text/resources \ $(TOPDIR)/src/$(MODULE)/share/classes/sun/text/resources \
$(TOPDIR)/src/$(MODULE)/share/classes/sun/util/resources \ $(TOPDIR)/src/$(MODULE)/share/classes/sun/util/resources, \
-name "FormatData_*.java" -o -name "FormatData_*.properties" -o \ FormatData_*.java FormatData_*.properties \
-name "CollationData_*.java" -o -name "CollationData_*.properties" -o \ CollationData_*.java CollationData_*.properties \
-name "TimeZoneNames_*.java" -o -name "TimeZoneNames_*.properties" -o \ TimeZoneNames_*.java TimeZoneNames_*.properties \
-name "LocaleNames_*.java" -o -name "LocaleNames_*.properties" -o \ LocaleNames_*.java LocaleNames_*.properties \
-name "CurrencyNames_*.java" -o -name "CurrencyNames_*.properties" -o \ CurrencyNames_*.java CurrencyNames_*.properties \
-name "CalendarData_*.java" -o -name "CalendarData_*.properties" -o \ CalendarData_*.java CalendarData_*.properties \
-name "BreakIteratorInfo_*.java" -o -name "BreakIteratorRules_*.java") BreakIteratorInfo_*.java BreakIteratorRules_*.java)
# Then translate the locale files into for example: FormatData_sv # Then translate the locale files into for example: FormatData_sv
LOCALE_RESOURCES := $(sort $(subst .properties,,$(subst .java,,$(notdir $(LOCALE_FILES))))) LOCALE_RESOURCES := $(sort $(subst .properties,,$(subst .java,,$(notdir $(LOCALE_FILES)))))
......
# #
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -68,7 +68,7 @@ define SetupCompilePropertiesBody ...@@ -68,7 +68,7 @@ define SetupCompilePropertiesBody
endif endif
# Locate all properties files in the given source dirs. # Locate all properties files in the given source dirs.
$1_SRC_FILES := $$(filter %.properties, $$(call CacheFind, $$($1_SRC_DIRS))) $1_SRC_FILES := $$(call FindFiles, $$($1_SRC_DIRS), *.properties)
ifneq ($$($1_EXCLUDE), ) ifneq ($$($1_EXCLUDE), )
$1_SRC_FILES := $$(filter-out $$($1_EXCLUDE), $$($1_SRC_FILES)) $1_SRC_FILES := $$(filter-out $$($1_EXCLUDE), $$($1_SRC_FILES))
......
# #
# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -65,7 +65,7 @@ ifeq ($(OPENJDK_TARGET_OS), linux) ...@@ -65,7 +65,7 @@ ifeq ($(OPENJDK_TARGET_OS), linux)
# significantly reduce the GC pause time on 32 bit Linux/Unix platforms by # significantly reduce the GC pause time on 32 bit Linux/Unix platforms by
# compiling without the PIC flag (-fPIC on linux). # compiling without the PIC flag (-fPIC on linux).
# See 6454213 for more details. # See 6454213 for more details.
ALL_SRC := $(filter %.cpp, $(call CacheFind, $(TOPDIR)/src/hotspot/share)) ALL_SRC := $(call FindFiles, $(TOPDIR)/src/hotspot/share, *.cpp)
NONPIC_FILTER := $(addsuffix %, $(addprefix $(TOPDIR)/src/hotspot/share/, \ NONPIC_FILTER := $(addsuffix %, $(addprefix $(TOPDIR)/src/hotspot/share/, \
memory oops gc)) memory oops gc))
# Due to what looks like a bug in the old build implementation of this, add a # Due to what looks like a bug in the old build implementation of this, add a
......
# #
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -29,7 +29,7 @@ include LibCommon.gmk ...@@ -29,7 +29,7 @@ include LibCommon.gmk
$(eval $(call IncludeCustomExtension, lib/Lib-java.base.gmk)) $(eval $(call IncludeCustomExtension, lib/Lib-java.base.gmk))
# Prepare the find cache. # Prepare the find cache.
$(eval $(call FillCacheFind, $(wildcard $(TOPDIR)/src/java.base/*/native))) $(call FillFindCache, $(wildcard $(TOPDIR)/src/java.base/*/native))
################################################################################ ################################################################################
# Create all the core libraries # Create all the core libraries
......
# #
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -29,7 +29,7 @@ include LibCommon.gmk ...@@ -29,7 +29,7 @@ include LibCommon.gmk
$(eval $(call IncludeCustomExtension, lib/Lib-java.desktop.gmk)) $(eval $(call IncludeCustomExtension, lib/Lib-java.desktop.gmk))
# Prepare the find cache. # Prepare the find cache.
$(eval $(call FillCacheFind, $(wildcard $(TOPDIR)/src/java.desktop/*/native))) $(call FillFindCache, $(wildcard $(TOPDIR)/src/java.desktop/*/native))
################################################################################ ################################################################################
# Create the AWT/2D libraries # Create the AWT/2D libraries
......
# #
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -63,7 +63,7 @@ $(OUTPUT_DIR)/_src_created: $(DEPS) ...@@ -63,7 +63,7 @@ $(OUTPUT_DIR)/_src_created: $(DEPS)
$(eval $(call SetupCopyFiles, COPY_1, \ $(eval $(call SetupCopyFiles, COPY_1, \
SRC := $(SRC_DIR), \ SRC := $(SRC_DIR), \
DEST := $(DEST_DIR), \ DEST := $(DEST_DIR), \
FILES := $(call CacheFind, $(SRC_DIR)), \ FILES := $(call ShellFindFiles, $(SRC_DIR)), \
)) ))
# Optionally define a rule that deletes all the target files after the makefile # Optionally define a rule that deletes all the target files after the makefile
......
# #
# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -105,13 +105,13 @@ endif ...@@ -105,13 +105,13 @@ endif
################################################################################ ################################################################################
# Test remove-prefixes # Test remove-prefixes
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(call remove-prefixes, pre, prefix postfix), fix postfix, \ $(call remove-prefixes, pre, prefix postfix), fix postfix, \
Prefixes not properly removed)) Prefixes not properly removed)
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(call remove-prefixes, pre post, prefix postfix), fix fix, \ $(call remove-prefixes, pre post, prefix postfix), fix fix, \
Prefixes not properly removed)) Prefixes not properly removed)
################################################################################ ################################################################################
# Test ShellQuote # Test ShellQuote
...@@ -204,19 +204,19 @@ VARDEP_VALUE_FILE := $(VARDEP_DIR)/value-file ...@@ -204,19 +204,19 @@ VARDEP_VALUE_FILE := $(VARDEP_DIR)/value-file
VARDEP_TEST_VAR2 := value3 VARDEP_TEST_VAR2 := value3
VARDEP_RETURN_VALUE := $(call DependOnVariable, VARDEP_TEST_VAR2, $(VARDEP_VALUE_FILE)) VARDEP_RETURN_VALUE := $(call DependOnVariable, VARDEP_TEST_VAR2, $(VARDEP_VALUE_FILE))
$(eval $(call assert-equals, $(VARDEP_RETURN_VALUE), $(VARDEP_VALUE_FILE), \ $(call AssertEquals, $(VARDEP_RETURN_VALUE), $(VARDEP_VALUE_FILE), \
Wrong filename returned)) Wrong filename returned)
-include $(VARDEP_VALUE_FILE) -include $(VARDEP_VALUE_FILE)
$(eval $(call assert-equals, $(VARDEP_TEST_VAR2_old), $(VARDEP_TEST_VAR2), \ $(call AssertEquals, $(VARDEP_TEST_VAR2_old), $(VARDEP_TEST_VAR2), \
Wrong contents in vardeps file)) Wrong contents in vardeps file)
# Test with a variable value containing some problematic characters # Test with a variable value containing some problematic characters
VARDEP_TEST_VAR3 := foo '""' "''" bar \$$ORIGIN &\#x00a9 VARDEP_TEST_VAR3 := foo '""' "''" bar \$$ORIGIN &\#x00a9
VARDEP_VALUE_FILE := $(call DependOnVariable, VARDEP_TEST_VAR3) VARDEP_VALUE_FILE := $(call DependOnVariable, VARDEP_TEST_VAR3)
-include $(VARDEP_VALUE_FILE) -include $(VARDEP_VALUE_FILE)
$(eval $(call assert-equals, $(call EscapeHash,$(VARDEP_TEST_VAR3_old)), \ $(call AssertEquals, $(call EscapeHash,$(VARDEP_TEST_VAR3_old)), \
$(call EscapeHash,$(VARDEP_TEST_VAR3)), \ $(call EscapeHash,$(VARDEP_TEST_VAR3)), \
Wrong contents in vardep file)) Wrong contents in vardep file)
TEST_TARGETS += test-vardep TEST_TARGETS += test-vardep
...@@ -245,85 +245,86 @@ endif ...@@ -245,85 +245,86 @@ endif
PATHLIST_INPUT := foo bar baz PATHLIST_INPUT := foo bar baz
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(call PathList, $(call PathList, $(PATHLIST_INPUT))), \ $(call PathList, $(call PathList, $(PATHLIST_INPUT))), \
$(call PathList, $(PATHLIST_INPUT)), \ $(call PathList, $(PATHLIST_INPUT)), \
PathList call not safe for calling twice)) PathList call not safe for calling twice, \
)
################################################################################ ################################################################################
# Test FindCommonPathPrefix # Test FindCommonPathPrefix
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar/banan), \ $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar/banan), \
/foo/bar, \ /foo/bar, \
FindCommonPathPrefix, \ FindCommonPathPrefix, \
)) )
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar), \ $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar), \
/foo/bar, \ /foo/bar, \
FindCommonPathPrefix, \ FindCommonPathPrefix, \
)) )
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar/), \ $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar/), \
/foo/bar, \ /foo/bar, \
FindCommonPathPrefix, \ FindCommonPathPrefix, \
)) )
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(call FindCommonPathPrefix, foo/bar/baz, foo/bar/banan), \ $(call FindCommonPathPrefix, foo/bar/baz, foo/bar/banan), \
foo/bar, \ foo/bar, \
FindCommonPathPrefix, \ FindCommonPathPrefix, \
)) )
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(call FindCommonPathPrefix, foo/bar/baz, /foo/bar/banan), \ $(call FindCommonPathPrefix, foo/bar/baz, /foo/bar/banan), \
, \ , \
FindCommonPathPrefix, \ FindCommonPathPrefix, \
)) )
################################################################################ ################################################################################
# DirToDotDot # DirToDotDot
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(call DirToDotDot, foo/bar/baz/), \ $(call DirToDotDot, foo/bar/baz/), \
../../.., \ ../../.., \
DirToDotDot, \ DirToDotDot, \
)) )
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(call DirToDotDot, foo/bar), \ $(call DirToDotDot, foo/bar), \
../.., \ ../.., \
DirToDotDot, \ DirToDotDot, \
)) )
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(call DirToDotDot, /foo), \ $(call DirToDotDot, /foo), \
.., \ .., \
DirToDotDot, \ DirToDotDot, \
)) )
################################################################################ ################################################################################
# RelativePath # RelativePath
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(call RelativePath, foo/bar/baz, foo/bar/banan), \ $(call RelativePath, foo/bar/baz, foo/bar/banan), \
../baz, \ ../baz, \
RelativePath, \ RelativePath, \
)) )
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(call RelativePath, foo/bar/baz/banan/kung, foo/bar/banan/kung), \ $(call RelativePath, foo/bar/baz/banan/kung, foo/bar/banan/kung), \
../../baz/banan/kung, \ ../../baz/banan/kung, \
RelativePath, \ RelativePath, \
)) )
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(call RelativePath, /foo/bar/baz/banan/kung, /foo/bar/banan/kung/), \ $(call RelativePath, /foo/bar/baz/banan/kung, /foo/bar/banan/kung/), \
../../baz/banan/kung, \ ../../baz/banan/kung, \
RelativePath, \ RelativePath, \
)) )
################################################################################ ################################################################################
# Test ParseKeywordVariable # Test ParseKeywordVariable
...@@ -335,29 +336,29 @@ $(eval $(call ParseKeywordVariable, KWBASE, \ ...@@ -335,29 +336,29 @@ $(eval $(call ParseKeywordVariable, KWBASE, \
STRING_KEYWORDS := COUNT MANY_WORDS, \ STRING_KEYWORDS := COUNT MANY_WORDS, \
)) ))
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(KWBASE_APA), \ $(KWBASE_APA), \
banan, \ banan, \
ParseKeywordVariable failed to parse APA, \ ParseKeywordVariable failed to parse APA, \
)) )
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(KWBASE_COUNT), \ $(KWBASE_COUNT), \
1 2 3 4 5, \ 1 2 3 4 5, \
ParseKeywordVariable failed to parse COUNT, \ ParseKeywordVariable failed to parse COUNT, \
)) )
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(KWBASE_SUM), \ $(KWBASE_SUM), \
1+2+3+4+5, \ 1+2+3+4+5, \
ParseKeywordVariable failed to parse SUM, \ ParseKeywordVariable failed to parse SUM, \
)) )
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(KWBASE_MANY_WORDS), \ $(KWBASE_MANY_WORDS), \
I have the best words., \ I have the best words., \
ParseKeywordVariable failed to parse MANY_WORDS, \ ParseKeywordVariable failed to parse MANY_WORDS, \
)) )
# Simulate variable set from command line by using "override" # Simulate variable set from command line by using "override"
override KWBASE_WEIRD_GURKA := paprika override KWBASE_WEIRD_GURKA := paprika
...@@ -368,17 +369,211 @@ $(eval $(call ParseKeywordVariable, KWBASE_WEIRD, \ ...@@ -368,17 +369,211 @@ $(eval $(call ParseKeywordVariable, KWBASE_WEIRD, \
STRING_KEYWORDS := COUNT, \ STRING_KEYWORDS := COUNT, \
)) ))
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(KWBASE_WEIRD_APA), \ $(KWBASE_WEIRD_APA), \
skansen, \ skansen, \
ParseKeywordVariable failed to overwrite APA, \ ParseKeywordVariable failed to overwrite APA, \
)) )
$(eval $(call assert-equals, \ $(call AssertEquals, \
$(KWBASE_WEIRD_GURKA), \ $(KWBASE_WEIRD_GURKA), \
paprika, \ paprika, \
ParseKeywordVariable failed to preserve GURKA, \ ParseKeywordVariable failed to preserve GURKA, \
)) )
################################################################################
# Test recursive wildcard
A_FOOBAR := $(OUTPUT_DIR)/wildcard/a/foo.bar
A_B_DOOBAR := $(OUTPUT_DIR)/wildcard/a/b/doo.bar
A_B_FOOBAR := $(OUTPUT_DIR)/wildcard/a/b/foo.bar
A_B_FOOBAZ := $(OUTPUT_DIR)/wildcard/a/b/foo.baz
X_Y_FOOBAR := $(OUTPUT_DIR)/wildcard/x/y/foo.bar
X_Y_FOOBAZ := $(OUTPUT_DIR)/wildcard/x/y/foo.baz
X_Y_FOODOLLAR := $(OUTPUT_DIR)/wildcard/x/y/foo$$foo
$(call MakeDir, $(OUTPUT_DIR)/wildcard/a/b)
$(call MakeDir, $(OUTPUT_DIR)/wildcard/x/y)
$(shell $(TOUCH) $(A_FOOBAR) $(A_B_FOOBAR) $(A_B_DOOBAR) $(A_B_FOOBAZ) \
$(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(call ShellQuote, $(X_Y_FOODOLLAR)))
ifeq ($(RWILDCARD_WORKS), true)
$(call AssertEquals, \
$(sort $(call rwildcard, $(OUTPUT_DIR)/wildcard, *.bar)), \
$(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_FOOBAR) $(X_Y_FOOBAR)), \
Wrong files returned from rwildcard, \
)
$(call AssertEquals, \
$(sort $(call rwildcard, $(OUTPUT_DIR)/wildcard, doo.*)), \
$(A_B_DOOBAR), \
Wrong files returned from rwildcard, \
)
$(call AssertEquals, \
$(sort $(call rwildcard, $(OUTPUT_DIR)/wildcard, *.bar *.baz)), \
$(sort $(A_B_DOOBAR) $(A_FOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) \
$(X_Y_FOOBAR) $(X_Y_FOOBAZ)), \
Wrong files returned from rwildcard, \
)
$(call AssertEquals, \
$(sort $(call WildcardFindFiles, $(OUTPUT_DIR)/wildcard)), \
$(sort $(A_B_DOOBAR) $(A_FOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) \
$(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \
Wrong files returned from WildcardFindFiles, \
)
$(call AssertEquals, \
$(sort $(call WildcardFindFiles, $(OUTPUT_DIR)/wildcard/x/y)), \
$(sort $(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \
Wrong files returned from WildcardFindFiles, \
)
$(call AssertEquals, \
$(sort $(call WildcardFindFiles, $(OUTPUT_DIR)/wildcard/a/b $(OUTPUT_DIR)/wildcard/x)), \
$(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) \
$(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \
Wrong files returned from WildcardFindFiles, \
)
endif
$(call AssertEquals, \
$(sort $(call ShellFindFiles, $(OUTPUT_DIR)/wildcard)), \
$(sort $(A_B_DOOBAR) $(A_FOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) \
$(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \
Wrong files returned from ShellFindFiles, \
)
$(call AssertEquals, \
$(sort $(call ShellFindFiles, $(OUTPUT_DIR)/wildcard/x/y)), \
$(sort $(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \
Wrong files returned from ShellFindFiles, \
)
$(call AssertEquals, \
$(sort $(call ShellFindFiles, $(OUTPUT_DIR)/wildcard/a/b $(OUTPUT_DIR)/wildcard/x)), \
$(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) \
$(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \
Wrong files returned from ShellFindFiles, \
)
$(call AssertEquals, \
$(sort $(call ShellFindFiles, $(OUTPUT_DIR)/wildcard, *.bar)), \
$(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_FOOBAR) $(X_Y_FOOBAR)), \
Wrong files returned from ShellFindFiles, \
)
$(call AssertEquals, \
$(sort $(call ShellFindFiles, $(OUTPUT_DIR)/wildcard, doo.*)), \
$(A_B_DOOBAR), \
Wrong files returned from ShellFindFiles, \
)
$(call AssertEquals, \
$(sort $(call ShellFindFiles, $(OUTPUT_DIR)/wildcard, *.bar *.baz)), \
$(sort $(A_B_DOOBAR) $(A_FOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) \
$(X_Y_FOOBAR) $(X_Y_FOOBAZ)), \
Wrong files returned from ShellFindFiles, \
)
################################################################################
$(call AssertEquals, \
$(sort $(call CacheFindFiles, $(OUTPUT_DIR)/wildcard/a/b)), \
$(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ)), \
CacheFindFiles test 1, \
)
$(call FillFindCache, $(OUTPUT_DIR)/wildcard/a/b)
$(call AssertEquals, \
$(CacheFindFiles_CACHED_DIRS), $(OUTPUT_DIR)/wildcard/a/b, \
Wrong files in find cache dirs, \
)
$(call AssertEquals, \
$(sort $(CacheFindFiles_CACHED_FILES)), \
$(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ)), \
Wrong files in find cache files, \
)
$(call AssertEquals, \
$(sort $(call CacheFindFiles, $(OUTPUT_DIR)/wildcard/a/b)), \
$(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ)), \
CacheFindFiles test 1, \
)
$(call AssertEquals, \
$(sort $(call CacheFindFiles, $(OUTPUT_DIR)/wildcard/a)), \
$(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) $(A_FOOBAR)), \
CacheFindFiles test 2, \
)
$(call FillFindCache, $(OUTPUT_DIR)/wildcard/a)
$(call AssertEquals, \
$(CacheFindFiles_CACHED_DIRS), \
$(OUTPUT_DIR)/wildcard/a/b $(OUTPUT_DIR)/wildcard/a, \
Wrong files in find cache dirs, \
)
$(call AssertEquals, \
$(sort $(CacheFindFiles_CACHED_FILES)), \
$(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) $(A_FOOBAR)), \
Wrong files in find cache files, \
)
$(call AssertEquals, \
$(words $(CacheFindFiles_CACHED_FILES)), 4, \
Wrong files in find cache files >$(CacheFindFiles_CACHED_FILES)<, \
)
$(call AssertEquals, \
$(sort $(call CacheFindFiles, $(OUTPUT_DIR)/wildcard/a)), \
$(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) $(A_FOOBAR)), \
CacheFindFiles test 2, \
)
$(call AssertEquals, \
$(sort $(call CacheFindFiles, $(OUTPUT_DIR)/wildcard/x)), \
$(sort $(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \
CacheFindFiles test 3, \
)
$(call FillFindCache, $(OUTPUT_DIR)/wildcard/x)
$(call AssertEquals, \
$(CacheFindFiles_CACHED_DIRS), \
$(OUTPUT_DIR)/wildcard/a/b $(OUTPUT_DIR)/wildcard/a $(OUTPUT_DIR)/wildcard/x, \
Wrong files in find cache dirs, \
)
$(call AssertEquals, \
$(sort $(CacheFindFiles_CACHED_FILES)), \
$(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) $(A_FOOBAR) \
$(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \
Wrong files in find cache files, \
)
$(call AssertEquals, \
$(words $(CacheFindFiles_CACHED_FILES)), 7, \
Wrong files in find cache files, \
)
$(call AssertEquals, \
$(sort $(call CacheFindFiles, $(OUTPUT_DIR)/wildcard/x)), \
$(sort $(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \
CacheFindFiles test 3, \
)
$(call AssertEquals, \
$(sort $(call CacheFindFiles, $(OUTPUT_DIR)/wildcard/x/y)), \
$(sort $(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \
CacheFindFiles test 4, \
)
$(call FillFindCache, $(OUTPUT_DIR)/wildcard/x/y)
$(call AssertEquals, \
$(CacheFindFiles_CACHED_DIRS), \
$(OUTPUT_DIR)/wildcard/a/b $(OUTPUT_DIR)/wildcard/a $(OUTPUT_DIR)/wildcard/x, \
Wrong files in find cache dirs, \
)
$(call AssertEquals, \
$(sort $(CacheFindFiles_CACHED_FILES)), \
$(sort $(A_B_DOOBAR) $(A_B_FOOBAR) $(A_B_FOOBAZ) $(A_FOOBAR) \
$(X_Y_FOOBAR) $(X_Y_FOOBAZ) $(X_Y_FOODOLLAR)), \
Wrong files in find cache files, \
)
$(call AssertEquals, \
$(words $(CacheFindFiles_CACHED_FILES)), 7, \
Wrong files in find cache files, \
)
################################################################################ ################################################################################
......
# #
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -29,11 +29,16 @@ ...@@ -29,11 +29,16 @@
# 1 - Tested value # 1 - Tested value
# 2 - Exepected value # 2 - Exepected value
# 3 - Error message # 3 - Error message
define assert-equals AssertEquals = \
ifneq ($$(strip $1),$$(strip $2)) $(if $(call equals, $(strip $1), $(strip $2)), , \
$$(error $3 - Expected >$$(strip $2)< - Got >$$(strip $1)<) $(info FAILURE: $3) \
endif $(info Expected: >$(strip $2)<) \
endef $(info Actual: >$(strip $1)<) \
$(error $3) \
)
CreateFile = $(shell $(MKDIR) -p $(call ShellQuote, $(dir $1)) \
&& $(TOUCH) $(call ShellQuote, $1))
# On macosx, file system timestamps only have 1 second resultion so must add # On macosx, file system timestamps only have 1 second resultion so must add
# sleeps to properly test dependencies. # sleeps to properly test dependencies.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册