-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
101 lines (64 loc) · 2.98 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
CC = gcc
override CFLAGS += -Wall -pedantic --std=gnu99
MAKEFLAGS = --jobs=$(shell nproc)
.PHONY: all clean cleanall killserver intserver hupserver testlock testhangup test1 test2 test3 cleantestlock cleantesthangup cleantest1 cleantest2 cleantest3 files morefiles rmmorefiles stats
SERVERDEPS = server FileCache FileCachingProtocol ion miniz ParseUtils Queue ServerLib TimespecUtils W2M
CLIENTDEPS = client ClientAPI FileCachingProtocol ion ParseUtils PathUtils Queue TimespecUtils
all: client server
server: build $(addprefix build/,$(addsuffix .o, $(SERVERDEPS)))
$(CC) $(CFLAGS) -pthread $(filter-out $<,$^) -o $@
client: build $(addprefix build/,$(addsuffix .o, $(CLIENTDEPS)))
$(CC) $(CFLAGS) $(filter-out $<,$^) -o $@
build:
mkdir -p build
build/%.o: src/%.c
$(CC) $(CFLAGS) $^ -c -o $@
build/%.o: src/lib/%.c
$(CC) $(CFLAGS) $^ -c -o $@
cleanall: clean cleantest1 cleantest2 cleantest3 rmmorefiles
rm -f server client /tmp/LSOfilestorage.sk /tmp/LSOfilestorage.log
clean:
rm -rf build
killserver:
ps -ao pid,command | grep -E "(valgrind)?server" | head -n1 | grep -Eo "[0-9]{3,6}" | xargs -n1 kill -SIGKILL
intserver:
ps -ao pid,command | grep -E "(valgrind)?server" | head -n1 | grep -Eo "[0-9]{3,6}" | xargs -n1 kill -SIGINT
hupserver:
ps -ao pid,command | grep -E "(valgrind)?server" | head -n1 | grep -Eo "[0-9]{3,6}" | xargs -n1 kill -SIGHUP
testlock: cleantest1 all
(sleep 1 && chmod +x ./tests/lock/startClients.sh && ./tests/lock/startClients.sh) &
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes ./server -c tests/test1/config.txt
cleantestlock: cleantest1
testhangup: cleantest1 all
(sleep 1 && chmod +x ./tests/hangup/startClients.sh && ./tests/hangup/startClients.sh) &
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes ./server -c tests/test1/config.txt
cleantesthangup: cleantest1
test1: cleantest1 all
(mkdir -p ./tests/test1/tmp && sleep 1 && chmod +x ./tests/test1/startClients.sh && ./tests/test1/startClients.sh) &
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes ./server -c tests/test1/config.txt
cleantest1:
rm -rf ./tests/test1/tmp
test2: cleantest2 all files
(mkdir -p ./tests/test2/tmp && sleep 1 && chmod +x ./tests/test2/startClients.sh && ./tests/test2/startClients.sh) &
./server -c tests/test2/config.txt
cleantest2:
rm -rf ./tests/test2/tmp
test3: cleantest3 all morefiles
(mkdir -p ./tests/test3/tmp && sleep 1 && chmod +x ./tests/test3/startClients.sh && ./tests/test3/startClients.sh) &
./server -c tests/test3/config.txt
cleantest3:
rm -rf ./tests/test3/tmp
files: rmmorefiles
cp ./src/*.c ./src/lib/* ./src/include/* ./tests/cats/small/
chmod +x ./createMoreFiles.sh
morefiles: rmmorefiles
@echo "Creating files for the test"
cp ./src/*.c ./src/lib/* ./src/include/* ./tests/cats/small/
chmod +x ./createMoreFiles.sh
./createMoreFiles.sh
@echo "Files created"
rmmorefiles:
rm -f ./tests/cats/small/*.c ./tests/cats/small/*.h
stats:
@chmod +x ./statistiche.sh
time ./statistiche.sh