summaryrefslogtreecommitdiffstats
path: root/ffi
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-03-12 17:04:02 +0100
committerJustus Winter <justus@sequoia-pgp.org>2020-03-13 14:31:36 +0100
commit61a3b55d115f770ed2cc493f052efa68e15a87ae (patch)
tree449676a356d7e413b514c5a359ea34104b493344 /ffi
parentcc1250dc96c6459f4510357430405032d6dbf9a9 (diff)
ffi, openpgp-ffi: Properly use LDLIBS to link against Sequoia.
- Fixes linking tests and examples with ld --as-needed.
Diffstat (limited to 'ffi')
-rw-r--r--ffi/examples/Makefile5
-rw-r--r--ffi/tests/c-tests.rs3
2 files changed, 5 insertions, 3 deletions
diff --git a/ffi/examples/Makefile b/ffi/examples/Makefile
index bce777b2..6186d6b9 100644
--- a/ffi/examples/Makefile
+++ b/ffi/examples/Makefile
@@ -10,7 +10,8 @@ EXAMPLE_TARGET_DIR ?= $(CARGO_TARGET_DIR)/debug/c-examples/ffi
EXAMPLES = keyserver configure
CFLAGS = -I../include -I../../openpgp-ffi/include -O0 -g -Wall -Werror
-LDFLAGS = -L$(CARGO_TARGET_DIR)/debug -lsequoia_ffi
+LDFLAGS = -L$(CARGO_TARGET_DIR)/debug
+LDLIBS = -lsequoia_ffi
# Prefix our target directory.
TARGETS := $(foreach example,$(EXAMPLES),$(EXAMPLE_TARGET_DIR)/$(example))
@@ -24,4 +25,4 @@ $(TARGETS): ../include/sequoia.h
$(EXAMPLE_TARGET_DIR)/%: %.c
mkdir -p $(EXAMPLE_TARGET_DIR)
- $(CC) $(CFLAGS) $(LDFLAGS) -o "$@" "$<"
+ $(CC) $(CFLAGS) $(LDFLAGS) -o "$@" "$<" $(LDLIBS)
diff --git a/ffi/tests/c-tests.rs b/ffi/tests/c-tests.rs
index afe91c2e..4df61903 100644
--- a/ffi/tests/c-tests.rs
+++ b/ffi/tests/c-tests.rs
@@ -228,7 +228,8 @@ fn build(include_dirs: &[PathBuf], ldpath: &Path, target_dir: &Path,
let st = Command::new("make")
.env("CFLAGS", &format!("-Wall -O0 -ggdb {} {}", includes,
env::var("CFLAGS").unwrap_or("".into())))
- .env("LDFLAGS", &format!("-L{:?} -lsequoia_ffi", ldpath))
+ .env("LDFLAGS", &format!("-L{:?}", ldpath))
+ .env("LDLIBS", "-lsequoia_ffi")
.arg("-C").arg(&target_dir)
.arg("--quiet")
// XXX: We don't track the header files as dependencies for