forked from pop-os/shell-shortcuts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
57 lines (41 loc) · 937 Bytes
/
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
55
56
57
prefix ?= /usr/local
# Files to watch for modifications
SRC = Cargo.toml Cargo.lock $(shell find src -type f -wholename 'src/*.rs')
.PHONY: all clean distclean install uninstall
BIN=pop-shell-shortcuts
TARGET=debug
DEBUG ?= 0
ifeq ($(DEBUG),0)
ARGS += "--release"
TARGET = release
endif
BINARY_SRC=target/$(TARGET)/$(BIN)
BINARY_DST=$(DESTDIR)$(prefix)/bin/$(BIN)
VENDORED ?= 0
ifeq ($(VENDORED),1)
ARGS += "--frozen"
endif
all: $(BINARY_SRC)
clean:
cargo clean
distclean:
rm -rf .cargo vendor vendor.tar.xz
run: $(BINARY_SRC)
$(BINARY_SRC)
install: $(BINARY_SRC)
install -Dm755 $(BINARY_SRC) $(BINARY_DST)
uninstall:
rm -f $(BINARY_DST)
update:
cargo update
vendor:
mkdir -p .cargo
cargo vendor | head -n -1 > .cargo/config
echo 'directory = "vendor"' >> .cargo/config
tar pcfJ vendor.tar.xz vendor
rm -rf vendor
$(BINARY_SRC): $(SRC)
ifeq ($(VENDORED),1)
tar pxf vendor.tar.xz
endif
cargo build $(ARGS)