首先提一下隱式規(guī)則
對(duì)于一個(gè)目標(biāo)曾雕,如果沒有顯示的指定規(guī)則变泄,則去所有的隱式規(guī)則查找
隱式規(guī)則提供了默認(rèn)的先決條件+執(zhí)行處方
實(shí)際上這些隱式規(guī)則示括,都是通過模式規(guī)則的方式來定義的
模式規(guī)則
模式規(guī)則许帐,就是為了服務(wù)隱式規(guī)則而存在的:
1 可以定義新的隱式規(guī)則
2 可以修改之前的隱式規(guī)則
規(guī)則樣式:
1 %.o : %.c(新的樣式)
2 .c.o(老的樣式)
靜態(tài)模式規(guī)則
這個(gè)和隱式規(guī)則,就沒有關(guān)系了
這個(gè)是實(shí)實(shí)在在的顯式規(guī)則
這個(gè)顯式規(guī)則粱栖,是根據(jù)我書寫的靜態(tài)模板,推導(dǎo)出來的
Static pattern rules are rules which specify multiple targets and
construct the prerequisite names for each target based on the target name.
They are more general than ordinary rules with multiple targets
because the targets do not have to have identical prerequisites.
Their prerequisites must be analogous, but not necessarily identical.
形式如下:
objects = foo.o bar.o
$(objects): %.o: %.c
$(CC) -c $(CFLAGS) $< -o $@