-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (42 loc) · 1.42 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
CC ?= cc
CFLAGS ?= -g3 -Og
ALLCFLAGS = $(CFLAGS) -std=c17
LDFLAGS += -lpthread -lhwpwm `pkg-config --libs libgpiod`
BIN = kokanybot
SRCDIR = src
BUILDDIR = build
SRC = $(wildcard $(SRCDIR)/*.c)
OBJ = $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%.o,$(SRC))
DTS = $(wildcard overlays/*.dts)
DTBOS = $(patsubst overlays/%.dts,overlays/%.dtbo,$(DTS))
.PHONY: clean
all: $(BIN) $(DTBOS)
$(BIN): $(OBJ)
$(CC) $^ $(ALLCFLAGS) $(LDFLAGS) -o $@
$(BUILDDIR)/%.c.o: $(SRCDIR)/%.c
mkdir -p $(BUILDDIR)
$(CC) $< -c $(ALLCFLAGS) -o $@
%.dtbo: %.dts
dtc -I dts $< -O dtb -o $@
clean:
rm -rf $(BUILDDIR) $(BIN) $(DTBOS)
install: all
install -m 744 $(BIN) /usr/bin/$(BIN)
install -m 644 system/* /etc/systemd/system/
install -m 744 kokanystream-front.sh /usr/bin
install -m 744 kokanystream-rear.sh /usr/bin
install -m 744 kokany-select-ip.sh /usr/bin
install -m 744 kokanyaudio.sh /usr/bin
install -m 660 rules/* /etc/udev/rules.d/
install -m 660 interfaces/* /etc/network/interfaces.d/
install -m 755 overlays/*.dtbo /boot/firmware/overlays/
install -m 644 kokanybot_dhcp.conf /etc/dnsmasq.d/
systemctl enable kokanybot.service
systemctl enable kokanystream-front.service
systemctl enable kokanystream-rear.service
systemctl enable kokanyaudio.service
systemctl restart dnsmasq.service
systemctl restart kokanybot.service
systemctl restart kokanystream-front.service
systemctl restart kokanystream-rear.service
systemctl restart kokanyaudio.service