网站公告列表

  没有公告

加入收藏
设为首页
联系本站
您现在的位置: AnalogCN安诺电子 >> 文章 >> 技术交流 >> 文章正文
  bfin-xxx-gcc中multilib.h的生成           ★★★ 【字体:
bfin-xxx-gcc中multilib.h的生成
作者:快乐虾    文章来源:http://blog.csdn.net/lights_joy    点击数:    更新时间:2008-8-20    

1.1.1.1             Makefile的生成方式

Makefile.in中有这样一段:

# Use the genmultilib shell script to generate the information the gcc

# driver program needs to select the library directory based on the

# switches.

multilib.h: s-mlib; @true

s-mlib: $(srcdir)/genmultilib Makefile

     if test @enable_multilib@ = yes \

        || test -n "$(MULTILIB_OSDIRNAMES)"; then \

       $(SHELL) $(srcdir)/genmultilib \

         "$(MULTILIB_OPTIONS)" \

         "$(MULTILIB_DIRNAMES)" \

         "$(MULTILIB_MATCHES)" \

         "$(MULTILIB_EXCEPTIONS)" \

         "$(MULTILIB_EXTRA_OPTS)" \

         "$(MULTILIB_EXCLUSIONS)" \

         "$(MULTILIB_OSDIRNAMES)" \

         "@enable_multilib@" \

         > tmp-mlib.h; \

     else \

       $(SHELL) $(srcdir)/genmultilib '' '' '' '' '' '' '' no \

         > tmp-mlib.h; \

     fi

     $(SHELL) $(srcdir)/../move-if-change tmp-mlib.h multilib.h

     $(STAMP) s-mlib

也就是说,这个文件是由genmultilib这个脚本文件生成的。

1.1.1.2             变量来源

Makefile.in中涉及到几个变量:

第一个是@enable_multilib@,这个变量将由config.status进行替换。查下替换的内容:

s,@enable_multilib@,$enable_multilib,;t t

即它将用$enable_multilib这个在configure脚本中出现的变量进行替换。而在configure中还有这样一段:

# Determine whether or not multilibs are enabled.

# Check whether --enable-multilib or --disable-multilib was given.

if test "${enable_multilib+set}" = set; then

  enableval="$enable_multilib"

 

else

  enable_multilib=yes

fi;

因而在默认配置下这个变量的取值将为yes

接下来是$ MULTILIB_OPTIONS这几个变量,找一下,可以发现在config\bfin\t-bfin-uclinux这个文件中有它们的定义。

MULTILIB_OPTIONS=mcpu=bf532-none/mcpu=bf532-0.3

MULTILIB_OPTIONS+=mid-shared-library/msep-data mleaf-id-shared-library

MULTILIB_DIRNAMES=bf532-none bf532-0.3 mid-shared-library msep-data mleaf-id-shared-library

MULTILIB_MATCHES=mcpu?bf532-none=mcpu?bf561

MULTILIB_MATCHES+=mcpu?bf532-none=mcpu?bf531-none mcpu?bf532-none=mcpu?bf533-none mcpu?bf532-none=mcpu?bf534-none mcpu?bf532-none=mcpu?bf536-none mcpu?bf532-none=mcpu?bf537-none mcpu?bf532-none=mcpu?bf561-none mcpu?bf532-none=mcpu?bf561-0.5

MULTILIB_MATCHES+=mcpu?bf532-0.3=mcpu?bf531-0.4 mcpu?bf532-0.3=mcpu?bf531-0.3 mcpu?bf532-0.3=mcpu?bf532-0.4 mcpu?bf532-0.3=mcpu?bf533-0.4 mcpu?bf532-0.3=mcpu?bf533-0.3 mcpu?bf532-0.3=mcpu?bf534-0.2 mcpu?bf532-0.3=mcpu?bf534-0.1 mcpu?bf532-0.3=mcpu?bf536-0.2 mcpu?bf532-0.3=mcpu?bf536-0.1 mcpu?bf532-0.3=mcpu?bf537-0.2 mcpu?bf532-0.3=mcpu?bf537-0.1 mcpu?bf532-0.3=mcpu?bf561-0.3 mcpu?bf532-0.3=mcpu?bf561-0.2 mcpu?bf532-0.3=mcpu?bf531-any mcpu?bf532-0.3=mcpu?bf532-any mcpu?bf532-0.3=mcpu?bf533-any mcpu?bf532-0.3=mcpu?bf534-any mcpu?bf532-0.3=mcpu?bf536-any mcpu?bf532-0.3=mcpu?bf537-any mcpu?bf532-0.3=mcpu?bf561-any

MULTILIB_EXCEPTIONS=mleaf-id-shared-library*

MULTILIB_EXCEPTIONS+=mcpu=bf532-0.3/mleaf-id-shared-library*

MULTILIB_EXCEPTIONS+=mcpu=bf532-none/mleaf-id-shared-library*

MULTILIB_EXCEPTIONS+=*msep-data/mleaf-id-shared-library*

那么,t-bfin-uclinux这个文件又用在什么地方呢?在config.gcc中有这样的用法:

bfin*-uclinux*)

     tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h linux.h bfin/uclinux.h"

     tmake_file=bfin/t-bfin-uclinux

     tm_defines="${tm_defines} UCLIBC_DEFAULT=1"

     extra_options="${extra_options} linux.opt"

     use_collect2=no

     ;;

而我们知道config.gcc这个脚本是在configure脚本中调用的,用于与target相关的一些配置。再查找tmake_file,在configure脚本中有这样的语句:

tmake_file_=

for f in ${tmake_file}

do

     if test -f ${srcdir}/config/$f

     then

         tmake_file_="${tmake_file_} \$(srcdir)/config/$f"

     fi

done

tmake_file="${tmake_file_}"

…………..

s,@tmake_file@,$tmake_file,;t t

即它将Makefile.in中的@tmake_file@变量替换为bfin/t-bfin-uclinux

Makefile.in中就有这样的一行:

tmake_file=@tmake_file@

# target overrides

ifneq ($(tmake_file),)

include $(tmake_file)

endif

原来如此。

config.gcc还可以知道,如果我们的目标是生成bfin-elf-gcc,那么它包含的将是config/bfin/t-bfin-elf这个文件。

1.1.1.3             genmultilib脚本

下面再看看genmultilib这个脚本的输出,以bfin-uclinux-gcc的目标为例:

第一个参数是$MULTILIB_OPTIONS,它的值为:

mcpu=bf532-none/mcpu=bf532-0.3 mid-shared-library/msep-data mleaf-id-shared-library

第二个参数$ MULTILIB_DIRNAMES的值为:

bf532-none bf532-0.3 mid-shared-library msep-data mleaf-id-shared-library

第三个参数$ MULTILIB_MATCHES的值为:

mcpu?bf532-none=mcpu?bf561 mcpu?bf532-none=mcpu?bf531-none mcpu?bf532-none=mcpu?bf533-none mcpu?bf532-none=mcpu?bf534-none mcpu?bf532-none=mcpu?bf536-none mcpu?bf532-none=mcpu?bf537-none mcpu?bf532-none=mcpu?bf561-none mcpu?bf532-none=mcpu?bf561-0.5 mcpu?bf532-0.3=mcpu?bf531-0.4 mcpu?bf532-0.3=mcpu?bf531-0.3 mcpu?bf532-0.3=mcpu?bf532-0.4 mcpu?bf532-0.3=mcpu?bf533-0.4 mcpu?bf532-0.3=mcpu?bf533-0.3 mcpu?bf532-0.3=mcpu?bf534-0.2 mcpu?bf532-0.3=mcpu?bf534-0.1 mcpu?bf532-0.3=mcpu?bf536-0.2 mcpu?bf532-0.3=mcpu?bf536-0.1 mcpu?bf532-0.3=mcpu?bf537-0.2 mcpu?bf532-0.3=mcpu?bf537-0.1 mcpu?bf532-0.3=mcpu?bf561-0.3 mcpu?bf532-0.3=mcpu?bf561-0.2 mcpu?bf532-0.3=mcpu?bf531-any mcpu?bf532-0.3=mcpu?bf532-any mcpu?bf532-0.3=mcpu?bf533-any mcpu?bf532-0.3=mcpu?bf534-any mcpu?bf532-0.3=mcpu?bf536-any mcpu?bf532-0.3=mcpu?bf537-any mcpu?bf532-0.3=mcpu?bf561-any

第四个参数$ MULTILIB_EXCEPTIONS的值为:

mleaf-id-shared-library* mcpu=bf532-0.3/mleaf-id-shared-library* mcpu=bf532-none/mleaf-id-shared-library* *msep-data/mleaf-id-shared-library*

第五个参数$MULTILIB_EXTRA_OPTS为空字符串。

第六个参数$ MULTILIB_EXCLUSIONS为空字符串。

第七个参数$ MULTILIB_OSDIRNAMES为空字符串。

第八个参数@enable_multilib@”yes”

最后生成的multilib.h如下:

static const char *const multilib_raw[] = {

". !mcpu=bf532-none !mcpu=bf532-0.3 !mid-shared-library !msep-data !mleaf-id-shared-library;",

"bf532-none mcpu=bf532-none !mcpu=bf532-0.3 !mid-shared-library !msep-data !mleaf-id-shared-library;",

"bf532-0.3 !mcpu=bf532-none mcpu=bf532-0.3 !mid-shared-library !msep-data !mleaf-id-shared-library;",

"mid-shared-library !mcpu=bf532-none !mcpu=bf532-0.3 mid-shared-library !msep-data !mleaf-id-shared-library;",

"msep-data !mcpu=bf532-none !mcpu=bf532-0.3 !mid-shared-library msep-data !mleaf-id-shared-library;",

"mid-shared-library/mleaf-id-shared-library !mcpu=bf532-none !mcpu=bf532-0.3 mid-shared-library !msep-data mleaf-id-shared-library;",

"bf532-none/mid-shared-library mcpu=bf532-none !mcpu=bf532-0.3 mid-shared-library !msep-data !mleaf-id-shared-library;",

"bf532-none/msep-data mcpu=bf532-none !mcpu=bf532-0.3 !mid-shared-library msep-data !mleaf-id-shared-library;",

"bf532-none/mid-shared-library/mleaf-id-shared-library mcpu=bf532-none !mcpu=bf532-0.3 mid-shared-library !msep-data mleaf-id-shared-library;",

"bf532-0.3/mid-shared-library !mcpu=bf532-none mcpu=bf532-0.3 mid-shared-library !msep-data !mleaf-id-shared-library;",

"bf532-0.3/msep-data !mcpu=bf532-none mcpu=bf532-0.3 !mid-shared-library msep-data !mleaf-id-shared-library;",

"bf532-0.3/mid-shared-library/mleaf-id-shared-library !mcpu=bf532-none mcpu=bf532-0.3 mid-shared-library !msep-data mleaf-id-shared-library;",

NULL

};

 

static const char *const multilib_matches_raw[] = {

"mcpu=bf561 mcpu=bf532-none;",

"mcpu=bf531-none mcpu=bf532-none;",

"mcpu=bf533-none mcpu=bf532-none;",

"mcpu=bf534-none mcpu=bf532-none;",

"mcpu=bf536-none mcpu=bf532-none;",

"mcpu=bf537-none mcpu=bf532-none;",

"mcpu=bf561-none mcpu=bf532-none;",

"mcpu=bf561-0.5 mcpu=bf532-none;",

"mcpu=bf531-0.4 mcpu=bf532-0.3;",

"mcpu=bf531-0.3 mcpu=bf532-0.3;",

"mcpu=bf532-0.4 mcpu=bf532-0.3;",

"mcpu=bf533-0.4 mcpu=bf532-0.3;",

"mcpu=bf533-0.3 mcpu=bf532-0.3;",

"mcpu=bf534-0.2 mcpu=bf532-0.3;",

"mcpu=bf534-0.1 mcpu=bf532-0.3;",

"mcpu=bf536-0.2 mcpu=bf532-0.3;",

"mcpu=bf536-0.1 mcpu=bf532-0.3;",

"mcpu=bf537-0.2 mcpu=bf532-0.3;",

"mcpu=bf537-0.1 mcpu=bf532-0.3;",

"mcpu=bf561-0.3 mcpu=bf532-0.3;",

"mcpu=bf561-0.2 mcpu=bf532-0.3;",

"mcpu=bf531-any mcpu=bf532-0.3;",

"mcpu=bf532-any mcpu=bf532-0.3;",

"mcpu=bf533-any mcpu=bf532-0.3;",

"mcpu=bf534-any mcpu=bf532-0.3;",

"mcpu=bf536-any mcpu=bf532-0.3;",

"mcpu=bf537-any mcpu=bf532-0.3;",

"mcpu=bf561-any mcpu=bf532-0.3;",

"mcpu=bf532-none mcpu=bf532-none;",

"mcpu=bf532-0.3 mcpu=bf532-0.3;",

"mid-shared-library mid-shared-library;",

"msep-data msep-data;",

"mleaf-id-shared-library mleaf-id-shared-library;",

NULL

};

 

static const char *multilib_extra = "";

 

static const char *const multilib_exclusions_raw[] = {

NULL

};

 

static const char *multilib_options = "mcpu=bf532-none/mcpu=bf532-0.3 mid-shared-library/msep-data mleaf-id-shared-library";

文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
    前置放大器在移动医疗服务系
    便携式多通道大容量生理信号
    防腐监测仪的设计与应用
    基于AD1674的酶标仪的设计
    基于C/S模式的JRTPLIB库的测
    ffmpeg与jrtplib相结合应用
    blackfin模拟摄像头驱动中的
    可编程逻辑在数字信号处理系
    发现VDSP4.5一个BUG:单步调
    VDSP5.0双核工程下sml3中的变
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    版权所有:AnalogCN安诺电子 湘ICP备06016315号