-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
118 lines (99 loc) · 3.1 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# **************************************************************************** #
# #
# :::::::: #
# Makefile :+: :+: #
# +:+ #
# By: tishj <tishj@student.codam.nl> +#+ #
# +#+ #
# Created: 2021/03/03 12:48:38 by tishj #+# #+# #
# Updated: 2021/05/18 17:08:05 by tbruinem ######## odam.nl #
# #
# **************************************************************************** #
NAME = libreins.a
SRC_DIR = ./src
OBJ_DIR = ./obj
CC = gcc
CFLAGS = -Wall -Wextra -Werror
ifeq ($(DEBUG),1)
CFLAGS += -g -fsanitize=address
else ifeq ($(DEBUG),2)
CFLAGS += -g
endif
HEADER = ./incl/reins.h \
./lib/vector/incl/vector.h \
./lib/bstree/incl/bstree.h
LIBRARY = ./lib/vector/libvector.a ./lib/bstree/libbst.a
TAIL = $(foreach lib,$(LIBRARY),-L $(dir $(lib)) $(patsubst lib%.a,-l%,$(notdir $(lib))))
SRC = reins_init.c \
init_keys.c \
init_cursor.c \
reins_destroy.c \
reins_get_input.c \
action/key_del.c \
action/key_regular.c \
action/key_eof.c \
action/key_down.c \
action/key_up.c \
action/key_right.c \
action/key_left.c \
action/key_newline.c \
util/util_atoi.c \
util/util_strlen.c \
util/util_bzero.c \
util/util_strdup.c \
util/util_memcpy.c \
util/util_memcmp.c \
util/util_strncmp.c \
util/util_strnlen.c \
util/util_strncpy.c \
print_keycode_formatted.c \
util/termcmd.c \
util/update_cursor.c \
util/refresh_cursor.c \
util/error.c \
create_keycode.c \
perform_action.c \
new_key.c \
reins_hook.c \
reins_key.c \
reins_enable.c \
reins_disable.c \
input/reins_input_add.c \
input/reins_input_del.c \
input/reins_input_clear.c \
input/reins_cursor_move.c \
input/reins_input_empty.c \
input/reins_input_size.c \
reins_print_keycodes.c \
visual_add.c \
visual_del.c \
action/key_end.c \
action/key_home.c
OBJ := $(SRC:%.c=$(OBJ_DIR)/%.o)
INCL := $(addprefix -I ,$(dir $(HEADER)))
$(OBJ_DIR)/%.o : $(SRC_DIR)/%.c
@mkdir -p $(@D)
@echo "Compiling $(notdir $@)"
@$(CC) $(CFLAGS) -c $^ $(INCL) -o $@
$(NAME) : $(OBJ) $(LIBRARY)
@echo "Compiling $(notdir $@)"
@ar -rcs $@ $^
./lib/vector/libvector.a:
@$(MAKE) -sC $(dir $@) DEBUG=$(DEBUG)
./lib/bstree/libbst.a:
@$(MAKE) -sC $(dir $@) DEBUG=$(DEBUG)
all : $(NAME)
test: all
$(CC) $(CFLAGS) main.c $(INCL) -L. -lreins $(TAIL) -ltermcap -o $@
clean:
@echo "Cleaning reins.."
@$(MAKE) -sC ./lib/vector/ clean
@$(MAKE) -sC ./lib/bstree/ clean
@rm -f $(OBJ)
fclean: clean
@echo "Full cleaning reins.."
@$(MAKE) -sC ./lib/vector/ fclean
@$(MAKE) -sC ./lib/bstree/ fclean
@rm -f $(NAME) test
re: fclean all
.PHONY: all test clean fclean re