-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathMakefile
37 lines (28 loc) · 785 Bytes
/
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
override CFLAGS += --std=c99 -O2 -Wall -Wtype-limits -Wno-missing-braces
LDFLAGS += -lcurl -lbluetooth -lpopt
SRC = ttblue.c \
bbatt.c \
ttops.c \
util.c \
version.c
HEADERS = bbatt.h \
ttops.h \
att-types.h \
util.h \
version.h
OUTPUT = ttblue
all: $(OUTPUT)
setcap: $(OUTPUT)
@echo 'This will give ttblue permissions to create raw'
@echo 'network sockets and thereby improve the speed of'
@echo 'the BLE connection.'
sudo setcap 'cap_net_raw,cap_net_admin+eip' $(OUTPUT)
$(SRC:.c=.o): $(HEADERS)
%.o: %.c
@echo Compiling $@...
$(CC) -c $(CFLAGS) $< -o $*.o
$(OUTPUT): $(SRC:.c=.o)
@echo Linking $(OUTPUT)...
$(CC) -o $(OUTPUT) $(SRC:.c=.o) $(LDFLAGS)
clean:
-rm $(OUTPUT) $(SRC:.c=.o) >/dev/null 2>&1