-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
45 lines (33 loc) · 864 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
36
37
38
39
40
41
42
43
44
45
PROJECT := multipart_parser_test
CXX := g++
SRC_DIR := .
SRC := $(wildcard $(SRC_DIR)/*.cpp)
HEADERS := $(wildcard $(SRC_DIR)/*.h)
#CXXFLAGS := -Wall -std=c++11
CXXFLAGS := -Wall -Werror -std=c++11
CXXFLAGS += -I./cpprestsdk/Release/include
ifdef DEBUG
CXXFLAGS += -g -DDEBUG
FLAVOR := debug
else
CXXFLAGS += -O3
FLAVOR := release
endif
BUILD_DIR := build/$(FLAVOR)
OBJ_DIR := obj/$(FLAVOR)/$(PROJECT)
BIN := $(BUILD_DIR)/$(PROJECT)
LDFLAGS := -L/usr/local/lib \
-L./cpprestsdk/Release/build/Binaries \
-lcpprest -lboost_system -lssl -lcrypto -pthread
SRC_OBJS := $(SRC:%.cpp=$(OBJ_DIR)/%.o)
all: $(BIN)
$(BIN): $(SRC_OBJS)
mkdir -p $(dir $@)
$(CXX) $^ $(CPPFLAGS) $(LDFLAGS) -o $@
$(SRC_OBJS): $(OBJ_DIR)/%.o : %.cpp
mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) -c $(CPPFLAGS) $< -o $@
.PHONY: clean
clean:
-rm -r $(OBJ_DIR)
-rm $(BIN)