-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (56 loc) · 1.95 KB
/
Makefile
File metadata and controls
75 lines (56 loc) · 1.95 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
71
72
73
74
75
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/05/16 11:42:25 by charles #+# #+# #
# Updated: 2020/05/18 10:45:17 by charles ### ########.fr #
# #
# **************************************************************************** #
RM = rm -f
MAKE = make --no-print-directory
LIBFT_DIR = libft
SRC_DIR = src
INC_DIR = inc
OBJ_DIR = obj
CC = gcc
OFLAG ?= -g
CCFLAGS = $(OFLAG) -I$(INC_DIR) -I$(LIBFT_DIR)/include \
-Wall -Wextra #-Werror
LDFLAGS = -L$(LIBFT_DIR) -lft
NAME = ft_ls
INC = $(shell find $(INC_DIR) -type f -name '*.h')
SRC = $(shell find $(SRC_DIR) -type f -name '*.c')
OBJ = $(SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
all: prebuild $(NAME)
debug: OFLAG = -g
debug: all
prebuild:
@mkdir -p $(OBJ_DIR)
$(NAME): $(OBJ) libft_all
@echo "Linking: $@"
@$(CC) -o $@ $(OBJ) $(LDFLAGS)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(INC)
@echo "Compiling: $@"
@$(CC) $(CCFLAGS) -c -o $@ $<
cleanloc:
@echo "Removing objects"
@$(RM) $(OBJ)
fcleanloc: cleanloc
@echo "Removing $(NAME)"
@$(RM) $(NAME)
reloc: fcleanloc all
clean: cleanloc libft_clean
fclean: fcleanloc libft_fclean
re: fclean libft_fclean all
libft_all:
@echo "Making libft all"
@$(MAKE) -C $(LIBFT_DIR) all
libft_clean:
@echo "Making libft clean"
@$(MAKE) -C $(LIBFT_DIR) clean
libft_fclean:
@echo "Making libft fclean"
@$(MAKE) -C $(LIBFT_DIR) fclean