-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
54 lines (40 loc) · 1.32 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
PKGNAME := rofi-vscode-mode
LIBNAME := librofi_vscode_mode.so
BINNAME := vscode-recent
CARGO ?= cargo
CARGO_TARGET_DIR ?= target
CARGO_RELEASE_DIR ?= $(CARGO_TARGET_DIR)/release
# Set DESTDIR for staged installs
prefix ?= /usr/local
bindir ?= $(prefix)/bin
libdir ?= $(prefix)/lib
datarootdir ?= $(prefix)/share
docdir ?= $(datarootdir)/doc/$(PKGNAME)
licensesdir ?= $(datarootdir)/licenses/$(PKGNAME)
# Find the directory to install plugins (only expand if needed)
pluginsdir_pc = $(shell pkg-config --variable pluginsdir rofi)
pluginsdir ?= $(if $(pluginsdir_pc),$(pluginsdir_pc),$(libdir)/rofi)
# Build everything
all:
cargo build --release
# Build only library (plugin for Rofi)
plugin:
$(CARGO) build --release --lib --features rofi
# Build only the binary
bin:
$(CARGO) build --release --bin $(BINNAME) --no-default-features
# Install everything
install: install.plugin install.bin
# Just install the plugin
install.plugin:
install -Dt $(DESTDIR)$(pluginsdir) $(CARGO_RELEASE_DIR)/$(LIBNAME)
# Just install the binary
install.bin:
install -Dt $(DESTDIR)$(bindir) $(CARGO_RELEASE_DIR)/$(BINNAME)
install.doc:
install -Dt $(DESTDIR)$(docdir) README.md
install.licenses:
install -Dt $(DESTDIR)$(licensesdir) LICENSE
clean:
$(CARGO) clean
.PHONY: all plugin bin install install.plugin install.bin install.doc install.licences clean