summaryrefslogtreecommitdiffstats
path: root/tool/Makefile
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-06-18 14:52:35 +0200
committerJustus Winter <justus@sequoia-pgp.org>2020-06-18 15:58:36 +0200
commitc99514eba879b318c25e0736064a5412ecc8fd28 (patch)
tree22a63aa0b82548249bfa0124debb9da6e10ed69f /tool/Makefile
parent022521a0f24143eb124ba4e1ec2f98bea04d170c (diff)
Improve install target.
- Add explicit build-release and install targets. - Explicitly build the crates. - Move installation to the crate's Makefile. - This allows building of Sequoia's individual parts, e.g. by using 'make -Copenpgp-ffi install'.
Diffstat (limited to 'tool/Makefile')
-rw-r--r--tool/Makefile32
1 files changed, 31 insertions, 1 deletions
diff --git a/tool/Makefile b/tool/Makefile
index 196a4cfb..78177449 100644
--- a/tool/Makefile
+++ b/tool/Makefile
@@ -1,11 +1,41 @@
-CARGO ?= cargo
+# Configuration.
CARGO_TARGET_DIR ?= $(shell pwd)/../target
# We currently only support absolute paths.
CARGO_TARGET_DIR := $(abspath $(CARGO_TARGET_DIR))
SQ ?= $(CARGO_TARGET_DIR)/debug/sq
+# Tools.
+CARGO ?= cargo
+ifeq ($(shell uname -s), Darwin)
+ INSTALL ?= ginstall
+else
+ INSTALL ?= install
+endif
+
all: src/sq-usage.rs
+# Installation.
+.PHONY: build-release
+build-release:
+ CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) \
+ $(CARGO) build $(CARGO_FLAGS) --release --package sequoia-tool
+ $(MAKE) -C../store build-release
+
+.PHONY: install
+install: build-release
+ $(INSTALL) -d $(DESTDIR)$(PREFIX)/bin
+ $(INSTALL) -t $(DESTDIR)$(PREFIX)/bin $(CARGO_TARGET_DIR)/release/sq
+ $(INSTALL) -d $(DESTDIR)$(PREFIX)/share/zsh/site-functions
+ $(INSTALL) -t $(DESTDIR)$(PREFIX)/share/zsh/site-functions \
+ $(CARGO_TARGET_DIR)/_sq
+ $(INSTALL) -d $(DESTDIR)$(PREFIX)/share/bash-completion/completions
+ $(INSTALL) $(CARGO_TARGET_DIR)/sq.bash \
+ $(DESTDIR)$(PREFIX)/share/bash-completion/completions/sq
+ $(INSTALL) -d $(DESTDIR)$(PREFIX)/share/fish/completions
+ $(INSTALL) -t $(DESTDIR)$(PREFIX)/share/fish/completions \
+ $(CARGO_TARGET_DIR)/sq.fish
+ $(MAKE) -C../store install
+
# Maintenance.
.PHONY: update-usage
update-usage: src/sq-usage.rs