-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
86 lines (74 loc) · 2.65 KB
/
Copy pathMakefile
File metadata and controls
86 lines (74 loc) · 2.65 KB
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
include mk/core.mk
include mk/json.mk
include mk/utils.mk
include mk/base64.mk
include mk/network.mk
CC = x86_64-w64-mingw32-gcc-win32
CXX = x86_64-w64-mingw32-g++-win32
LIBS = -lws2_32
LIBSFOLDERS = -L/usr/lib/x86_64-linux-gnu/
vpath %.cpp $(dir MAKEFILE_LIST)
vpath %.c $(dir MAKEFILE_LIST)
CFLAGS = -Wall -Wextra -Werror -Wno-unused-result -Wno-unused-parameter -Wno-unused-function -Wno-ignored-qualifiers -I./includes
CXXFLAGS = -Wall -Wextra -Werror -Wno-unused-result -Wno-unused-parameter -Wno-unused-function -Wno-ignored-qualifiers -I./includes
CPPFLAGS += -MMD -MP
OBJDIR = .o
UNAME = $(shell uname)
NAME = AxiomShell
OBJS = $(subst .cpp,.o,$(subst ./src/,./$(OBJDIR)/,$(SRCS)))
OBJS := $(subst .c,.o,$(subst ./src/,./$(OBJDIR)/,$(OBJS)))
DEPS = $(subst .cpp,.d,$(subst ./src/,./$(OBJDIR)/,$(SRCS)))
DEPS := $(subst .c,.d,$(subst ./src/,./$(OBJDIR)/,$(SRCS)))
all: $(NAME)
$(NAME): $(OBJS)
@$(RM) tmp_log
@$(RM) tmp_errors
@if [ -e files_missing ]; then \
printf "\033[1;31m\n[COMPILATION FAILED]\033[0m\n"; \
else \
$(CXX) -s -static $(OBJS) -o $(NAME) $(LIBSFOLDERS) $(LIBS) && \
printf "\033[1;36m\n[COMPILATION SUCCESSFUL]\033[0m\n" || \
printf "\033[1;31m\n[COMPILATION FAILED]\033[0m\n"; \
chown 1000:users $(NAME).exe >/dev/null 2>&1; \
fi;
@$(RM) files_missing
@$(RM) /tmp/.makefile_link
$(OBJDIR):
@$(shell mkdir -p $(OBJDIR))
$(OBJDIR)/%.o: src/%.c | $(OBJDIR)
@$(shell mkdir -p $(dir $@))
@$(shell touch /tmp/.makefile_link)
@printf "%-50s" "C Precompiling $(notdir $@)..."
@$(CXX) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< 2> ./tmp_log || touch ./tmp_errors
@if [ -e tmp_errors ]; then \
printf "\033[1;31m[KO]\n\033[0m" && cat 1>&2 ./tmp_log && touch files_missing; \
elif test -s ./tmp_log; then \
printf "\033[1;33m[WARNING]\n\033[0m" && cat ./tmp_log; \
else \
printf "\033[1;32m[OK]\n\033[0m"; \
fi;
@$(RM) ./tmp_errors
$(OBJDIR)/%.o: src/%.cpp | $(OBJDIR)
@$(shell mkdir -p $(dir $@))
@$(shell touch /tmp/.makefile_link)
@printf "%-50s" "C++ Precompiling $(notdir $@)..."
@$(CXX) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< 2> ./tmp_log || touch ./tmp_errors
@if [ -e tmp_errors ]; then \
printf "\033[1;31m[KO]\n\033[0m" && cat 1>&2 ./tmp_log && touch files_missing; \
elif test -s ./tmp_log; then \
printf "\033[1;33m[WARNING]\n\033[0m" && cat ./tmp_log; \
else \
printf "\033[1;32m[OK]\n\033[0m"; \
fi;
@$(RM) ./tmp_errors
clean:
@$(RM) $(OBJS) $(DEPS)
@printf "\033[1;33m[OBJECT FILES CLEANED]\033[0m\n"
fclean:
@$(RM) $(OBJS) $(DEPS)
@printf "\033[1;33m[OBJECT FILES CLEANED]\033[0m\n"
@$(RM) $(NAME)
@printf "\033[1;35m[BINARY DELETED]\033[0m\n"
re: fclean all
.PHONY: all clean fclean re re_nolib fclean_nolib
-include $(DEPS)