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.
 
 

90 lines
2.7 KiB

# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: hroussea <hroussea@student.42lyon.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/02/06 16:48:42 by hroussea #+# #+# #
# Updated: 2021/02/27 16:45:45 by hroussea ### ########lyon.fr #
# #
# **************************************************************************** #
CC = gcc
CFLAGS = -O3 -Wall -Wextra
NAME = cub3D
SRCS_F = main.c scene0.c scene1.c scene2.c scene3.c
LNK_LIBS = mlx ft ftparsing mlxglue
LIBFT_DIR = libft
MLX_DIR = deps/mlx
MLXGLUE_DIR = deps/mlxglue
LIBFTPARSING_DIR = deps/parsing
ALL_LIBS_DIRS = ${LIBFT_DIR} ${MLX_DIR} ${MLXGLUE_DIR} ${LIBFTPARSING_DIR}
OBJS_F = ${SRCS_F:.c=.o}
SRCS = $(addprefix src/,${SRCS_F})
OBJS = $(addprefix obj/,${OBJS_F})
INC_DIRS = deps include ${LIBFT_DIR}
INC_DIRS_FLAG = ${addprefix -I ,${INC_DIRS}}
LNK_DIRS_FLAG = ${addprefix -L, ${ALL_LIBS_DIRS}}
LNK_LIBS_FLAG = ${LNK_DIRS_FLAG} ${addprefix -l,${LNK_LIBS}} -framework OpenGL -framework Cocoa
all: ${NAME}
${NAME}: ${MLXGLUE_DIR}/libmlxglue.a libmlx.dylib ${LIBFT_DIR}/libft.a ${LIBFTPARSING_DIR}/libftparsing.a ${OBJS}
@printf "\nBuilding Cub3D...\n"
${CC} -o ${NAME} ${LNK_LIBS_FLAG} ${OBJS}
obj/%.o: src/%.c obj
${CC} ${CFLAGS} ${INC_DIRS_FLAG} -c $< -o $@
${LIBFTPARSING_DIR}/libftparsing.a:
@printf "\Building libftparsing...\n"
${MAKE} -C ${LIBFTPARSING_DIR}
${LIBFT_DIR}/libft.a:
@printf "\nBuilding libft...\n"
${MAKE} -C ${LIBFT_DIR}
obj:
mkdir -p obj
${MLXGLUE_DIR}/libmlxglue.a:
@printf "\nBuilding mlxglue...\n"
${MAKE} -C ${MLXGLUE_DIR}
libmlx.dylib: ${MLX_DIR}/libmlx.dylib
@printf "\nBuilding Minilibx...\n"
cp ${MLX_DIR}/libmlx.dylib .
${MLX_DIR}/libmlx.dylib:
${MAKE} -C ${MLX_DIR}
clean:
rm -rf obj
fclean: clean
${RM} ${NAME}
${RM} libmlx.dylib
re: fclean all
fcleanf: fclean
@printf "\nCleaning Minilibx...\n"
${MAKE} -C ${MLX_DIR} clean
@printf "\nCleaning Libftparsing...\n"
${MAKE} -C ${LIBFTPARSING_DIR} fclean
@printf "\nCleaning mlxglue...\n"
${MAKE} -C ${MLXGLUE_DIR} fclean
@printf "\nCleaning libft...\n"
${MAKE} -C ${LIBFT_DIR} fclean
norme:
norminettev2 src libft deps/mlxglue deps/parsing
.PHONY: all clean fclean re fcleanf norme