aboutsummaryrefslogtreecommitdiffstats
path: root/config/Substfiles.am
diff options
context:
space:
mode:
Diffstat (limited to 'config/Substfiles.am')
-rw-r--r--config/Substfiles.am30
1 files changed, 17 insertions, 13 deletions
diff --git a/config/Substfiles.am b/config/Substfiles.am
index b051438fb..7f069877a 100644
--- a/config/Substfiles.am
+++ b/config/Substfiles.am
@@ -21,18 +21,22 @@ subst_sed_cmd = \
-e 's|@ASAN_ENABLED[@]|$(ASAN_ENABLED)|g' \
-e 's|@UBSAN_ENABLED[@]|$(UBSAN_ENABLED)|g'
-SUBSTFILES =
-CLEANFILES = $(SUBSTFILES)
-EXTRA_DIST = $(SUBSTFILES:=.in)
-
-$(SUBSTFILES):%:%.in Makefile
- $(AM_V_GEN)set -e; \
- $(MKDIR_P) $$(dirname $@); \
- $(RM) $@~; \
- $(SED) $(subst_sed_cmd) $< >$@~; \
- if grep -E '@[a-zA-Z0-9_]+@' $@~ >&2; then \
+define SUBST
+$(1) : $(2)$(1).in Makefile;
+ $$(AM_V_GEN)set -e; \
+ $$(MKDIR_P) $$(@D); \
+ $$(RM) $$@~; \
+ $$(SED) $$(subst_sed_cmd) $$< >$$@~; \
+ if grep -E '@[a-zA-Z0-9_]+@' $$@~ >&2; then \
echo "Undefined substitution" >&2; \
exit 1; \
- else test $$? -eq 1; fi; \
- test -x $< && chmod +x $@~; \
- mv -f $@~ $@
+ fi; \
+ [ -x $$< ] && chmod +x $$@~; \
+ mv -f $$@~ $$@
+endef
+
+SUBSTFILES =
+CLEANFILES += $(SUBSTFILES)
+EXTRA_DIST += $(SUBSTFILES:=.in)
+
+$(call SUBST,%,)