aboutsummaryrefslogtreecommitdiffstats
path: root/libft/Makefile
blob: 8ad24a724ab437887dcf0ea7a4a1eae636590d88 (plain)
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
default: all
#==============================================================================#
#--------------------------------- Shell --------------------------------------#
#==============================================================================#
SHELL		:= /bin/sh
#==============================================================================#
#------------------------------ Directories -----------------------------------#
#==============================================================================#
INCS_DIR	= inc/
SRCS_DIR	= src/
OBJS_DIR	= obj/
#==============================================================================#
#--------------------------------- Files --------------------------------------#
#==============================================================================#
INCS		= libft.h
#------------------------------------------------------------------------------#
SRCS_NAME	= ft_memset.c
SRCS_NAME	+= ft_bzero.c
SRCS_NAME	+= ft_memcpy.c
SRCS_NAME	+= ft_memccpy.c
SRCS_NAME	+= ft_memmove.c
SRCS_NAME	+= ft_memchr.c
SRCS_NAME	+= ft_memlchr.c
SRCS_NAME	+= ft_memcmp.c
SRCS_NAME	+= ft_strlen.c
SRCS_NAME	+= ft_isalpha.c
SRCS_NAME	+= ft_isdigit.c
SRCS_NAME	+= ft_isalnum.c
SRCS_NAME	+= ft_isascii.c
SRCS_NAME	+= ft_isprint.c
SRCS_NAME	+= ft_ischarset.c
SRCS_NAME	+= ft_tolower.c
SRCS_NAME	+= ft_toupper.c
SRCS_NAME	+= ft_strchr.c
SRCS_NAME	+= ft_strrchr.c
SRCS_NAME	+= ft_strlchr.c
SRCS_NAME	+= ft_strncmp.c
SRCS_NAME	+= ft_strlcpy.c
SRCS_NAME	+= ft_strlcat.c
SRCS_NAME	+= ft_strnstr.c
SRCS_NAME	+= ft_atoi.c
SRCS_NAME	+= ft_calloc.c
SRCS_NAME	+= ft_nrealloc.c
SRCS_NAME	+= ft_strdup.c
SRCS_NAME	+= ft_substr.c
SRCS_NAME	+= ft_strjoin.c
SRCS_NAME	+= ft_strtrim.c
SRCS_NAME	+= ft_split.c
SRCS_NAME	+= ft_itoa.c
SRCS_NAME	+= ft_itoa_base.c
SRCS_NAME	+= ft_uitoa.c
SRCS_NAME	+= ft_uitoa_base.c
SRCS_NAME	+= ft_strmapi.c
SRCS_NAME	+= ft_putchar_fd.c
SRCS_NAME	+= ft_putstr_fd.c
SRCS_NAME	+= ft_putendl_fd.c
SRCS_NAME	+= ft_putnbr_fd.c
SRCS_NAME	+= ft_lstnew.c
SRCS_NAME	+= ft_lstadd_front.c
SRCS_NAME	+= ft_lstsize.c
SRCS_NAME	+= ft_lstlast.c
SRCS_NAME	+= ft_lstadd_back.c
SRCS_NAME	+= ft_lstdelone.c
SRCS_NAME	+= ft_lstclear.c
SRCS_NAME	+= ft_lstiter.c
SRCS_NAME	+= ft_lstmap.c
SRCS_NAME	+= ft_putchar.c
SRCS_NAME	+= ft_putnchar.c
SRCS_NAME	+= ft_putstr.c
SRCS_NAME	+= ft_putendl.c
SRCS_NAME	+= ft_putnbr.c
SRCS_NAME	+= ft_putnbr_base.c
SRCS_NAME	+= ft_strnlen.c
SRCS_NAME	+= ft_strcat.c
SRCS_NAME	+= ft_strcmp.c
SRCS_NAME	+= ft_isspace.c
SRCS_NAME	+= ft_sqrt.c
SRCS_NAME	+= ft_intlen.c
SRCS_NAME	+= ft_intlen_base.c
SRCS_NAME	+= ft_uintlen.c
SRCS_NAME	+= ft_uintlen_base.c
SRCS_NAME	+= ft_nstr.c
SRCS_NAME	+= ft_memdel.c
SRCS_NAME	+= ft_kernel_panic.c
SRCS_NAME	+= get_next_line.c
SRCS_NAME	+= get_next_line_utils.c
SRCS_NAME	+= ft_printf.c
SRCS_NAME	+= ft_dprintf.c
SRCS_NAME	+= ft_sprintf.c
SRCS_NAME	+= ft_printf_init_struct.c
SRCS_NAME	+= ft_printf_get_flags.c
SRCS_NAME	+= ft_printf_use_flags.c
SRCS_NAME	+= ft_printf_get_width_nstr.c
SRCS_NAME	+= ft_printf_treat_flags.c
SRCS_NAME	+= ft_printf_parts.c
SRCS_NAME	+= ft_printf_put_width.c
SRCS_NAME	+= ft_printf_put_precision.c
SRCS_NAME	+= ft_printf_put_char.c
SRCS_NAME	+= ft_printf_put_str.c
SRCS_NAME	+= ft_printf_put_ptr.c
SRCS_NAME	+= ft_printf_put_int.c
SRCS_NAME	+= ft_printf_put_hex.c
SRCS_NAME	+= ft_printf_put_none.c
SRCS_NAME	+= ft_printf_get_s_putlen.c
SRCS_NAME	+= ft_printf_process.c
SRCS_NAME	+= ft_printf_cat_output.c
SRCS_NAME	+= ft_printf_flag_to_atoi.c
#------------------------------------------------------------------------------#
SRCS		= $(addprefix ${SRCS_DIR},${SRCS_NAME})
#------------------------------------------------------------------------------#
OBJS		= $(patsubst ${SRCS_DIR}%.c,${OBJS_DIR}%.o,${SRCS})
#==============================================================================#
#--------------------------------- UNIX ---------------------------------------#
#==============================================================================#
MKDIR		= mkdir -p
RM			= rm -rf
OS			= $(shell uname)
#==============================================================================#
#-------------------------------- Compiler ------------------------------------#
#==============================================================================#
DBG			= -glldb
FSANITIZE	= -fsanitize=address
#------------------------------------------------------------------------------#
CC			= clang
#------------------------------------------------------------------------------#
CFLAGS		= -std=c89
CFLAGS		+= -Wall
CFLAGS		+= -Wextra
CFLAGS		+= -Werror
CFLAGS		+= -pedantic
ifdef DEBUG
	CFLAGS	+= ${DBG}
endif
#------------------------------------------------------------------------------#
ifdef ASAN
	CFLAGS	+= ${DBG}
	CFLAGS	+= ${FSANITIZE}
endif
#------------------------------------------------------------------------------#
NAME		= libft.a
#==============================================================================#
#-------------------------------- Library -------------------------------------#
#==============================================================================#
AR			= ar rcs
#==============================================================================#
#--------------------------------- Rules --------------------------------------#
#==============================================================================#
${OBJS_DIR}%.o:		${SRCS_DIR}%.c ${INCS_DIR}${INCS}
	@${MKDIR} ${OBJS_DIR}
	${CC} -c ${CFLAGS} -I${INCS_DIR} -o $@ $<
#------------------------------------------------------------------------------#
${NAME}:	${OBJS}
	${AR} ${NAME} ${OBJS}
#------------------------------------------------------------------------------#
all:	${NAME}
#------------------------------------------------------------------------------#
clean: 
	${RM} ${OBJS_DIR}
#------------------------------------------------------------------------------#
fclean:		clean
	${RM} ${NAME}
#------------------------------------------------------------------------------#
re:		fclean all
#------------------------------------------------------------------------------#
run:	${OBJS}
	${CC} ${CFLAGS} -Iinc/ -o a.out ${OBJS} ${SRCS_DIR}main.c
#------------------------------------------------------------------------------#
.PHONY:	all clean clean fclean re run default
#==================================== EOF =====================================#