forked from pop-os/system76-oled
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (44 loc) · 1.15 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
55
56
57
prefix ?= /usr
sysconfdir ?= /etc
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
includedir = $(prefix)/include
datarootdir = $(prefix)/share
datadir = $(datarootdir)
SRC = Cargo.toml Cargo.lock Makefile $(shell find src -type f -wholename '*src/*.rs')
.PHONY: all clean distclean install uninstall update
BIN=system76-oled
DEBUG ?= 0
ifeq ($(DEBUG),0)
ARGS += "--release"
TARGET = release
endif
VENDORED ?= 0
ifeq ($(VENDORED),1)
ARGS += "--frozen"
endif
all: target/release/$(BIN)
clean:
cargo clean
distclean:
rm -rf .cargo vendor vendor.tar.xz
install: all
install -D -m 04755 "target/release/$(BIN)" "$(DESTDIR)$(bindir)/$(BIN)"
install -D -m 0644 "data/$(BIN).desktop" "$(DESTDIR)$(sysconfdir)/xdg/autostart/$(BIN).desktop"
uninstall:
rm -f "$(DESTDIR)$(bindir)/$(BIN)"
rm -f "$(DESTDIR)$(sysconfdir)/xdg/autostart/$(BIN).desktop"
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
target/release/$(BIN): $(SRC)
ifeq ($(VENDORED),1)
tar pxf vendor.tar.xz
endif
cargo build $(ARGS)