-install-$(dir):
- $(call quiet_mkdir, $(DESTDIR)$(libdir)/)
- $(call quiet_install_data, $(dir)/$(LIBNAME) $(DESTDIR)$(libdir)/)
- $(call quiet_symlink, $(LIBNAME) $(DESTDIR)$(libdir)/$(SONAME))
- $(call quiet_symlink, $(LIBNAME) $(DESTDIR)$(libdir)/$(LINKER_NAME))
- $(call quiet_mkdir, $(DESTDIR)$(prefix)/include/)
- $(call quiet_install_data, $(dir)/notmuch.h $(DESTDIR)$(prefix)/include/)
+# The (often-reused) $dir works fine within targets/prerequisites,
+# but cannot be used reliably within commands, so copy its value to a
+# variable that is not reused.
+lib := $(dir)
+install-$(dir): $(dir)/$(LIBNAME)
+ mkdir -p "$(DESTDIR)$(libdir)/"
+ install -m0644 "$(lib)/$(LIBNAME)" "$(DESTDIR)$(libdir)/"
+ ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(SONAME)"
+ ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(LINKER_NAME)"
+ mkdir -p "$(DESTDIR)$(includedir)"
+ install -m0644 "$(srcdir)/$(lib)/notmuch.h" "$(DESTDIR)$(includedir)/"
+ $(LIBRARY_INSTALL_POST_COMMAND)