-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
56 lines (44 loc) · 1.31 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
BUILD_DIR=.build
OUT=$(BUILD_DIR)/litter-controller
DEPS=-lwiringPi -lwiringPiDev -lpthread -lcrypt -lm -lrt -largparse -Largparse/
WARNINGS=-Wall
FLAGS=$(DEPS) $(WARNINGS)
COMPILER=gcc
PREFIX?=/usr/local
INSTALL_DIR?=$(PREFIX)/bin
SYSTEMD_UNIT_DESTINATION?=/etc/systemd/system/
.PHONY: test install uninstall clean
$(OUT): $(wildcard ./*.c)
mkdir -p $(BUILD_DIR)
set -ex && $(COMPILER) $< $(FLAGS) -o $@
deploy: $(out) install service
test: $(OUT)
./$(OUT) -d9 -I53
deps:
git submodule update --init
cd wiringPi; ./build; cd ../
$(MAKE) -Cargparse/
install argparse/libargparse.so $(PREFIX)/lib/
install argparse/argparse.h $(PREFIX)/include/
ldconfig
install: $(OUT)
install -d $(INSTALL_DIR)
install $(OUT) $(INSTALL_DIR)
service:
install litter-controller.service $(SYSTEMD_UNIT_DESTINATION)
systemctl enable litter-controller.service
systemctl restart litter-controller.service
rpi-config:
install config.txt /boot/
touch /boot/ssh
echo i2c-dev > /etc/modules-load.d/i2c.conf
usermod -a -G i2c pi
modprobe i2c-dev
logs:
journalctl -fu litter-controller
uninstall:
$(RM) $(INSTALL_DIR)/$(OUT)
clean:
$(RM) -r $(BUILD_DIR)
GITROOT=$(shell git rev-parse --show-toplevel)
include $(shell test -d $(GITROOT)/include.mk/ || git clone [email protected]:smaslennikov/include.mk.git && echo $(GITROOT))/include.mk/*.mk