libucontext/Makefile

49 lines
1.3 KiB
Makefile
Raw Normal View History

2018-01-31 05:58:26 +00:00
ARCH := $(shell uname -m)
2018-01-30 03:41:02 +00:00
2018-01-31 20:37:00 +00:00
CFLAGS = -ggdb3 -O2 -Wall -Iarch/${ARCH}
2018-01-30 03:41:02 +00:00
LIBUCONTEXT_C_SRC = \
arch/${ARCH}/makecontext.c
LIBUCONTEXT_S_SRC = \
arch/${ARCH}/getcontext.S \
2018-01-30 03:41:02 +00:00
arch/${ARCH}/setcontext.S \
arch/${ARCH}/swapcontext.S \
arch/${ARCH}/startcontext.S
LIBUCONTEXT_OBJ = ${LIBUCONTEXT_C_SRC:.c=.o} ${LIBUCONTEXT_S_SRC:.S=.o}
LIBUCONTEXT_SOVERSION = 0
2018-01-30 03:53:04 +00:00
LIBUCONTEXT_NAME = libucontext.so
LIBUCONTEXT_SONAME = libucontext.so.${LIBUCONTEXT_SOVERSION}
LIBUCONTEXT_PATH = /lib/${LIBUCONTEXT_SONAME}
2018-01-30 03:53:04 +00:00
all: ${LIBUCONTEXT_SONAME}
${LIBUCONTEXT_NAME}: ${LIBUCONTEXT_OBJ}
2018-01-30 03:53:04 +00:00
$(CC) -o ${LIBUCONTEXT_NAME} -Wl,-soname,${LIBUCONTEXT_SONAME} \
-shared ${LIBUCONTEXT_OBJ}
2018-01-30 03:53:04 +00:00
${LIBUCONTEXT_SONAME}: ${LIBUCONTEXT_NAME}
ln -sf ${LIBUCONTEXT_NAME} ${LIBUCONTEXT_SONAME}
.c.o:
$(CC) -std=c99 -D_BSD_SOURCE -fPIC -DPIC ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
.S.o:
$(CC) -fPIC -DPIC ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
clean:
2018-01-30 03:53:04 +00:00
rm -f ${LIBUCONTEXT_NAME} ${LIBUCONTEXT_SONAME} ${LIBUCONTEXT_OBJ}
install: all
install -D -m755 ${LIBUCONTEXT_NAME} ${DESTDIR}/${LIBUCONTEXT_PATH}
2018-01-30 03:53:04 +00:00
ln -sf ${LIBUCONTEXT_SONAME} ${DESTDIR}/lib/${LIBUCONTEXT_NAME}
check: test_libucontext ${LIBUCONTEXT_SONAME}
env LD_LIBRARY_PATH=. ./test_libucontext
test_libucontext: test_libucontext.c ${LIBUCONTEXT_NAME}
2018-01-31 04:12:09 +00:00
$(CC) -std=c99 -D_BSD_SOURCE ${CFLAGS} ${CPPFLAGS} $@.c -o $@ ${LIBUCONTEXT_NAME}
2018-01-30 03:53:04 +00:00
.PHONY: check