-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (56 loc) · 1.57 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
DEBUG =
ifdef TEST
DEBUG = -g -fsanitize=address -fsanitize=undefined
else
DEBUG =
endif
ifdef LEAKS
DEBUG = -g
endif
NAME = ft_ssl
LIBFT = libftprintf/libftprintf.a
CFLAGS += -Wall -Wextra -Werror -Wpedantic
LDFLAGS := -Llibftprintf -lftprintf -I./includes
MD5 := md5 md5_hashing
DES := des_algo des_helpers des_modes_1 des_modes_2 des des_parsing des3
SALSA := salsa
SHA256 := sha256 sha256_algo
KEYGEN := pbkdf2 scrypt scrypt_utils
BASE64 := b64_parsing b64 b64_algo
CIPHERS := $(addprefix des/, $(DES)) \
$(addprefix salsa/, $(SALSA))
HASHING := hmac hash_padding hash_parsing hash_printing \
$(addprefix md5_hash/, $(MD5)) \
$(addprefix sha256_hash/, $(SHA256))
CORE := main parsing printing
FILES := $(addprefix core/, $(CORE)) \
$(addprefix hashing/, $(HASHING)) \
$(addprefix b64/, $(BASE64)) \
$(addprefix ciphers/, $(CIPHERS)) \
$(addprefix keygen/, $(KEYGEN))
SRC := $(addsuffix .c, $(FILES))
OBJ := $(SRC:.c=.o)
.PHONY = all clean fclean re
all: $(SUBMODULES) $(NAME)
$(SUBMODULES):
@git submodule init
@git submodule update
$(LIBFT):
@$(MAKE) -C libftprintf
$(OBJ): %.o: %.c
@$(CC) -c $(DEBUG) -I. $(CFLAGS) $< -o $@
$(NAME): $(LIBFT) $(OBJ)
@echo -n 'Compiling ft_ssl... '
@$(CC) $(DEBUG) $(CFLAGS) $(LDFLAGS) $(OBJ) -o $@
@echo "\033[32mdone\033[0m"
clean:
@$(MAKE) clean -C libftprintf
@echo -n 'Cleaning ft_ssl object files... '
@rm -f $(OBJ) *.dSYM *.DS_Store
@echo "\033[32mdone\033[0m"
fclean: clean
@$(MAKE) fclean -C libftprintf
@echo -n 'Cleaning ft_ssl executable... '
@rm -f $(NAME)
@echo "\033[32mdone\033[0m"
re: fclean all