-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
77 lines (60 loc) · 2.14 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: fmaurer <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/10/02 00:03:28 by fmaurer #+# #+# #
# Updated: 2024/11/05 06:59:47 by fmaurer ### ########.fr #
# #
# **************************************************************************** #
NAME = pipex
SRCS_IN = ./pipex.c \
./utils.c \
./get_exec_path.c \
./join_cmd_argv.c
SRCS = $(patsubst ./%.c,%.c,$(SRCS_IN))
OBJDIR = obj
OBJS = $(patsubst %.c,$(OBJDIR)/%.o,$(SRCS))
CC = clang
# CFLAGS = -Wall -Werror -Wextra
CFLAGS = -g
# adding libft
LIBFT_PATH = ./libft/libft
LIBFT = $(LIBFT_PATH)/libft.a
LIB_PATHS += -L$(LIBFT_PATH)
LIBS += -lft
GRN = \033[1;32m
RED = \033[1;31m
WHT = \033[1;37m
EOC = \033[1;0m
YLW = \033[1;33m
MSGOPN = $(YLW)[[$(GRN)
MSGEND = $(YLW)]]$(EOC)
log_msg = $(MSGOPN) $(1) $(MSGEND)
all: $(NAME)
$(OBJDIR)/%.o: %.c | $(OBJDIR)
@echo -e "$(call log_msg,Compiling $<...)"
$(CC) $(CFLAGS) -c $< -o $@
$(NAME): $(OBJS) | $(LIBFT)
@echo -e "$(call log_msg,Compiling $(NAME)...)"
$(CC) $(CFLAGS) $(LIB_PATHS) -o $@ $^ $(LIBS)
$(LIBFT):
@echo -e "$(call log_msg,Compiling libft...)"
make -C $(LIBFT_PATH) all
debug: $(SRCS)
$(CC) -g $(CFLAGS) -o pipex $^
$(OBJDIR):
mkdir -p obj
clean:
@echo -e "$(call log_msg,Removing libft objs.)"
@make -s -C $(LIBFT_PATH) clean
@echo -e "$(call log_msg,Removing pipex objs.)"
@rm -rf $(OBJDIR)
fclean: clean
@echo -e "$(call log_msg,fcleaning libft..)"
@make -s -C $(LIBFT_PATH) fclean
@echo -e "$(call log_msg,fcleaning pipex..)"
@rm -f $(NAME)
.PHONY: all clean fclean debug