-
Notifications
You must be signed in to change notification settings - Fork 28
/
Makefile
67 lines (51 loc) · 1.7 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
58
59
60
61
62
63
64
65
66
67
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
PKG=system76-firmware
CLI=$(PKG)-cli
DAEMON=$(PKG)-daemon
ARGS = --release
VENDORED ?= 0
ifeq ($(VENDORED),1)
ARGS += --frozen
endif
all: target/release/$(CLI) target/release/$(DAEMON)
clean:
cargo clean
distclean: clean
rm -rf .cargo vendor vendor.tar.xz
install: install-cli install-daemon
install-cli: target/release/$(CLI)
install -D -m 0755 "target/release/$(CLI)" "$(DESTDIR)$(bindir)/$(CLI)"
install-daemon: target/release/$(DAEMON)
install -D -m 0755 "target/release/$(DAEMON)" "$(DESTDIR)$(libdir)/$(PKG)/$(DAEMON)"
install -D -m 0644 "data/$(DAEMON).conf" "$(DESTDIR)$(sysconfdir)/dbus-1/system.d/$(DAEMON).conf"
install -D -m 0644 "debian/$(DAEMON).service" "$(DESTDIR)$(sysconfdir)/systemd/system/$(DAEMON).service"
uninstall: uninstall-cli uninstall-daemon
uninstall-cli:
rm -f "$(DESTDIR)$(bindir)/$(CLI)"
uninstall-daemon:
rm -f "$(DESTDIR)$(libdir)/$(PKG)/$(DAEMON)"
rm -f "$(DESTDIR)$(sysconfdir)/dbus-1/system.d/$(DAEMON).conf"
rm -f "$(DESTDIR)$(sysconfdir)/systemd/system/$(DAEMON).service"
update:
cargo update
vendor:
mkdir -p .cargo
cargo vendor --sync daemon/Cargo.toml | head -n -1 > .cargo/config
echo 'directory = "vendor"' >> .cargo/config
tar pcfJ vendor.tar.xz vendor
rm -rf vendor
target/release/$(CLI) target/release/$(DAEMON): $(SRC)
ifeq ($(VENDORED),1)
tar pxf vendor.tar.xz
endif
cargo build $(ARGS)
cargo build -p $(DAEMON) $(ARGS)