From b620178705abae6f5a5e6c22d49736f764407f33 Mon Sep 17 00:00:00 2001 From: Lukas Jiriste Date: Tue, 16 Jan 2024 10:38:15 +0100 Subject: [PATCH] Change Makefile to download submodules Add target %/Makefile to Makefile and add Makefiles of subprojects as prerequisites for compilation. This ammends the situation when after git clone, the submodule folders are empty nad compilation fails because header files are missing. --- Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 510eea5..4f55ad5 100644 --- a/Makefile +++ b/Makefile @@ -21,13 +21,13 @@ debug : $(NAME) $(NAME) : $(OBJS) $(LFT) $(MLX) $(CC) $(CFLAGS) $(OBJS) -o $@ $(LINKGRAPH) -%.o : %.c +%.o : %.c $(LFTDIR)Makefile $(MLX)Makefile $(CC) $(CFLAGS) $(INCGRAPH) -c $< -o $@ -$(MLX) : +$(MLX) : | $(MLXDIR)Makefile $(MAKE) -C $(MLXDIR) -$(LFT) : +$(LFT) : | $(LFTDIR)Makefile ifneq (,$(findstring debug, $(MAKECMDGOALS))) $(MAKE) -C $(LFTDIR) debug else @@ -46,3 +46,6 @@ fclean : re : fclean $(MAKE) + +%/Makefile : + git submodule update --init $($@%/Makefile=%) -- 2.30.2