diff options
author | Luca Boccassi <luca.boccassi@microsoft.com> | 2020-10-26 11:15:05 +0000 |
---|---|---|
committer | Eric Biggers <ebiggers@google.com> | 2020-10-26 10:18:48 -0700 |
commit | a06a9eba5c80983c55499943730e28567888c092 (patch) | |
tree | b2edcdfc48801bc75e29d2e8e11b337dcc68177e | |
parent | 3967abf40918991b7e5cc486c7b1d9f1340316a1 (diff) | |
download | fsverity-utils-a06a9eba5c80983c55499943730e28567888c092.tar.gz |
Use pkg-config to get libcrypto build flags
Especially when cross-compiling or other such cases, it might be necessary
to pass additional compiler flags. This is commonly done via pkg-config,
so use it if available, and fall back to the hardcoded -lcrypto if not.
Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
Link: https://lore.kernel.org/r/20201026111506.3215328-1-luca.boccassi@gmail.com
[EB: updated comment at top of file]
Signed-off-by: Eric Biggers <ebiggers@google.com>
-rw-r--r-- | Makefile | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -28,7 +28,7 @@ # Define DESTDIR to override the installation destination directory # (default: empty string) # -# You can also specify custom CC, CFLAGS, CPPFLAGS, and/or LDFLAGS. +# You can also specify custom CC, CFLAGS, CPPFLAGS, LDFLAGS, and/or PKGCONF. # ############################################################################## @@ -58,6 +58,7 @@ BINDIR ?= $(PREFIX)/bin INCDIR ?= $(PREFIX)/include LIBDIR ?= $(PREFIX)/lib DESTDIR ?= +PKGCONF ?= pkg-config # Rebuild if a user-specified setting that affects the build changed. .build-config: FORCE @@ -69,7 +70,8 @@ DESTDIR ?= DEFAULT_TARGETS := COMMON_HEADERS := $(wildcard common/*.h) -LDLIBS := -lcrypto +LDLIBS := $(shell "$(PKGCONF)" libcrypto --libs 2>/dev/null || echo -lcrypto) +CFLAGS += $(shell "$(PKGCONF)" libcrypto --cflags 2>/dev/null || echo) # If we are dynamically linking, when running tests we need to override # LD_LIBRARY_PATH as no RPATH is set |