-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
56 lines (35 loc) · 1.29 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
CROSS_COMPILE ?=
TARGET ?= bt_start_sniffer
SOURCE_ROOT ?= ./
CC := $(CROSS_COMPILE)gcc
LD := $(CROSS_COMPILE)ld
OBJCOPY := $(CROSS_COMPILE)objcopy
OBJDUMP := $(CROSS_COMPILE)objdump
# Header file directory
INCUDIRS := ${SOURCE_ROOT} \
${SOURCE_ROOT}/component/config \
${SOURCE_ROOT}/component/log \
${SOURCE_ROOT}/component/type \
${SOURCE_ROOT}/component/zmq \
${SOURCE_ROOT}/component/ringbuffer \
${SOURCE_ROOT}/component/controller \
${SOURCE_ROOT}/component/injection \
# C source code file directory
SRCDIRS := ${SOURCE_ROOT} \
${SOURCE_ROOT}/component/zmq \
${SOURCE_ROOT}/component/ringbuffer \
${SOURCE_ROOT}/component/controller \
${SOURCE_ROOT}/component/injection \
INCLUDE := $(patsubst %, -I %, $(INCUDIRS))
CFILES := $(foreach dir, $(SRCDIRS), $(wildcard $(dir)/*.c))
CFILENDIR := $(notdir $(CFILES))
OBJS := $(patsubst %, obj/%, $(CFILENDIR:.c=.o))
VPATH := $(SRCDIRS)
#CFLAGS ?= -g -Wall -Werror $(INCLUDE)
CFLAGS ?= -g -Wall $(INCLUDE)
LDFLAGS ?= -lpthread -lzmq
.PHONY:clean
$(TARGET) : $(CFILES)
$(CC) $^ $(CFLAGS) $(LDFLAGS) -o $@
clean:
rm -rf $(TARGET) $(OBJS)