This repository has been archived by the owner on Sep 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (61 loc) · 2.13 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: tmaluh <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/06/05 18:01:30 by tmaluh #+# #+# #
# Updated: 2019/06/21 22:49:51 by tmaluh ### ########.fr #
# #
# **************************************************************************** #
NAME := wu_algo
NPWD := $(CURDIR)/$(NAME)
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
LIBS :=
LIBSINC :=
endif
ifeq ($(UNAME_S),Darwin)
LIBS := -L ~/.brew/lib -rpath ~/.brew/lib
LIBSINC := -I ~/.brew/include
endif
LIBS += -lSDL2 -lm
CC := gcc -march=native -mtune=native -Ofast -flto -pipe
CC_DEBUG := gcc -march=native -mtune=native -g3 -D DEBUG
CFLAGS := -Wall -Wextra -Werror -Wunused
IFLAGS := -I $(CURDIR)/includes/
SRCS := $(abspath $(wildcard srcs/*.c srcs/*/*.c srcs/*/*/*.c))
OBJ := $(SRCS:.c=.o)
DEL := rm -rf
WHITE := \033[0m
BGREEN := \033[42m
GREEN := \033[32m
RED := \033[31m
INVERT := \033[7m
SUCCESS = [$(GREEN)✓$(WHITE)]
all: $(NAME)
$(OBJ): %.o: %.c
@echo -n ' $@: '
@$(CC) -c $(CFLAGS) $(LIBSINC) $(IFLAGS) $< -o $@
@echo "$(SUCCESS)"
$(NAME): $(OBJ)
@echo -n ' <q.p> | $(NPWD): '
@$(CC) $(OBJ) $(LIBS) -o $(NAME)
@echo "[$(INVERT)$(GREEN)✓$(WHITE)]"
del:
@$(DEL) $(OBJ)
@$(DEL) $(NPWD)
pre: del all
@echo "$(INVERT)$(GREEN)Successed re-build.$(WHITE)"
set_cc_debug:
@$(eval CC=$(CC_DEBUG))
debug: set_cc_debug pre
@echo "$(INVERT)$(GREEN)Ready for debug.$(WHITE)"
clean:
@$(DEL) $(OBJ)
fclean: clean
@$(DEL) $(NAME)
@echo "$(INVERT)$(RED)deleted$(WHITE)$(INVERT): $(NPWD)$(WHITE)"
re: fclean all
.PHONY: all fclean clean re