uboot学习之二----主Makefile学习之二----环境变量之:主机的操作系统和主机架构(HOSTOS、HOSTARCH)(31-43行)

HOSTARCH := $(shell uname -m | \   
sed -e s/i.86/i386/ \
-e s/sun4u/sparc64/ \
-e s/arm.*/arm/ \
-e s/sa110/arm/ \
-e s/powerpc/ppc/ \
-e s/ppc64/ppc/ \
-e s/macppc/ppc/)

HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
sed -e 's/\(cygwin\).*/cygwin/')

export HOSTARCH HOSTOS  //导出CPU的架构和CPU操作系统这两个环境变量,下面备用。

Makefile中的shell函数的用法(《跟我一起学makefile_陈皓》第53页 ):
contents := $(shell cat foo)
files := $(shell echo *.c)
(1)shell函数和反引号" ` "是相同的功能。在shell中执行 uname -m可以打印出主机的硬件架构名称
(2)shell中的| 叫做管道,管道:将管道前面的运算式的输出作为后面一个的输入再去处理。最终输出才是我们整个式子的输出。
(3)HOSTARCH

cpu架构 ARCH就是architecture,架构的意思。

posted on 2016-04-07 00:45  岳睿_02  阅读(1506)  评论(0编辑  收藏  举报

导航