-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (47 loc) · 1.16 KB
/
Makefile
File metadata and controls
68 lines (47 loc) · 1.16 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
##
## EPITECH PROJECT, 2024
## my_ls
## File description:
## ./Makefile
##
MAKEFLAGS += -j
NAME := my_ls
LIB_NAME := libmy.a
SRC := $(wildcard src/*.c)
SRC += $(wildcard src/flags/*.c)
SRC += $(wildcard src/utils/*.c)
LIB_SRC := $(wildcard lib/my/*.c)
LIB_SRC += $(wildcard lib/my/printf/*.c)
LIB_SRC += $(wildcard lib/my/printf/baby/*.c)
LIB_SRC += $(wildcard lib/my/printf/handler/*.c)
BUILD_DIR := .build
TEST_SRC := tests/main.c
TEST_OBJ := $(TEST_SRC:%.c=$(BUILD_DIR)/%.o)
OBJ := $(SRC:%.c=$(BUILD_DIR)/%.o)
LIB_OBJ := $(LIB_SRC:%.c=$(BUILD_DIR)/%.o)
CC := gcc
CFLAGS += -Wall -Wextra -g3
CFLAGS += -iquote ./include
CFLAGS += -Wno-unused-parameter
LDFLAGS += -L .
LDLIBS := -lmy
oui: $(NAME)
$(BUILD_DIR)/%.o: %.c
@ mkdir -p $(dir $@)
$(CC) $(CFLAGS) -o $@ -c $<
$(LIB_NAME): $(LIB_OBJ)
ar rc $(LIB_NAME) $(LIB_OBJ)
$(NAME): $(LIB_NAME) $(OBJ)
$(CC) $(CFLAGS) $(OBJ) $(LDFLAGS) $(LDLIBS) -o $(NAME)
clean:
$(RM) $(OBJ)
fclean:
$(RM) -r $(NAME) $(BUILD_DIR)
$(RM) $(LIB_NAME)
.NOTPARALLEL: re
re: fclean oui
test: $(NAME) $(TEST_OBJ)
$(CC) $(CFLAGS) -o $@ $(TEST_OBJ) $(LDFLAGS) $(LDLIBS)
tests_run: test
./$<
.PHONY: all clean fclean re test tests_run