-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing makefile and removing unecessary files for graphical development
- Loading branch information
1 parent
a806f76
commit 7fbb313
Showing
7 changed files
with
51 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,73 @@ | ||
# Variables | ||
NAME := cub3D | ||
|
||
BUILD_DIR := build/ | ||
SOURCES_DIR := sources/ | ||
OBJECTS_DIR := objects/ | ||
HEADERS_DIR := includes/ | ||
LIBRARIES_DIR := libraries/ | ||
LIBFT_DIR := $(addprefix $(LIBRARIES_DIR), lib/) | ||
LIBFT_FILE := libft.a | ||
LIBFT_DIR := $(addprefix $(LIBRARIES_DIR), libft/) | ||
MLX_DIR := $(addprefix $(LIBRARIES_DIR), mlx/) | ||
|
||
# Flags | ||
MAKE := make | ||
MAKE_LIBS := $(MAKE) -sC | ||
MAKE_LIBS := make -sC | ||
CC := cc | ||
CFLAGS := -Wall -Wextra -Werror -Wunreachable-code -Ofast -g3 | ||
MKDIR := mkdir -p | ||
RM := rm -rf | ||
CMAKE := cmake | ||
|
||
# MLX42 | ||
MLX_FILE := libmlx42.a | ||
LIB_MLX_FLAGS := -Iinclude -ldl -lglfw -pthread -lm | ||
LIB_MLX_SRCS := MLX42/build/libmlx42.a | ||
MLX_BUILD := $(addprefix $(MLX_DIR), $(BUILD_DIR)) | ||
MLX := $(addprefix $(MLX_BUILD), $(MLX_FILE)) | ||
|
||
# Sources | ||
FILES := main | ||
|
||
SOURCES := $(addprefix $(SOURCES_DIR), $(addsuffix .c, $(FILES))) | ||
OBJECTS := $(addprefix $(OBJECTS_DIR), $(addsuffix .o, $(FILES))) | ||
LIBFT := $(addprefix $(LIBFT_DIR), $(LIBFT_FILE)) | ||
LIBFT_HEADER := $(addprefix $(LIBFT_DIR), includes/libft.h) | ||
HEADERS := -I $(HEADERS_DIR) | ||
|
||
MESSAGE1 := "------------------Compiling cub3d Objects!-------------------" | ||
MESSAGE2 := "---------------Objects Compiled Successfully!----------------" | ||
MESSAGE3 := "-----------------.cub3d Compiled Successfully----------------" | ||
LIBFT_FILE := libft.a | ||
LIBFT := $(addprefix $(LIBFT_DIR), $(LIBFT_FILE)) | ||
|
||
# Rules | ||
.PHONY: all clean fclean re bonus | ||
MESSAGE1 := "-----------------.cub3d Compiled Successfully----------------" | ||
|
||
all: $(NAME) | ||
all: libraries $(NAME) | ||
|
||
$(NAME): $(LIBFT) $(OBJECTS) | ||
@ echo ' ' | ||
$(NAME): $(OBJECTS) | ||
@ $(CC) $(CFLAGS) $(OBJECTS) $(LIBFT) $(MLX) $(MLX_FLAGS) -o $(NAME) | ||
@ echo $(MESSAGE1) | ||
@ echo ' ' | ||
@$(CC) $(CFLAGS) $^ $(LIBFT) -o $(NAME) $(INCLUDES) $(LFLAGS) | ||
@ echo $(MESSAGE2) | ||
@ echo ' ' | ||
@ echo $(MESSAGE3) | ||
@ echo ' ' | ||
|
||
cleanlibft: | ||
@$(MAKE_LIBS) $(LIBFT_DIR) clean | ||
$(OBJECTS_DIR)%.o: $(SOURCES_DIR)%.c | ||
@ $(MKDIR) $(OBJECTS_DIR) | ||
@ $(CC) $(CFLAGS) -c $< -o $@ | ||
|
||
fcleanlibft: | ||
@$(MAKE_LIBS) $(LIBFT_DIR) fclean | ||
libraries : $(LIBFT) $(MLX) | ||
|
||
clean: cleanlibft | ||
@ rm -rf $(OBJECTS_DIR) | ||
$(LIBFT): | ||
@ $(MAKE_LIBS) $(LIBFT_DIR) | ||
|
||
fclean: clean fcleanlibft | ||
@$(RM) $(NAME) | ||
$(MLX): | ||
@ $(CMAKE) $(MLX_DIR) -B $(MLX_BUILD) && $(MAKE_LIBS) $(MLX_BUILD) -j4 | ||
|
||
re: fclean | ||
@$(MAKE) -s | ||
clean: cleanlibs | ||
@ $(RM) $(OBJECTS_DIR) | ||
|
||
bonus: all | ||
cleanlibs: cleanmlx cleanlibft | ||
|
||
$(OBJECTS_DIR)%.o: $(SOURCES_DIR)%.c | ||
@$(MKDIR) $(OBJECTS_DIR) | ||
@$(CC) $(CFLAGS) -c $< -o $@ | ||
cleanlibft: | ||
@ $(MAKE_LIBS) $(LIBFT_DIR) clean | ||
|
||
libraries: $(LIBFT) | ||
cleanmlx: | ||
@ $(RM) $(MLX_BUILD) | ||
|
||
$(LIBFT): | ||
@$(MAKE_LIBS) $(LIBFT_DIR) | ||
fclean: clean | ||
@ $(RM) $(NAME) $(LIBFT) | ||
|
||
re: fclean all | ||
|
||
bonus: all | ||
|
||
# Rules | ||
.PHONY: all clean fclean re bonus libraries |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.