-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathMakefile
65 lines (56 loc) · 2.34 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
62
63
64
65
CC = g++
LIBS = -lwiringPi -lm -lpthread -lrt -lcrypt
CFLAGS = -std=c++14 -Wall -DLINUX -DARDUINO=999 -DRADIOLIB_FIX_ERRATA_SX127X -IRadioLib/src/ \
-IRadioLib/src/modules/ -IRadioLib/src/protocols/ -IRadioLib/src/modules/RF69/ \
-IRadioLib/src/modules/SX127x/ -IRadioLib/src/modules/SX126x/ -IRadioLib/src/modules/LLCC68/ \
-IRadioLib/src/linux-workarounds/ -IRadioLib/src/linux-workarounds/SPI/
# Should be equivalent to your list of C files, if you don't build selectively
SRC = $(wildcard RadioLib/src/linux-workarounds/SPI/*.cpp) $(wildcard RadioLib/src/linux-workarounds/*.cpp) \
$(wildcard RadioLib/src/protocols/PhysicalLayer/*.cpp) $(wildcard RadioLib/src/modules/RF69/*.cpp) \
$(wildcard RadioLib/src/modules/SX127x/*.cpp) $(wildcard RadioLib/src/modules/SX126x/*.cpp) \
$(wildcard RadioLib/src/modules/LLCC68/*.cpp) $(wildcard RadioLib/src/*.cpp) \
$(wildcard smtUdpPacketForwarder/base64/*.c) $(wildcard smtUdpPacketForwarder/gpsTimestampUtils/*.cpp) \
$(wildcard smtUdpPacketForwarder/*.cpp) $(wildcard *.cpp)
TAG_COMMIT := $(shell git rev-list --abbrev-commit --tags --max-count=1 || true)
TAG := $(shell git describe --abbrev=0 --tags ${TAG_COMMIT} 2>/dev/null || true)
COMMIT := $(shell git rev-parse --short HEAD || true)
VERSION := $(TAG:v%=%)
ifneq ($(COMMIT), $(TAG_COMMIT))
ifneq ($(VERSION),)
VERSION := $(VERSION)-
endif
VERSION := $(VERSION)next-$(COMMIT)
endif
ifeq ($(VERSION),)
ifeq ($(COMMIT),)
VERSION := unknown
else
VERSION := $(COMMIT)
endif
endif
ifneq ($(shell git status --porcelain || true),)
VERSION := $(VERSION)-dirty
endif
all: $(SRC)
$(CC) -o LoRaPktFwrd $^ $(CFLAGS) -DGIT_VER=$(VERSION) -O3 $(LIBS)
debug: $(SRC)
$(CC) -o LoRaPktFwrd $^ -g3 -DRADIOLIB_DEBUG -DGIT_VER=$(VERSION) $(CFLAGS) $(LIBS)
clean:
rm -f ./LoRaPktFwrd
install:
mkdir -p /etc/LoRaPacketForwarder
cp -f ./config.json.template /etc/LoRaPacketForwarder
cp -f ./config.json /etc/LoRaPacketForwarder
cp -f ./LoRaPktFwrd /usr/bin
chmod a+x /usr/bin/LoRaPktFwrd
cp -f LoRaPktFwrd.service /lib/systemd/system
systemctl daemon-reload
uninstall:
systemctl stop LoRaPktFwrd.service
systemctl disable LoRaPktFwrd.service
rm -f /lib/systemd/system/LoRaPktFwrd.service
systemctl daemon-reload
rm -fr /etc/LoRaPacketForwarder
rm -f /usr/bin/LoRaPktFwrd
getsvclogs:
journalctl -n 100 -f -u LoRaPktFwrd.service