-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
115 lines (85 loc) · 3.79 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Paths to source files
MAIN = main
MODULES = modules
DATASETS = datasets
TESTS = tests
# Paths to include files
INCLUDE = include
# Compiler
CC = gcc
# Compile options. The -I<dir> tells the compiler where to find the include files
# -Werror makes warnings errors
CFLAGS = -Wall -Werror -g -I$(INCLUDE)
LDFLAGS = -lm
# .o files
OBJS = $(MAIN)/main.o $(MODULES)/Graph.o $(MODULES)/Node.o $(MODULES)/Neighbors.o $(MODULES)/Dimension.o $(MODULES)/MathematicalFunctions.o $(MODULES)/FindAllRightNeighborsAlgorithm.o $(MODULES)/knn.o $(MODULES)/knn_improvements.o $(MODULES)/Cost.o $(MODULES)/projection_tree.o
# Test objects
OBJSKNN_IMP = $(TESTS)/knn_improvements_test.o $(MODULES)/Cost.o $(MODULES)/knn_improvements.o $(MODULES)/Graph.o $(MODULES)/Node.o $(MODULES)/Neighbors.o $(MODULES)/Dimension.o $(MODULES)/MathematicalFunctions.o $(MODULES)/knn.o $(MODULES)/projection_trees.o
OBJSKNN = $(TESTS)/knn_test.o $(MODULES)/Graph.o $(MODULES)/Node.o $(MODULES)/Neighbors.o $(MODULES)/Dimension.o $(MODULES)/MathematicalFunctions.o $(MODULES)/FindAllRightNeighborsAlgorithm.o $(MODULES)/knn.o
OBJSG = $(TESTS)/graph_test.o $(MODULES)/Graph.o $(MODULES)/Node.o $(MODULES)/Neighbors.o $(MODULES)/Dimension.o $(MODULES)/MathematicalFunctions.o $(MODULES)/knn.o
OBJSN = $(TESTS)/nodes_test.o $(MODULES)/Node.o $(MODULES)/Dimension.o $(MODULES)/Neighbors.o $(MODULES)/MathematicalFunctions.o
OBJSD = $(TESTS)/dimension_test.o $(MODULES)/Node.o $(MODULES)/Dimension.o $(MODULES)/Neighbors.o $(MODULES)/MathematicalFunctions.o
OBJSNEI = $(TESTS)/neighbours_test.o $(MODULES)/Neighbors.o $(MODULES)/Node.o $(MODULES)/Dimension.o $(MODULES)/MathematicalFunctions.o
OBJSMATH = $(TESTS)/mathematical_test.o $(MODULES)/MathematicalFunctions.o $(MODULES)/Dimension.o
OBJSTREE = $(TESTS)/projection_trees_tests.o $(MODULES)/projection_trees.o $(MODULES)/Graph.o $(MODULES)/Node.o $(MODULES)/Neighbors.o $(MODULES)/Dimension.o $(MODULES)/MathematicalFunctions.o $(MODULES)/knn.o
# Executables
EXEC = program
EXECKNN_IMP = knn_improvements_test
EXECKNN = knn_test
EXECG = graph_test
EXECN = nodes_test
EXECD = dimension_test
EXECNEI = neighbours_test
EXECMATH = mathFunctions_test
EXECTREES = projection_trees_tests
# Args for examples
ARGSEUCL = $(DATASETS)/00001000-4.bin 100 399 euclidean 0.2 0.001
ARGSMAN = $(DATASETS)/00001000-4.bin 100 399 manhattan 0.1 0.001
run-euclidean: $(EXEC)
./$(EXEC) $(ARGSEUCL)
run-manhattan: $(EXEC)
./$(EXEC) $(ARGSMAN)
runKNN_imp: $(EXECKNN_IMP)
./$(EXECKNN_IMP)
runKNN: $(EXECKNN)
./$(EXECKNN)
runG: $(EXECG)
./$(EXECG)
runN: $(EXECN)
./$(EXECN)
runD: $(EXECD)
./$(EXECD)
runNEI: $(EXECNEI)
./$(EXECNEI)
runMath: $(EXECMATH)
./$(EXECMATH)
runTrees: $(EXECTREES)
./$(EXECTREES)
# for every .c file
all: run-euclidean run-manhattan runKNN_imp runKNN runG runN runD runNEI runMath runTrees
# for 2 "main"
main-all: run-euclidean run-manhattan
# for all tests
run-all-tests: runKNN_imp runKNN runG runN runD runNEI runMath runTrees
$(EXEC): $(OBJS)
$(CC) $(OBJS) -o $(EXEC) $(LDFLAGS)
@if [ -f $(EXEC).exe ]; then ln -sf $(EXEC).exe $(EXEC); fi
$(EXECKNN_IMP): $(OBJSKNN_IMP)
$(CC) $(OBJSKNN_IMP) -o $(EXECKNN_IMP) $(LDFLAGS)
$(EXECKNN): $(OBJSKNN)
$(CC) $(OBJSKNN) -o $(EXECKNN) $(LDFLAGS)
$(EXECG): $(OBJSG)
$(CC) $(OBJSG) -o $(EXECG) $(LDFLAGS)
$(EXECN): $(OBJSN)
$(CC) $(OBJSN) -o $(EXECN) $(LDFLAGS)
$(EXECD): $(OBJSD)
$(CC) $(OBJSD) -o $(EXECD) $(LDFLAGS)
$(EXECNEI): $(OBJSNEI)
$(CC) $(OBJSNEI) -o $(EXECNEI) $(LDFLAGS)
$(EXECMATH): $(OBJSMATH)
$(CC) $(OBJSMATH) -o $(EXECMATH) $(LDFLAGS)
$(EXECTREES): $(OBJSTREE)
$(CC) $(OBJSTREE) -o $(EXECTREES) $(LDFLAGS)
clean:
rm -f $(OBJS) $(EXEC) $(OBJSG) $(OBJSN) $(OBJSD) $(OBJSKNN) $(OBJSMATH) $(OBJSNEI) $(EXECG) $(EXECN) $(EXECD) $(EXECKNN) $(EXECNEI) $(EXECMATH) $(OBJSKNNIMP) $(EXECMATH) $(EXECKNN_IMP) $(OBJSKNN_IMP) $(EXECTREES) $(OBJSTREE)
rm *.txt