-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (44 loc) · 1.93 KB
/
Makefile
File metadata and controls
57 lines (44 loc) · 1.93 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
# **************************************************************************** #
# #
# .--. _ #
# Makefile |o_o || | #
# |:_/ || |_ _ ___ __ #
# By: safoh <safoh@student.codam.nl> // \ \ __| | | \ \/ / #
# (| | )|_| |_| |> < #
# Created: 2022/02/09 17:06:29 by safoh /'\_ _/`\__|\__,_/_/\_\ #
# Updated: 2022/07/16 20:43:00 by safoh \___)=(___/ #
# #
# **************************************************************************** #
include makerc/colours.mk
include makerc/libft.mk
################################################################################
NAME =libft.a
CC :=gcc
RM :=rm -rf
CFLAGS =-Wall -Wextra -Werror$(if $(DEBUG), -g -fsanitize=address)\
$(if $(MALLOC), -g)
SRC_DIR :=./src
BUILD_DIR :=./build
OBJS =$(addprefix $(BUILD_DIR)/, $(SRCS:%.c=%.o))
HEADERS =include/libft.h
INCLUDE_FLAGS =$(addprefix -I, $(sort $(dir $(HEADERS))))
################################################################################
all: $(NAME)
$(NAME): SHELL :=/bin/bash
$(NAME): $(OBJS)
@ar rc $@ $^
@printf "$(BLUE_FG)$(NAME)$(RESET_COLOR) created\n"
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c $(HEADERS)
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(INCLUDE_FLAGS) -c $< -o $@
################################################################################
clean:
@$(RM) $(OBJS)
fclean: clean
@$(RM) $(NAME) *.a *.dSYM
re: all
@$(MAKE) fclean
debug:
@$(MAKE) DEBUG=1
.PHONY: all clean fclean re debug
################################################################################