-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (39 loc) · 1.6 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
#* ************************************************************************** *#
#* *#
#* *#
#* Makefile *#
#* *#
#* By: yhetman <[email protected]> *#
#* *#
#* Created: 2021/10/05 12:45:04 by yhetman *#
#* Updated: 2021/10/09 03:40:14 by yhetman *#
#* *#
#* ************************************************************************** *#
SRCS = main.c cipher.c get_options.c \
key_scheduler.c tables.c decipher.c
SRCS_DIR = src/
OBJ_DIR = obj/
OBJ = $(addprefix $(OBJ_DIR), $(SRCS:.c=.o))
OBJ_DIR = obj/
LIB_NAME = libkalyna.a
KALYNA = kalyna
FLAGS = -I includes -Wall -Wextra -Werror
DEBUG_FLAGS = -g3 -fsanitize=address
KALYNA_MAIN = src/main.c
all: make_obj_dir $(KALYNA)
$(OBJ_DIR)%.o: $(SRCS_DIR)%.c
gcc $(FLAGS) -c $< -o $@
$(LIB_NAME): $(OBJ)
ar -rv $(LIB_NAME) $^
ranlib $(LIB_NAME)
$(KALYNA): $(LIB_NAME) $(KALYNA_MAIN)
gcc $(FLAGS) $(DEBUG_FLAGS) $(KALYNA_MAIN) $(LIB_NAME) -o $(KALYNA)
make_obj_dir:
mkdir -p $(OBJ_DIR)
clean:
rm -rf $(OBJ_DIR)
fclean: clean
rm -f $(KALYNA)
rm -f $(LIB_NAME)
re: fclean all
.PHONY: all clean flcean re debug