generated from Iipal/MakeMeBetter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (53 loc) · 1.77 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
include configs/default_lib_config.mk
.PHONY: all multi STATUS_START
multi: STATUS_START
ifneq (,$(filter $(MAKECMDGOALS),debug debug_all))
@$(MAKE) $(MAKE_PARALLEL_FLAGS) CFLAGS="$(CFLAGS_DEBUG)" DEFINES="$(shell echo $(basename $(NAME)) | tr a-z A-Z)_DEBUG" all
else
ifneq (,$(filter $(MAKECMDGOALS),sanitize sanitize_all))
@$(MAKE) $(MAKE_PARALLEL_FLAGS) CFLAGS="$(CFLAGS_SANITIZE)" DEFINES="$(shell echo $(basename $(NAME)) | tr a-z A-Z)_SANITIZE" all
else
@$(MAKE) $(MAKE_PARALLEL_FLAGS) all
endif
endif
STATUS_START:
@$(ECHO) " | -------"
@$(ECHO) " | making: $(CLR_UNDERLINE)$(NAME)$(CLR_WHITE) ..."
@$(ECHO) " | -------"
all: $(NAME)
$(NAME): $(OBJS)
@$(AR) $(ARFLAGS) $(NAME) $(OBJS)
@$(MAKE) STATUS
-include $(DEPS)
$(OBJS): %.o: %.c
@$(CC) $(addprefix -D,$(DEFINES)) -c $(CFLAGS) $(CFLAGS_DEFAULT) $(IFLAGS) $< -o $@
@$(ECHO) " | $@: $(MSG_SUCCESS)"
STATUS:
@$(ECHO) "/"
@$(ECHO) "|"
@$(ECHO) "| created: $(NAME) $(MSG_SUCCESS)"
ifneq (,$(DEFINES))
@$(ECHO) "| compiler custom defines: $(foreach dfns,$(DEFINES),$(CLR_INVERT)$(dfns)$(CLR_WHITE) )"
endif
@$(ECHO) "| compiler default flags: $(CFLAGS_DEFAULT)"
@$(ECHO) "| compiler optional flags: $(CLR_UNDERLINE)$(CFLAGS)$(CLR_WHITE)"
@$(ECHO) "| archiver flags: $(CLR_UNDERLINE)$(ARFLAGS)$(CLR_WHITE)"
@$(ECHO) "|"
@$(ECHO) "\\"
debug_all: pre
debug: multi
sanitize_all: pre
sanitize: multi
clean:
@$(DEL) $(OBJS)
@$(ECHO) " | $(CLR_INVERT)deleted$(CLR_WHITE): $(NPWD) source objects"
fclean: clean
@$(DEL) $(NAME)
@$(ECHO) " | $(CLR_INVERT)deleted$(CLR_WHITE): $(NPWD)"
pre: fclean multi
re: fclean multi
norme:
@$(ECHO) "$(CLR_INVERT)norminette$(CLR_WHITE) for $(NPWD):"
@norminette includes/
@norminette $(SRCS)
.PHONY: re fclean clean norme del pre sanitize sanitize_all debug debug_all STATUS