-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
100 lines (81 loc) · 1.95 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
include $(CURDIR)/configs/common_variables.mk
include $(CURDIR)/configs/functions.mk
include $(CURDIR)/configs/detect_os.mk
include $(CURDIR)/configs/preparation.mk
include $(CURDIR)/configs/libraries_processing.mk
include $(CURDIR)/configs/process_flag_rules.mk
include $(CURDIR)/configs/create_compile_rules.mk
include $(CURDIR)/configs/MODIFIERS.mk
.PHONY: all
all: $(CLEAR)
ifneq ($(LIBS_NAMES),$(error))
@$(MAKE_LIBS)
endif
@$(MAKE) $(NAME) --no-print-directory
.PRECIOUS: $(OBJECTS_DIR)/. $(OBJECTS_DIR)%/.
$(OBJECTS_DIR)/.:
@$(MKDIR) $@
$(OBJECTS_DIR)%/.:
@$(MKDIR) $@
.SECONDEXPANSION:
$(OBJECTS_DIR)/%.o: $(SOURCES_DIR)/%.c | $$(@D)/.
@$(info [COMPILING]$(tab)$(subst $(SOURCES_DIR),,$<))
@$(PROJ_CC) $(COMPILE_OBJ_RULE) -c $< -o $@
ifdef CLEAR
$(CLEAR):
@$(CLEAR)
endif
STATUS:
@$(info [$@])
@$(info $(tab)created:$(NAME))
@$(info $(tab)compiler:$(PROJ_CC))
@$(info $(tab)flags:$(FLAG))
$(NAME):
@$(info [CREATING] $@ [$(BUILD)-$(FLAG)])
@$(MAKE) -j $(OBJECTS) --no-print-directory
@$(MAKE) -q STATUS --no-print-directory
ifeq ($(LIB_DETECT).a,$(NAME))
@ar rc $@ $(OBJECTS)
@ranlib $@
else
@$(PROJ_CC) $(OBJECTS) $(COMPILE_APP_RULE) -o $@
endif
ifeq ($(LIB_DETECT),$(error))
ifeq (DEBUG,$(findstring DEBUG,$(strip $(FLAG))))
@$(DB) $@
endif
ifeq (PROFILE,$(findstring PROFILE,$(strip $(FLAG))))
@./$(NAME) > $(P_OUT) $(P_OUT_FLAGS)
@$(PROF) $(PROF_FLAGS) $@
endif
endif
.PHONY: clean
clean:
@$(info [REMOVING] $(OBJECTS_DIR))
@$(RMDIR) $(OBJECTS_DIR)
.PHONY: fclean
fclean: clean
@$(info [REMOVING] $(NAME))
@$(RMFILE) $(NAME)
.PHONY: re
re:
ifdef CLEAR
@$(CLEAR)
endif
@$(info [REWORKING])
@$(MAKE) fclean --no-print-directory
@$(MAKE) all --no-print-directory
.PHONY: re_libs
re_libs:
@$(RE_LIBS)
.PHONY: fclean_libs
fclean_libs:
@$(FCLEAN_LIBS)
.PHONY: re_all
re_all:
@$(MAKE) -j re_libs --no-print-directory
@$(MAKE) re --no-print-directory
.PHONY: fclean_all
fclean_all:
@$(MAKE) -j fclean_libs --no-print-directory
@$(MAKE) fclean