|
1 |
| -# |
2 |
| -# Copyright 2019-2022 Xilinx, Inc. |
| 1 | +# Copyright (C) 2019-2022, Xilinx, Inc. |
| 2 | +# Copyright (C) 2022-2023, Advanced Micro Devices, Inc. |
3 | 3 | #
|
4 | 4 | # Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | # you may not use this file except in compliance with the License.
|
|
12 | 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 | 13 | # See the License for the specific language governing permissions and
|
14 | 14 | # limitations under the License.
|
15 |
| -# vitis makefile-generator v2.0.8 |
| 15 | +# vitis makefile-generator v2.0.9 |
16 | 16 | #
|
17 | 17 | #+-------------------------------------------------------------------------------
|
18 | 18 | # The following parameters are assigned with default values. These parameters can
|
@@ -69,23 +69,79 @@ check_device:
|
69 | 69 | then echo "[ERROR]: The device $(PLATFORM_NAME) in blocklist."; exit 1;\
|
70 | 70 | fi;
|
71 | 71 |
|
| 72 | +ifneq (,$(wildcard $(PLATFORM))) |
| 73 | +# Use PLATFORM as a file path |
| 74 | +XPLATFORM := $(PLATFORM) |
| 75 | +else |
| 76 | +# Use PLATFORM as a file name pattern |
| 77 | +# 1. search paths specified by variable |
| 78 | +ifneq (,$(PLATFORM_REPO_PATHS)) |
| 79 | +# 1.1 as exact name |
| 80 | +XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) |
| 81 | +# 1.2 as a pattern |
| 82 | +ifeq (,$(XPLATFORM)) |
| 83 | +XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) |
| 84 | +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) |
| 85 | +endif # 1.2 |
| 86 | +endif # 1 |
| 87 | +# 2. search Vitis installation |
| 88 | +ifeq (,$(XPLATFORM)) |
| 89 | +# 2.1 as exact name vitis < 2022.2 |
| 90 | +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) |
| 91 | +ifeq (,$(XPLATFORM)) |
| 92 | +# 2.2 as exact name vitis >= 2022.2 |
| 93 | +XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/base_platforms/$(PLATFORM)/$(PLATFORM).xpfm)) |
| 94 | +# 2.3 as a pattern vitis < 2022.2 |
| 95 | +ifeq (,$(XPLATFORM)) |
| 96 | +XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) |
| 97 | +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) |
| 98 | +# 2.4 as a pattern vitis >= 2022.2 |
| 99 | +ifeq (,$(XPLATFORM)) |
| 100 | +XPLATFORMS := $(wildcard $(XILINX_VITIS)/base_platforms/*/*.xpfm) |
| 101 | +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) |
| 102 | +endif # 2.4 |
| 103 | +endif # 2.3 |
| 104 | +endif # 2.2 |
| 105 | +endif # 2 |
| 106 | +# 3. search default locations |
| 107 | +ifeq (,$(XPLATFORM)) |
| 108 | +# 3.1 as exact name |
| 109 | +XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) |
| 110 | +# 3.2 as a pattern |
| 111 | +ifeq (,$(XPLATFORM)) |
| 112 | +XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) |
| 113 | +XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) |
| 114 | +endif # 3.2 |
| 115 | +endif # 3 |
| 116 | +endif |
| 117 | + |
| 118 | +define MSG_PLATFORM |
| 119 | +No platform matched pattern '$(PLATFORM)'. |
| 120 | +Available platforms are: $(XPLATFORMS) |
| 121 | +To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. |
| 122 | +endef |
| 123 | +export MSG_PLATFORM |
| 124 | + |
| 125 | +.PHONY: check_platform |
| 126 | +check_platform: |
| 127 | +ifeq (,$(XPLATFORM)) |
| 128 | + @echo "$${MSG_PLATFORM}" && false |
| 129 | +endif |
| 130 | +#Check ends |
| 131 | + |
72 | 132 | #get HOST_ARCH by PLATFORM
|
73 |
| -ifneq (,$(PLATFORM)) |
74 |
| -HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') |
| 133 | +HOST_ARCH_temp = $(shell platforminfo -p $(XPLATFORM) | grep 'CPU Type' | sed 's/.*://' | sed '/ai_engine/d' | sed 's/^[[:space:]]*//') |
75 | 134 | ifeq ($(HOST_ARCH_temp), x86)
|
76 | 135 | HOST_ARCH := x86
|
77 | 136 | else ifeq ($(HOST_ARCH_temp), cortex-a9)
|
78 | 137 | HOST_ARCH := aarch32
|
79 | 138 | else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp)))
|
80 | 139 | HOST_ARCH := aarch64
|
81 | 140 | endif
|
82 |
| -endif |
83 |
| - |
84 |
| - |
85 | 141 |
|
86 | 142 | # Special processing for tool version/platform type
|
87 | 143 | VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]*//' | sed -e 's/^[*]* v++ v//g' | cut -d " " -f1)
|
88 |
| -AIE_TYPE := $(shell platforminfo $(PLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') |
| 144 | +AIE_TYPE := $(shell platforminfo $(XPLATFORM) -f -j | grep "arch.:" | sed 's|"arch":||g' | sed 's|["|,]||g') |
89 | 145 | ifeq (AIE ,$(findstring AIE, $(AIE_TYPE)))
|
90 | 146 | HAS_AIE := on
|
91 | 147 | else
|
@@ -280,58 +336,6 @@ LD_LIBRARY_PATH := $(XILINX_XRT)/lib:$(LD_LIBRARY_PATH)
|
280 | 336 | endif
|
281 | 337 | endif
|
282 | 338 |
|
283 |
| -ifneq (,$(wildcard $(PLATFORM))) |
284 |
| -# Use PLATFORM as a file path |
285 |
| -XPLATFORM := $(PLATFORM) |
286 |
| -else |
287 |
| -# Use PLATFORM as a file name pattern |
288 |
| -# 1. search paths specified by variable |
289 |
| -ifneq (,$(PLATFORM_REPO_PATHS)) |
290 |
| -# 1.1 as exact name |
291 |
| -XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/$(PLATFORM)/$(PLATFORM).xpfm))) |
292 |
| -# 1.2 as a pattern |
293 |
| -ifeq (,$(XPLATFORM)) |
294 |
| -XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS)), $(wildcard $(p)/*/*.xpfm)) |
295 |
| -XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) |
296 |
| -endif # 1.2 |
297 |
| -endif # 1 |
298 |
| -# 2. search Vitis installation |
299 |
| -ifeq (,$(XPLATFORM)) |
300 |
| -# 2.1 as exact name |
301 |
| -XPLATFORM := $(strip $(wildcard $(XILINX_VITIS)/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) |
302 |
| -# 2.2 as a pattern |
303 |
| -ifeq (,$(XPLATFORM)) |
304 |
| -XPLATFORMS := $(wildcard $(XILINX_VITIS)/platforms/*/*.xpfm) |
305 |
| -XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) |
306 |
| -endif # 2.2 |
307 |
| -endif # 2 |
308 |
| -# 3. search default locations |
309 |
| -ifeq (,$(XPLATFORM)) |
310 |
| -# 3.1 as exact name |
311 |
| -XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM)/$(PLATFORM).xpfm)) |
312 |
| -# 3.2 as a pattern |
313 |
| -ifeq (,$(XPLATFORM)) |
314 |
| -XPLATFORMS := $(wildcard /opt/xilinx/platforms/*/*.xpfm) |
315 |
| -XPLATFORM := $(strip $(foreach p, $(XPLATFORMS), $(shell echo $(p) | awk '$$1 ~ /$(PLATFORM)/'))) |
316 |
| -endif # 3.2 |
317 |
| -endif # 3 |
318 |
| -endif |
319 |
| - |
320 |
| -define MSG_PLATFORM |
321 |
| -No platform matched pattern '$(PLATFORM)'. |
322 |
| -Available platforms are: $(XPLATFORMS) |
323 |
| -To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file. |
324 |
| -endef |
325 |
| -export MSG_PLATFORM |
326 |
| - |
327 |
| - |
328 |
| -.PHONY: check_platform |
329 |
| -check_platform: |
330 |
| -ifeq (,$(XPLATFORM)) |
331 |
| - @echo "$${MSG_PLATFORM}" && false |
332 |
| -endif |
333 |
| -#Check ends |
334 |
| - |
335 | 339 | # Cleaning stuff
|
336 | 340 | RM = rm -f
|
337 | 341 | RMDIR = rm -rf
|
|
0 commit comments