Skip to content

Commit 923cf4d

Browse files
committed
update upstream repo
2 parents 723874e + 01ee03c commit 923cf4d

35 files changed

+739
-150
lines changed

.assets/rt_A.png

-204 Bytes
Loading

.assets/rt_C.png

216 Bytes
Loading

.assets/rt_L.png

1.47 KB
Loading

.assets/rt_cy.png

1.47 KB
Loading

.assets/rt_pl.png

3 KB
Loading

.assets/rt_sp.png

-467 Bytes
Loading

Makefile

+30-23
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,17 @@
66
# By: aschenk <[email protected]> +#+ +:+ +#+ #
77
# +#+#+#+#+#+ +#+ #
88
# Created: 2024/11/07 16:20:40 by aschenk #+# #+# #
9-
# Updated: 2025/02/22 08:48:23 by aschenk ### ########.fr #
9+
# Updated: 2025/02/26 12:08:29 by aschenk ### ########.fr #
1010
# #
1111
# **************************************************************************** #
1212

13-
# Implement light attenuation (fading of light intensity with distance);
14-
# set FADE to 1 to enable, 0 to disable during compilation ('make FADE=0')
15-
FADE ?= 1
16-
1713
NAME := miniRT
1814

1915
OS := $(shell uname) # Detect OS type
2016

21-
#############################
22-
# PRE-COMPILATION CONSTANTS #
23-
#############################
17+
##########
18+
# MACROS #
19+
##########
2420

2521
WINDOW_W ?= 1440 # Default window width
2622
WINDOW_H ?= 900 # Default window height
@@ -117,16 +113,23 @@ LIB_FLAGS := $(LIBFT_FLAGS) $(MLX_FLAGS)
117113

118114
CC := cc
119115
CFLAGS := -Wall -Wextra -Werror
120-
CFLAGS += -I$(HDRS_DIR) -I$(LIBFT_DIR) -I$(MLX_DIR) # Look for headers in these directories
121-
CFLAGS += -DFADE=$(FADE)
122-
CFLAGS += -DWINDOW_H=$(WINDOW_H) -DWINDOW_W=$(WINDOW_W) # Define window dimensions with pre-compilation constants
116+
CFLAGS += -I$(HDRS_DIR) -I$(LIBFT_DIR) -I$(MLX_DIR) # Look for headers in these directories
117+
CFLAGS += -DWINDOW_H=$(WINDOW_H) -DWINDOW_W=$(WINDOW_W) # Define window dimensions with macros
123118

124119
CFLAGS += -g -Wpedantic # Debugging flag, pedantic warnings
125120

126121
ifeq ($(strip $(OS)),Darwin) # Suppress some errors/warnings on MacOS (due to the way prototypes are defined in MiniLibX)
127122
CFLAGS += -Wno-strict-prototypes
128123
endif
129124

125+
##########
126+
# BONUS #
127+
#########
128+
129+
ifdef BONUS
130+
CFLAGS += -DBONUS=1
131+
endif
132+
130133
######################
131134
# FORMATTING STRINGS #
132135
######################
@@ -186,7 +189,7 @@ $(LIBMLX):
186189
git clone https://github.com/42Paris/minilibx-linux.git $(MLX_DIR) >/dev/null 2>&1; \
187190
fi
188191
@echo "Compiling MiniLibX..."
189-
@make -s -C $(MLX_DIR) >/dev/null 2>&1;
192+
@$(MAKE) -s -C $(MLX_DIR) >/dev/null 2>&1;
190193
@echo "$(BOLD)MiniLibX compiled.$(RESET)"
191194

192195
# Build libft library by calling 'make' in LIBFT_DIR.
@@ -243,7 +246,7 @@ $(LIBFT): $(LIBFT_DIR)/libft.h \
243246
$(LIBFT_DIR)/ft_printf_utils.c \
244247
$(LIBFT_DIR)/ft_printf.c \
245248
$(LIBFT_DIR)/ft_atoi_base.c
246-
@make -s -C $(LIBFT_DIR)
249+
@$(MAKE) -s -C $(LIBFT_DIR)
247250
@echo ""
248251

249252
# Compilation of program; depends on $(OBJS) and library files
@@ -261,7 +264,7 @@ $(NAME): $(OBJS) $(LIBFT) $(LIBMLX)
261264

262265
@echo "$(RESET)"
263266

264-
@echo "by Natalie Holbrook & Alex Schenk @42Berlin, December 2024"
267+
@echo "by Natalie Holbrook & Alex Schenk @42Berlin, February 2025"
265268
@echo "\n$(BOLD)$(YELLOW)Usage: './$(NAME) <scene.rt>'$(RESET)"
266269

267270
##########
@@ -271,7 +274,7 @@ $(NAME): $(OBJS) $(LIBFT) $(LIBMLX)
271274
# Target to remove all generated files BUT the program executable and compiled libraries.
272275
clean:
273276
@rm -rf $(OBJS_DIR)
274-
@make -s -C $(LIBFT_DIR) clean >/dev/null 2>&1
277+
@$(MAKE) -s -C $(LIBFT_DIR) clean >/dev/null 2>&1
275278
@rm -rf $(MLX_DIR)/obj
276279
@echo "$(BOLD)$(RED)Object files removed.$(RESET)"
277280

@@ -282,20 +285,24 @@ fclean: clean
282285

283286
# Target to remove all generated files and the program executable (NOT the compiled libraries).
284287
fclean_all: fclean
285-
@make -s -C $(LIBFT_DIR) fclean >/dev/null 2>&1
288+
@$(MAKE) -s -C $(LIBFT_DIR) fclean >/dev/null 2>&1
286289
@rm -rf $(MLX_DIR)
287290
@echo "$(BOLD)$(RED)Library files removed.$(RESET)"
288291

289292
# Target to remove all object files, the program executable,
290293
# and then rebuild the program.
291-
re: fclean
292-
@echo ""
293-
@$(MAKE) -s all
294+
re: fclean all
294295

295296
# Target to remove all object files, the program executable, and the compiled libraries,
296297
# and then rebuild the program.
297-
re_all: fclean_all
298-
@echo ""
299-
@$(MAKE) -s all
298+
re_all: fclean_all all
299+
300+
# Bonus rules
301+
bonus:
302+
@$(MAKE) -s BONUS=1
303+
304+
re_bonus: fclean bonus
305+
306+
re_all_bonus: fclean_all bonus
300307

301-
.PHONY: all clean fclean re
308+
.PHONY: all clean fclean fclean_all re re_all bonus re_bonus re_all_bonus

0 commit comments

Comments
 (0)