-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
executable file
·67 lines (48 loc) · 2.23 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
# Flags de compilation:
# -Wall: affichage des warnings
# -ansi: Assurer le respect du standard ANSI
CFLAGS=-W -Wall -Wextra -pedantic -ansi -lpthread
#-ansi -g
SRC=src/
OBJ=obj/
BIN=bin/
TEST=test/
OPT = -l pthread
HEADER=include/
# Compilateur utilisé
CC=gcc -I$(HEADER) -g
all:
clean runserver
$(OBJ)list.o: $(SRC)list.c $(HEADER)list.h
$(CC) $(CFLAGS) -c $(SRC)list.c -o $(OBJ)list.o
shared_directory_server: $(BIN)shared_directory_server
$(BIN)shared_directory_server: $(SRC)server.c $(OBJ)list.o $(OBJ)tools.o $(OBJ)file.o $(HEADER)server.h
$(CC) $(CFLAGS) $(SRC)server.c $(OBJ)tools.o $(OBJ)list.o $(OBJ)file.o -o $(BIN)shared_directory_server
runserver: shared_directory_server
./${BIN}shared_directory_server 10000 files.txt 10001 rep1
shared_directory_client: $(BIN)shared_directory_client
$(BIN)shared_directory_client: $(SRC)client.c $(OBJ)tools.o $(OBJ)file.o $(OBJ)locker.o $(OBJ)list.o $(HEADER)client.h
$(CC) $(CFLAGS) $(OBJ)tools.o $(OBJ)file.o $(OBJ)locker.o $(OBJ)list.o $(SRC)client.c -o $(BIN)shared_directory_client
$(OBJ)tools.o: $(SRC)tools.c $(HEADER)tools.h
$(CC) $(CFLAGS) -c $(SRC)tools.c -o $(OBJ)tools.o
$(OBJ)locker.o: $(SRC)locker.c $(HEADER)locker.h $(HEADER)list.h $(HEADER)tools.h
$(CC) $(CFLAGS) -c $(SRC)locker.c -o $(OBJ)locker.o $(OPT)
runclient1: shared_directory_client
./${BIN}shared_directory_client rep2 10000 "localhost" 20000
runclient2: shared_directory_client
./${BIN}shared_directory_client rep3 10000 "localhost" 20001
$(OBJ)file.o: $(SRC)file.c $(HEADER)file.h
$(CC) $(CFLAGS) -c $(SRC)file.c -o $(OBJ)file.o
# test
$(OBJ)testTools.o : $(SRC)testTools.c $(HEADER)testTools.h
$(CC) $(CFLAGS) -c $(SRC)testTools.c -o $(OBJ)testTools.o
testFile: $(BIN)testFile
$(BIN)testFile: $(TEST)testFile.c $(OBJ)file.o $(OBJ)tools.o
$(CC) $(CFLAGS) $(OBJ)file.o $(OBJ)tools.o $(TEST)testFile.c -o $(BIN)testFile
testLocker: $(BIN)testLocker
$(BIN)testLocker: $(TEST)testLocker.c $(OBJ)tools.o $(OBJ)file.o $(OBJ)list.o $(OBJ)testTools.o $(OBJ)locker.o
$(CC) $(CFLAGS) $(OBJ)list.o $(OBJ)tools.o $(OBJ)file.o $(OBJ)testTools.o $(OBJ)locker.o $(TEST)testLocker.c -o $(BIN)testLocker
clean:
rm -rf bin/* obj/* rep1/* rep2/* rep3/*
touch rep2/1.txt rep2/2.txt rep2/3.txt
touch rep3/1.txt rep3/2.txt rep3/3.txt