summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2018-03-16 18:50:09 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2018-03-16 18:50:09 +0000
commit70f81c1edf07718fab62abf3c88e124d6c658e59 (patch)
treeb1878d78926ca1142973ede2cd2b3235328cbc45 /Makefile
parent1a59e495dbe68a6f5dc862f929ed38da056afbd4 (diff)
downloadgcompat-70f81c1edf07718fab62abf3c88e124d6c658e59.tar.gz
gcompat-70f81c1edf07718fab62abf3c88e124d6c658e59.tar.bz2
gcompat-70f81c1edf07718fab62abf3c88e124d6c658e59.tar.xz
gcompat-70f81c1edf07718fab62abf3c88e124d6c658e59.zip
build: allow building with libucontext support
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile11
1 files changed, 9 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 0b4e76c..06af84f 100644
--- a/Makefile
+++ b/Makefile
@@ -40,11 +40,18 @@ LOADER_OBJ = ${LOADER_SRC:.c=.o}
LOADER_NAME = ld-linux.so.2
LOADER_PATH = /lib/${LOADER_NAME}
+ifdef WITH_LIBUCONTEXT
+
+LIBUCONTEXT_LIBS = -Wl,--no-as-needed -lucontext
+LIBUCONTEXT_CFLAGS = -DWITH_LIBUCONTEXT
+
+endif
+
all: ${LIBGCOMPAT_NAME} ${LOADER_NAME}
${LIBGCOMPAT_NAME}: ${LIBGCOMPAT_OBJ}
$(CC) -o ${LIBGCOMPAT_NAME} -Wl,-soname,${LIBGCOMPAT_NAME} \
- -shared ${LIBGCOMPAT_OBJ}
+ -shared ${LIBGCOMPAT_OBJ} ${LIBUCONTEXT_LIBS}
${LIBGCOMPAT_OBJ}: ${LIBGCOMPAT_INCLUDE}
@@ -54,7 +61,7 @@ ${LOADER_NAME}: ${LOADER_OBJ}
.c.o:
$(CC) -c -D_BSD_SOURCE -DLIBGCOMPAT=\"${LIBGCOMPAT_PATH}\" \
-DLINKER=\"${LINKER_PATH}\" -DLOADER=\"${LOADER_NAME}\" \
- -Ilibgcompat \
+ -Ilibgcompat ${LIBUCONTEXT_CFLAGS} \
-fPIC -std=c99 -Wall -Wextra -Wno-frame-address \
-Wno-unused-parameter ${CFLAGS} ${CPPFLAGS} -o $@ $<