-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (24 loc) · 846 Bytes
/
Makefile
File metadata and controls
31 lines (24 loc) · 846 Bytes
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
SRC_FILES := $(wildcard src/*.cpp)
SRC_NO_MAIN := $(filter-out src/main.cpp, $(SRC_FILES))
LIB_NAME = libshrincs.a
SRC_DIR = src
INC_DIR = include
OBJ_DIR = obj
OBJS = $(SRC_NO_MAIN:$(SRC_DIR)/%.cpp=$(OBJ_DIR)/%.o)
build: $(OBJS)
ar rcs $(LIB_NAME) $(OBJS)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
@mkdir -p $(OBJ_DIR)
g++ -O3 -Wall -fPIC -I$(INC_DIR) -c $< -o $@
clean:
rm -rf $(OBJ_DIR) $(LIB_NAME)
TEST_FLAGS := -lgtest -lpthread -fsanitize=address -fno-omit-frame-pointer
test:
mkdir -p bin
g++ -g -Wall -Wno-deprecated-declarations $(SRC_NO_MAIN) tests/tests.cpp -I include -o bin/run_tests $(TEST_FLAGS) -lssl -lcrypto
./bin/run_tests
BENCH_FLAGS := -lgtest -lpthread
benchmark:
mkdir -p bin
g++ -O3 -Wall -Wno-deprecated-declarations $(SRC_NO_MAIN) tests/bench.cpp -I include -o bin/bench $(BENCH_FLAGS) -lssl -lcrypto
./bin/bench