xref: /freebsd/sys/contrib/openzfs/config/Substfiles.am (revision 5def4c47d4bd90b209b9b4a4ba9faec15846d8fd)
1subst_sed_cmd = \
2	-e 's|@bindir[@]|$(bindir)|g' \
3	-e 's|@sbindir[@]|$(sbindir)|g' \
4	-e 's|@datadir[@]|$(datadir)|g' \
5	-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
6	-e 's|@runstatedir[@]|$(runstatedir)|g' \
7	-e 's|@initconfdir[@]|$(initconfdir)|g' \
8	-e 's|@initdir[@]|$(initdir)|g' \
9	-e 's|@mounthelperdir[@]|$(mounthelperdir)|g' \
10	-e 's|@systemdgeneratordir[@]|$(systemdgeneratordir)|g' \
11	-e 's|@systemdunitdir[@]|$(systemdunitdir)|g' \
12	-e 's|@udevdir[@]|$(udevdir)|g' \
13	-e 's|@udevruledir[@]|$(udevruledir)|g' \
14	-e 's|@zfsexecdir[@]|$(zfsexecdir)|g' \
15	-e 's|@PYTHON[@]|$(PYTHON)|g' \
16	-e 's|@PYTHON_SHEBANG[@]|$(PYTHON_SHEBANG)|g' \
17	-e 's|@DEFAULT_INIT_NFS_SERVER[@]|$(DEFAULT_INIT_NFS_SERVER)|g' \
18	-e 's|@DEFAULT_INIT_SHELL[@]|$(DEFAULT_INIT_SHELL)|g' \
19	-e 's|@LIBFETCH_DYNAMIC[@]|$(LIBFETCH_DYNAMIC)|g' \
20	-e 's|@LIBFETCH_SONAME[@]|$(LIBFETCH_SONAME)|g'
21
22SUBSTFILES =
23CLEANFILES = $(SUBSTFILES)
24EXTRA_DIST = $(SUBSTFILES:=.in)
25
26$(SUBSTFILES):%:%.in Makefile
27	$(AM_V_GEN)set -e; \
28	$(MKDIR_P) $$(dirname $@); \
29	$(RM) $@~; \
30	$(SED) $(subst_sed_cmd) $< >$@~; \
31	if grep -E '@[a-zA-Z0-9_]+@' $@~ >&2; then \
32		echo "Undefined substitution" >&2; \
33		exit 1; \
34	else test $$? -eq 1; fi; \
35	test -x $< && chmod +x $@~; \
36	mv -f $@~ $@
37