-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (51 loc) · 1.78 KB
/
Makefile
File metadata and controls
66 lines (51 loc) · 1.78 KB
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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: kiroussa <oss@xtrm.me> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/08/06 21:19:50 by kiroussa #+# #+# #
# Updated: 2024/04/02 07:27:31 by kiroussa ### ########.fr #
# #
# **************************************************************************** #
NAME = libbreakage.so
SRC = hooks/add_history.c \
hooks/free.c \
hooks/malloc.c \
hooks/readline.c \
brk_allocs_count.c \
brk_backtrace.c \
brk_check_leaks.c \
brk_find_symbol.c \
brk_fprintf.c \
brk_init.c \
brk_insert_alloc.c \
brk_log.c
SRC_FOLDER = src
OBJ_FOLDER = obj
OBJ := $(addprefix $(OBJ_FOLDER)/, $(SRC:.c=.o))
SRC := $(addprefix $(SRC_FOLDER)/, $(SRC))
INCLUDE_DIR = include
CC = clang
CFLAGS = -Wall -Wextra -Werror -fPIC
ifeq ($(DEBUG), 1)
CFLAGS += -gdwarf-4
endif
COPTS += -I $(INCLUDE_DIR)/
RM = rm -rf
#
# Rules
#
all: $(NAME)
$(NAME): $(OBJ)
$(CC) $(CFLAGS) $(COPTS) -shared -nostartfiles -o $(NAME) $(OBJ)
$(OBJ_FOLDER)/%.o: $(SRC_FOLDER)/%.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) $(COPTS) -c $< -o $@
clean:
$(RM) $(OBJ_FOLDER)
fclean: clean
$(RM) $(NAME)
re: fclean all
.PHONY: all clean fclean re