-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (44 loc) · 1.07 KB
/
Copy pathMakefile
File metadata and controls
54 lines (44 loc) · 1.07 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
# Configuration
NAME = libftprintf.a
CC = cc
CFLAGS = -Wall -Wextra -Werror
LIBFT_DIR = libft
LIBFT = $(LIBFT_DIR)/libft.a
# wildcard use just developing
#SRCS = $(wildcard ft_*.c)
# File sources
SRCS = ft_print_char.c ft_printf.c ft_print_hex.c ft_printnum.c \
ft_print_point.c ft_printstr.c ft_print_uns.c
# Final object files
OBJS = $(SRCS:.c=.o)
AR = ar rcs
RM = rm -f
# Main rule for make
all: $(NAME)
# Library compilation
# you copy the compiled library libft.a
# and you combine with the libftprint.a
# for the only one library requirement in norminette
$(NAME): $(OBJS)
@echo "📦 Compiling $(LIBFT)"
@make -C $(LIBFT_DIR)
@cp $(LIBFT) $(NAME)
@echo "$(LIBFT) compiled succesfuly"
@$(AR) $(NAME) $(OBJS)
@echo "✅ Library $(NAME) compiled"
# Compile .c to .o
%.o:%.c
@$(CC) $(CFLAGS) -c $< -o $@
# Clean .o
clean:
@$(RM) $(OBJS)
@make -C $(LIBFT_DIR) clean
@echo "Object removed"
# Clean everything
fclean: clean
@$(RM) $(NAME)
@make -C $(LIBFT_DIR) fclean
@echo "Library $(NAME) removed"
# Recompile
re : fclean all
.PHONY: all clean fclean re