-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (36 loc) · 1.04 KB
/
Makefile
File metadata and controls
46 lines (36 loc) · 1.04 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
# Couleurs pour l'affichage
RED = \033[31m
GREEN = \033[32m
YELLOW = \033[33m
YELLOW = \033[33m
BOLD = \033[1m
NC = \033[0m # Pas de couleur
# Compilateur
CC = gcc
# Dossiers
SRV_DIR = Serveur
CLI_DIR = Client
# Sources et objets
SRV_SOURCES = $(SRV_DIR)/server2.c $(SRV_DIR)/awale.c
CLI_SOURCE = $(CLI_DIR)/client2.c
SRV_OBJECTS = $(SRV_SOURCES:.c=.o)
CLI_OBJECT = $(CLI_SOURCE:.c=.o)
# Exécutables
SRV_BIN = server_bin
CLI_BIN = client_bin
all: $(SRV_BIN) $(CLI_BIN)
$(SRV_BIN): $(SRV_OBJECTS)
@echo "$(YELLOW)Génération de $@...$(NC)"
$(CC) -o $@ $^
@echo "$(GREEN)$(BOLD)$@ a été généré avec succès !$(NC)\r\n"
$(CLI_BIN): $(CLI_OBJECT)
@echo "$(YELLOW)Génération de $@...$(NC)"
$(CC) -o $@ $^
@echo "$(GREEN)$(BOLD)$@ a été généré avec succès !$(NC)\r\n"
%.o: %.c
@echo "$(YELLOW)Compilation de $<...$(NC)"
$(CC) -c $< -o $@
clean:
@echo "$(RED)Suppression des fichiers objets et des exécutables...$(NC)"
rm -f $(SRV_DIR)/*.o $(CLI_DIR)/*.o $(SRV_BIN) $(CLI_BIN)
.PHONY: all clean