-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·90 lines (74 loc) · 2.58 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: yhetman <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/09/29 14:44:07 by yhetman #+# #+# #
#* Updated: 2019/11/09 03:38:44 by yhetman ### ########.fr *#
# #
# **************************************************************************** #
SRCS= main.c \
go_to_assembler.c \
great_initialization.c \
great_freeing.c \
store_all_token_details.c \
file_checker.c \
get_command_info.c \
get_command_arguments.c \
rewrite_file.c \
catch_tokens.c \
init.c \
clear.c \
writing_process.c \
write_direct_indirect.c
OBJ=$(addprefix $(OBJDIR), $(SRCS:.c=.o))
OBJDIR=./obj/
SRCDIR=sources/
NAME=asm
FLAGS=#-Wall -Wextra -Werror
DEBUG=-g3 -fsanitize=address
INCLUDE=-I./includes/ -I./asmlib/includes
ASMLIB=asmlib.a
ASMLIB_PATH=./asmlib/
all:$(NAME)
EOC = \033[0m
COLOR1= \033[38;5;44m
COLOR2= \033[38;5;45m
COLOR3 = \33[38;5;51m
COLOR4 = \033[38;5;87m
COLOR5 = \033[38;5;52m
COLOR6 = \033[38;5;81m
$(NAME): $(OBJDIR) $(ASMLIB_PATH)$(ASMLIB) $(OBJ)
@printf "$(COLOR2) >>$(EOC) $(COLOR1)$(NAME) is ready.$(EOC)\n"
@gcc $(FLAGS) $(INCLUDE) $(ASMLIB_PATH)$(ASMLIB) -o $(NAME)
$(OBJDIR):
@printf "$(COLOR4)\t\t|\t\tCONSTRUCTING ASSEMBLER\t\t|$(EOC)\n"
@mkdir $(OBJDIR)
debug: debugflags debuglib all
debugflags:
$(eval FLAGS=$(FLAGS) $(DEBUG))
debuglib:
@make debug -C ./asmlib
$(OBJDIR)%.o:$(SRCDIR)%.c
@printf "$(COLOR3)||||$(EOC)"
@gcc $(FLAGS) $(INCLUDE) -c $< -o $@
@ar -r $(ASMLIB_PATH)$(ASMLIB) $@
@ranlib $(ASMLIB_PATH)$(ASMLIB)
$(ASMLIB_PATH)$(ASMLIB):
@printf "$(COLOR6)|\tConstructing asmlib: $(EOC)"
@make -C $(ASMLIB_PATH)
lib:
@printf "$(COLOR6)|\tRecompiling asmlib: $(EOC)"
@make -C $(ASMLIB_PATH)
clean:
@printf "$(COLOR5)\t\t|\tObject files are deleted!\t\t|\n$(EOC)"
@make clean -C $(ASMLIB_PATH)
@rm -rf obj/
fclean: clean
@printf "$(COLOR5)\t\t|\tAssembler executable file deleted!\t|\n$(EOC)"
@make fclean -C $(ASMLIB_PATH)
@rm -rf $(NAME)
re: fclean all
.PHONY: all clean fclean re