Openwrt main Makefile
OpenWrt是一个典型的嵌入式Linux工程,了解OpenWrt的Makefile的工作过程对提高嵌入式Linux工程的开发能力有极其重要意义。OpenWrt的主Makefile文件只有100行左右,可以简单分为三部分,前导部分、首次执行部分、再次执行部分。
下面就以openwrt-15.05版本的主Makefile为例进行讲解,该版本的主Makefile一共就只有91行,其中前导部分为9-20行、首次执行部分为22-31行、再次执行部分为32-91。(查看下文需要有一定的Makefile编程基础)
1.前导部分
前导部分的代码
TOPDIR:=${CURDIR}
LC_ALL:=C
LANG:=C
export TOPDIR LC_ALL LANG
empty:=
space:= $(empty) $(empty)
$(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the OpenWrt directory must not include any spaces))
world:
include $(