From 06bf294aae5fd2c7208658c300bfe235988af68c Mon Sep 17 00:00:00 2001 From: Lukas Jiriste Date: Thu, 14 Nov 2024 11:50:19 +0100 Subject: [PATCH] Add initial tools and structure --- .gitignore | 2 ++ .gitmodules | 7 +++++ Libft | 1 + Makefile | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++ inc/miniRT.h | 4 +++ minilibx-linux | 1 + src/main.c | 6 ++++ 7 files changed, 99 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 160000 Libft create mode 100644 Makefile create mode 100644 inc/miniRT.h create mode 160000 minilibx-linux create mode 100644 src/main.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6c6ca1b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.[ao] +miniRT diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..7594a50 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,7 @@ +[submodule "minilibx-linux"] + path = minilibx-linux + url = https://github.com/Kycilak/minilibx-linux + branch = 58-repair-invalid-read +[submodule "Libft"] + path = Libft + url = git://ljiriste.work/Libft diff --git a/Libft b/Libft new file mode 160000 index 0000000..4afafbb --- /dev/null +++ b/Libft @@ -0,0 +1 @@ +Subproject commit 4afafbba59ad4abf953ea8aa23f1e61fb2c1daea diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8299fef --- /dev/null +++ b/Makefile @@ -0,0 +1,78 @@ +CC := gcc +CFLAGS = -std=c99 -Wall -Wextra -Werror -Wpedantic + +INCGRAPH := minilibx-linux /usr/include Libft/inc +LINKGRAPH := -Lminilibx-linux -lmlx -L/usr/lib -lXext -lX11 -lm -lbsd -LLibft -lft + +ifneq ("$(wildcard .debug)","") + CFLAGS += -g +endif + +RM := rm -f + +MLXDIR := minilibx-linux/ +MLX := $(MLXDIR)libmlx_Linux.a +LFTDIR := Libft/ +LFT := $(LFTDIR)libft.a + +INCDIR := inc $(LFTDIR)inc/ $(MLXDIR) +INCLUDE := $(addprefix -I, $(INCDIR)) + +SRCDIR := src + +SOURCES := main.c \ + +SOURCES := $(addprefix $(SRCDIR)/, $(SOURCES)) + +OBJECTS := $(SOURCES:.c=.o) + +NAME := miniRT + +all : $(NAME) + +debug : .debug + $(MAKE) -C Libft debug + $(MAKE) all + +nodebug : + $(MAKE) -C Libft nodebug + $(RM) .debug + $(MAKE) shallow_re + +.% : + $(MAKE) shallow_fclean + touch $@ + +$(NAME) : $(OBJECTS) $(LFT) $(MLX) + $(CC) $(CFLAGS) -o $@ $^ $(LINKS) + +FORCE: ; + +$(LFT) : FORCE | $(LFTDIR)Makefile + $(MAKE) -C $(LFTDIR) + +$(MLX) : FORCE | $(MLXDIR)Makefile + $(MAKE) -C $(MLXDIR) + +%.o : %.c | $(MLXDIR)Makefile $(LFTDIR)Makefile + $(CC) $(CFLAGS) -o $@ -c $< $(INCLUDE) + +%/Makefile : + git submodule update --init $($@%/Makefile=%) + +clean : + $(RM) $(OBJECTS) + +fclean : clean + $(RM) $(NAME) + $(MAKE) -C $(LFTDIR) fclean + $(MAKE) -C $(MLXDIR) clean + +re : fclean + $(MAKE) all + +shallow_fclean : clean + $(RM) $(NAME) + +shallow_re : shallow_fclean + $(MAKE) all diff --git a/inc/miniRT.h b/inc/miniRT.h new file mode 100644 index 0000000..7866a56 --- /dev/null +++ b/inc/miniRT.h @@ -0,0 +1,4 @@ +#ifndef MINIRT_H +# define MINIRT_H + +#endif // MINIRT_H diff --git a/minilibx-linux b/minilibx-linux new file mode 160000 index 0000000..7b689db --- /dev/null +++ b/minilibx-linux @@ -0,0 +1 @@ +Subproject commit 7b689dbf576eeaafdde87fa2deddd6f616406982 diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..d916721 --- /dev/null +++ b/src/main.c @@ -0,0 +1,6 @@ +#include "miniRT.h" + +int main(void) +{ + return (0); +} -- 2.30.2