编译目标:
compile_object() {
do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC
}
执行编译命令把源文件编译成.o文件
检查宏定义:
check_define() {
cat > $TMPC <<EOF
#if !defined($1)
#error $1 not defined
#endif
int main(void) { return 0; }
EOF
compile_object
}
检查宏定义的用法:
if check_define __linux__ ; then
targetos="Linux"
elif check_define _WIN32 ; then
targetos='MINGW32'
elif check_define __OpenBSD__ ; then
targetos='OpenBSD'
elif check_define __sun__ ; then
targetos='SunOS'
elif check_define __HAIKU__ ; then
targetos='Haiku'
else
targetos=`uname -s`
fi
执行 check_define __linux__
如果有定义 __linux__则会把
#if !defined($1)
#error $1 not defined
#endif
int main(void) { return 0; }
这些内容写入 $TMPC 文件中 然后执行compile_object函数对 $TMPC文件进行编译
如果有定义__linux__宏 则编译会成功 否则#error __linux__ not defined错误
cat > $TMPC <<EOF
...
EOF
通过cat命令把...的内容写入 $TMPC
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。