Chinaunix首页 | 论坛 | 博客
  • 博客访问: 65154
  • 博文数量: 17
  • 博客积分: 673
  • 博客等级: 中士
  • 技术积分: 150
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-17 16:48
文章分类

全部博文(17)

文章存档

2012年(5)

2011年(12)

分类: LINUX

2011-08-26 18:12:52


  pre-process ==> compiler ==> assembler ==> link
  target file: .o
  static lib: .a

  "make" excute the "cmd" when the target is updated.
  If the final target is not dependent on one rule, the rule will not be excuted.
  (Except example, like "make clean")

==========================================================

Order-only prerequisites can be speci?ed by placing a pipe symbol (|) in the prerequisites list: any prerequisites to
the left of the pipe symbol are normal; any prerequisites to the right are order-only.
basic pattern (ruler):
  TARGETS : NORMAL-PREREQUISITES | ORDER-ONLY-PREREQUISITES
  order-only dependency modified will not rebuild the target

==========================================================

 objects := $(patsubst %.c,%.o,$(wildcard *.c))
 foo : $(objects)
 cc -o foo $(objects)

==========================================================

like:
  @echo "***"

==========================================================

In Linux .so files are dynamic library files, often called shared objects or shared libraries, which are loaded and linked to an executable at runtime. These .so files are analogous to .dll files in a Windows environment. 

On the other hand, .a files are static library files that get linked to code at compile time.

NI-VISA uses .so files while NI-488.2 uses .a files.

==========================================================

ARCHIVE(MEMBER) 
这种书写方式只能出现在规则的目标和依赖文件中,不能出现在规则的命令行中。
含有这种表达方式规则的命令行只能是“ar”命令或者其它可以对库成员进行操作的命令。
ar命令可以用来创建、修改库,也可以从库中提出单个模块。库是一单独的文件,里面包含了按照特定的结构组织起来的其它的一些文件(称做此库文件的member)。原始文件的内容、模式、时间戳、属主、组等属性都保留在库文件中。


==========================================================

如果同时存在静态和动态库,不特别指定的话,将与动态库相连接。 
当规则中依赖文件列表中存在一个“-lNAME”形式的文件时。make将根据“NAME”首先
搜索当前系统可提供的共享库,如果当前系统不能提供这个共享库,则再搜索它的静态库。
如果既要和libhello进行静态连接,又要和libbye进行动态连接,其命令应为:
 $gcc testlib.o -o testlib -WI,-Bstatic -lhello -WI,-Bdynamic -lbye
参见: http://blog.csdn.net/zougangx/article/details/3073569

==========================================================

How do I list the symbols in a .so file

除了nm -D 和 readelf -Ws 以外 objdump -T  也是能够work的

==========================================================
ld生成share lib的时候会默认delete unused symbols
workaround就要依靠whole-archive等option

阅读(1274) | 评论(0) | 转发(0) |
0

上一篇:ls 常用alias

下一篇:perforce 相关

给主人留下些什么吧!~~