diff options
author | Neal H. Walfield <neal@pep.foundation> | 2018-09-08 11:50:11 +0200 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2018-09-08 13:01:57 +0200 |
commit | 50e5ecba26948eefbbc058bc4a47205a429453cf (patch) | |
tree | 2d65b2a11e9b5f84366624d0eda14dc61aebcb6f /ffi | |
parent | 7bac8e4fed5eccbdc04f48ef5d946c5da2613ec4 (diff) |
Change Makefiles to support CARGO_TARGET_DIR.
- Also use 'cargo clean' instead of 'rm -rf $(CARGO_TARGET_DIR)' in
case $(CARGO_TARGET_DIR) is incorrectly set.
Diffstat (limited to 'ffi')
-rw-r--r-- | ffi/Makefile | 13 | ||||
-rw-r--r-- | ffi/examples/Makefile | 7 |
2 files changed, 15 insertions, 5 deletions
diff --git a/ffi/Makefile b/ffi/Makefile index 352da2b8..b379ac80 100644 --- a/ffi/Makefile +++ b/ffi/Makefile @@ -4,6 +4,11 @@ PREFIX ?= /usr/local DESTDIR ?= +CARGO ?= cargo +CARGO_TARGET_DIR ?= $(shell pwd)/../target +# We currently only support absolute paths. +CARGO_TARGET_DIR := $(abspath $(CARGO_TARGET_DIR)) + VERSION ?= $(shell grep '^version[[:space:]]*=[[:space:]]*' Cargo.toml | cut -d'"' -f2) VERSION_MAJOR = $(shell echo $(VERSION) | cut -d'.' -f1) @@ -20,9 +25,9 @@ all: build build: sed -e 's|VERSION|$(VERSION)|g' \ -e 's|PREFIX|$(shell pwd)|g' \ - -e 's|libdir=.*|libdir=$(shell pwd)/../target/debug|g' \ + -e 's|libdir=.*|libdir='"$(CARGO_TARGET_DIR)"'/debug|g' \ sequoia.pc.in \ - > ../target/debug/sequoia.pc + > $(CARGO_TARGET_DIR)/debug/sequoia.pc # Testing and examples. .PHONY: test check @@ -49,13 +54,13 @@ install: sequoia.pc $(INSTALL) -t $(DESTDIR)$(PREFIX)/include/sequoia \ include/sequoia/*.h $(INSTALL) -d $(DESTDIR)$(PREFIX)/lib - $(INSTALL) ../target/release/libsequoia_ffi.so \ + $(INSTALL) $(CARGO_TARGET_DIR)/release/libsequoia_ffi.so \ $(DESTDIR)$(PREFIX)/lib/libsequoia_ffi.so.$(VERSION) ln -fs libsequoia_ffi.so.$(VERSION) \ $(DESTDIR)$(PREFIX)/lib/libsequoia_ffi.so.$(VERSION_MAJOR) ln -fs libsequoia_ffi.so.$(VERSION) \ $(DESTDIR)$(PREFIX)/lib/libsequoia_ffi.so - $(INSTALL) ../target/release/libsequoia_ffi.a \ + $(INSTALL) $(CARGO_TARGET_DIR)/release/libsequoia_ffi.a \ $(DESTDIR)$(PREFIX)/lib/libsequoia_ffi.a # Housekeeping. diff --git a/ffi/examples/Makefile b/ffi/examples/Makefile index 3b7b6794..5920b9d3 100644 --- a/ffi/examples/Makefile +++ b/ffi/examples/Makefile @@ -1,8 +1,13 @@ # Makefile for examples written in C. +CARGO ?= cargo +CARGO_TARGET_DIR ?= $(shell pwd)/../../target +# We currently only support absolute paths. +CARGO_TARGET_DIR := $(abspath $(CARGO_TARGET_DIR)) + TARGETS = example keyserver configure reader parser encrypt-for CFLAGS = -I../include -O0 -g -Wall -LDFLAGS = -L../../target/debug -lsequoia_ffi +LDFLAGS = -L$(CARGO_TARGET_DIR)/debug -lsequoia_ffi all: $(TARGETS) |