You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

75 lines
2.0 KiB

# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: hroussea <hroussea@student.42lyon.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/08/14 14:44:12 by hroussea #+# #+# #
# Updated: 2021/10/02 08:57:48 by hroussea ### ########lyon.fr #
# #
# **************************************************************************** #
# JORUN MAKEFILE V1.3 #
include sources.mk
vpath .h ${INCLUDES}
SRCS_ = ${addprefix ${SRCDIR}/,${SRCS}}
OBJS_ = ${addprefix ${OBJDIR}/,${SRCS:.c=.o}}
DEPS_ = ${OBJS_:.o=.d}
INCS_ = ${addprefix -I,${INCLUDES}}
LIB_ = ${addprefix -L,${LIB}}
LIBS_ = ${addprefix -l,${LIBS}}
NAME = ${TARGET}
OBJDIRS_ = ${shell find ${SRCDIR} -type d | sed s/^${SRCDIR}/${OBJDIR}/g}
all: ${TARGET}
clean:
rm -rf ${OBJDIR}
fclean: clean
rm -rf ${TARGET}
re:
${MAKE} fclean
${MAKE} all
libft/libft.a:
${MAKE} -C libft
ifeq (${ARTIFACT_TYPE},"executable")
${TARGET}: ${OBJS_} libft/libft.a
${CC} ${CFLAGS} $^ -o $@ ${LIB_} ${LIBS_}
else
ifeq (${ARTIFACT_TYPE},"static_lib")
${TARGET}: ${OBJS_}
${AR} rcs $@ $^
else
${TARGET}:
$(error Please define the ARTIFACT_TYPE Makefile variable ("executable" or "static_lib") in sources.mk)
endif
endif
${OBJDIR}:
mkdir -p ${OBJDIRS_}
${OBJDIR}/%.o: ${SRCDIR}/%.c | ${OBJDIR}
${CC} ${INCS_} -MMD ${CFLAGS} ${OPTFLAGS} -c $< -o $@
norme:
norminette ${SRCDIR} libft include/minishell
cleanall:
${MAKE} -C libft fclean
${MAKE} fclean
-include ${DEPS_}
.PHONY: all