xref: /freebsd/sys/contrib/openzfs/config/Substfiles.am (revision 1323ec571215a77ddd21294f0871979d5ad6b992)
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	-e 's|@ASAN_ENABLED[@]|$(ASAN_ENABLED)|g' \
22	-e 's|@UBSAN_ENABLED[@]|$(UBSAN_ENABLED)|g'
23
24SUBSTFILES =
25CLEANFILES = $(SUBSTFILES)
26EXTRA_DIST = $(SUBSTFILES:=.in)
27
28$(SUBSTFILES):%:%.in Makefile
29	$(AM_V_GEN)set -e; \
30	$(MKDIR_P) $$(dirname $@); \
31	$(RM) $@~; \
32	$(SED) $(subst_sed_cmd) $< >$@~; \
33	if grep -E '@[a-zA-Z0-9_]+@' $@~ >&2; then \
34		echo "Undefined substitution" >&2; \
35		exit 1; \
36	else test $$? -eq 1; fi; \
37	test -x $< && chmod +x $@~; \
38	mv -f $@~ $@
39