-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (42 loc) · 1.07 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
prefix ?= /usr/local
bindir = $(prefix)/bin
libdir = $(prefix)/lib
TARGET = debug
DEBUG ?= 0
ARGS ?=
ifeq ($(DEBUG),0)
TARGET = release
ARGS += --release
endif
BINARY = target/${TARGET}/wait-online
SERVICE = network-standalone-wait-online.service
SOURCES = $(shell find src -type f -name '*.rs') build.rs Cargo.toml Cargo.lock
.PHONY: all
all: $(BINARY)
.PHONY: test
test: $(SOURCES)
env prefix=${prefix} \
cargo build $(ARGS)
.PHONY: clean
clean:
cargo clean
distclean: clean
rm -rf .cargo
## Building the binaries
bin $(BINARY): $(SOURCES)
env prefix=${prefix} \
cargo build $(ARGS)
## Install commands
.PHONY: install
install: install-bin install-service
install-bin: ${BINARY}
install -Dm0755 "$(BINARY)" "$(DESTDIR)$(bindir)/wait-online"
install-service: ${BINARY}
install -Dm0644 "target/$(SERVICE)" "$(DESTDIR)$(libdir)/systemd/system/$(SERVICE)"
## Uninstall Commands
.PHONY: uninstall
uninstall: uninstall-service uninstall-bin
uninstall-bin:
rm "$(DESTDIR)$(bindir)/wait-online"
uninstall-service:
rm "$(DESTDIR)$(libdir)/systemd/system/$(SERVICE)"