-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (36 loc) · 1.19 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
.DEFAULT_GOAL := all
LIBRABBITMQ_C_PATH=./thirdparty/rabbitmq-c
LIBRABBITMQ_INCLUDE_PATH=$(LIBRABBITMQ_C_PATH)/librabbitmq
LIBRABBITMQ_LIBRARY_PATH=$(LIBRABBITMQ_C_PATH)/build/librabbitmq
CXX_INCLUDE_PATH=-I./include -I$(LIBRABBITMQ_INCLUDE_PATH)
CXX_LIBRARIES=-L$(LIBRABBITMQ_LIBRARY_PATH) -lrabbitmq -lpthread -lconfig
CXX_FLAGS=-std=c++14 -Wall -g $(CXX_INCLUDE_PATH)
CXX=g++ $(CXX_FLAGS)
SOURCES := \
src/utils.o \
src/error.o \
src/resolver.o \
src/channel.o \
src/connection.o \
src/consumer.o \
src/publisher.o \
src/operation.o \
src/config_loader.o \
src/main.o
.PHONY+=tests all
include test/Makefile.in
all: $(LIBRABBITMQ_LIBRARY_PATH)/librabbitmq.so rmq-aggregator
rmq-aggregator: $(SOURCES)
$(CXX) -o $@ $^ $(CXX_LIBRARIES)
$(LIBRABBITMQ_INCLUDE_PATH):
git submodule update --init --recursive
$(LIBRABBITMQ_LIBRARY_PATH)/librabbitmq.so: $(LIBRABBITMQ_INCLUDE_PATH)
mkdir -p $(LIBRABBITMQ_C_PATH)/build
cd $(LIBRABBITMQ_C_PATH)/build && cmake .. && make
clean: clean-tests
rm -f $(SOURCES) ./rmq-aggregator
clean-all: clean
rm -rf $(LIBRABBITMQ_C_PATH)/build
tests: $(LIBRABBITMQ_LIBRARY_PATH)/librabbitmq.so $(TEST_TARGETS)
%.o: %.cpp
$(CXX) -c -o $@ $^ $(CXX_LIBRARIES)