diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-03-12 17:04:02 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-03-13 14:31:36 +0100 |
commit | 61a3b55d115f770ed2cc493f052efa68e15a87ae (patch) | |
tree | 449676a356d7e413b514c5a359ea34104b493344 /openpgp-ffi | |
parent | cc1250dc96c6459f4510357430405032d6dbf9a9 (diff) |
ffi, openpgp-ffi: Properly use LDLIBS to link against Sequoia.
- Fixes linking tests and examples with ld --as-needed.
Diffstat (limited to 'openpgp-ffi')
-rw-r--r-- | openpgp-ffi/examples/Makefile | 5 | ||||
-rw-r--r-- | openpgp-ffi/tests/c-tests.rs | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/openpgp-ffi/examples/Makefile b/openpgp-ffi/examples/Makefile index faf6962d..6742a9a5 100644 --- a/openpgp-ffi/examples/Makefile +++ b/openpgp-ffi/examples/Makefile @@ -17,7 +17,8 @@ EXAMPLES = \ reader-cookie \ CFLAGS = -I../include -O0 -g -Wall -Werror -LDFLAGS = -L$(CARGO_TARGET_DIR)/debug -lsequoia_openpgp_ffi +LDFLAGS = -L$(CARGO_TARGET_DIR)/debug +LDLIBS = -lsequoia_openpgp_ffi # Prefix our target directory. TARGETS := $(foreach example,$(EXAMPLES),$(EXAMPLE_TARGET_DIR)/$(example)) @@ -31,4 +32,4 @@ $(TARGETS): ../include/sequoia/openpgp.h $(EXAMPLE_TARGET_DIR)/%: %.c mkdir -p $(EXAMPLE_TARGET_DIR) - $(CC) $(CFLAGS) $(LDFLAGS) -o "$@" "$<" + $(CC) $(CFLAGS) $(LDFLAGS) -o "$@" "$<" $(LDLIBS) diff --git a/openpgp-ffi/tests/c-tests.rs b/openpgp-ffi/tests/c-tests.rs index 8dc38227..e58fff52 100644 --- a/openpgp-ffi/tests/c-tests.rs +++ b/openpgp-ffi/tests/c-tests.rs @@ -227,7 +227,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_openpgp_ffi", ldpath)) + .env("LDFLAGS", &format!("-L{:?}", ldpath)) + .env("LDLIBS", "-lsequoia_openpgp_ffi") .arg("-C").arg(&target_dir) .arg("--quiet") // XXX: We don't track the header files as dependencies for |