Commit 5502b5b5 authored by Kir Kolyshkin's avatar Kir Kolyshkin Committed by Pavel Emelyanov

Makefile.install: cure LIBDIR guessing logic

Commit 6a51c7ec ("make: Allow to install in custom dirs") replaced
all := assignments with ?=, effectively disabling the LIBDIR guessing
logic (as once a variable is assigned, further ?= make no sense).

That commit description says that setting PREFIX from make command line
didn't work. I can't find the original bug report but according to
GNU make documentation (see [1], [2]) as well as to my best knowledge,
any variable set in Makefile can be overridden from the command line,
unless "override VAR = value" is used in the Makefile.

The result of this patch is LIBDIR is correctly set for distros such as
Fedora and Debian, so "make install" works more correct. Surely, any
variable can still be overriden from the command line.

I have also checked the build of Fedora package from criu.spec with this
change -- it works fine.

Now, I am not sure why it was not working for the original bug reporter.
The only hypothesis I have is he tried to do something like

	PREFIX=/usr make

instead of

	make PREFIX=/usr

If this was the case, it was not a bug but wrong usage.

While at it, fix LIBDIR description in INSTALL.md.

[1] https://www.gnu.org/software/make/manual/html_node/Overriding.html
[2] https://www.gnu.org/software/make/manual/html_node/Override-Directive.html

travis-ci: success for Makefile.install fixes
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 27f3ef85
...@@ -14,7 +14,7 @@ this command accepts the following variables: ...@@ -14,7 +14,7 @@ this command accepts the following variables:
* **SBINDIR**, to specify where to put CRIU executable (`$(PREFIX)/sbin` by default); * **SBINDIR**, to specify where to put CRIU executable (`$(PREFIX)/sbin` by default);
* **MANDIR**, to specify directory for manual pages (`$(PREFIX)/share/man` by default); * **MANDIR**, to specify directory for manual pages (`$(PREFIX)/share/man` by default);
* **SYSTEMDUNITDIR**, to specify place where systemd units are living (`$(PREFIX)/lib/systemd/system` by default); * **SYSTEMDUNITDIR**, to specify place where systemd units are living (`$(PREFIX)/lib/systemd/system` by default);
* **LIBDIR**, to specify directory where to put libraries (`$(PREFIX)/lib` by default). * **LIBDIR**, to specify directory where to put libraries (guess the correct path by default).
Thus one can type Thus one can type
......
# #
# Installation paths. # Installation paths.
PREFIX ?= /usr/local PREFIX := /usr/local
BINDIR ?= $(PREFIX)/bin BINDIR := $(PREFIX)/bin
SBINDIR ?= $(PREFIX)/sbin SBINDIR := $(PREFIX)/sbin
MANDIR ?= $(PREFIX)/share/man MANDIR := $(PREFIX)/share/man
SYSTEMDUNITDIR ?= $(PREFIX)/lib/systemd/system SYSTEMDUNITDIR := $(PREFIX)/lib/systemd/system
LOGROTATEDIR ?= $(PREFIX)/etc/logrotate.d LOGROTATEDIR := $(PREFIX)/etc/logrotate.d
LIBDIR ?= $(PREFIX)/lib LIBDIR := $(PREFIX)/lib
INCLUDEDIR ?= $(PREFIX)/include INCLUDEDIR := $(PREFIX)/include
LIBEXECDIR ?= $(PREFIX)/libexec LIBEXECDIR := $(PREFIX)/libexec
# #
# For recent Debian/Ubuntu with multiarch support. # For recent Debian/Ubuntu with multiarch support.
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null) DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null)
ifneq "$(DEB_HOST_MULTIARCH)" "" ifneq "$(DEB_HOST_MULTIARCH)" ""
LIBDIR ?= $(PREFIX)/lib/$(DEB_HOST_MULTIARCH) LIBDIR := $(PREFIX)/lib/$(DEB_HOST_MULTIARCH)
else else
# #
# For most other systems # For most other systems
ifeq "$(shell uname -m)" "x86_64" ifeq "$(shell uname -m)" "x86_64"
LIBDIR ?= $(PREFIX)/lib64 LIBDIR := $(PREFIX)/lib64
endif endif
endif endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment