-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (35 loc) · 1.16 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
ENCODER = encoder
DECODER = decoder
PATH_SRC_ENC = ./sources_encoder/
PATH_SRC_DEC = ./sources_decoder/
PATH_OBJ_ENC = ./objects_encoder/
PATH_OBJ_DEC = ./objects_decoder/
OBJ_ENC = ${SRC_ENC:%.c=$(PATH_OBJ_ENC)%.o}
OBJ_DEC = ${SRC_DEC:%.c=$(PATH_OBJ_DEC)%.o}
SRC_ENC = encoder.c main.c list_utils.c tree.c dictionary.c read_file.c shm_encoder.c
SRC_DEC = decoder.c shm_decoder.c main.c
INCLUDE = -I ./includes/
FLAGS = -Wall -Wextra -Werror -g3
all: $(ENCODER) $(DECODER)
$(ENCODER): $(OBJ_ENC)
@cc $(FLAGS) $(OBJ_ENC) -o $(ENCODER)
$(DECODER): $(OBJ_DEC)
@cc $(FLAGS) $(OBJ_DEC) -o $(DECODER)
$(PATH_OBJ_ENC)%.o: $(PATH_SRC_ENC)%.c
@mkdir -p $(PATH_OBJ_ENC)
cc $(FLAGS) $(INCLUDE) -c $< -o $@
@echo "\033[1;92m[SUCCESS] Objects creation done!\033[0m"
$(PATH_OBJ_DEC)%.o: $(PATH_SRC_DEC)%.c
@mkdir -p $(PATH_OBJ_DEC)
cc $(FLAGS) $(INCLUDE) -c $< -o $@
@echo "\033[1;92m[SUCCESS] Objects creation done!\033[0m"
clean:
@rm -rf $(PATH_OBJ_ENC)
@rm -rf $(PATH_OBJ_DEC)
@echo "\33[1;93m[SUCCESS] Objects removal done!\33[0m"
fclean: clean
@rm -f $(ENCODER)
@rm -f $(DECODER)
@echo "\033[1;93m[SUCCESS] Removal done!\33[0m"
re: fclean all
.PHONY: all clean fclean re