Skip to content

Commit 7bd373c

Browse files
committed
improve makefile to use default lib location not only on debian-based distros; #642
1 parent 96b0216 commit 7bd373c

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

Makefile

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,24 @@ BIN_PATH ?=$(PREFIX)/usr# /bin is appended later
117117
BIN_AFTER_INST_PATH ?=$(BIN_PATH)# needed for debian package and desktop file exec
118118
PROMPT_BIN_PATH ?=$(PREFIX)/usr# /bin is appended later
119119
LIB_PATH ?=$(PREFIX)/usr/lib/x86_64-linux-gnu
120-
LIBDEV_PATH ?=$(PREFIX)/usr/lib/x86_64-linux-gnu
120+
ifeq ($(origin LIB_PATH), default)
121+
# Debian/Ubuntu
122+
DEB_MULTIARCH := $(shell command -v dpkg-architecture >/dev/null 2>&1 && dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null)
123+
ifneq ($(DEB_MULTIARCH),)
124+
LIB_PATH := $(prefix)/lib/$(DEB_MULTIARCH)
125+
else
126+
# RPM-based
127+
HAVE_RPM := $(shell command -v rpm >/dev/null 2>&1 && echo yes)
128+
ifeq ($(HAVE_RPM),yes)
129+
RPM_LIBDIR := $(shell rpm --eval %_libdir)
130+
ifeq ($(prefix),/usr)
131+
LIB_PATH := $(RPM_LIBDIR)
132+
else
133+
LIB_PATH := $(prefix)/$(shell echo $(RPM_LIBDIR) | sed 's|^/usr/||')
134+
endif
135+
endif
136+
endif
137+
LIBDEV_PATH ?=$(LIB_PATH)
121138
INCLUDE_PATH ?=$(PREFIX)/usr/include/x86_64-linux-gnu
122139
MAN_PATH ?=$(PREFIX)/usr/share/man
123140
PROMPT_MAN_PATH ?=$(PREFIX)/usr/share/man

0 commit comments

Comments
 (0)