TIOVX 学习笔记其三:concerto makefile
TIOVX 学习笔记其三:concerto makefile
Reference:
1. Introduction
concerto 是一个基于 GNU 的搭建系统,被 PSDK RTOS 中的许多组件所使用。它是 make 规则和 make 宏的集合,可以跨多个代码生成工具、CPU arch、操作系统、SoC 进行流线编译和链接。
下面的部分使用了基于 concerto 的 PSDK RTOS 搭建系统:
- Ethernet firmware
- Remote Device
- Imaging
- Perception (PTK)
- TI OpenVX
- Video codec
- Vision apps
2. Concerto basic’s
concerto 从项目根文件夹开始和根文件夹中所有子目录,寻找文件 concerto.mak。
- 每个
<kbd>concerto.mak搭建一个 library 或者一个可执行文件 - 要搜索的目录列在
/Makefile中的 make 变量DIRECTORIES中
3. Common command line options to use when building
在 vision_apps 路径下的 Build 方式:
| make command | Description |
|---|---|
| make all | Build everything |
| make clean | Clean everything |
| make targets | List all granular targets (libraries or executables) enabled in current build |
| make <maketarget> | Build a specific target listed during make targets(如TARGET := vx_app_tutorial,则命令为make vx_app_tutorial) |
make targets 列出了所有已启用的 build targets,会有如下显示(可以看成类似 ls 的指令):
CONCERTO_TARGETS+=targetname1
CONCERTO_TARGETS+=targetname2
CONCERTO_TARGETS+=targetname3
…
使用后面一个命令 make targetname1 就可以搭建叫做 targetname1 的 target 了。这样就可以只编译一个确切的 library 或者 executable,而不是所有的。
4. Anatomy of concerto.mak file
4.1 示例
以下示例为最小的 concerto.mak 文件内容,这将搭建此 concerto.mak 所在文件夹中的所有C文件。
include $(PRELUDE)
# all variable setup should be between PRELUDE and FINALE
TARGET := my_lib_name
TARGETTYPE := library # 另一种可选的类型为exe
CSOURCES := $(call all-c-files)
include $(FINALE)
4.2 变量
- 下面列出了预定义的和常用的变量:
| Variable | Purpose |
|---|---|
| CSOURCES | 列出要构建的C文件,显式地列出每个文件或使用宏 $(call all-c-files) |
| DEFS | 定义在编译此taget文件时要应用的 |
| IDIRS | 在编译此target文件时请求的include的搜索路径 |
| LDIRS | 在链接此target文件时请求的library的搜索路径 |
| STATIC_LIBS | 在创建可执行文件时,链接的静态库(.a) |
| SYS_SHARED_LIBS | 在创建可执行文件时,链接的共享库(.so) |
- 通常,项目会把
concerto.mak的内容放在如下所示的 ifeq 下:
ifeq ($(TARGET_CPU),$(filter $(TARGET_CPU), x86_64 A72))
这允许为特定的 CPU、OS或特定的SoC搭建特定的库,还有以下变量:
| Variable | Purpose |
|---|---|
| TARGET_CPU | CPU architecture type |
| TARGET_OS | OS type |
| TARGET_PLATFORM | SoC or SoC family type |
| TARGET_BUILD | Build profile |
⋅
\cdot
⋅ 使用 ifeq 和 $(filter) 来根据 make 变量有条件地选择文件,比如上面的示例,如果 CPU 是 A72 时,\$(filter $(TARGET_CPU), x86_64 A72) 会返回 A72,式子就变成了 ifeq ($(TARGET_CPU), A72,这样就能解决有多个可选变量的情况。
点击跳转:
TIOVX 学习笔记其一:OpenVX.
TIOVX 学习笔记其二:TIVOX.
TIOVX 学习笔记其四:Objects.