I was going through some shell scripts, and I came across (for the first time) the use "%", some thing like:
build/audio/base/%.wav: src-audio/%.wav
I do not know what it is supposed to mean. Is it some thing like "*"?
Thanks!
I was going through some shell scripts, and I came across (for the first time) the use "%", some thing like:
build/audio/base/%.wav: src-audio/%.wav
I do not know what it is supposed to mean. Is it some thing like "*"?
Thanks!
That is from a makefile, not a shell script. From the documentation:
A target pattern is composed of a ‘
%
’ between a prefix and a suffix, either or both of which may be empty. The pattern matches a file name only if the file name starts with the prefix and ends with the suffix, without overlap. The text between the prefix and the suffix is called the stem. Thus, when the pattern ‘%.o
’ matches the file nametest.o
, the stem is ‘test
’. The pattern rule prerequisites are turned into actual file names by substituting the stem for the character ‘%
’. Thus, if in the same example one of the prerequisites is written as ‘%.c
’, it expands to ‘test.c
’.
So every file that matches "build/audio/base/*.wav" has a dependency of "src-audio/*.wav" where the two parts that are represented by "*" must match.