Open nnop opened 6 years ago
rpath
$ORIGIN
is a special variable that means ‘this executable’, and it means the actual executable filename, asreadlink
would see it, so symlinks are followed. In other words,$ORIGIN
is special and resolves to wherever the binary is at runtime.
You need to pass the literal string
$ORIGIN/../lib
as an argument to your linker. The$ORIGIN
token is kept inside your program after it's created and when the runtime linker starts to run your program it will replace$ORIGIN
with the current path that your program was invoked from.In order to pass a literal
$
to the command invoked by a make recipe, you have to escape the$
by doubling it:$$
. Otherwise, make will see the$
as introducing a make variable or function. Remember, it's perfectly legal for a make variable to avoid the parentheses etc., if it's a single character (note,$@
,$<
, etc.)
其实是相当于写了很多explicit rules
每个target必须跟target pattern相匹配
其实是一些惯用的(customary)处理方法。
用pattern rules来定义
需要所有前置条件exists and can be made it is mentioned explicitly in the makefile as a target or a prerequisite, or if an implicit rule can be recursively found for how to make it.
make会为每个没有recipe的target找implicit rule
只在prerequisites里提到的文件
explicit prerequisites不影响implicit rule search
make的惯例,对于.x源文件
预处理PREPROCESS.x
编译COMPILE.x
链接LINK.x
%的扩展在所有变量扩展之后
只有在所有prerequisites exists or can be made时才会应用
pattern match
-MMD根据-o值放.d文件
-MP对每个prerequisite加一个phony target,这样,文件被删的时候就不会报错了
3.1 stem短的优先
3.2 先定义的优先