# **************************************************************************** # # LE - / # # / # # Makefile .:: .:/ . .:: # # +:+:+ +: +: +:+:+ # # By: rbousset +:+ +: +: +:+ # # #+# #+ #+ #+# # # Created: 2019/10/08 15:04:55 by rbousset #+# ## ## #+# # # Updated: 2019/10/13 14:01:21 by rbousset ### #+. /#+ ###.fr # # / # # / # # **************************************************************************** # .DEFAULT_GOAL := all #==============================================================================# #--------------------------------- Shell --------------------------------------# #==============================================================================# SHELL := /bin/sh #==============================================================================# #------------------------------ Directories -----------------------------------# #==============================================================================# SRCS_DIR = src/ OBJS_DIR = obj/ LFT_DIR = libft/ INCS_DIR = inc/ LFT_INCS_DIR = ${LFT_DIR}/inc/ #==============================================================================# #--------------------------------- Files --------------------------------------# #==============================================================================# LFT = ft #------------------------------------------------------------------------------# SRCS_NAME = main.c SRCS_NAME += ft_process_arg.c SRCS_NAME += ft_error.c SRCS_NAME += ft_exit.c SRCS_NAME += ft_echo.c SRCS_NAME += ft_pwd.c SRCS_NAME += ft_exec.c SRCS_NAME += ft_history.c SRCS = $(addprefix ${SRCS_DIR}, ${SRCS_NAME}) #------------------------------------------------------------------------------# OBJS = $(patsubst ${SRCS_DIR}%.c,${OBJS_DIR}%.o,${SRCS}) #------------------------------------------------------------------------------# #==============================================================================# #-------------------------------- Compiler ------------------------------------# #==============================================================================# CC = clang CFLAGS = -Wall CFLAGS += -Wextra CFLAGS += -Werror CFLAGS += ${DEBUG} CFLAGS += ${FSANITIZE} #------------------------------------------------------------------------------# DEBUG = -glldb FSANITIZE = -fsanitize=address #------------------------------------------------------------------------------# NAME = minishell #==============================================================================# #--------------------------------- UNIX ---------------------------------------# #==============================================================================# RM = rm -rf MKDIR = mkdir -p #==============================================================================# #--------------------------------- Rules --------------------------------------# #==============================================================================# ${OBJS_DIR}%.o: ${SRCS_DIR}%.c ${INCS_DIR}minishell.h ${LFT_INCS_DIR}libft.h @${MKDIR} ${OBJS_DIR} ${CC} ${CFLAGS} -I${INCS_DIR} -I${LFT_INCS_DIR} -o $@ -c $< #------------------------------------------------------------------------------# $(NAME): ${OBJS} ${CC} ${CFLAGS} -o ${NAME} ${OBJS} -L${LFT_DIR} -l${LFT} #------------------------------------------------------------------------------# all: @$(MAKE) --no-print-directory -C ${LFT_DIR} all @printf "\n" @$(MAKE) --no-print-directory ${NAME} #------------------------------------------------------------------------------# clean: @$(MAKE) --no-print-directory -C ${LFT_DIR} clean ${RM} ${OBJS_DIR} #------------------------------------------------------------------------------# fclean: clean @$(MAKE) --no-print-directory -C ${LFT_DIR} fclean ${RM} ${NAME} ${RM} ${NAME}.dSYM/ ${RM} joe-sh_history #------------------------------------------------------------------------------# re: fclean all #------------------------------------------------------------------------------# .PHONY: all clean clean fclean re