-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (25 loc) · 714 Bytes
/
Makefile
File metadata and controls
38 lines (25 loc) · 714 Bytes
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
CC = gcc
CFLAGS = -Wall -Wextra -Werror $(ALL_INC)
AR = ar rcs
TARGET = libft.a
SRC_DIR = src
OBJ_DIR = obj
ALL_PATHS = checks conversions gnl linked_list memory print strings arrays utils
SRC = $(wildcard $(SRC_DIR)/**/*.c)
OBJ = $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRC))
ALL_INC = $(addprefix -I, includes $(wildcard libs/*/includes))
all: dir $(TARGET)
dir:
@mkdir -p obj; (cd obj; mkdir -p $(ALL_PATHS))
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
@$(CC) $(CFLAGS) -c $< -o $@
@echo "\033[92m•\033[0m\c"
$(TARGET): $(OBJ)
@ar rsc $(TARGET) $(OBJ)
@echo "\n\033[92mLibft successfully compiled!\033[0m"
clean:
@rm -rf obj
fclean: clean
@$(RM) $(TARGET)
re: fclean all
.PHONY: all clean fclean re