diff options
author | Samuel Holland <samuel@sholland.org> | 2019-01-05 09:00:35 -0600 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2019-01-05 09:35:19 -0600 |
commit | 59d0cbb49bc0c69d5bd754215faaec16e2c20057 (patch) | |
tree | e19ae28b4cba5836933ef3ce456fbc9f5c7c7f17 | |
parent | 98b8025edf172ae8d3e0a619249dc1670067b0f0 (diff) | |
download | gcompat-59d0cbb49bc0c69d5bd754215faaec16e2c20057.tar.gz gcompat-59d0cbb49bc0c69d5bd754215faaec16e2c20057.tar.bz2 gcompat-59d0cbb49bc0c69d5bd754215faaec16e2c20057.tar.xz gcompat-59d0cbb49bc0c69d5bd754215faaec16e2c20057.zip |
Makefile: Detect and link an obstack library
Signed-off-by: Samuel Holland <samuel@sholland.org>
-rw-r--r-- | CHANGELOG.rst | 5 | ||||
-rw-r--r-- | Makefile | 18 |
2 files changed, 20 insertions, 3 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7c5365c..7df686f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -11,6 +11,11 @@ 0.4.0 (201?-??-??) ================== +Build system +------------ + +* Allow building against libobstack. + wchar ----- @@ -44,11 +44,23 @@ LOADER_OBJ = ${LOADER_SRC:.c=.o} LOADER_NAME = ld-linux.so.2 LOADER_PATH = /lib/${LOADER_NAME} -ifdef WITH_LIBUCONTEXT +PKG_CONFIG ?= pkg-config +ifdef WITH_LIBUCONTEXT LIBUCONTEXT_CFLAGS = -DWITH_LIBUCONTEXT LIBUCONTEXT_LIBS = -lucontext +endif + +ifndef WITH_OBSTACK +WITH_OBSTACK = $(shell \ + for pkg in obstack obstack-standalone; do \ + ${PKG_CONFIG} --exists "$$pkg" && { echo "$$pkg"; exit 0; } \ + done; echo "no") +endif +ifneq (${WITH_OBSTACK},no) +OBSTACK_CFLAGS = $(shell ${PKG_CONFIG} --cflags ${WITH_OBSTACK}) -DWITH_OBSTACK +OBSTACK_LIBS = $(shell ${PKG_CONFIG} --libs ${WITH_OBSTACK}) endif all: ${LIBGCOMPAT_NAME} ${LOADER_NAME} @@ -56,7 +68,7 @@ all: ${LIBGCOMPAT_NAME} ${LOADER_NAME} ${LIBGCOMPAT_NAME}: ${LIBGCOMPAT_OBJ} ${CC} ${CFLAGS} ${LDFLAGS} -shared -Wl,-soname,${LIBGCOMPAT_NAME} \ -o ${LIBGCOMPAT_NAME} ${LIBGCOMPAT_OBJ} \ - -Wl,--no-as-needed ${LIBUCONTEXT_LIBS} + -Wl,--no-as-needed ${LIBUCONTEXT_LIBS} ${OBSTACK_LIBS} ${LIBGCOMPAT_OBJ}: ${LIBGCOMPAT_INCLUDE} @@ -69,7 +81,7 @@ ${LOADER_NAME}: ${LOADER_OBJ} -DLINKER='"${LINKER_PATH}"' -DLOADER='"${LOADER_NAME}"' \ -fPIC -Ilibgcompat -std=c99 \ -Wall -Wextra -Wno-frame-address -Wno-unused-parameter \ - ${LIBUCONTEXT_CFLAGS} -o $@ $< + ${LIBUCONTEXT_CFLAGS} ${OBSTACK_CFLAGS} -o $@ $< clean: rm -f libgcompat/*.o loader/*.o ${LIBGCOMPAT_NAME} ${LOADER_NAME} |