Add initial tools and structure
authorLukas Jiriste <ljiriste@student.42prague.com>
Thu, 14 Nov 2024 10:50:19 +0000 (11:50 +0100)
committerLukas Jiriste <ljiriste@student.42prague.com>
Fri, 22 Nov 2024 09:11:54 +0000 (10:11 +0100)
.gitignore [new file with mode: 0644]
.gitmodules [new file with mode: 0644]
Libft [new submodule]
Makefile [new file with mode: 0644]
inc/miniRT.h [new file with mode: 0644]
minilibx-linux [new submodule]
src/main.c [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..6c6ca1b
--- /dev/null
@@ -0,0 +1,2 @@
+*.[ao]
+miniRT
diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..7594a50
--- /dev/null
@@ -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 (submodule)
index 0000000..4afafbb
--- /dev/null
+++ b/Libft
@@ -0,0 +1 @@
+Subproject commit 4afafbba59ad4abf953ea8aa23f1e61fb2c1daea
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
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 (file)
index 0000000..7866a56
--- /dev/null
@@ -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 (submodule)
index 0000000..7b689db
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 7b689dbf576eeaafdde87fa2deddd6f616406982
diff --git a/src/main.c b/src/main.c
new file mode 100644 (file)
index 0000000..d916721
--- /dev/null
@@ -0,0 +1,6 @@
+#include "miniRT.h"
+
+int    main(void)
+{
+       return (0);
+}