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.

85 lines
2.1 KiB

# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: hroussea <hroussea@student.42lyon.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/08/14 14:44:12 by hroussea #+# #+# #
# Updated: 2021/09/23 00:07:25 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}}
NAME = ${TARGET}
OBJDIRS_ = ${shell find ${SRCDIR} -type d | sed s/^${SRCDIR}/${OBJDIR}/g}
all: ${TARGET}
clean:
rm -rf ${OBJDIR}
fclean: clean
rm -rf ${TARGET}
${RM} libmlx.dylib
re:
${MAKE} fclean
${MAKE} all
libft/libft.a:
${MAKE} -C libft
ifeq (${ARTIFACT_TYPE},"executable")
${TARGET}: ${OBJS_} libft/libft.a libmlx.dylib mlxglue/libmlxglue.a
${CC} $^ -o $@ -lft -Llibft -lmlx -lmlxglue -Lmlx -Lmlxglue
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} include libft mlxglue
libmlx.dylib: mlx/libmlx.dylib
cp mlx/libmlx.dylib .
mlx/libmlx.dylib:
make -C mlx -j1
mlxglue/libmlxglue.a:
${MAKE} -C mlxglue
cleanall:
${MAKE} -C libft fclean
${MAKE} -C mlxglue fclean
${MAKE} -C mlx clean
${MAKE} fclean
-include ${DEPS_}
.PHONY: all