-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
152 lines (128 loc) · 3.46 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
###################################################################
# NOTA: Il nome riportato in UNIX_PATH deve corrispondere al nome
# usato per l'opzione UnixPath nel file di configurazione del
# server (vedere i file nella directory DATA).
# Lo stesso vale per il nome riportato in STAT_PATH e DIR_PATH
# che deveno corrispondere con l'opzione StatFileName e
# DirName, rispettivamente.
#
###################################################################
UNIX_PATH = /tmp/chatty_socket
STAT_PATH = /tmp/chatty_stats.txt
DIR_PATH = /tmp/chatty
CC = gcc
AR = ar
CFLAGS += -std=c99 -Wall -pedantic -g -DMAKE_VALGRIND_HAPPY
ARFLAGS = rvs
INCLUDES = -I.
LDFLAGS = -L.
OPTFLAGS = #-O3
LIBS = -pthread
# aggiungere qui altri targets se necessario
TARGETS = chatty \
client
# aggiungere qui i file oggetto da compilare
OBJECTS = connections.o \
icl_hash.o \
msgqueue.o \
parser.o \
queuelib.o \
threadlib.o \
userlib.o
# aggiungere qui gli altri include
INCLUDE_FILES = config.h \
connections.h \
icl_hash.h \
message.h \
msgqueue.h \
ops.h \
parser.h \
queuelib.h \
stats.h \
threadlib.h \
userlib.h
.PHONY: all clean cleanall test1 test2 test3 test4 test5 consegna
.SUFFIXES: .c .h
%: %.c
$(CC) $(CFLAGS) $(INCLUDES) $(OPTFLAGS) -o $@ $< $(LDFLAGS)
%.o: %.c
$(CC) $(CFLAGS) $(INCLUDES) $(OPTFLAGS) -c -o $@ $<
all : $(TARGETS)
chatty: chatty.o libchatty.a $(INCLUDE_FILES)
$(CC) $(CFLAGS) $(INCLUDES) $(OPTFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
client: client.o connections.o message.h
$(CC) $(CFLAGS) $(INCLUDES) $(OPTFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
############################ non modificare da qui in poi
libchatty.a: $(OBJECTS)
$(AR) $(ARFLAGS) $@ $^
clean :
rm -f $(TARGETS)
cleanall : clean
\rm -f *.o *~ libchatty.a valgrind_out $(STAT_PATH) $(UNIX_PATH)
\rm -fr $(DIR_PATH)
killchatty:
killall -9 chatty
# test base
test1:
make cleanall
\mkdir -p $(DIR_PATH)
make all
./chatty -f DATA/chatty.conf1&
./client -l $(UNIX_PATH) -c pippo
./client -l $(UNIX_PATH) -c pluto
./client -l $(UNIX_PATH) -c minni
./client -l $(UNIX_PATH) -k pippo -S "Ciao pluto":pluto -S "come stai?":pluto
./client -l $(UNIX_PATH) -k pluto -p -S "Ciao pippo":pippo -S "bene e tu?":pippo -S "Ciao minni come stai?":minni
./client -l $(UNIX_PATH) -k pippo -p
./client -l $(UNIX_PATH) -k pluto -p
./client -l $(UNIX_PATH) -k minni -p
killall -QUIT -w chatty
@echo "********** Test1 superato!"
# test scambio file
test2:
make cleanall
\mkdir -p $(DIR_PATH)
make all
./chatty -f DATA/chatty.conf1&
./testfile.sh $(UNIX_PATH) $(DIR_PATH)
killall -QUIT -w chatty
@echo "********** Test2 superato!"
# test parametri di configurazione e statistiche
test3:
make cleanall
\mkdir -p $(DIR_PATH)
make all
./chatty -f DATA/chatty.conf2&
./testconf.sh $(UNIX_PATH) $(STAT_PATH)
killall -QUIT -w chatty
@echo "********** Test3 superato!"
# verifica di memory leaks
test4:
make cleanall
\mkdir -p $(DIR_PATH)
make all
./testleaks.sh $(UNIX_PATH)
@echo "********** Test4 superato!"
# stress test
test5:
make cleanall
\mkdir -p $(DIR_PATH)
make all
./chatty -f DATA/chatty.conf1&
./teststress.sh $(UNIX_PATH)
killall -QUIT -w chatty
@echo "********** Test5 superato!"
# target per la consegna
consegna:
make test1
sleep 3
make test2
sleep 3
make test3
sleep 3
make test4
sleep 3
make test5
sleep 3
@echo "********** Supearti tutti i test!"
@echo