-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (44 loc) · 1.16 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
CC = g++
NAME = avm
FLAGS = -Wall -Werror -Wextra -std=c++17
FILES = main.cpp Operands/OperandFactory.cpp Parser.cpp Lexer.cpp
ODIR = obj
SDIR = src
IDIR = inc
DEPS = EOperandType.hpp IOperand.hpp Operand.hpp OperandFactory.hpp Parser.hpp Lexer.hpp
OBJ := $(patsubst %.cpp, $(ODIR)/%.o, $(FILES))
SRC := $(patsubst %, $(SDIR)/%, $(FILES))
DEPS := $(patsubst %, $(IDIR)/%, $(DEPS))
BLACK=\033[0;30m
RED=\033[0;31m
GREEN=\033[0;32m
YELLOW=\033[0;33m
BLUE=\033[0;34m
PURPLE=\033[0;35m
CYAN=\033[0;36m
WHITE=\033[0;37m
END=\033[0m
all: $(NAME)
$(NAME): $(ODIR) $(OBJ)
@echo "$(CYAN)Linking\t\t$(GREEN)$(NAME)$(END)";
@$(CC) -o $(NAME) $(OBJ) $(FLAGS) -I $(IDIR)
$(ODIR)/%.o: $(SDIR)/%.cpp $(DEPS)
@echo "$(CYAN)Compiling\t$(GREEN)$@$(END)";
@$(CC) -c -o $@ $< $(FLAGS) -I $(IDIR)
$(ODIR):
@echo "$(CYAN)Creating\t$(GREEN)$(ODIR)$(END)";
@cd $(SDIR) && \
find . -type d > ../hold.txtAVM && \
cd .. && \
mkdir -p $(ODIR) && \
cd $(ODIR) && \
xargs mkdir -p < ../hold.txtAVM;
@rm hold.txtAVM;
clean:
@echo "$(RED)Cleaning\t$(END)";
@rm -rf $(ODIR)
fclean: clean
@echo "$(RED)Removing\t$(GREEN)$(NAME)$(END)";
@rm -rf $(NAME)
re: fclean all
.PHONY: re clean all fclean