-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
48 lines (36 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
CPP := g++
CFLAGS := -O3 -Wpedantic -Wall -Wextra -Wconversion -Wshadow -Werror
PYTHON_LIB := $(shell python3-config --includes) -lpython3.9
THREAD_LIB := -lpthread
TARGET := aneris
SRC_DIR := ./src
INSTALL_DIR := /etc/$(TARGET)/
default: dependencies $(TARGET) $(TARGET)-ctl
dependencies:
apt install python3.9-dev g++ python3-picamera
pip3 install pybind11 opencv-python
$(TARGET): $(TARGET).o GPIO.o Logger.o Web_Server.o
$(CPP) -o $@ $? $(CFLAGS) $(THREAD_LIB) $(PYTHON_LIB)
$(TARGET).o: $(SRC_DIR)/$(TARGET).cpp
$(CPP) -c $< $(CFLAGS) $(THREAD_LIB)
GPIO.o: $(SRC_DIR)/GPIO.cpp
$(CPP) -c $< $(CFLAGS)
Logger.o: $(SRC_DIR)/Logger.cpp
$(CPP) -c $< $(CFLAGS)
Web_Server.o: $(SRC_DIR)/Web_Server.cpp
$(CPP) -c $< $(CFLAGS) $(PYTHON_LIB)
$(TARGET)-ctl: $(SRC_DIR)/$(TARGET)-ctl.cpp
$(CPP) -o $@ $< $(CFLAGS)
install:
mkdir -p $(INSTALL_DIR)
mkdir -p /var/log/aneris/
cp $(TARGET) $(SRC_DIR)/web_server.py $(INSTALL_DIR)
cp -r www/ $(INSTALL_DIR)
cp $(TARGET).service /etc/systemd/system/
cp $(TARGET)-ctl /usr/bin/
systemctl daemon-reload
systemctl enable aneris
systemctl start aneris
clean:
$(RM) $(TARGET) $(TARGET)-ctl *.o
remake: clean $(TARGET)