summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 78a34e027866a6f29c5df6441f0abb73f2b0d289 (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
# **************************************************************************** #
#                                                           LE - /             #
#                                                               /              #
#    Makefile                                         .::    .:/ .      .::    #
#                                                  +:+:+   +:    +:  +:+:+     #
#    By: rbousset <marvin@le-101.fr>                +:+   +:    +:    +:+      #
#                                                  #+#   #+    #+    #+#       #
#    Created: 2019/10/08 15:04:55 by rbousset     #+#   ##    ##    #+#        #
#    Updated: 2019/10/13 14:01:21 by rbousset    ###    #+. /#+    ###.fr      #
#                                                          /                   #
#                                                         /                    #
# **************************************************************************** #

SRCS_DIR		= src/
SRCS			= \
				${SRCS_DIR}main.c \
				${SRCS_DIR}ft_process_arg.c \
				${SRCS_DIR}ft_error.c \
				${SRCS_DIR}ft_exit.c \
				${SRCS_DIR}ft_echo.c \
				${SRCS_DIR}ft_pwd.c \
				${SRCS_DIR}ft_exec.c \
				${SRCS_DIR}ft_history.c \

OBJS_DIR		= obj/
OBJS			= $(patsubst ${SRCS_DIR}%.c,${OBJS_DIR}%.o,${SRCS})

INCS_DIR		= -Iinc/ -Ilibft/inc/

LIB_DIR			= -Llibft/
LIB				= -lft

CC				= clang
CFLAGS			= -Wall -Wextra -Werror

DEBUG			= -g3
FSANITIZE		= -fsanitize=address

NAME			= minishell

RM				= rm -rf
MKDIR			= mkdir -p


${OBJS_DIR}%.o:		${SRCS_DIR}%.c inc/minishell.h libft/inc/libft.h
	@${MKDIR} ${OBJS_DIR}
	${CC} ${CFLAGS} ${DEBUG} ${INCS_DIR} -o $@ -c $< 

$(NAME):		${OBJS}
	${CC} ${CFLAGS} ${DEBUG} ${LIB_DIR} ${LIB} -o ${NAME} ${OBJS}

all:			${NAME}

clean: 
	${RM} ${OBJS_DIR}

xclean:
	${RM} ${NAME}
	${RM} ${NAME}.dSYM/
	${RM} joe-sh_history

fclean:			clean xclean

re:				fclean all

build:			${OBJS}
	${CC} ${CFLAGS} ${DEBUG} ${FSANITIZE} ${LIB_DIR} ${LIB} -o minishell ${OBJS}

default: all

.PHONY:	all clean clean fclean re