-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (63 loc) · 2.46 KB
/
Copy pathMakefile
File metadata and controls
76 lines (63 loc) · 2.46 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
67
68
69
70
71
72
73
74
75
76
# **************************************************************************** #sr
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: vinguyen <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/09/30 16:39:05 by vinguyen #+# #+# #
# Updated: 2019/09/30 17:10:55 by vinguyen ### ########.fr #
# #
# **************************************************************************** #
#Library name
NAME = libft.a
#Folders containing *.c and *.h files
SRC = .
INCLUDES = .
#Source Files
NAMES = ft_atoi ft_bzero ft_isalnum ft_isalpha ft_isascii ft_isdigit \
ft_isprint ft_itoa ft_lstadd ft_lstdel ft_lstdelone ft_lstiter \
ft_lstmap ft_lstnew ft_memalloc ft_memccpy ft_memchr ft_memcmp \
ft_memcpy ft_memdel ft_memmove ft_memset ft_putchar ft_putchar_fd \
ft_putendl ft_putendl_fd ft_putnbr ft_putnbr_fd ft_putstr \
ft_putstr_fd ft_strcat ft_strchr ft_strclr ft_strcmp ft_strcpy \
ft_strdel ft_strdup ft_strequ ft_striter ft_striteri ft_strjoin \
ft_strlcat ft_strlen ft_strmap ft_strmapi ft_strncat ft_strncmp \
ft_strncpy ft_strnequ ft_strnew ft_strnstr ft_strrchr ft_strsplit \
ft_strstr ft_strsub ft_strtrim ft_tolower ft_toupper \
ft_strstart ft_strend ft_iswhitespace ft_countwords ft_nbrlen
SRC_FILES = $(addsuffix .c, $(NAMES))
OBJ_FILES = $(addsuffix .o, $(NAMES))
#Compiler
CC = gcc
#Flags
CFLAGS = -g -Wall -Wextra -Werror
SANIT = -fsanitize=address
#Baseline command that compiles all the files
.PHONY: all
all: $(NAME)
#Command that compiles the *.c files, creates the library, and index the files
$(NAME):
@$(CC) $(CFLAGS) -I $(INCLUDES) -c $(addprefix $(SRC)/, $(SRC_FILES))
@ar -rc $(NAME) $(OBJ_FILES)
@ranlib $(NAME)
.PHONY: clean
clean:
@/bin/rm -rf $(OBJ_FILES)
.PHONY: fclean
fclean: clean
@if test -e $(NAME); then\
/bin/rm $(NAME);\
fi;
#Command that cleans all the files and remakes the library
.PHONY: re
re: fclean all
#Testing code
.PHONY: test
test:
@gcc fake.c -g $(SANIT)
@./a.out
#Norminette
.PHONY: Norminette
norm:
@norminette *.c *.h