-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (50 loc) · 1.51 KB
/
Makefile
File metadata and controls
70 lines (50 loc) · 1.51 KB
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
CXX = g++
CXXFLAGS = -std=c++17 -O3
CUDA_AVAILABLE := $(shell which nvcc > /dev/null 2>&1 && echo 1 || echo 0)
VERILATOR_ROOT := $(shell verilator --getenv VERILATOR_ROOT)
BUILD_DIR = build
TARGET = $(BUILD_DIR)/sfu_test
VERILATOR_SRCS = $(VERILATOR_ROOT)/include/verilated.cpp $(VERILATOR_ROOT)/include/verilated_threads.cpp
SUBDIRS = util cmodel cpu mpfr chisel
LIBS = util/build/libutil.a \
chisel/build/libchisel.a \
cmodel/build/libcmodel.a \
cpu/build/libcpu.a \
mpfr/build/libmpfr.a
INCLUDES = -I./util/include \
-I./chisel/include \
-I./cmodel/include \
-I./cpu/include \
-I./mpfr/include \
-I$(VERILATOR_ROOT)/include
LDFLAGS = -lmpfr -lgmp
ifeq ($(CUDA_AVAILABLE), 1)
SUBDIRS += gpu
CXXFLAGS += -DUSE_GPU
LDFLAGS += -L$(shell dirname $(shell which nvcc))/../lib64 -lcudart
LIBS += gpu/build/libgpu.a
INCLUDES += -I./gpu/include
endif
all: run
run: $(TARGET)
@LUT_PATH=./lut ./$(TARGET)
util/build/libutil.a:
$(MAKE) -C util
cmodel/build/libcmodel.a:
$(MAKE) -C cmodel
cpu/build/libcpu.a:
$(MAKE) -C cpu
mpfr/build/libmpfr.a:
$(MAKE) -C mpfr
gpu/build/libgpu.a:
$(MAKE) -C gpu
chisel/build/libchisel.a:
$(MAKE) -C chisel
$(TARGET): main.cpp $(LIBS) | $(BUILD_DIR)
$(CXX) $(CXXFLAGS) $(INCLUDES) -o $@ $< $(VERILATOR_SRCS) $(LIBS) $(LDFLAGS)
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
clean:
rm -rf $(BUILD_DIR)
for dir in $(SUBDIRS); do $(MAKE) -C $$dir clean; done
.PHONY: all clean $(SUBDIRS)