summaryrefslogtreecommitdiffstats
path: root/Makefile.am
diff options
context:
space:
mode:
authorKarel Zak2012-08-15 01:53:40 +0200
committerKarel Zak2012-08-15 02:06:53 +0200
commitd4baf92e50da3545f80c87d12e4e3827febcc4fa (patch)
tree2997b77f723a39977c671913654405a3afa06239 /Makefile.am
parentcolumn: --separator segfaults (diff)
downloadkernel-qcow2-util-linux-d4baf92e50da3545f80c87d12e4e3827febcc4fa.tar.gz
kernel-qcow2-util-linux-d4baf92e50da3545f80c87d12e4e3827febcc4fa.tar.xz
kernel-qcow2-util-linux-d4baf92e50da3545f80c87d12e4e3827febcc4fa.zip
build-sys: expand paths at make time
autoconf docs about *dir variables (e.g bindir): ... A corollary is that you should not use these variables except in makefiles... ...you should not rely on AC_CONFIG_FILES to replace bindir and friends in your shell scripts and other files; instead, let make manage their replacement. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am37
1 files changed, 37 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index e22dad339..a540f0eeb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -43,6 +43,8 @@ ruman1_DATA =
check_PROGRAMS =
TESTS =
+PATHFILES =
+
INSTALL_EXEC_HOOKS =
UNINSTALL_HOOKS =
INSTALL_DATA_HOOKS =
@@ -86,6 +88,41 @@ include fdisks/Makemodule.am
include tests/Makemodule.am
+#
+# Don't rely on configure.ac AC_CONFIG_FILES for install paths.
+#
+# The paths should be expanded at make time rather than configure:
+# - to support 'make install prefix=/foo DESTDIR=/foo'
+# - to recursively expands the paths (e.g. AC_CONFIG_FILES expands
+# '@usrsbin_execdir@' to ${exec_prefix}/sbin')
+#
+edit_cmd = sed \
+ -e 's|@prefix[@]|$(prefix)|g' \
+ -e 's|@exec_prefix[@]|$(exec_prefix)|g' \
+ -e 's|@sysconfdir[@]|$(sysconfdir)|g' \
+ -e 's|@datadir[@]|$(datadir)|g' \
+ -e 's|@sbindir[@]|$(sbindir)|g' \
+ -e 's|@bindir[@]|$(bindir)|g' \
+ -e 's|@includedir[@]|$(includedir)|g' \
+ -e 's|@localstatedir[@]|$(localstatedir)|g' \
+ -e 's|@usrlib_execdir[@]|$(usrlib_execdir)|g' \
+ -e 's|@usrbin_execdir[@]|$(usrbin_execdir)|g' \
+ -e 's|@usrsbin_execdir[@]|$(usrsbin_execdir)|g' \
+ -e 's|@VERSION[@]|$(VERSION)|g' \
+ -e 's|@LIBUUID_VERSION[@]|$(LIBUUID_VERSION)|g' \
+ -e 's|@LIBMOUNT_VERSION[@]|$(LIBMOUNT_VERSION)|g' \
+ -e 's|@LIBBLKID_VERSION[@]|$(LIBBLKID_VERSION)|g'
+
+CLEANFILES += $(PATHFILES)
+EXTRA_DIST += $(PATHFILES:=.in)
+
+$(PATHFILES): Makefile
+ @ rm -f $@ $@.tmp
+ $(AM_V_GEN) srcdir=''; \
+ test -f ./$@.in || srcdir=$(srcdir)/; \
+ $(edit_cmd) $${srcdir}$@.in >$@.tmp
+ @ mv $@.tmp $@
+
# Arrange so that .tarball-version appears only in the distribution
# tarball, and never in a checked-out repository.
dist-hook: