-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (52 loc) · 1.97 KB
/
Makefile
File metadata and controls
70 lines (52 loc) · 1.97 KB
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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: kuyu <kuyu@student.codam.nl> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/08/12 01:37:18 by kuyu #+# #+# #
# Updated: 2025/08/25 14:43:41 by kuyu ### ########.fr #
# #
# **************************************************************************** #
NAME = pipex
BONUS = pipex_bonus
CC = cc
CFLAGS = -Wall -Wextra -Werror
INCLUDE = -I includes -I libft
LIBFT_DIR = libft
LIBFT = $(LIBFT_DIR)/libft.a
SHARED_SRCS = src/utils.c \
src/child.c \
src/handler.c \
src/exiter.c
SRCS = src/main.c \
$(SHARED_SRCS)
BONUS_SRCS = src/main_bonus.c \
$(SHARED_SRCS)
OBJS = $(SRCS:.c=.o)
BONUS_OBJS = $(BONUS_SRCS:.c=.o)
all: libft ${NAME}
${NAME}: ${LIBFT} ${OBJS}
${CC} ${CFLAGS} ${INCLUDE} ${OBJS} ${LIBFT} -o ${NAME}
${BONUS}: ${LIBFT} ${BONUS_OBJS}
${CC} ${CFLAGS} ${INCLUDE} ${BONUS_OBJS} ${LIBFT} -o ${BONUS}
# objects file generation, so only build modified file
%.o: %.c
$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
# $@ - the file name of the target of the rule
# $< - the name of the first prerequisite
# $^ - the names of all the prerequisites
libft:
$(MAKE) -C $(LIBFT_DIR)
bonus: libft $(BONUS)
clean:
rm -f ${OBJS} ${BONUS_OBJS}
$(MAKE) -C $(LIBFT_DIR) clean
# make -C $(LIBFT_DIR) clean
fclean: clean
rm -f ${NAME} ${BONUS}
$(MAKE) -C $(LIBFT_DIR) fclean
# make -C $(LIBFT_DIR) fclean
re: fclean all
.PHONY: all clean fclean re libft