-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
35 lines (26 loc) · 1.17 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
TARGET = bluez-helper
INSTALL_PREFIX ?= /usr/local/bin
BLUEZ_PATH = ./bluez
BLUEZ_SRCS = lib/bluetooth.c lib/hci.c lib/sdp.c lib/uuid.c
BLUEZ_SRCS += attrib/att.c attrib/gatt.c attrib/gattrib.c attrib/utils.c
BLUEZ_SRCS += btio/btio.c src/log.c src/shared/log.c src/shared/mgmt.c
BLUEZ_SRCS += src/shared/crypto.c src/shared/att.c src/shared/queue.c src/shared/util.c
BLUEZ_SRCS += src/shared/io-glib.c src/shared/timeout-glib.c
BLUEZ_FULL_SRCS = $(addprefix $(BLUEZ_PATH)/, $(BLUEZ_SRCS))
LOCAL_SRCS = src/bluez-helper.c
CC ?= gcc
CFLAGS ?= -O3
EXTRA_CFLAGS = -DHAVE_CONFIG_H
EXTRA_CFLAGS += -I$(BLUEZ_PATH)/attrib -I$(BLUEZ_PATH) -I$(BLUEZ_PATH)/lib -I$(BLUEZ_PATH)/src -I$(BLUEZ_PATH)/gdbus -I$(BLUEZ_PATH)/btio -I$(BLUEZ_PATH)/sys
EXTRA_CFLAGS += $(shell pkg-config glib-2.0 --cflags)
GLIB = $(shell pkg-config glib-2.0 --libs)
.PHONY: clean install
all: $(TARGET)
$(TARGET): $(LOCAL_SRCS) $(BLUEZ_FULL_SRCS)
$(CC) -L. $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $(LOCAL_SRCS) $(BLUEZ_FULL_SRCS) $(GLIB)
install:
install -d $(INSTALL_PREFIX)
install -m 0755 $(TARGET) $(INSTALL_PREFIX)/$(TARGET)
setcap 'cap_net_raw,cap_net_admin+eip' $(INSTALL_PREFIX)/$(TARGET)
clean:
rm -f $(TARGET)