-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
48 lines (39 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
36
37
38
39
40
41
42
43
44
45
46
47
48
.PHONY: clean all doc install
LIB_OBJS := ble_adv.o
SCANNER_OBJS := scanner.o
LYWSD03MMC_DUMPER_OBJS := lywsd03mmc_dumper.o
OBJS := $(SCANNER_OBJS) $(LYWSD03MMC_DUMPER_OBJS) $(LIB_OBJS)
HEADERS := ble_adv.h
BINARIES := scanner lywsd03mmc_dumper
LIB := libble_adv.so
CC := gcc
DOXYGEN := doxygen
CFLAGS := -fPIE -Wall -Werror -Wextra -pedantic -std=c11 -O0 -g -Wcast-align -D_DEFAULT_SOURCE -Iinclude
ifeq (clang,$(CC))
CFLAGS += -Weverything
CFLAGS += -Wno-padded
CFLAGS += -Wno-disabled-macro-expansion
CFLAGS += -Wno-unused-macros
CFLAGS += -Wno-unsafe-buffer-usage
CFLAGS += -Wno-declaration-after-statement
endif
LDFLAGS := -lbluetooth
PREFIX := /usr/local
DESTDIR :=
all: $(BINARIES) $(LIB)
clean:
rm -f $(BINARIES) $(OBJS) $(LIB)
rm -rf doc
scanner: $(SCANNER_OBJS) $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDFLAGS_EXAMPLES)
lywsd03mmc_dumper: $(LYWSD03MMC_DUMPER_OBJS) $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
%.o: %.c $(HEADERS)
$(CC) $(CFLAGS) -c -o $@ $<
$(LIB): $(LIB_OBJS)
$(CC) -shared -o $@ $^
doc:
$(DOXYGEN)
install: $(LIB)
install -Dm644 -t "$(DESTDIR)$(PREFIX)/include" ble_adv.h
install -Dm755 -t "$(DESTDIR)$(PREFIX)/lib" libble_adv.so