-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (42 loc) · 1.63 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: dde-jesu <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2018/11/30 10:00:57 by dde-jesu #+# #+# #
# Updated: 2019/05/29 06:01:49 by dde-jesu ### ########.fr #
# #
# **************************************************************************** #
NAME = lem-in
BUILD_DIR = build
OBJ_DIR = $(BUILD_DIR)/objs
DEP_DIR = $(BUILD_DIR)/deps
CC = gcc
CFLAGS = -Wall -Wextra -Iinclude
PRECOMPILE = @mkdir -p $(dir $@)
POSTCOMPILE =
ifndef NODEPS
DEPFLAGS = -MT $@ -MMD -MP -MF $(DEP_DIR)/$*.Td
CFLAGS += $(DEPFLAGS)
PRECOMPILE += ;mkdir -p $(dir $(DEP_DIR)/$*)
POSTCOMPILE += @mv -f $(DEP_DIR)/$*.Td $(DEP_DIR)/$*.d && touch $@
endif
include src.mk
OBJS = $(patsubst src/%.c,$(OBJ_DIR)/%.o,$(SRCS))
all: $(NAME)
$(OBJ_DIR)/%.o: src/%.c Makefile
$(PRECOMPILE)
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c -o $@ $<
$(POSTCOMPILE)
$(NAME): $(OBJS)
$(CC) $(CFLAGS) -o $(NAME) $(OBJS)
clean:
rm -rf $(BUILD_DIR)
fclean: clean
rm -f $(NAME)
re: fclean $(NAME)
include $(wildcard $(DEP_DIR)/*.d)
.PHONY: all clean fclean re