Skip to content

Commit bcbe4aa

Browse files
Virat Agarwalheeran-xilinx
authored andcommitted
Adding sections into Makefile (#397)
1 parent 3952f6e commit bcbe4aa

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

hello_world/Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
############################## Help Section ##############################
12
.PHONY: help
23

34
help::
@@ -28,6 +29,7 @@ help::
2829
$(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH and EDGE_COMMON_SW is required for SoC shells"
2930
$(ECHO) ""
3031

32+
############################## Setting up Project Variables ##############################
3133
# Points to top directory of Git repository
3234
COMMON_REPO = ../
3335
PWD = $(shell readlink -f .)
@@ -62,6 +64,8 @@ HOST_SRCS += $(xcl2_SRCS)
6264
CXXFLAGS += $(opencl_CXXFLAGS) -Wall -O0 -g -std=c++11
6365
LDFLAGS += $(opencl_LDFLAGS)
6466

67+
############################## Setting up Host Variables ##############################
68+
#Include Required Host Source Files
6569
HOST_SRCS += src/host.cpp
6670

6771
# Host compiler global settings
@@ -72,6 +76,7 @@ ifneq ($(HOST_ARCH), x86)
7276
LDFLAGS += --sysroot=$(SYSROOT)
7377
endif
7478

79+
############################## Setting up Kernel Variables ##############################
7580
# Kernel compiler global settings
7681
CLFLAGS += -t $(TARGET) --platform $(DEVICE) --save-temps
7782
ifneq ($(TARGET), hw)
@@ -85,9 +90,11 @@ CMD_ARGS = $(BUILD_DIR)/vadd.xclbin
8590
EMCONFIG_DIR = $(TEMP_DIR)
8691
EMU_DIR = $(SDCARD)/data/emulation
8792

93+
############################## Declaring Binary Containers ##############################
8894
BINARY_CONTAINERS += $(BUILD_DIR)/vadd.xclbin
8995
BINARY_CONTAINER_vadd_OBJS += $(TEMP_DIR)/vadd.xo
9096

97+
############################## Setting Targets ##############################
9198
CP = cp -rf
9299

93100
.PHONY: all clean cleanall docs emconfig
@@ -99,22 +106,23 @@ exe: $(EXECUTABLE)
99106
.PHONY: build
100107
build: check-vitis $(BINARY_CONTAINERS)
101108

102-
# Building kernel
109+
############################## Setting Rules for Binary Containers (Building Kernels) ##############################
103110
$(TEMP_DIR)/vadd.xo: src/vadd.cpp
104111
mkdir -p $(TEMP_DIR)
105112
$(VPP) $(CLFLAGS) --temp_dir $(TEMP_DIR) -c -k vadd -I'$(<D)' -o'$@' '$<'
106113
$(BUILD_DIR)/vadd.xclbin: $(BINARY_CONTAINER_vadd_OBJS)
107114
mkdir -p $(BUILD_DIR)
108115
$(VPP) $(CLFLAGS) --temp_dir $(BUILD_DIR) -l $(LDCLFLAGS) -o'$@' $(+)
109116

110-
# Building Host
117+
############################## Setting Rules for Host (Building Host Executable) ##############################
111118
$(EXECUTABLE): check-xrt $(HOST_SRCS) $(HOST_HDRS)
112119
$(CXX) $(CXXFLAGS) $(HOST_SRCS) $(HOST_HDRS) -o '$@' $(LDFLAGS)
113120

114121
emconfig:$(EMCONFIG_DIR)/emconfig.json
115122
$(EMCONFIG_DIR)/emconfig.json:
116123
emconfigutil --platform $(DEVICE) --od $(EMCONFIG_DIR)
117124

125+
############################## Setting Essential Checks and Running Rules ##############################
118126
check: all
119127
ifeq ($(TARGET),$(filter $(TARGET),sw_emu hw_emu))
120128
ifeq ($(HOST_ARCH), x86)
@@ -146,11 +154,13 @@ endif
146154
endif
147155

148156

157+
############################## Preparing sdcard ##############################
149158
sd_card: gen_run_app
150159
ifneq ($(HOST_ARCH), x86)
151160
$(VPP) -t $(TARGET) --platform $(DEVICE) -p $(BUILD_DIR)/vadd.xclbin --package.out_dir $(PACKAGE_OUT) --package.rootfs $(EDGE_COMMON_SW)/rootfs.ext4 --package.sd_file $(SD_IMAGE_FILE) --package.sd_file xrt.ini --package.sd_file $(RUN_APP_SCRIPT) --package.sd_file $(EXECUTABLE) -o vadd.xclbin
152161
endif
153162

163+
############################## Cleaning Rules ##############################
154164
# Cleaning stuff
155165
clean:
156166
-$(RMDIR) $(EXECUTABLE) $(XCLBIN)/{*sw_emu*,*hw_emu*}

0 commit comments

Comments
 (0)