-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
35 lines (28 loc) · 897 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
PROJECT_ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
NAME = subscriber
# subscriber publisher
OBJS = $(FILE_NAME).o
BUILD_MODE=run
ifeq ($(BUILD_MODE),debug)
CFLAGS += -g
else ifeq ($(BUILD_MODE),run)
CFLAGS += -O2 -Wall -Werror
else ifeq ($(BUILD_MODE),linuxtools)
CFLAGS += -g -pg -fprofile-arcs -ftest-coverage
LDFLAGS += -pg -fprofile-arcs -ftest-coverage
else
$(error Build mode $(BUILD_MODE) not supported by this Makefile)
endif
OBJDIR = $(mkfile_dir)obj
BINDIR = $(mkfile_dir)bin
SRCDIR = $(mkfile_dir)src
OBJS = $(OBJDIR)/$(NAME).o
$(shell mkdir -p $(OBJDIR))
$(shell mkdir -p $(BINDIR))
all: $(BINDIR)/$(NAME)
$(BINDIR)/$(NAME): $(OBJS)
$(CXX) $(LDFLAGS) -o $@ $^ -ltbb --std=c++17 -lpaho-mqtt3as -lpaho-mqttpp3
$(OBJS): $(PROJECT_ROOT)src/$(NAME).cpp
$(CXX) -c $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) -o $@ $< -ltbb --std=c++17
clean:
rm -rf -v $(OBJDIR) $(BINDIR)