-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
48 lines (43 loc) · 2.18 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
# Single Channel LoRaWAN Gateway
CC = gcc
LDFLAGS = -lprotobuf-c -lpaho-embed-mqtt3c -lpthread
CPPFLAGS = -std=gnu11
INCLUDE = -I/usr/include/protobuf-c -I. \
-Igithub.com/gogo/protobuf/protobuf \
-Ipaho.mqtt.embedded-c/MQTTClient-C/src \
-Ipaho.mqtt.embedded-c/MQTTPacket/src
CFLAGS = -Wall -Wextra -Wfatal-errors -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-parameter $(INCLUDE)
TARGET = lorawan-gateway
SRCFILES = base64.c main.c spi.c gpio.c time_util.c connector.c sx1276.c \
paho.mqtt.embedded-c/MQTTClient-C/src/linux/MQTTLinux.c \
paho.mqtt.embedded-c/MQTTClient-C/src/MQTTClient.c \
github.com/gogo/protobuf/protobuf/google/protobuf/descriptor.pb-c.c \
github.com/gogo/protobuf/protobuf/google/protobuf/empty.pb-c.c \
github.com/gogo/protobuf/gogoproto/gogo.pb-c.c \
github.com/TheThingsNetwork/api/api.pb-c.c \
github.com/TheThingsNetwork/api/trace/trace.pb-c.c \
github.com/TheThingsNetwork/api/gateway/gateway.pb-c.c \
github.com/TheThingsNetwork/api/protocol/protocol.pb-c.c \
github.com/TheThingsNetwork/api/protocol/lorawan/lorawan.pb-c.c \
github.com/TheThingsNetwork/api/router/router.pb-c.c \
github.com/TheThingsNetwork/gateway-connector-bridge/types/types.pb-c.c
OBJECTS = $(patsubst %.c, %.o, $(SRCFILES))
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(CC) -o $@ $^ $(LDFLAGS)
PROTOC = protoc-c --c_out=. --proto_path=. \
-I github.com/TheThingsNetwork/api \
-I github.com/gogo/protobuf/protobuf
protoc:
$(PROTOC) github.com/gogo/protobuf/protobuf/google/protobuf/descriptor.proto
$(PROTOC) github.com/gogo/protobuf/protobuf/google/protobuf/empty.proto
$(PROTOC) github.com/gogo/protobuf/gogoproto/gogo.proto
$(PROTOC) github.com/TheThingsNetwork/api/api.proto
$(PROTOC) github.com/TheThingsNetwork/api/trace/trace.proto
$(PROTOC) github.com/TheThingsNetwork/api/gateway/gateway.proto
$(PROTOC) github.com/TheThingsNetwork/api/protocol/protocol.proto
$(PROTOC) github.com/TheThingsNetwork/api/protocol/lorawan/lorawan.proto
$(PROTOC) github.com/TheThingsNetwork/api/router/router.proto
$(PROTOC) github.com/TheThingsNetwork/gateway-connector-bridge/types/types.proto
clean:
rm -f *.o $(TARGET)