-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
76 lines (49 loc) · 1.88 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
# Copyright (C) 2022 Jacob Koziej <jacobkoziej@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
BUILD ?= build
RTL = rtl
TESTS = tests
IVERILOG ?= iverilog
IVERILOGFLAGS += -I$(RTL) -Wall -g2012
ALU_SRC = $(RTL)/alu.v
ALU_INC = $(RTL)/alu.vh
ALU_TB = $(TESTS)/alu_tb.v
CTRL_SRC = $(RTL)/ctrl.v
CTRL_INC = $(RTL)/alu.vh $(RTL)/flag.vh $(RTL)/opcode.vh
CTRL_TB = $(TESTS)/ctrl_tb.v
JAVK_SRC = $(RTL)/javk.v $(ALU_SRC) $(CTRL_SRC)
JAVK_INC = $(RTL)/regfile.vh $(CTRL_INC)
JAVK_TB = $(TESTS)/javk_tb.v
.PHONY: all
all: alu_tb ctrl_tb javk_tb
.PHONY: clean
clean:
@rm -rvf $(BUILD)
.PHONY: alu_tb
alu_tb: $(BUILD)/$(TESTS)/alu_tb
.PHONY: ctrl_tb
ctrl_tb: $(BUILD)/$(TESTS)/ctrl_tb
.PHONY: javk_tb
javk_tb: $(BUILD)/$(TESTS)/javk_tb
$(BUILD)/$(TESTS)/alu_tb: $(ALU_TB) $(ALU_SRC) $(ALU_INC) $(BUILD)/$(TESTS)
$(IVERILOG) $(IVERILOGFLAGS) -o $(BUILD)/$(TESTS)/alu_tb $(ALU_TB) $(ALU_SRC)
$(BUILD)/$(TESTS)/ctrl_tb: $(CTRL_TB) $(CTRL_SRC) $(CTRL_INC) $(BUILD)/$(TESTS)
$(IVERILOG) $(IVERILOGFLAGS) -o $(BUILD)/$(TESTS)/ctrl_tb $(CTRL_TB) $(CTRL_SRC)
$(BUILD)/$(TESTS)/javk_tb: $(JAVK_TB) $(JAVK_SRC) $(JAVK_INC) $(BUILD)/$(TESTS)
$(IVERILOG) $(IVERILOGFLAGS) -o $(BUILD)/$(TESTS)/javk_tb $(JAVK_TB) $(JAVK_SRC)
$(BUILD)/$(TESTS): $(BUILD)
@mkdir $(BUILD)/$(TESTS)
$(BUILD):
@mkdir $(BUILD)