1. Introduction
This article mainly introduces how to add the method of obtaining directories and .c files in hexagon.min in Qualcomm hexagon ide for reference.
Second, the specific order
OBJ_PATH := ./algo_lib
INCLUDE_PATH := $(shell find $(OBJ_PATH ) -type d)
SRC_C_FILE := $(foreach dir, $(INCLUDE_PATH ), $(wildcard $(dir)/*.c))
#add source c files
capi_awinic_iv_sp_C_SRCS += $(basename $(SRC_C_FILE))
#add the path of .h file
INCDIRS += $(INCLUDE_PATH )
Three, command supplementary introduction
find command:
For details, see the link: " Linux Common Commands "
foreach command:
$(foreach <var>,<list>,<text>)
Meaning: This function means to take out the words in the parameter; one by one and put them in the variable specified by the parameter;, and then execute the expression contained in <text>;. every time
Therefore, ; is preferably a variable name, ; can be an expression, and
names := a b c d
files := $(foreach n,$(names),$(n).o)
In the above example, the words in (name) will be taken out one by one and stored in the variable "n", "The words in (name) will be taken out one by one and stored in the variable "n", "The words in ( name e ) will be taken out one by one and stored in the variable " n " , " (n).o"calculates a value according to "(n)" each time, these values are separated by spaces, and finally used as the foreach function The return, so, (n)" calculates a value, these values are separated by spaces, and finally returned as the return of the foreach function, so,( n ) " calculates a value, these values are separated by spaces, and finally used as the return of the fore a ch function, so the value of (files) is "ao bo co do".
Note that the ; parameter in foreach is a temporary local variable. After the foreach function is executed, the parameter ; variable will no longer work, and its scope is only in the foreach function.
wildcard command:
Order | meaning |
---|---|
wildcard $(dir)/*.c | Represents all .c files in the $(dir) directory |
basename command:
Order | meaning |
---|---|
basename directory name/file name | Get the last directory name or file name |
basename file name file suffix | Get the file name at the end and remove the file suffix at the same time |
basename -s file suffix file name | (Same as above) Get the file name at the end and remove the file suffix at the same time |
basename -s file name file suffix | Get only the file suffix, remove the file name |
basename -a directory1/file1 directory2/file2 | Output the names of multiple directories or files at the same time (when using basename, if the directory or file does not exist, no error will be reported) |
Four, summary
This article mainly introduces how to add the method of obtaining directories and .c files in hexagon.min in Qualcomm hexagon ide for reference. Welcome to discuss and exchange~