-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (40 loc) · 1.12 KB
/
Makefile
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
#
# smiro
# Makefile
# 2024-02
#
################################################################################
MAKE = make --no-print-directory
NAME = libft.a
SRC_DIR = src/
BUILD_DIR = build/
LIB_DIR = lib/
-include $(SRC_DIR)src.mk
CFLAGS = -I ./$(SRC_DIR) -MMD -MP -MF $(BUILD_DIR)$*.d -Wall -Werror -Wextra -O3
RM = rm -rf
CC = gcc
AR = ar rcs
################################################################################
SRC = $(addprefix $(SRC_DIR), $(SRC_FILES))
OBJ = $(patsubst $(SRC_DIR)%, $(BUILD_DIR)%, $(SRC:.c=.o))
DEP = $(patsubst $(SRC_DIR)%, $(BUILD_DIR)%, $(SRC:.c=.d))
################################################################################
all:
@$(MAKE) -sC $(LIB_DIR)ftprintf
@$(MAKE) $(NAME)
$(BUILD_DIR)%.o: $(SRC_DIR)%.c Makefile
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c $< -o $@
$(NAME):: $(OBJ)
@$(AR) $(NAME) $(OBJ) $(LIB_DIR)ftprintf/libftprintf.a
clean:
@$(MAKE) $@ -sC $(LIB_DIR)ftprintf
$(RM) $(BUILD_DIR)
fclean: clean
@$(MAKE) $@ -sC $(LIB_DIR)ftprintf
$(RM) $(NAME)
re:
@$(MAKE) fclean
@$(MAKE)
.PHONY: all clean fclean re
-include $(DEP)