$(VAR:XXX=YYY)
如果变量VAR
中出现 XXX
则用 YYY
替换。
例如在U-boot的Makefile中遇到的 $(@:_config=)
如果 $@
的值中出现 _config
则用 空 替换。
normal prerequisites && order-only prerequisites
GUN Makefile Manual Chapter4.3 、参考博客
targets : normal-prerequisites | order-only-prerequisites
简单的讲就是:如果目标的依赖中有 order-only prerequisites ,只有在目标第一次生成时,会去检查并生成这些 order-only prerequisites 。如果目标已经存在,在判断是否需要更新目标时,则忽略 order-only prerequisites ,即:即使这些 order-only prerequisites 有更新,也忽略这些更新,当然,如果 normal prerequisites 有更新,则目标就会更新。
include & -include & sinclude
The include
directive tells make to suspend reading the current makefile and read one or more other makefiles before continuing.
The -include
directive to include makefiles with no error for a nonexistent file comes from SunOS 4 make. (But note that SunOS 4 make does not allow multiple makefiles to be specified in one -include
directive.) The same feature appears with the name sinclude
in SGI make and perhaps others.
@ + -
all:
@command
-command
+command
@
不显示命令本身-
忽略错误+
忽略-n
,-t
,-q
三个参数的影响。(命令前使用+
和 使用$(MAKE)
、${MAKE}
是相同的作用。) As a special feature, using the variable MAKE in the recipe of a rule alters the effects of the ‘-t’ (‘–touch’), ‘-n’ (‘–just-print’), or ‘-q’ (‘–question’) option. Using the MAKE variable has the same effect as using a ‘+’ character at the beginning of the recipe line. GUN Makefile Manual Chapter5.7.1
.SUFFIXES:
# eliminate default suffix rules
.SUFFIXES: .c .S .h
.DELETE_ON_ERROR:
# delete target files if there is an error (or make is interrupted)
.DELETE_ON_ERROR: