-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
92 lines (66 loc) · 2.48 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
# **************************************************************************** #
# #
# :::::::: #
# Makefile :+: :+: #
# +:+ #
# By: mmarcell <mmarcell@student.codam.nl> +#+ #
# +#+ #
# Created: 2020/01/07 18:47:20 by mmarcell #+# #+# #
# Updated: 2020/05/07 13:54:44 by nstabel ######## odam.nl #
# #
# **************************************************************************** #
include srcs/_files.mk
COR_NAME := corewar
ASM_NAME := asm
COR_OBJS := $(COR_FILES:%.c=objs/%.o) objs/cor_main.o
ASM_OBJS := $(ASM_FILES:%.c=objs/%.o) objs/asm_main.o
CFLAGS := -Wall -Wextra -Werror -g
LDFLAGS = -lncurses
LIBFT_PATH := libft
LIBFT := $(LIBFT_PATH)/libft.a
INCLUDES_PATH := includes
INCLUDES := -I $(INCLUDES_PATH) -I $(LIBFT_PATH)
HDRS := $(INCLUDES_PATH)/corewar.h $(INCLUDES_PATH)/asm.h $(INCLUDES_PATH)/op.h \
$(INCLUDES_PATH)/vis.h $(INCLUDES_PATH)/cor_errors.h
PLUS := $$(tput setaf 2)+$$(tput sgr0)
MINUS := $$(tput setaf 1)-$$(tput sgr0)
MAX_PARALLEL = 6
all: $(COR_NAME) $(ASM_NAME)
$(COR_NAME): $(LIBFT) $(COR_OBJS)
@$(CC) $(CFLAGS) -o $@ $^ $(LIBFT) $(LDFLAGS)
@echo " $(PLUS) $@"
$(ASM_NAME): $(LIBFT) $(ASM_OBJS)
@$(CC) $(CFLAGS) -o $@ $^ $(LIBFT)
@echo " $(PLUS) $@"
objs/%.o: srcs/%.c $(HDRS) | objs
@$(CC) -c $(CFLAGS) -o $@ $(INCLUDES) $<
@echo " $(PLUS) $@"
objs:
@mkdir -p $@
multi:
@$(MAKE) -j$(MAX_PARALLEL) all
$(LIBFT): FORCE
@+make -C $(LIBFT_PATH) | sed "s/^/libft: /"
clean: lclean
@+make clean -C $(LIBFT_PATH) | sed "s/^/libft: /"
lclean:
@rm -rfv objs | sed "s/^/ $(MINUS) /"
fclean: clean lfclean
@rm -fv $(LIBFT) | sed "s/^/ $(MINUS) /"
lfclean: lclean
@rm -fv $(COR_NAME) $(ASM_NAME) | sed "s/^/ $(MINUS) /"
re:
$(MAKE) fclean
$(MAKE) all
lre:
$(MAKE) lfclean
$(MAKE) all
test: $(LIBFT) $(OBJS) $(HDRS)
@$(MAKE) all
@make re -C test_folder/criterion
@echo "\n ---- ASM ---- \n"
@./test_folder/criterion/asm_test
@echo "\n ---- VM ---- \n"
@./test_folder/criterion/cor_test
FORCE:
.PHONY: all clean fclean lclean lfclean lre test re multi objs FORCE