-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
81 lines (63 loc) · 2.27 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: abelov <abelov@student.42london.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/10/23 22:28:51 by abelov #+# #+# #
# Updated: 2023/10/23 22:34:31 by abelov ### ########.fr #
# #
# **************************************************************************** #
NAME := bsq
CC := cc
INC_DIR = ./include
INCLUDE_FLAGS := -I. -I $(INC_DIR) -I/usr/include
OPTIMIZE_FLAGS := -O0
DEBUG_FLAGS := -g3 -gdwarf-3
MANDATORY_FLAGS := -Wall -Wextra -Werror
CFLAGS = $(MANDATORY_FLAGS) $(DEBUG_FLAGS) $(OPTIMIZE_FLAGS)
LIBFT_PATH = ./lib/ft
LIBFT = $(LIBFT_PATH)/libft.a
LIBSQ_PATH = ./lib/sq
LIBSQ = $(LIBSQ_PATH)/libsq.a
LINK_FLAGS := -L $(LIBFT_PATH) -L $(LIBSQ_PATH) -lsq -lft
CTAGS := ctags
RM := /bin/rm
BUILD_DIR = build
SRC_DIR = src
OBJ_DIR = $(BUILD_DIR)/obj
SRC_FS := main.c
SRCS := $(SRC_FS:%.c=$(SRC_DIR)/%.c)
OBJS = $(SRCS:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
all: clean bsq test
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) $(INCLUDE_FLAGS) -o $@ -c $<
$(LIBFT):
@make -C $(LIBFT_PATH) -j8
$(LIBSQ):
@make -C $(LIBSQ_PATH) -j8
bsq: $(OBJS) $(LIBFT) $(LIBSQ)
$(CC) $(CFLAGS) $(INCLUDE_FLAGS) -o $@ $^ $(LINK_FLAGS)
test: bsq
printf '\033[36m%s\033[0m\n' 'this is a test'
./bsq test/map1.txt
@echo
./bsq test/map2.txt
@echo
./test/map_generator.pl 80 80 15 | ./bsq
clean:
@$(RM) -fr $(OBJ_DIR)
@make -C $(LIBFT_PATH) clean
@make -C $(LIBSQ_PATH) clean
fclean: clean
@$(RM) -fr $(NAME) $(BUILD_DIR) a.out
@make -C $(LIBFT_PATH) fclean
@make -C $(LIBSQ_PATH) fclean
re: fclean all
norm:
@norminette $(SRCS)
@make -C $(LIBFT_PATH) norm
@make -C $(LIBSQ_PATH) norm
.PHONY: all clean test re