473,698 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Best Way to Compile Large Project

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.

Dec 28 '06 #1
30 3860
"David T. Ashley" <dt*@e3ft.comwr ites:
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/

"Specificat ions are for the weak and timid!"
Dec 28 '06 #2
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>

Dec 28 '06 #3

"David T. Ashley" <dt*@e3ft.comwr ote in message
news:nB******** ***********@fe1 78.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>>
Dec 28 '06 #4
b)Any thoughts on doing this with "make"?
>
We're in a situation much like your own. More then 100 files, at least 10
applications build from both our "framework" code and application specific
code.

If you consider make then try out makepp instead:
http://makepp.sourceforge.net/

I've used it for like 3 years for now and don't regret it at all!
It's suppose to be a make replacement and it solves several issues that make
has.
E.g. it has an automatic dependency scanner and I've never suffered from
files which were not correctly recompiled.
Also it won't need recursing (in most cases) like traditional make.

Besides you can write extra scripts for it in perl.

The downside is though that it's a bit slower since it's written in perl.
However this is a cheap price to pay. Also the latest build from CVS is
nessecary but not always stable. I've contributed with alot of feedback to
the project so far but usually it's only for the better.

One more thing is that it's very portable. We use it on Windows, Linux,
Macosx, Solaris, AIX and HP-UX and also support several cross compilers
without additional scripts or applications.

At least if you consider make then give this one a try.

-- Henrik
Dec 28 '06 #5
On Wed, 27 Dec 2006 22:11:31 -0500
"David T. Ashley" <dt*@e3ft.comwr ote:
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.
That's not a large project :)
Not all of the executables will use all of the files (i.e. there
would be no linker references to some symbols).
Then you should consider using shared objects (.so libraries).
The project will naturally be broken down into several or more
subdirectories.
One hopes so. Also consider using a version control system. Subversion
is pretty neat and a doddle to set up.
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?
See above. One would normally group the related functions into shared
libraries, and then link the various programs against these libraries.
Just linking everything statically is so twentieth century, dear :)
>
b)Any thoughts on doing this with "make"?
Make is the time-honoured way to do this. You need to spend some time
mastering its syntax, but once you know how to use it, make is a very
powerful tool. There are alternatives to make, but they have their own
limitations and idiosyncrasies, in addition to being niche products.
c)Any thoughts on the limitations of the linker?
Unless you have some specific requirements you did not mention, rest
assured that for a project like yours (building a few executables from
a moderate number of source files) the Unix linkers have no
limitations.

--
Stefaan A Eeckels
--
"We have gone from a world of concentrated knowledge and wisdom to one
of distributed ignorance. And we know and understand less while being
increasingly capable." Prof. Peter Cochrane, formerly of BT Labs
(With thanks to Brian Hamilton Kelly)
Dec 28 '06 #6

Barry wrote:
"David T. Ashley" <dt*@e3ft.comwr ote in message
news:nB******** ***********@fe1 78.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"?
Yes.

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.
What also tends to be revealed by make *questions* is that the
questioner has not read 'info make'[1], which should a first step to
any serious use of it.

[1] Online here: http://www.gnu.org/software/make/manual/make.html
>
<<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>>
Dec 28 '06 #7
David T. Ashley wrote:
b)Any thoughts on doing this with "make"?
IMHO once any project grows to anything over one or two files,
using make is the only way to go.

Also if you take a little bit of time to understand make files:

http://www.zeusedit.com/forum/viewtopic.php?t=300

you'll find make is pretty easy to use.

Jussi Jumppanen
Author: Zeus for Windows
http:\\www.zeusedit.com

Dec 28 '06 #8
toby wrote:
What also tends to be revealed by make *questions* is that the
questioner has not read 'info make'[1], which should a first step to
any serious use of it.
Provided you have a specific reason to use GNU make. If not, then
reading some documentation that isn't GNU-specific might be a better
idea.

- Logan
Dec 29 '06 #9
ju****@zeusedit .com wrote:
Jussi Jumppanen
Author: Zeus for Windows
http:\\www.zeusedit.com
^^

I'm sure you meant to give a legal URI there...

- Logan
Dec 29 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1715
by: Johan Nilsson | last post by:
I've seen many alternatives when it comes to referring to types defined in parent/sibling/other namespaces. Consider the following hypothetical namespace layout: namespace company { namespace lib { class SomeClass {};
6
2364
by: Peter Hickman | last post by:
I have a program that requires x strings all of y length. x will be in the range of 100-10000 whereas the strings will all be < 200 each. This does not need to be grown once it has been created. Should I allocate x strings of y length or should I allocate a single string x * y long? Which would be more efficient and / or portable? Thank you.
4
1451
by: Chris | last post by:
Where I work, we basically have 1 large ASP.NET application that we work on. This is compiled into one big DLL. I think it would be a good idea to somehow break up the project, so that if I am in the middle of development on some sub project, I don't have to push up that code to fix a bug in another part of the application.
10
3453
by: jojobar | last post by:
Hello, I am trying to use vs.net 2005 to migrate a project originally in vs.net 2003. I started with creation of a "web site", and then created folders for each component of the site. I read somewhere that each folder under the "web site" is compiled in separate assembly. I however, did not find that the "web site" creation in vs.net 2005 created any AssemblyInfo.cs file.
6
1291
by: Kevin Atherton | last post by:
Hello. I work for a large web company, and we are in the process of converting our old .asp pages to .aspx with VB code-behind. The solution includes 8 projects, all of which are very interwoven. The problem is that when I first open the IDE and load my solution, if I try to build or build all, it gets partway through the compile and then IDE simply goes away. There is no error, no fanfare, no warning, no indication that there is a...
27
1925
by: Rene | last post by:
I keep getting the following error every time I compile the solution under VS 2005: ---------------- Error 5 Unable to copy file "obj\Debug\xyz.dll" to "bin\Debug\xyz.dll". The process cannot access the file 'bin\Debug\xyz.dll' because it is being used by another process. ----------------
55
12805
by: Steve | last post by:
I have to develop several large and complex C++ hardware test programs that should work under DOS, most likely with 32-bit DOS extender. Development workstation OS would be Microsoft XP. Quite some time ago I worked in DOS, with Borland BC++ 4.1. I do not have it any more. Which compiler would you recommend me now? Which ones support serious DOS program development? Criterion should be number of available free library modules (graphic menu...
16
2805
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and efficient navigating within Visual Studio 2005. Let's say your project (or solution) has dozens of forms and hundreds or even thousands of routines. Two Questions: 1) BUILT-IN to Visual Studio 2005. What ideas do you have to quickly
4
2042
by: =?Utf-8?B?VzFsZDBuZTc0?= | last post by:
When one architects a new project one of the first steps in the decision is to decide on the layers. (In my opinion anyway) One architecture that I have used before is to go solid OO and create objects, which normally are very small and only deals with the stuff pertaining to that object, then break it down into Business Process, Process Controllers and Data Access Objects for each "Object", each of which is created in it's very own .Net...
0
8674
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8893
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7723
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4366
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2328
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.