-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
101 lines (91 loc) · 3.36 KB
/
Copy pathMakefile
File metadata and controls
101 lines (91 loc) · 3.36 KB
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
# Compiler and flags
CC=gcc
CFLAGS = -Wall -Wextra -O3 -std=c99 -g
OBJS_P1 = api.o coloring.o queue.o heap.o search.o generator.o utils.o dijkstra.o prim.o greedyflow.o insertionArray.o diapi.o
VALGRIND_FLAGS = --leak-check=full --show-reachable=yes
VALGRIND_CMD = $(if $(VALGRIND),valgrind $(VALGRIND_FLAGS),)
.PHONY: clean
parte1: test_graphs
final: main.o $(OBJS_P1)
$(CC) $(CFLAGS) -o final main.o $(OBJS_P1)
# Compile and run the tests in test_generator.c
test_graphs: test_utils.o test_generator.o test_search.o test_graph_typing.o test_api.o test_digraph.o test_dijkstra.o test_prim.o test_network.o test_greedyflow.o $(OBJS_P1)
$(CC) $(CFLAGS) -o test_graphs test_utils.o $(OBJS_P1)
@echo "\nRunning utilities tests..."
$(VALGRIND_CMD) ./test_graphs
$(CC) $(CFLAGS) -o test_graphs test_graph_typing.o $(OBJS_P1)
@echo "\nRunning utilities tests..."
$(VALGRIND_CMD) ./test_graphs
$(CC) $(CFLAGS) -o test_graphs test_api.o $(OBJS_P1)
@echo "\nRunning API tests..."
$(VALGRIND_CMD) ./test_graphs
$(CC) $(CFLAGS) -o test_graphs test_digraph.o $(OBJS_P1)
@echo "\nRunning digraph tests..."
$(VALGRIND_CMD) ./test_graphs
$(CC) $(CFLAGS) -o test_graphs test_network.o $(OBJS_P1)
@echo "\nRunning API tests for flow networks..."
$(VALGRIND_CMD) ./test_graphs
$(CC) $(CFLAGS) -o test_graphs test_search.o $(OBJS_P1)
@echo "\nRunning tests for search functions..."
$(VALGRIND_CMD) ./test_graphs
$(CC) $(CFLAGS) -o test_graphs test_generator.o $(OBJS_P1)
@echo "\nRunning tests for generator functions..."
$(VALGRIND_CMD) ./test_graphs
$(CC) $(CFLAGS) -o test_graphs test_dijkstra.o $(OBJS_P1)
@echo "\nRunning tests for Dijkstra..."
$(VALGRIND_CMD) ./test_graphs
$(CC) $(CFLAGS) -o test_graphs test_prim.o $(OBJS_P1)
@echo "\nRunning tests for Prim..."
$(VALGRIND_CMD) ./test_graphs
$(CC) $(CFLAGS) -o test_graphs test_greedyflow.o $(OBJS_P1)
@echo "\nRunning tests for greedy flow..."
$(VALGRIND_CMD) ./test_graphs
# Individual object file compilation
main.o: c/main.c
$(CC) $(CFLAGS) -c c/main.c
api.o: c/api.c c/api.h c/graphStruct.h
$(CC) $(CFLAGS) -c c/api.c
coloring.o: c/coloring.c c/api.h c/graphStruct.h c/coloring.h
$(CC) $(CFLAGS) -c c/coloring.c
queue.o: c/queue.c c/queue.h
$(CC) $(CFLAGS) -c c/queue.c
heap.o: c/heap.c c/heap.h
$(CC) $(CFLAGS) -c c/heap.c
search.o: c/search.c c/api.h c/search.h
$(CC) $(CFLAGS) -c c/search.c
generator.o: c/generator.c c/api.h c/generator.h
$(CC) $(CFLAGS) -c c/generator.c
utils.o: c/utils.c c/api.h c/utils.h
$(CC) $(CFLAGS) -c c/utils.c
dijkstra.o: c/dijkstra.c
$(CC) $(CFLAGS) -c c/dijkstra.c
prim.o: c/prim.c
$(CC) $(CFLAGS) -c c/prim.c
test_generator.o:
$(CC) $(CFLAGS) -c c/test_generator.c
test_search.o:
$(CC) $(CFLAGS) -c c/test_search.c
test_graph_typing.o:
$(CC) $(CFLAGS) -c c/test_graph_typing.c
test_api.o:
$(CC) $(CFLAGS) -c c/test_api.c
test_utils.o:
$(CC) $(CFLAGS) -c c/test_utils.c
test_network.o:
$(CC) $(CFLAGS) -c c/test_network.c
test_dijkstra.o:
$(CC) $(CFLAGS) -c c/test_dijkstra.c
test_prim.o:
$(CC) $(CFLAGS) -c c/test_prim.c
greedyflow.o: c/greedyflow.c
$(CC) $(CFLAGS) -c c/greedyflow.c
test_greedyflow.o:
$(CC) $(CFLAGS) -c c/test_greedyflow.c
insertionArray.o: c/insertionArray.h
$(CC) $(CFLAGS) -c c/insertionArray.c
diapi.o: c/diapi.c c/diapi.h c/graphStruct.h
$(CC) $(CFLAGS) -c c/diapi.c
test_digraph.o:
$(CC) $(CFLAGS) -c c/test_digraph.c
clean:
rm -f *.o final main a.out test_graphs