现在的位置: 首页 > 综合 > 正文

binutils-2.18/gprof/Makefile分析

2013年09月04日 ⁄ 综合 ⁄ 共 6143字 ⁄ 字号 评论关闭

 

快乐虾

http://blog.csdn.net/lights_joy/

lights@hb165.com

 

本文适用于

binutils-2.18

configure –target=bfin-uclinux-gnu

Blackfin系列DSP

Cygwin gcc 3.4.4

 

欢迎转载,但请保留作者信息

 

 

1       gprof/Makefile

这个文件由主控Makefile调用configure脚本生成并执行make操作。要求生成的目标为all

1.1    all

Makefile中的第一个目标就是all

all: $(BUILT_SOURCES) gconfig.h

       $(MAKE) $(AM_MAKEFLAGS) all-recursive

BUILD_SOURCES定义了一些源文件。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子目录略过不做分析。当在gprof目录下执行all-recursive操作时,上述脚本转而执行all-am目标,因此下面转而分析all-am目标。这条规则定义为:

all-am: Makefile $(PROGRAMS) $(MANS) $(HEADERS) gconfig.h

PROGRAMS = $(bin_PROGRAMS)

bin_PROGRAMS = gprof$(EXEEXT)

MANS = $(man_MANS)

man_MANS = gprof.1

HEADERS = $(noinst_HEADERS)

noinst_HEADERS = /

       basic_blocks.h call_graph.h cg_arcs.h cg_dfn.h cg_print.h /

       corefile.h gmon.h gmon_io.h gmon_out.h gprof.h hertz.h hist.h /

       search_list.h source.h sym_ids.h symtab.h utils.h

因此这个目标实际依赖于gprof$(EXEEXT),它的规则定义为:

gprof$(EXEEXT): $(gprof_OBJECTS) $(gprof_DEPENDENCIES)

       @rm -f gprof$(EXEEXT)

       $(LINK) $(gprof_LDFLAGS) $(gprof_OBJECTS) $(gprof_LDADD) $(LIBS)

在生成所有的.o文件后,这段脚本将之链接为gprof.exe

1.1.1   $(gprof_OBJECTS)

这个变量定义为:

gprof_OBJECTS = $(am_gprof_OBJECTS)

am_gprof_OBJECTS = $(am__objects_1) flat_bl.$(OBJEXT) /

       bsd_callg_bl.$(OBJEXT) fsf_callg_bl.$(OBJEXT)

am__objects_1 = basic_blocks.$(OBJEXT) call_graph.$(OBJEXT) /

       cg_arcs.$(OBJEXT) cg_dfn.$(OBJEXT) cg_print.$(OBJEXT) /

       corefile.$(OBJEXT) gmon_io.$(OBJEXT) gprof.$(OBJEXT) /

       hertz.$(OBJEXT) hist.$(OBJEXT) source.$(OBJEXT) /

       search_list.$(OBJEXT) symtab.$(OBJEXT) sym_ids.$(OBJEXT) /

       utils.$(OBJEXT) i386.$(OBJEXT) alpha.$(OBJEXT) vax.$(OBJEXT) /

       tahoe.$(OBJEXT) sparc.$(OBJEXT) mips.$(OBJEXT)

这些目标的生成全部由通用规则完成:

.c.o:

       $(COMPILE) -c $<

同时有以下依赖关系:

basic_blocks.o: basic_blocks.c $(INCDIR)/libiberty.h /

  $(INCDIR)/ansidecl.h gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h /

  $(INCDIR)/ansidecl.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h /

  ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h /

  gconfig.h basic_blocks.h corefile.h gmon_io.h gmon_out.h /

  search_list.h source.h symtab.h sym_ids.h

call_graph.o: call_graph.c gprof.h $(BFDDIR)/sysdep.h /

  ../bfd/config.h $(INCDIR)/ansidecl.h $(INCDIR)/fopen-same.h /

  $(INCDIR)/filenames.h ../bfd/bfd.h $(INCDIR)/ansidecl.h /

  $(INCDIR)/symcat.h gconfig.h search_list.h source.h /

  symtab.h cg_arcs.h call_graph.h corefile.h gmon_io.h /

  gmon_out.h sym_ids.h

cg_arcs.o: cg_arcs.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h /

  gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/ansidecl.h /

  $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h ../bfd/bfd.h /

  $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h gconfig.h search_list.h /

  source.h symtab.h call_graph.h cg_arcs.h cg_dfn.h cg_print.h /

  utils.h sym_ids.h

cg_dfn.o: cg_dfn.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h /

  gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/ansidecl.h /

  $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h ../bfd/bfd.h /

  $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h gconfig.h search_list.h /

  source.h symtab.h cg_arcs.h cg_dfn.h utils.h

cg_print.o: cg_print.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h /

  gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/ansidecl.h /

  $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h ../bfd/bfd.h /

  $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h gconfig.h search_list.h /

  source.h symtab.h cg_arcs.h cg_print.h hist.h utils.h /

  corefile.h

corefile.o: corefile.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h /

  gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/ansidecl.h /

  $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h ../bfd/bfd.h /

  $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h gconfig.h search_list.h /

  source.h symtab.h hist.h corefile.h $(INCDIR)/safe-ctype.h

gmon_io.o: gmon_io.c gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h /

  $(INCDIR)/ansidecl.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h /

  ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h /

  gconfig.h search_list.h source.h symtab.h cg_arcs.h /

  basic_blocks.h corefile.h call_graph.h gmon_io.h gmon_out.h /

  gmon.h hertz.h hist.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h

gprof.o: gprof.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h /

  gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/ansidecl.h /

  $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h ../bfd/bfd.h /

  $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h gconfig.h ../bfd/bfdver.h /

  search_list.h source.h symtab.h basic_blocks.h call_graph.h /

  cg_arcs.h cg_print.h corefile.h gmon_io.h hertz.h hist.h /

  sym_ids.h $(INCDIR)/demangle.h $(INCDIR)/libiberty.h

hertz.o: hertz.c gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h /

  $(INCDIR)/ansidecl.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h /

  ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h /

  gconfig.h hertz.h

hist.o: hist.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h /

  gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/ansidecl.h /

  $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h ../bfd/bfd.h /

  $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h gconfig.h search_list.h /

  source.h symtab.h corefile.h gmon_io.h gmon_out.h hist.h /

  sym_ids.h utils.h

source.o: source.c gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h /

抱歉!评论已关闭.