-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (46 loc) · 1.07 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
NAME = ft_ssl
SRCDIR = ./src/
OBJDIR = ./obj/
INCDIR = ./include/
LIBFTDIR = ./libft/
SRC = $(addprefix $(SRCDIR), main.c \
parser.c \
digest.c \
printers.c \
swappers.c \
ft_ssl_md5.c \
ft_ssl_sha256.c \
ft_ssl_sha224.c \
ft_ssl_sha512.c \
ft_ssl_sha384.c \
)
OBJ = $(SRC:$(SRCDIR)%.c=$(OBJDIR)%.o)
HEADERS = $(wildcard $(INCDIR)*.h)
CC = gcc
LIBFT = $(addprefix $(LIBFTDIR), libft.a)
CFLAGS = -Wall -Wextra -Werror
ifdef DEBUG
CFLAGS += -g -DDEBUG=1
endif
LDFLAGS = -L$(LIBFTDIR) -lft
.PHONY: all clean fclean re
all: $(NAME)
$(NAME): $(OBJ) $(LIBFT)
$(info Linking objects)
@$(CC) $(OBJ) $(LDFLAGS) -o $(NAME)
$(info Done.)
$(OBJDIR)%.o: $(SRCDIR)%.c $(HEADERS)
$(info Compiling $<)
@mkdir -p $(OBJDIR)
@$(CC) $(CFLAGS) -c $< -o $@ -I$(INCDIR) -I$(LIBFTDIR)
$(LIBFT):
@make -sC $(LIBFTDIR)
clean:
$(info Deleting objects)
@rm -rf $(OBJDIR)
@make -sC $(LIBFTDIR) clean
fclean: clean
$(info Deleting $(NAME))
@rm -rf $(NAME)
# @make -sC $(LIBFTDIR) fclean
re: fclean all