如何用GCC编译出动态库文件(*.so)

使用下面的makefile

view plaincopy to clipboardprint?
01.CC=gcc  
02.CFLAGS=-Wall   -ggdb   -fPIC  
03. 
04.all:   libfunc  
05. 
06.libfunc:func.o   func1.o  
07.                $(CC)   -shared   -Wl,-soname,libfunc.so.1   -o   libfunc.so.1.1   $ <  
08.                ln   -sf   libfunc.so.1.1   libfunc.so.1  
09.                ln   -sf   libfunc.so.1   libfunc.so  
10. 
11.%.o:%.c  
12.                $(CC)   -c   $(CFLAGS)   -o   $@   $ <  
13. 
14.clean:  
15.                rm   -fr   *.o  
16.                rm   -fr   *.so*  

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/asiainfolf/archive/2011/04/29/6372700.aspx

posted on 2011-04-29 18:45  sohu2000000  阅读(373)  评论(0编辑  收藏  举报

导航