-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (34 loc) · 863 Bytes
/
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
Name = ft_nm
Srcs = $(shell find srcs -type f -name '*.c')
Deps = $(shell find incs -type f -name '*.h') Makefile
Objs = $(Srcs:srcs/%.c=bin/%.o)
Incs = -I incs
Flag = $(Incs) -Wall -Wextra -Werror -O3
Red = \033[0;1;91m
Green = \033[0;1;92m
Eoc = \033[0m
Args = elf
all: $(Name)
bonus: all
run: all elf
@echo -e "🖥 $(Green)launching$(Eoc) ./$(Name) $(Args)"
@./$(Name) $(Args)
bin/%.o: srcs/%.c $(Deps)
@echo -e "🔧 $(Green)compiling$(Eoc) $(notdir $<)"
@mkdir -p $(dir $@)
@gcc $(Flag) -c $< -o $@
$(Name): $(Objs)
@echo -e "🎯 $(Green)compiling$(Eoc) $@"
@gcc $(Flag) $^ -o $@
clean:
@echo -e "🗑 $(Red)deleting$(Eoc) binaries"
@rm -rf bin
fclean: clean
@echo -e "🗑 $(Red)deleting$(Eoc) $(Name)"
@rm -rf $(Name)
re: fclean all
elf:
@make -C test
test: all
@make -C test test
.PHONY: all run clean fclean re elf test