build(make): improved the Makefile
- The C default Compiler is now defined if not defined - Added the preprocessor rules with the includes rules - Now the rules CC is use and not hardcoded
This commit is contained in:
parent
2418466658
commit
afb804195a
1 changed files with 6 additions and 12 deletions
18
Makefile
18
Makefile
|
|
@ -6,7 +6,7 @@
|
||||||
# By: rparodi <marvin@42.fr> +#+ +:+ +#+ #
|
# By: rparodi <marvin@42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2023/11/12 11:05:05 by rparodi #+# #+# #
|
# Created: 2023/11/12 11:05:05 by rparodi #+# #+# #
|
||||||
# Updated: 2024/10/31 17:26:05 by rparodi ### ########.fr #
|
# Updated: 2025/09/01 17:44:59 by rparodi ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
|
|
@ -16,21 +16,15 @@
|
||||||
NAME = libft.a
|
NAME = libft.a
|
||||||
|
|
||||||
# Commands
|
# Commands
|
||||||
CC = cc
|
CC ?= clang
|
||||||
RM = rm -rf
|
RM = rm -rf
|
||||||
|
|
||||||
# Flags
|
# Flags
|
||||||
CFLAGS = -Werror -Wextra -Wall
|
CFLAGS = -Werror -Wextra -Wall
|
||||||
CFLAGS += -g3 -MMD
|
|
||||||
# CFLAGS += -lm
|
|
||||||
|
|
||||||
# CFLAGS += -fsanitize=address
|
CPPFLAGS = $(addprefix -I, $(INC_DIR)) -MMD -MP
|
||||||
# CFLAGS += -fsanitize=thread
|
|
||||||
|
|
||||||
LDFLAGS = -L.
|
INC_DIR = includes
|
||||||
LDLIBS = -lft
|
|
||||||
|
|
||||||
INCLUDES = ./includes/libft/
|
|
||||||
|
|
||||||
# Objects
|
# Objects
|
||||||
OBJDIRNAME = ./build
|
OBJDIRNAME = ./build
|
||||||
|
|
@ -104,7 +98,7 @@ bonus: header $(OBJ) $(LIB_OBJ) footer
|
||||||
@mkdir -p $(OBJDIRNAME)
|
@mkdir -p $(OBJDIRNAME)
|
||||||
@mkdir -p $(OBJDIRNAME)/$(SRCDIRNAME)
|
@mkdir -p $(OBJDIRNAME)/$(SRCDIRNAME)
|
||||||
@printf '$(GREY) Be Carefull ur in $(END)$(GREEN)Debug Mode$(END)\n'
|
@printf '$(GREY) Be Carefull ur in $(END)$(GREEN)Debug Mode$(END)\n'
|
||||||
@cc $(CFLAGS) -D BONUS=1 -o $(NAME) $(OBJ) $(LIB_OBJ)
|
@$(CC) $(CFLAGS) $(CPPFLAGS) -D BONUS=1 -o $(NAME) $(OBJ) $(LIB_OBJ)
|
||||||
|
|
||||||
# Clean (make clean)
|
# Clean (make clean)
|
||||||
clean:
|
clean:
|
||||||
|
|
@ -131,7 +125,7 @@ $(NAME): $(OBJ)
|
||||||
$(OBJDIRNAME)/%.o: %.c
|
$(OBJDIRNAME)/%.o: %.c
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
@printf '$(GREY) Compiling $(END)$(GREEN)$<$(END)\n'
|
@printf '$(GREY) Compiling $(END)$(GREEN)$<$(END)\n'
|
||||||
@cc $(CFLAGS) -o $@ -c $< -I$(INCLUDES)
|
@$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
|
||||||
|
|
||||||
# Header
|
# Header
|
||||||
header:
|
header:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue