cub3d/Makefile

78 lines
2.5 KiB
Makefile
Raw Normal View History

2023-10-25 13:56:45 +02:00
# **************************************************************************** #
# #
2023-10-26 11:01:31 +02:00
# :::::::: #
2023-10-25 13:56:45 +02:00
# Makefile :+: :+: #
2023-10-26 11:01:31 +02:00
# +:+ #
# By: houtworm <codam@houtworm.net> +#+ #
# +#+ #
# Created: 2023/10/26 10:46:29 by houtworm #+# #+# #
2023-11-06 00:08:25 +01:00
# Updated: 2023/11/05 22:29:47 by houtworm ######## odam.nl #
2023-10-25 13:56:45 +02:00
# #
# **************************************************************************** #
2023-10-25 14:07:29 +02:00
NAME =cub3d
2023-10-25 13:56:45 +02:00
CC =gcc
FC =-Wall -Werror -Wextra -Wunreachable-code -flto -Ofast -march=native -g #-fsanitize=address
2023-10-25 13:56:45 +02:00
HEAD =-I ./include -I $(MLX)/include
RM =rm -rf
2023-10-26 17:40:01 +02:00
LIB =libft/libft.a getnextline/get_next_line.a mlx/build/libmlx42.a -ldl -lglfw -pthread -lm
2023-11-05 04:53:41 +01:00
SRC =src/main/main.c\
2023-11-05 11:53:15 +01:00
src/main/pickup.c\
2023-11-05 04:53:41 +01:00
src/main/init.c\
src/main/error.c\
2023-11-05 08:04:05 +01:00
src/main/cleanup.c\
2023-11-05 07:27:38 +01:00
src/parse/parse.c\
src/parse/map.c\
2023-11-05 11:53:15 +01:00
src/parse/sprite.c\
2023-11-05 04:53:41 +01:00
src/draw/raycast.c\
2023-11-05 07:27:38 +01:00
src/draw/world.c\
src/draw/texture.c\
2023-11-06 00:08:25 +01:00
src/draw/weapon.c\
2023-11-05 08:04:05 +01:00
src/draw/stats.c\
2023-11-05 06:38:58 +01:00
src/input/game.c\
src/input/move.c\
src/input/turn.c\
src/input/rest.c\
2023-11-05 11:53:15 +01:00
src/sprite/check.c\
src/sprite/draw.c
2023-10-25 13:56:45 +02:00
OBJ =$(SRC:src/%.c=obj/%.o)
2023-10-26 17:40:01 +02:00
all: libft getnextline mlx/build/mlx42.a $(NAME)
2023-10-25 13:56:45 +02:00
clean:
2023-10-26 11:01:31 +02:00
@$(RM) obj
2023-10-25 13:56:45 +02:00
@$(MAKE) -C libft clean > /dev/null
2023-10-26 17:40:01 +02:00
@$(MAKE) -C getnextline clean > /dev/null
2023-10-25 13:56:45 +02:00
@$(MAKE) -C mlx/build clean > /dev/null
@printf "\e[1;35mCleaned Object Files\n\e[0;00m"
2023-11-01 14:17:37 +01:00
fclean: clean
2023-10-25 14:07:29 +02:00
@$(RM) $(NAME) mlx/build > /dev/null
2023-10-25 13:56:45 +02:00
@$(MAKE) -C libft fclean > /dev/null
2023-10-26 17:40:01 +02:00
@$(MAKE) -C getnextline fclean > /dev/null
2023-10-25 13:56:45 +02:00
@printf "\e[1;31mCleaned Executables\n\e[0;00m"
re: fclean all
2023-10-26 19:11:30 +02:00
$(OBJ): $(SRC) Makefile cub3d.h
2023-10-25 13:56:45 +02:00
@mkdir -p $(dir $@)
@printf "\e[1;34mBuilding $@\n\e[0;00m"
@$(CC) $(CFLAGS) -c $(@:obj/%.o=src/%.c) -o $@
$(NAME): $(OBJ)
@printf "\e[1;36mCompiling $@\e[0;00m\n"
@$(CC) $(FC) -o $(NAME) $(SRC) $(LIB) $(HEAD)
@printf "\e[1;32mDone\e[0;00m\n"
libft:
@$(MAKE) -C libft all
2023-10-26 17:40:01 +02:00
getnextline:
@$(MAKE) -C getnextline all
2023-10-26 11:01:31 +02:00
mlx/build/mlx42.a:
2023-10-25 13:56:45 +02:00
@cmake -S mlx -B mlx/build
@$(MAKE) -C mlx/build -j4
2023-10-26 19:18:18 +02:00
.PHONY: libft getnextline