build: make and install libucontext_posix

pull/23/head
Ariadne Conill 2020-12-08 18:29:21 -07:00
parent ed1e5752fc
commit 2688747f8a
1 changed files with 25 additions and 2 deletions

View File

@ -39,8 +39,27 @@ LIBUCONTEXT_HEADERS = \
include/libucontext/bits.h
LIBUCONTEXT_EXAMPLES = \
examples/cooperative_threading
LIBUCONTEXT_POSIX_NAME = libucontext_posix.so
LIBUCONTEXT_POSIX_STATIC_NAME = libucontext_posix.a
LIBUCONTEXT_POSIX_C_SRC = libucontext_posix.c
LIBUCONTEXT_POSIX_OBJ = ${LIBUCONTEXT_POSIX_C_SRC:.c=.o}
LIBUCONTEXT_POSIX_SONAME = libucontext_posix.so.${LIBUCONTEXT_SOVERSION}
LIBUCONTEXT_POSIX_PATH = ${LIBDIR}/${LIBUCONTEXT_POSIX_SONAME}
LIBUCONTEXT_POSIX_STATIC_PATH = ${LIBDIR}/${LIBUCONTEXT_POSIX_STATIC_NAME}
all: ${LIBUCONTEXT_SONAME} ${LIBUCONTEXT_STATIC_NAME} ${LIBUCONTEXT_PC}
ifeq ($(FREESTANDING),yes)
LIBUCONTEXT_POSIX_NAME =
LIBUCONTEXT_POSIX_STATIC_NAME =
endif
all: ${LIBUCONTEXT_SONAME} ${LIBUCONTEXT_STATIC_NAME} ${LIBUCONTEXT_POSIX_NAME} ${LIBUCONTEXT_POSIX_STATIC_NAME} ${LIBUCONTEXT_PC}
${LIBUCONTEXT_POSIX_NAME}: ${LIBUCONTEXT_NAME} ${LIBUCONTEXT_POSIX_OBJ}
$(CC) -fPIC -o ${LIBUCONTEXT_POSIX_NAME} -Wl,-soname,${LIBUCONTEXT_POSIX_SONAME} \
-shared ${LIBUCONTEXT_POSIX_OBJ} ${LDFLAGS}
${LIBUCONTEXT_POSIX_STATIC_NAME}: ${LIBUCONTEXT_POSIX_OBJ}
$(AR) rcs ${LIBUCONTEXT_POSIX_STATIC_NAME} ${LIBUCONTEXT_POSIX_OBJ}
${LIBUCONTEXT_STATIC_NAME}: ${LIBUCONTEXT_OBJ}
$(AR) rcs ${LIBUCONTEXT_STATIC_NAME} ${LIBUCONTEXT_OBJ}
@ -81,7 +100,7 @@ docs: ${MANPAGES}
clean:
rm -f ${LIBUCONTEXT_NAME} ${LIBUCONTEXT_SONAME} ${LIBUCONTEXT_STATIC_NAME} \
${LIBUCONTEXT_OBJ} ${LIBUCONTEXT_PC} \
${LIBUCONTEXT_OBJ} ${LIBUCONTEXT_PC} ${LIBUCONTEXT_POSIX_NAME} ${LIBUCONTEXT_POSIX_STATIC_NAME} \
include/libucontext/bits.h test_libucontext ${MANPAGES}
install: all
@ -93,6 +112,10 @@ install: all
install -D -m644 $$i ${DESTDIR}${INCLUDEDIR}/$$destfn; \
done
install -D -m644 ${LIBUCONTEXT_PC} ${DESTDIR}${PKGCONFIGDIR}/${LIBUCONTEXT_PC}
if [ -n ${LIBUCONTEXT_POSIX_NAME} ]; then \
install -D -m755 ${LIBUCONTEXT_POSIX_NAME} ${DESTDIR}${LIBUCONTEXT_POSIX_PATH}; \
install -D -m644 ${LIBUCONTEXT_STATIC_POSIX_NAME} ${DESTDIR}${LIBUCONTEXT_STATIC_POSIX_PATH}; \
fi
install_docs: docs
install -D -m644 doc/libucontext.3 ${DESTDIR}/usr/share/man/man3/libucontext.3