summaryrefslogtreecommitdiff
path: root/coreconf
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2020-05-05 12:29:51 +0000
committerJan-Marek Glogowski <glogow@fbihome.de>2020-05-05 12:29:51 +0000
commit09ddd44c2dae4cf18b95040a37bbc85268e7ec78 (patch)
tree523a6a9ef62c2e0454a554a6805eca721b87ac0d /coreconf
parent7170a8c9f0b568bf5642cda06b31ad78f5eee541 (diff)
downloadnss-hg-09ddd44c2dae4cf18b95040a37bbc85268e7ec78.tar.gz
Bug 1629553 Use an eval template for export targets r=rrelyea
Differential Revision: https://phabricator.services.mozilla.com/D70984
Diffstat (limited to 'coreconf')
-rw-r--r--coreconf/rules.mk72
1 files changed, 24 insertions, 48 deletions
diff --git a/coreconf/rules.mk b/coreconf/rules.mk
index 03abba4c9..4dc5e2b6e 100644
--- a/coreconf/rules.mk
+++ b/coreconf/rules.mk
@@ -755,37 +755,29 @@ export: $(JMC_HEADERS) $(JMC_STUBS)
endif
endif
-#
-# Copy each element of EXPORTS to $(SOURCE_XP_DIR)/public/$(MODULE)/
-#
-PUBLIC_EXPORT_DIR = $(SOURCE_XP_DIR)/public/$(MODULE)
-
-ifneq ($(EXPORTS),)
-$(PUBLIC_EXPORT_DIR)/d:
- @$(MAKE_OBJDIR)
+define copy_varlist_into_dir_RULE
+ifdef $(2)
+ifneq (,$$(strip $$($(2))))
+$(3)/d:
+ @$$(MAKE_OBJDIR)
-$(PUBLIC_EXPORT_DIR)/%: %
- $(INSTALL) -m 444 $^ $(PUBLIC_EXPORT_DIR)
+$(3)/%: %
+ $$(INSTALL) -m 444 $$^ $(3)
-export: $(addprefix $(PUBLIC_EXPORT_DIR)/,$(EXPORTS)) | $(PUBLIC_EXPORT_DIR)/d
+$(1): $$(addprefix $(3)/,$$($(2))) | $(3)/d
+endif
+else
+$(1):
endif
+endef # copy_varlist_into_dir_RULE
-# Duplicate export rule for private exports, with different directories
+# export rule
+PUBLIC_EXPORT_DIR = $(SOURCE_XP_DIR)/public/$(MODULE)
+$(eval $(call copy_varlist_into_dir_RULE,export,EXPORTS,$(PUBLIC_EXPORT_DIR)))
+# private_export rule
PRIVATE_EXPORT_DIR = $(SOURCE_XP_DIR)/private/$(MODULE)
-
-ifneq ($(PRIVATE_EXPORTS),)
-$(PRIVATE_EXPORT_DIR)/d:
- @$(MAKE_OBJDIR)
-
-$(PRIVATE_EXPORT_DIR)/%: %
- $(INSTALL) -m 444 $^ $(PRIVATE_EXPORT_DIR)
-
-private_export: $(addprefix $(PRIVATE_EXPORT_DIR)/,$(PRIVATE_EXPORTS)) | $(PRIVATE_EXPORT_DIR)/d
-else
-private_export:
- @echo "There are no private exports."
-endif
+$(eval $(call copy_varlist_into_dir_RULE,private_export,PRIVATE_EXPORTS,$(PRIVATE_EXPORT_DIR)))
##########################################################################
### RULES FOR RUNNING REGRESSION SUITE TESTS
@@ -801,13 +793,12 @@ ifneq ($(BUILD_OPT),)
REGDATE = $(subst \ ,, $(shell $(PERL) $(CORE_DEPTH)/$(MODULE)/scripts/now))
endif
-check: $(REGRESSION_SPEC)
+$(TESTS_DIR)/d:
+ @$(MAKE_OBJDIR)
+
+check: $(REGRESSION_SPEC) | $(TESTS_DIR)/d
cd $(PLATFORM); \
- ../$(SOURCE_MD_DIR)/bin/regress$(PROG_SUFFIX) specfile=../$(REGRESSION_SPEC) progress $(EXTRA_REGRESS_OPTIONS); \
- if test ! -d $(TESTS_DIR); then \
- echo Creating $(TESTS_DIR); \
- $(NSINSTALL) -D $(TESTS_DIR); \
- fi
+ ../$(SOURCE_MD_DIR)/bin/regress$(PROG_SUFFIX) specfile=../$(REGRESSION_SPEC) progress $(EXTRA_REGRESS_OPTIONS)
ifneq ($(BUILD_OPT),)
$(NSINSTALL) -m 664 $(PLATFORM)/$(REGDATE).sum $(TESTS_DIR); \
$(NSINSTALL) -m 664 $(PLATFORM)/$(REGDATE).htm $(TESTS_DIR); \
@@ -819,23 +810,8 @@ check:
@echo "Error: you didn't specify REGRESSION_SPEC in your manifest.mn file!"
endif
-
-# Duplicate export rule for releases, with different directories
-
-ifneq ($(EXPORTS),)
-$(SOURCE_RELEASE_XP_DIR)/include:
- @if test ! -d $@; then \
- echo Creating $@; \
- $(NSINSTALL) -D $@; \
- fi
-
-release_export: $(SOURCE_RELEASE_XP_DIR)/include
-
-release_export: $(EXPORTS)
- $(INSTALL) -m 444 $^ $(SOURCE_RELEASE_XP_DIR)/include
-endif
-
-
+# release_export rule
+$(eval $(call copy_varlist_into_dir_RULE,release_export,EXPORTS,$(SOURCE_RELEASE_XP_DIR)/include))
################################################################################