编译大型项目的最佳方式 [英] Best Way to Compile Large Project

查看:42
本文介绍了编译大型项目的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个Linux机器上有一个大项目,可能最终有几个

百''C''源文件,需要编译并链接成几个

可执行文件。


并非所有的可执行文件都会使用所有文件(即某些符号没有

链接器引用)。


该项目自然会被分解为几个或更多

子目录。


问题:


a)一般来说构建的最佳方式是什么?将所有的.c文件编译成

对应的.o文件,然后明确地链接.o文件?


b)任何想法都可以用 make?


c)关于链接器限制的任何想法?


谢谢。

解决方案

" David T. Ashley" < dt*@e3ft.comwrites:


我在一个Linux机器上有一个大项目,可能最终有几个

''' C''源文件,需要编译并链接成几个

可执行文件。


并非所有可执行文件都将使用所有文件(即没有

链接器引用某些符号)。


该项目自然会被分解为几个或更多

子目录。


问题:


a)一般来说构建的最佳方法是什么?将所有.c文件编译成

对应的.o文件,然后显式链接.o文件?



是的。另一种选择,如果项目很大,子部分以不同的速度发展,那就是制作子项目库(模块)。


另外,它可以更快地构建库并链接几个

程序与这些库的选择,而不是每次都链接所有目标文件中的这些

程序。 (更好的基准测试,

它取决于项目)。


b)任何关于这样做的想法"使" ;?



是的。但请先阅读此内容:

http://members.canb.auug.org.au/~mil...cons-harm.html


ie。只使用一个Makefile。


c)关于链接器限制的任何想法?



无。我脑子里空空如也。对不起。

-

__Pascal Bourguignon__ http ://www.informatimago.com/


规格适用于弱者和胆怯!


< blockquote> David T. Ashley写道:


我在Linux机器上有一个大型项目,可能最终有几个

百分之一'C ''源文件,需要编译并链接成几个

可执行文件。


并非所有可执行文件都会使用所有文件(即将是没有

链接器引用某些符号)。


该项目自然会被分解为几个或更多

子目录。


问题:


a)一般来说构建的最佳方式是什么?将所有的.c文件编译成

对应的.o文件,然后明确地链接.o文件?


b)任何想法都可以用 make" ;?


c)关于链接器限制的任何想法?


谢谢。



< OT>

你试过Eclipse和CDT吗?
http://www.eclipse.org/
http://www.eclipse.org/cdt/

< / OT>




" David T. Ashley" < dt*@e3ft.com写在消息中

新闻:nB ******************* @ fe178.usenetserver.com。 ..


我在Linux机器上有一个大项目,最终可能有几个

百''C''源文件,需要编译并链接到



几个


可执行文件。


并非所有的可执行文件都会使用所有文件(即会有



no


链接器引用某些符号)。


该项目自然会被分解为几个或更多

子目录。

问题:


a)一般来说构建的最佳方式是什么?将所有的.c文件编译成

对应的.o文件,然后明确地链接.o文件?


b)任何想法都可以用 make?


c)关于链接器限制的任何想法?


谢谢。



构建工具不是clc的主题,但你可以先看看

at make。上一次这个董事会的一些人试图回答关于制造的问题。有几个人表示他们已经有了b $ b $ n nlue最好通过搜索和使用你的手册来完成。


<< OT>>

如果你有完全安装的开发环境,你可以看看autoconf和automake。但是,它们随附了

警告你应该看一下,这可能会导致你获得更好的工具。

<< / OT>>


I have a large project on a Linux box that may eventually have several
hundred ''C'' source files, which need to be compiled and linked into several
executables.

Not all of the executables will use all of the files (i.e. there would be no
linker references to some symbols).

The project will naturally be broken down into several or more
subdirectories.

Questions:

a)What is the best way in general to build? Compile all the .c files into
corresponding .o files, and then link the .o files explicitly?

b)Any thoughts on doing this with "make"?

c)Any thoughts on the limitations of the linker?

Thanks.

解决方案

"David T. Ashley" <dt*@e3ft.comwrites:

I have a large project on a Linux box that may eventually have several
hundred ''C'' source files, which need to be compiled and linked into several
executables.

Not all of the executables will use all of the files (i.e. there would be no
linker references to some symbols).

The project will naturally be broken down into several or more
subdirectories.

Questions:

a)What is the best way in general to build? Compile all the .c files into
corresponding .o files, and then link the .o files explicitly?

Yes. An alternative, if the project is big, with subparts evolving at
different paces, would be to make libraries of subprojects (modules).

Also, it could be faster to build the libraries and link several
programs with a choice of these libraries, rather than linking these
programs from all the object files everytime. (Better benchmark it,
it''d depend on the project).

b)Any thoughts on doing this with "make"?

Yes. But read this first:

http://members.canb.auug.org.au/~mil...cons-harm.html

ie. use only one Makefile.

c)Any thoughts on the limitations of the linker?

None. I''ve got an empty brain. Sorry.
--
__Pascal Bourguignon__ http://www.informatimago.com/

"Specifications are for the weak and timid!"


David T. Ashley wrote:

I have a large project on a Linux box that may eventually have several
hundred ''C'' source files, which need to be compiled and linked into several
executables.

Not all of the executables will use all of the files (i.e. there would be no
linker references to some symbols).

The project will naturally be broken down into several or more
subdirectories.

Questions:

a)What is the best way in general to build? Compile all the .c files into
corresponding .o files, and then link the .o files explicitly?

b)Any thoughts on doing this with "make"?

c)Any thoughts on the limitations of the linker?

Thanks.

<OT>
Have you tried Eclipse and CDT?
http://www.eclipse.org/
http://www.eclipse.org/cdt/
</OT>



"David T. Ashley" <dt*@e3ft.comwrote in message
news:nB*******************@fe178.usenetserver.com. ..

I have a large project on a Linux box that may eventually have several
hundred ''C'' source files, which need to be compiled and linked into

several

executables.

Not all of the executables will use all of the files (i.e. there would be

no

linker references to some symbols).

The project will naturally be broken down into several or more
subdirectories.

Questions:

a)What is the best way in general to build? Compile all the .c files into
corresponding .o files, and then link the .o files explicitly?

b)Any thoughts on doing this with "make"?

c)Any thoughts on the limitations of the linker?

Thanks.

Build tools are off topic for clc, but you could start by looking
at make. The last time some of the folks on this board tried to
respond to a questions about "make" several showed they had
noclue Best done by a search and use of your man pages.

<<OT>>
If you have a fully installed development environment you may
take a look at autoconf and automake. But, they come with
caveats with you should look at as well, which may lead you
to better tools.
<</OT>>


这篇关于编译大型项目的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆