-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
126 lines (99 loc) · 4.26 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: agrumbac <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2018/04/10 17:19:11 by agrumbac #+# #+# #
# Updated: 2019/06/03 21:45:07 by agrumbac ### ########.fr #
# #
# **************************************************************************** #
############################## BIN #############################################
NAME = woody_woodpacker
SRC = woody_woodpacker.c original_safe.c clone_safe.c endian.c encrypt.s decrypt.s \
elf64/elf64_adjust_references.c \
elf64/elf64_copy_to_clone.c \
elf64/elf64_find_entry.c \
elf64/elf64_identifier.c \
elf64/elf64_iterators.c \
elf64/elf64_packer.c \
elf64/elf64_payload.s \
elf64/elf64_setup_payload.c \
elf64/elf64_viewer.c
CC = clang
AS = nasm
SRCDIR = srcs
OBJDIR = objs
OBJC = $(addprefix ${OBJDIR}/, $(SRC:.c=.o))
OBJ = $(OBJC:.s=.o)
DEP = $(addprefix ${OBJDIR}/, $(SRC:.c=.d))
CFLAGS = -Wall -Wextra -g -MMD #-fsanitize=address,undefined
ASFLAGS = -f elf64 -g
LDFLAGS = -Iincludes/
############################## COLORS ##########################################
BY = "\033[33;1m"
BR = "\033[31;1m"
BG = "\033[32;1m"
BB = "\033[34;1m"
BM = "\033[35;1m"
BC = "\033[36;1m"
BW = "\033[37;1m"
Y = "\033[33m"
R = "\033[31m"
G = "\033[32m"
B = "\033[34m"
M = "\033[35m"
C = "\033[36m"
W = "\033[0m""\033[32;1m"
WR = "\033[0m""\033[31;5m"
WY = "\033[0m""\033[33;5m"
X = "\033[0m"
UP = "\033[A"
CUT = "\033[K"
############################## RULES ###########################################
all: art ${NAME}
${NAME}: ${OBJ}
@echo ${B}Compiling [${NAME}]...${X}
@${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${OBJ}
@echo ${G}Success" "[${NAME}]${X}
${OBJDIR}/%.o: ${SRCDIR}/%.s
@echo ${Y}Compiling [$@]...${X}
@/bin/mkdir -p ${OBJDIR} ${OBJDIR}/elf64
@${AS} ${ASFLAGS} -o $@ $<
@printf ${UP}${CUT}
${OBJDIR}/%.o: ${SRCDIR}/%.c
@echo ${Y}Compiling [$@]...${X}
@/bin/mkdir -p ${OBJDIR} ${OBJDIR}/elf64
@${CC} ${CFLAGS} ${LDFLAGS} -c -o $@ $<
@printf ${UP}${CUT}
############################## GENERAL #########################################
clean:
@echo ${R}Cleaning" "[objs]...${X}
@/bin/rm -Rf ${OBJDIR}
fclean: clean
@echo ${R}Cleaning" "[${NAME}]...${X}
@/bin/rm -f ${NAME}
@/bin/rm -Rf ${NAME}.dSYM
re: fclean all
############################## DECORATION ######################################
art:
@echo ${BB}
@echo " '-------------------.. "
@echo " '\\_________ \`-.-----. "
@echo " '\\_______ \`\\ \`. "${BG}" __ ____ "${BB}
@echo " \\____ \`\\ : "${BG}"/_ | | .-.\\ "${BB}
@echo " '._____ (____ \`\\.\`. .--._ "${BG}" \\\\' / "${BB}
@echo " \\____ \"'..____.(_______ \`~-.________.-' "${WR}"@"${X}${BB}". \\___"${BG}"\\.'"${BB}"___ "
@echo " )___ ___ /___________\\ "
@echo " )___..'' '--. _.----------.____\`----"${BG}")'("${BB}"---' "
@echo " _:-' , _.-' "${BG}" /( \\\\ "${BB}
@echo " .-~~ __..-'~~~~~~~~~~' "${BG}" .' '\\ "${BB}
@echo " \\ \\~~ \\ \\ "${BG}" _ "${BG}" / ' ) \\ "${BB}
@echo " \\ \\ \\ \\_.-' "${BG}"_ _ _ ___ ___ _| |_ _ "${BG}" | ) ' "${BB}
@echo " \\ \\_ _;-,,' "${BG}"| | | | . | . | . | | | "${BG}" ( ( ) ) "${BB}
@echo " ;-,,' "${BG}"|_____|___|___|___|_ | "${BG}" \"--------\" "${BB}
@echo " "${BG}" |___|"
@echo ${X}
.PHONY: all clean fclean re art
-include ${DEP}