-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (66 loc) · 2.33 KB
/
Makefile
File metadata and controls
81 lines (66 loc) · 2.33 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
71
72
73
74
75
76
77
78
79
80
81
.RECIPEPREFIX +=
#######################################################################################
.PHONY: help
help:
@echo "Makefile Usage:"
@echo " make device TARGET=<sw_emu/hw_emu/hw>"
@echo " Command to generate the design for specified Target and Device."
@echo ""
@echo " make host "
@echo " Command to generate host."
@echo ""
@echo " make clean "
@echo " Command to remove the generated files."
@echo ""
#######################################################################################
TARGET := sw_emu
PLATFORM := xilinx_u280_xdma_201920_3
#PLATFORM := xilinx_u250_gen3x16_xdma_3_1_202020_1
HOST_EXE := host
XO := sum_kernel.$(TARGET).xo
XCLBIN := sum_kernel.$(TARGET).xclbin
KERNEL_NAME := sum_kernel
DEVICE_SRCDIR:=src/device
TEMP_DIR := ./_x.$(TARGET)
SOURCES := $(wildcard $(DEVICE_SRCDIR)/*.cpp)
INCLUDES := $(wildcard $(DEVICE_SRCDIR)/*.h)
OBJECTS := $(SOURCES:$(DEVICE_SRCDIR)/%.cpp=%.xo)
# Host building global settings
CXXFLAGS := -I$(XILINX_XRT)/include/ -I$(XILINX_VIVADO)/include/ -I'./vitis_power/vitis_power/' -Wall -O3 -std=c++11 -L$(XILINX_XRT)/lib/ -lhostsupport -lpthread -lrt -lstdc++ -fopenmp
CXXFLAGS2 := -lxilinxopencl
# Kernel compiler & linker global settings
KRNL_COMPILE_OPTS := -t $(TARGET) --config ../design.cfg --save-temps -O3
KRNL_LINK_OPTS := -t $(TARGET) --config ../link.cfg --save-temps -O3
build: $(XO) $(XCLBIN) $(HOST_EXE) emconfig
.PHONY: device
.ONESHELL:
device: mkrefdir $(OBJECTS) $(XCLBIN)
cp reference_files_$(TARGET)/$(XCLBIN) bin/.
mkrefdir:
rm -Rf reference_files_$(TARGET)
mkdir -p reference_files_$(TARGET)
mkdir -p bin
# Building kernel
.PHONY: $(OBJECTS)
$(OBJECTS): %.xo : $(DEVICE_SRCDIR)/%.cpp
cd reference_files_$(TARGET) ; v++ $(KRNL_COMPILE_OPTS) -c -k sum_kernel -I'../include' -I'../$(<D)' -o'$@' ../$<
.PHONY: $(XCLBIN)
$(XCLBIN): $(OBJECTS)
cd reference_files_$(TARGET) ; v++ $(KRNL_LINK_OPTS) -l -o'$@' $(+)
host: src/host/host.cpp
mkdir -p bin
g++ $(CXXFLAGS) -o bin/host '$<' $(CXXFLAGS2)
.PHONY: emconfig
emconfig:
mkdir -p bin
cd bin
emconfigutil --platform $(PLATFORM)
# Cleaning stuff
.PHONY: clean
clean:
rm -f $(HOST_EXE) *mmult.$(TARGET).$(PLATFORM).* *.log *.json *.xo
clean_kernels:
rm src/device/fixed_point/*.cpp
rm src/device/floating_point/*.cpp
clean_reference_files:
rm -rf reference_files_*