Skip to content

Commit

Permalink
feat: add inicitialization of submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathalia Vitoria Buchholz committed Jan 20, 2025
1 parent 3fc874b commit 2870263
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# By: nbuchhol <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/01/03 12:09:52 by nbuchhol #+# #+# #
# Updated: 2025/01/20 16:57:11 by nbuchhol ### ########.fr #
# Updated: 2025/01/20 17:33:23 by nbuchhol ### ########.fr #
# #
# **************************************************************************** #

Expand All @@ -23,21 +23,35 @@ OBJ = ${SRC:.c=.o}
SUB_DIRS = libft minilibx
RM = rm -f

all: ${NAME}
all: init-submodules ${NAME}

${NAME}: ${OBJ}
@${CC} ${OBJ} -o ${NAME}

%.o: %.c
@${CC} ${CFLAGS} -c $^ -o $@

init-submodules:
@if [ ! -d "libft" ] || [ ! -f "libft/.git" ]; then \
echo "Inicializando submódulo libft..."; \
git submodule update --init --recursive libft; \
else \
echo "Submódulo libft já está inicializado."; \
fi
@if [ ! -d "minilibx" ] || [ ! -f "minilibx/.git" ]; then \
echo "Inicializando submódulo minilibx..."; \
git submodule update --init --recursive minilibx; \
else \
echo "Submódulo minilibx já está inicializado."; \
fi

clean:
${RM} ${OBJ}
for dir in $(SUBDIRS); do $(MAKE) -C $$dir clean; done
@for dir in $(SUBDIRS); do $(MAKE) -C $$dir clean; done

fclean: clean
${RM} ${NAME}

re: fclean all

.PHONY = all clean fclean re
.PHONY = all clean fclean re init-submodules

0 comments on commit 2870263

Please sign in to comment.