This repository has been archived by the owner on Dec 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
76 lines (56 loc) · 1.76 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
MK_DIR= ./mk/
include $(MK_DIR)colors.mk $(MK_DIR)defs.mk
###### Add your projects here #####
PROJECT_DIR= ./projects/
PROJECTS= pakpak \
server/connect_manager \
server/game_server \
server/client_test
LIB_DIR= ./libs/
LIBS= logger \
crypto \
memory \
exceptions \
network \
packet \
ini \
pythonpp \
multithread
PROJECTS_PATH= $(addprefix $(LIB_DIR), $(LIBS)) \
$(addprefix $(PROJECT_DIR), $(PROJECTS))
# Some useful variables
DEBUG= no
ARGS= DEBUG=$(DEBUG) -s --warn-undefined-variables -C
CURRENT_DIR= ${PWD}
PRINT_DIR= $(ECHO) "$(YELLOW)$(path) :$(CLEAR)\n";
RULES= all \
clean \
fclean \
re \
infos
no_rule:
@$(foreach path, $(PROJECTS_PATH), \
$(PRINT_DIR) \
$(MAKE) $(ARGS) $(path);)
$(RULES):
@$(foreach path, $(PROJECTS_PATH), \
$(PRINT_DIR) \
$(MAKE) $(ARGS) $(path) $@;)
$(PROJECTS):
@$(ECHO) "$(YELLOW)./$(PROJECT_DIR)$@/ :$(CLEAR)\n"
@$(MAKE) $(ARGS) $(PROJECT_DIR)$@
$(foreach _rule, $(RULES), $(addsuffix -$(_rule),$(PROJECTS))):
$(eval _rule := $(lastword $(subst -, ,$@)))
$(eval _proj := $(@:%-$(_rule)=%))
@$(ECHO) "$(YELLOW)$(PROJECT_DIR)$(_proj)/ :$(CLEAR)\n"
@$(MAKE) $(ARGS) $(PROJECT_DIR)$(_proj) $(_rule);
$(LIBS):
@$(ECHO) "$(YELLOW)./$(PROJECT_DIR)$@/ :$(CLEAR)\n"
@$(MAKE) $(ARGS) $(PROJECT_DIR)$@
$(foreach _rule, $(RULES), $(addsuffix -$(_rule),$(LIBS))):
$(eval _rule := $(lastword $(subst -, ,$@)))
$(eval _proj := $(@:%-$(_rule)=%))
@$(ECHO) "$(YELLOW)$(LIB_DIR)$(_proj)/ :$(CLEAR)\n"
@$(MAKE) $(ARGS) $(LIB_DIR)$(_proj) $(_rule);
.PHONY: no_rule all $(RULES) $(PROJECTS) $(foreach _rule, $(RULES), $(addsuffix -$(_rule),$(PROJECTS))) \
$(LIBS) $(foreach _rule, $(RULES), $(addsuffix -$(_rule),$(LIBS)))