This repository has been archived by the owner on Oct 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (34 loc) · 1.84 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
CC = g++ -std=gnu++0x -std=c++17
PYTHON_INTERPRETER = python3
SOURCE_DIR = src/alignment
TEST_DIR = src/alignment_tests
INFOGRAPHIC_DIR = src/alignment
MAIN_ALGO_FILE = $(SOURCE_DIR)/main.cpp
MAIN_BIN_FILE = main_algo.exe
TEST_DIR_EXE_FILES := $(shell find ./$(TEST_DIR)/* -name "*.exe")
SUFFIX_FOREST_TESTS_DIR := $(TEST_DIR)/suffix_forest
SLICE_MATCHER_TESTS_DIR := $(TEST_DIR)/slice_matcher
ALL_SOURCE_CPP_FILES := $(shell find ./$(SOURCE_DIR)/*/* -name "*.cpp")
ALL_SOURCE_HPP_FILES := $(shell find ./$(SOURCE_DIR) -name "*.hpp")
SUFFIX_TREE_TESTS := $(addprefix $(SUFFIX_FOREST_TESTS_DIR)/, $(addsuffix .exe, \
$(shell find ./$(SUFFIX_FOREST_TESTS_DIR) -iname "*.cpp" -execdir basename {} .cpp ';')))
SLICE_MATCHER_TESTS := $(addprefix $(SLICE_MATCHER_TESTS_DIR)/, $(addsuffix .exe, \
$(shell find ./$(SLICE_MATCHER_TESTS_DIR) -iname "*.cpp" -execdir basename {} .cpp ';')))
all: suffix_forest_tests slice_matcher_tests main_algo
all_tests: suffix_forest_tests slice_matcher_tests
suffix_forest_tests: $(SUFFIX_TREE_TESTS)
@$(addsuffix $() &&, $(addprefix ./, $(SUFFIX_TREE_TESTS))) echo "Finished $@\n";
slice_matcher_tests: $(SLICE_MATCHER_TESTS)
@$(addsuffix $() &&, $(addprefix ./, $(SLICE_MATCHER_TESTS))) echo "Finished $@\n";
main_algo : $(MAIN_BIN_FILE)
@./$^ && echo "Finished $@\n" && $(PYTHON_INTERPRETER) $(INFOGRAPHIC_DIR)/slice_matches_plotting.py;
slice_matches_plot:
@$(PYTHON_INTERPRETER) $(INFOGRAPHIC_DIR)/slice_matches_plotting.py
$(SUFFIX_FOREST_TESTS_DIR)/%.exe : $(SUFFIX_FOREST_TESTS_DIR)/%.cpp $(ALL_SOURCE_CPP_FILES)
@$(CC) $^ -o $@
$(SLICE_MATCHER_TESTS_DIR)/%.exe : $(SLICE_MATCHER_TESTS_DIR)/%.cpp $(ALL_SOURCE_CPP_FILES)
@$(CC) $^ -o $@
$(MAIN_BIN_FILE) : $(MAIN_ALGO_FILE) $(ALL_SOURCE_CPP_FILES) $(ALL_SOURCE_HPP_FILES)
@$(CC) $^ -o $@
clean:
@rm $(MAIN_BIN_FILE); $(addprefix rm , $(addsuffix ;, $(TEST_DIR_EXE_FILES)))