子目录执行make
函数
shell(执行shell命令)
subst(字符串替换)

子目录执行make

SUBDIRS=doc src scripts tests configs
all:
        for d in ${SUBDIRS}; do ${MAKE} -C $$d $@; done

函数

shell(执行shell命令)

PKGNAME=distutils
SPECFILE=${PKGNAME}.spec
VERSION=$(shell rpm -q --specfile --qf "%{version}\n" ${SPECFILE} | sed -ne 1p)
RELEASE=$(shell rpm -q --specfile --qf "%{release}\n" ${SPECFILE} | sed -ne 1p)
CVSTAG=R$(subst .,_,$(VERSION)-$(RELEASE))

何的Makefile示例。

subst(字符串替换)

$(subst ee,EE,feet on the street)

"feet on the street" 中的 "ee" 替换成 "EE"