![]() |
|
||||||||||||||
| | 首页 | 新闻 | 文库 | 方案 | 技术 | 独家 | 座谈 | 下载 | 图库 | 开发板 | 仿真器 | 邮购 | VIP会员 | 芯片代购 | 客户评价 | | ||
|
||
|
|||||
| binutils-2.18/opcodes/Makefile分析 | |||||
作者:快乐虾 文章来源:http://blog.csdn.net/lights_joy 点击数: 更新时间:2008-9-1 ![]() |
|||||
1 opcodes/Makefile这个文件由主控Makefile调用configure脚本生成并执行make操作。要求生成的目标为all。 1.1 all在Makefile中的第一个目标就是all: $(MAKE) $(AM_MAKEFLAGS) all-recursive 因此它将执行all-recursive这个目标。这个目标的生成都是由RECURSIVE_TARGETS来完成的。 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" 在这段脚本中将分别进入各子目录并执行make xxx操作,xxx为-recusive目标的前面一部分。 po子目录略过不做分析。当在opcodes目录下执行all-recursive操作时,上述脚本转而执行all-am目标,因此下面转而分析all-am目标。这条规则定义为: all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) config.h LIBRARIES = $(noinst_LIBRARIES) noinst_LIBRARIES = libopcodes.a LTLIBRARIES = $(bfdlib_LTLIBRARIES) bfdlib_LTLIBRARIES = libopcodes.la 看看libopcodes.a的规则: stamp-lib: libopcodes.la libtooldir=`$(LIBTOOL) --config | sed -n -e 's/^objdir=//p'`; \ if [ -f $$libtooldir/libopcodes.a ]; then \ cp $$libtooldir/libopcodes.a libopcodes.tmp; \ $(RANLIB) libopcodes.tmp; \ $(SHELL) $(srcdir)/../move-if-change libopcodes.tmp libopcodes.a; \ else true; fi touch stamp-lib libopcodes.a: stamp-lib ; @true 因而实际工作都由libopcodes.la完成,最后这段脚本将之复制为libopcodes.a。 1.2 libopcodes.la这条规则定义为: libopcodes.la: $(libopcodes_la_OBJECTS) $(libopcodes_la_DEPENDENCIES) $(LINK) -rpath $(bfdlibdir) $(libopcodes_la_LDFLAGS) $(libopcodes_la_OBJECTS) $(libopcodes_la_LIBADD) $(LIBS) 在生成所有的.o文件后,这段脚本将它们链接为libopcodes.la文件。 1.2.1 $( libopcodes_la_OBJECTS)这个变量定义为: libopcodes_la_OBJECTS = $(am_libopcodes_la_OBJECTS) am_libopcodes_la_OBJECTS = dis-buf.lo disassemble.lo dis-init.lo 1.2.1.1 dis-buf.lo这个目标的生成由通用规则完成: .c.lo: $(LTCOMPILE) -c -o $@ $< 然后有依赖关系: dis-buf.lo: dis-buf.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ opintl.h 直接调用libtool脚本生成同名的.o和.lo两个文件。 1.2.1.2 disassemble.lo这条规则定义为: disassemble.lo: disassemble.c $(INCDIR)/dis-asm.h $(LIBTOOL) --mode=compile $(COMPILE) -c -DARCH_bfin $(srcdir)/disassemble.c 直接调用libtool脚本生成同名的.o和.lo两个文件。 1.2.1.3 dis-init.lo这个目标的生成由通用规则完成: .c.lo: $(LTCOMPILE) -c -o $@ $< 然后有依赖关系: dis-init.lo: dis-init.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ $(BFD_H) 直接调用libtool脚本生成同名的.o和.lo两个文件。 1.2.2 $( libopcodes_la_DEPENDENCIES)这个变量定义为: libopcodes_la_DEPENDENCIES = $(OFILES) OFILES = bfin-dis.lo 1.2.2.1 bfin-dis.lo这个目标的生成由通用规则完成: .c.lo: $(LTCOMPILE) -c -o $@ $< 然后有依赖关系: bfin-dis.lo: bfin-dis.c $(INCDIR)/opcode/bfin.h $(INCDIR)/dis-asm.h \ $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h 直接调用libtool脚本生成同名的.o和.lo两个文件。 2 目标生成顺序以下是所有目标的生成顺序: opcodes/Makefile: all: begin opcodes/Makefile: all-recursive: begin opcodes/Makefile: dis-buf.lo: begin opcodes/Makefile: dis-buf.lo: end opcodes/Makefile: disassemble.lo: begin opcodes/Makefile: disassemble.lo: end opcodes/Makefile: dis-init.lo: begin opcodes/Makefile: dis-init.lo: end opcodes/Makefile: bfin-dis.lo: begin opcodes/Makefile: bfin-dis.lo: end opcodes/Makefile: libopcodes.la: begin opcodes/Makefile: libopcodes.la: end opcodes/Makefile: stamp-lib: begin opcodes/Makefile: stamp-lib: end opcodes/Makefile: all-recursive: end opcodes/Makefile: all: end |
|||||
| 文章录入:admin 责任编辑:admin | |||||
| 【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 | |||||
| 最新热点 | 最新推荐 | 相关文章 | ||
| 前置放大器在移动医疗服务系 便携式多通道大容量生理信号 防腐监测仪的设计与应用 基于AD1674的酶标仪的设计 基于C/S模式的JRTPLIB库的测 ffmpeg与jrtplib相结合应用 blackfin模拟摄像头驱动中的 可编程逻辑在数字信号处理系 发现VDSP4.5一个BUG:单步调 VDSP5.0双核工程下sml3中的变 |
| 网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!) |
| | 本站介绍 | 合作联络 | 欢迎投稿 | 广告业务 | 网站地图 | 设为首页 | 加入收藏 | 友情链接 | 网站公告 | 联系我们 | | |||
|