-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
74 lines (59 loc) · 2.38 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: ffloris <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2018/04/13 09:39:19 by ffloris #+# #+# #
# Updated: 2018/10/20 19:43:47 by ffloris ### ########.fr #
# #
# **************************************************************************** #
EXT_DIR = ext
JUNIT_JAR = $(EXT_DIR)/junit-4.12.jar
JUNIT_MAIN = org.junit.runner.JUnitCore
HAMCREST_JAR = $(EXT_DIR)/hamcrest-core-1.3.jar
CLASS_DIR = class
TEST_CLASS_DIR = $(CLASS_DIR)/test
SRC_CLASS_DIR = $(CLASS_DIR)/src
CLASS_DIRS = $(TEST_CLASS_DIR) $(SRC_CLASS_DIR)
SRC_DIR = src
TEST_DIR = test
SRC = ComputorV1 Utility \
Variable Equation \
EquationTokenizer Token TokenPattern TokenType \
EquationParser ParserException \
IEquationSolver EquationSolver \
LinearEquationSolver QuadraticEquationSolver CubicEquationSolver
SRC := $(addprefix $(SRC_DIR)/, $(addsuffix .java, $(SRC)))
TEST_SRC = VariableTest EquationTest \
EquationParserTest EquationSolverTest
TEST_SRC_WIDTH_DIR = $(addprefix $(TEST_DIR)/, $(addsuffix .java, $(TEST_SRC)))
GREEN_COLOR = "\033[0;32m"
YELLOW_COLOR = "\033[0;33m"
RED_COLOR = "\033[0;31m"
DEFAULT_COLOR = "\033[0m"
all: compile
tests: compile
@javac -cp $(JUNIT_JAR):$(SRC_CLASS_DIR) -d $(TEST_CLASS_DIR) $(TEST_SRC_WIDTH_DIR)
@java -cp $(JUNIT_JAR):$(HAMCREST_JAR):$(TEST_CLASS_DIR):$(SRC_CLASS_DIR) $(JUNIT_MAIN) $(TEST_SRC)
compile: $(CLASS_DIRS)
@printf $(YELLOW_COLOR)
@printf "Compiling... "
@printf $(RED_COLOR)
@javac -d $(SRC_CLASS_DIR) $(SRC)
@printf $(GREEN_COLOR)
@printf "[OK]\n"
@printf $(DEFAULT_COLOR)
$(CLASS_DIRS):
@mkdir -p $(CLASS_DIRS)
clean:
@printf $(YELLOW_COLOR)
@printf "Cleaning... "
@printf $(RED_COLOR)
@rm -rf $(CLASS_DIR)
@printf $(GREEN_COLOR)
@printf "[OK]\n"
@printf $(DEFAULT_COLOR)
re: clean all
.PHONY: all tests compile clean re