changeset 21978:f0a982a28944

relax verify_defs_make in jvmci.make for conditional exports
author Doug Simon <doug.simon@oracle.com>
date Tue, 16 Jun 2015 11:25:50 +0200
parents a6425aa8f70c
children c0b6865b7698
files make/defs.make make/jvmci.make mx/mx_graal_makefile.py
diffstat 3 files changed, 24 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/make/defs.make	Mon Jun 15 11:36:11 2015 +0200
+++ b/make/defs.make	Tue Jun 16 11:25:50 2015 +0200
@@ -373,7 +373,7 @@
 EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.jvmci.debug.TTYStreamProvider
 
 ifneq ("$(wildcard $(SHARED_DIR)/services/com.oracle.jvmci.hotspot.events.EventProvider)","")
-EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.jvmci.hotspot.events.EventProvider
+CONDITIONAL_EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.jvmci.hotspot.events.EventProvider
 endif
 
 EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.jvmci.hotspot.HotSpotConstantReflectionProvider
@@ -384,6 +384,9 @@
 EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.jvmci.compiler.Compiler
 EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.jvmci.debug.JVMCIDebugConfig
 
+# The use of CONDITIONAL_EXPORT_LIST is for the checking
+# done by verify_defs_make in jvmci.make
+EXPORT_LIST += $(CONDITIONAL_EXPORT_LIST)
 
 .PHONY: $(HS_ALT_MAKE)/defs.make
 
--- a/make/jvmci.make	Mon Jun 15 11:36:11 2015 +0200
+++ b/make/jvmci.make	Tue Jun 16 11:25:50 2015 +0200
@@ -91,12 +91,16 @@
 # and that only existing JVMCI services and options are exported.
 # Arguments:
 #  1: list of service or option files
-#  2: prefix to apply to each file to create match pattern
+#  2: variable name for directory of service or option files
 define verify_defs_make
     $(eval defs := make/defs.make)
-    $(eval exports := $(shell grep '$(2)' make/defs.make | sed 's:.*$(2)::g'))
-    $(foreach file,$(1),$(if $(findstring $(file),$(exports)), ,$(error "Pattern '$(2)$(file)' not found in $(defs)")))
-    $(foreach export,$(exports),$(if $(findstring $(export),$(1)), ,$(error "The line '$(2)$(export)' should not be in $(defs)")))
+    $(eval uncondPattern := EXPORT_LIST += $$$$($(2))/)
+    $(eval condPattern := CONDITIONAL_EXPORT_LIST += $$$$($(2))/)
+    $(eval unconditionalExports := $(shell grep '^EXPORT_LIST += $$($2)' make/defs.make | sed 's:.*($(2))/::g'))
+    $(eval conditionalExports := $(shell grep '^CONDITIONAL_EXPORT_LIST += $$($2)' make/defs.make | sed 's:.*($(2))/::g'))
+    $(eval allExports := $(unconditionalExports) $(conditionalExports))
+    $(foreach file,$(1),$(if $(findstring $(file),$(allExports)), ,$(error "Line matching '$(uncondPattern)$(file)' or '$(condPattern)$(file)' not found in $(defs)")))
+    $(foreach export,$(unconditionalExports),$(if $(findstring $(export),$(1)), ,$(error "The line '$(uncondPattern)$(export)' should not be in $(defs)")))
 endef
 
 all: default
@@ -105,8 +109,8 @@
 	$(foreach export,$(EXPORTED_FILES),$(call extract,$(export),$(SHARED_DIR)))
 
 export: all
-	$(call verify_defs_make,$(notdir $(wildcard $(SHARED_DIR)/jvmci.services/*)),EXPORT_LIST += $$(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/)
-	$(call verify_defs_make,$(notdir $(wildcard $(SHARED_DIR)/jvmci.options/*)),EXPORT_LIST += $$(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/)
+	$(call verify_defs_make,$(notdir $(wildcard $(SHARED_DIR)/jvmci.services/*)),EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)
+	$(call verify_defs_make,$(notdir $(wildcard $(SHARED_DIR)/jvmci.options/*)),EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)
 .PHONY: export
 
 clean:
--- a/mx/mx_graal_makefile.py	Mon Jun 15 11:36:11 2015 +0200
+++ b/mx/mx_graal_makefile.py	Tue Jun 16 11:25:50 2015 +0200
@@ -252,12 +252,16 @@
 # and that only existing JVMCI services and options are exported.
 # Arguments:
 #  1: list of service or option files
-#  2: prefix to apply to each file to create match pattern
+#  2: variable name for directory of service or option files
 define verify_defs_make
     $(eval defs := make/defs.make)
-    $(eval exports := $(shell grep '$(2)' make/defs.make | sed 's:.*$(2)::g'))
-    $(foreach file,$(1),$(if $(findstring $(file),$(exports)), ,$(error "Pattern '$(2)$(file)' not found in $(defs)")))
-    $(foreach export,$(exports),$(if $(findstring $(export),$(1)), ,$(error "The line '$(2)$(export)' should not be in $(defs)")))
+    $(eval uncondPattern := EXPORT_LIST += $$$$($(2))/)
+    $(eval condPattern := CONDITIONAL_EXPORT_LIST += $$$$($(2))/)
+    $(eval unconditionalExports := $(shell grep '^EXPORT_LIST += $$($2)' make/defs.make | sed 's:.*($(2))/::g'))
+    $(eval conditionalExports := $(shell grep '^CONDITIONAL_EXPORT_LIST += $$($2)' make/defs.make | sed 's:.*($(2))/::g'))
+    $(eval allExports := $(unconditionalExports) $(conditionalExports))
+    $(foreach file,$(1),$(if $(findstring $(file),$(allExports)), ,$(error "Line matching '$(uncondPattern)$(file)' or '$(condPattern)$(file)' not found in $(defs)")))
+    $(foreach export,$(unconditionalExports),$(if $(findstring $(export),$(1)), ,$(error "The line '$(uncondPattern)$(export)' should not be in $(defs)")))
 endef
 
 all: default
@@ -266,8 +270,8 @@
 \t$(foreach export,$(EXPORTED_FILES),$(call extract,$(export),$(SHARED_DIR)))
 
 export: all
-\t$(call verify_defs_make,$(notdir $(wildcard $(SHARED_DIR)/jvmci.services/*)),EXPORT_LIST += $$(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/)
-\t$(call verify_defs_make,$(notdir $(wildcard $(SHARED_DIR)/jvmci.options/*)),EXPORT_LIST += $$(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/)
+\t$(call verify_defs_make,$(notdir $(wildcard $(SHARED_DIR)/jvmci.services/*)),EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)
+\t$(call verify_defs_make,$(notdir $(wildcard $(SHARED_DIR)/jvmci.options/*)),EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)
 .PHONY: export
 
 clean: