Refactor project file structure
authorLukas Jiriste <ljiriste@student.42prague.com>
Thu, 25 Apr 2024 10:23:06 +0000 (12:23 +0200)
committerLukas Jiriste <ljiriste@student.42prague.com>
Thu, 25 Apr 2024 10:23:06 +0000 (12:23 +0200)
14 files changed:
Makefile
inc/color.h [moved from color.h with 100% similarity]
inc/complex.h [moved from complex.h with 100% similarity]
inc/fractals.h [moved from fractals.h with 100% similarity]
inc/fractol.h [moved from fractol.h with 100% similarity]
inc/pixel.h [moved from pixel.h with 100% similarity]
inc/vect2.h [moved from vect2.h with 100% similarity]
src/color.c [moved from color.c with 100% similarity]
src/complex.c [moved from complex.c with 100% similarity]
src/event_handling.c [moved from event_handling.c with 100% similarity]
src/fractals.c [moved from fractals.c with 100% similarity]
src/main.c [moved from main.c with 100% similarity]
src/pixel.c [moved from pixel.c with 100% similarity]
src/vect2.c [moved from vect2.c with 100% similarity]

index e37b34624c6cd8a4363a21f059db2f978b65b763..d252ab85c9cf789b79b70f2545229d9c24255598 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,16 +1,30 @@
 CC := gcc
 
 CFLAGS := -std=c99 -Wall -Wextra -Werror -Wpedantic
-INCGRAPH := -Iminilibx-linux -I/usr/include -ILibft/inc
+INCGRAPH := minilibx-linux /usr/include Libft/inc
 LINKGRAPH := -Lminilibx-linux -lmlx -L/usr/lib -lXext -lX11 -lm -lbsd -LLibft -lft
 
+INCDIR := inc
+
+INC = $(addprefix -I, $(INCDIR) $(INCGRAPH))
+
 NAME := fractol
 MLXDIR := minilibx-linux/
 MLX := $(MLXDIR)libmlx_Linux.a
 LFTDIR := Libft/
 LFT := $(LFTDIR)libft.a
 
-SRCS := main.c complex.c color.c event_handling.c fractals.c pixel.c
+SRCDIR := src
+
+SRCS := main.c                         \
+               complex.c                       \
+               color.c                         \
+               event_handling.c        \
+               fractals.c                      \
+               pixel.c                         \
+
+SRCS := $(addprefix $(SRCDIR)/, $(SRCS))
+
 OBJS := $(SRCS:%.c=%.o)
 
 all : $(NAME)
@@ -22,7 +36,7 @@ $(NAME) : $(OBJS) $(LFT) $(MLX)
        $(CC) $(CFLAGS) $(OBJS) -o $@ $(LINKGRAPH)
 
 %.o : %.c | $(LFTDIR)Makefile $(MLXDIR)Makefile
-       $(CC) $(CFLAGS) $(INCGRAPH) -c $< -o $@
+       $(CC) $(CFLAGS) $(INC) -c $< -o $@
 
 $(MLX) : | $(MLXDIR)Makefile
        $(MAKE) -C $(MLXDIR)
similarity index 100%
rename from color.h
rename to inc/color.h
similarity index 100%
rename from complex.h
rename to inc/complex.h
similarity index 100%
rename from fractals.h
rename to inc/fractals.h
similarity index 100%
rename from fractol.h
rename to inc/fractol.h
similarity index 100%
rename from pixel.h
rename to inc/pixel.h
similarity index 100%
rename from vect2.h
rename to inc/vect2.h
similarity index 100%
rename from color.c
rename to src/color.c
similarity index 100%
rename from complex.c
rename to src/complex.c
similarity index 100%
rename from event_handling.c
rename to src/event_handling.c
similarity index 100%
rename from fractals.c
rename to src/fractals.c
similarity index 100%
rename from main.c
rename to src/main.c
similarity index 100%
rename from pixel.c
rename to src/pixel.c
similarity index 100%
rename from vect2.c
rename to src/vect2.c