This repository has been archived by the owner on Apr 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
59 lines (41 loc) · 1.78 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
INC_DIR = ./inc
MAVLINK_DIR = ./lib/mavlink_generated/include/mavlink/v2.0
SRC_DIR = ./src
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
ifdef $(DESTDIR)
$(DESTDIR) := $(DESTDIR)/
endif
SYSTEM_INCLUDE = $(PREFIX)/include
LDFLAGS = -L$(PREFIX)/lib -lboost_system -lboost_program_options -lboost_regex
openhd_router: serial.o router.o endpoint.o udpendpoint.o tcpendpoint.o main.o
g++ -std=c++11 -g -pthread -o openhd_router serial.o router.o endpoint.o udpendpoint.o tcpendpoint.o main.o $(LDFLAGS)
main.o: $(SRC_DIR)/main.cpp
g++ -std=c++11 -g -c -pthread -I$(SYSTEM_INCLUDE) -I$(MAVLINK_DIR) -I$(INC_DIR) $(SRC_DIR)/main.cpp
router.o: $(SRC_DIR)/router.cpp
g++ -std=c++11 -g -c -pthread -I$(SYSTEM_INCLUDE) -I$(MAVLINK_DIR) -I$(INC_DIR) $(SRC_DIR)/router.cpp
endpoint.o: $(SRC_DIR)/endpoint.cpp
g++ -std=c++11 -g -c -pthread -I$(SYSTEM_INCLUDE) -I$(MAVLINK_DIR) -I$(INC_DIR) $(SRC_DIR)/endpoint.cpp
tcpendpoint.o: $(SRC_DIR)/tcpendpoint.cpp
g++ -std=c++11 -g -c -pthread -I$(SYSTEM_INCLUDE) -I$(MAVLINK_DIR) -I$(INC_DIR) $(SRC_DIR)/tcpendpoint.cpp
udpendpoint.o: $(SRC_DIR)/udpendpoint.cpp
g++ -std=c++11 -g -c -pthread -I$(SYSTEM_INCLUDE) -I$(MAVLINK_DIR) -I$(INC_DIR) $(SRC_DIR)/udpendpoint.cpp
serial.o: $(SRC_DIR)/serial.cpp
g++ -std=c++11 -g -c -pthread -I$(SYSTEM_INCLUDE) -I$(MAVLINK_DIR) -I$(INC_DIR) $(SRC_DIR)/serial.cpp
clean:
rm -f *.o openhd_router
.PHONY: install
install: openhd_router
install -d $(DESTDIR)$(PREFIX)/bin/
install -d $(DESTDIR)/etc/systemd/system
install -m 755 openhd_router $(DESTDIR)$(PREFIX)/bin/
install -m 644 openhd_router.service $(DESTDIR)/etc/systemd/system/
install -d $(DESTDIR)/etc/openhd
.PHONY: enable
enable: install
systemctl enable openhd_router
systemctl start openhd_router
.PHONY: uninstall
uninstall:
rm -f $(PREFIX)/bin/openhd_router