Makefile: Add LIBDIR variable

This ensures that it can be installed into custom location and also

Upstream-Status: Submitted
Signed-off-by: Khem Raj <raj.khem@gmail.com>
pull/18/head
Khem Raj 2020-03-30 08:21:20 +00:00 committed by Ariadne Conill
parent e040915105
commit e2178de76a
1 changed files with 6 additions and 5 deletions

View File

@ -3,6 +3,7 @@ ifeq ($(ARCH),$(filter $(ARCH),i386 i686))
override ARCH = x86
endif
LIBDIR := /lib
CFLAGS = -ggdb3 -O2 -Wall -Iarch/${ARCH} -Iarch/common
LIBUCONTEXT_C_SRC = $(wildcard arch/${ARCH}/*.c)
@ -13,8 +14,8 @@ LIBUCONTEXT_SOVERSION = 0
LIBUCONTEXT_NAME = libucontext.so
LIBUCONTEXT_STATIC_NAME = libucontext.a
LIBUCONTEXT_SONAME = libucontext.so.${LIBUCONTEXT_SOVERSION}
LIBUCONTEXT_PATH = /lib/${LIBUCONTEXT_SONAME}
LIBUCONTEXT_STATIC_PATH = /lib/${LIBUCONTEXT_STATIC_NAME}
LIBUCONTEXT_PATH = ${LIBDIR}/${LIBUCONTEXT_SONAME}
LIBUCONTEXT_STATIC_PATH = ${LIBDIR}/${LIBUCONTEXT_STATIC_NAME}
all: ${LIBUCONTEXT_SONAME} ${LIBUCONTEXT_STATIC_NAME}
@ -39,9 +40,9 @@ clean:
${LIBUCONTEXT_OBJ} test_libucontext
install: all
install -D -m755 ${LIBUCONTEXT_NAME} ${DESTDIR}/${LIBUCONTEXT_PATH}
install -D -m664 ${LIBUCONTEXT_STATIC_NAME} ${DESTDIR}/${LIBUCONTEXT_STATIC_PATH}
ln -sf ${LIBUCONTEXT_SONAME} ${DESTDIR}/lib/${LIBUCONTEXT_NAME}
install -D -m755 ${LIBUCONTEXT_NAME} ${DESTDIR}${LIBUCONTEXT_PATH}
install -D -m664 ${LIBUCONTEXT_STATIC_NAME} ${DESTDIR}${LIBUCONTEXT_STATIC_PATH}
ln -sf ${LIBUCONTEXT_SONAME} ${DESTDIR}${LIBDIR}/${LIBUCONTEXT_NAME}
check: test_libucontext ${LIBUCONTEXT_SONAME}
env LD_LIBRARY_PATH=$(shell pwd) ./test_libucontext