Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

makefile woes
Hi folks,

I am having some trouble getting a makefile to work in the way I need it
to.  It involves building a header file dependency list using the gcc
-MM feature, but either it's not always being made when it needs to be,
or it is made every time even when it isn't needed (or even desired, for
targets like clean, for instance).

I've tried various combinations of:
1) marking it .PHONY
2) setting it a prerequisite for the object files
3) giving it the .c files as prerequisites
...all to no avail.

One problem seems to be that I can't find a way of conditionally
including it only for the targets the require those dependencies to be
listed in the makefile (namely the object files).  make clean and
friends obviously have no need for this file (make clean removes it
even) and as such its absence *should* not cause any trouble.

The other problem is that I can't seem to ensure it gets built only when
it needs to be, without making it being unconditionally.

I'm fumbling around in the dark here, as the info pages are not very
helpful and google hasn't turned up much either.  The suggested solution
in the info page (writing a separate makefile for each source file)
seems far from optimal and I've never seen this technique used in practice.

What are other people doing?

Thanks in advance,
Koster

Report this thread to moderator Post Follow-up to this message
Old Post
T Koster
04-11-05 09:00 PM


Re: makefile woes
T Koster wrote:
> Hi folks,
>
> I am having some trouble getting a makefile to work in the way I need it
> to.  It involves building a header file dependency list using the gcc
> -MM feature, but either it's not always being made when it needs to be,
> or it is made every time even when it isn't needed (or even desired, for
> targets like clean, for instance).
>
> I've tried various combinations of:
>     1) marking it .PHONY
>     2) setting it a prerequisite for the object files
>     3) giving it the .c files as prerequisites
> ...all to no avail.

I have sone somthing similar in MakeXS.  MakeXS is just a huge Makefile
(to the first approximation).

>
> One problem seems to be that I can't find a way of conditionally
> including it only for the targets the require those dependencies to be
> listed in the makefile (namely the object files).  make clean and
> friends obviously have no need for this file (make clean removes it
> even) and as such its absence *should* not cause any trouble.
>
> The other problem is that I can't seem to ensure it gets built only when
> it needs to be, without making it being unconditionally.

You only need to include it if it exists. (hint)

>
> I'm fumbling around in the dark here, as the info pages are not very
> helpful and google hasn't turned up much either.  The suggested solution
> in the info page (writing a separate makefile for each source file)
> seems far from optimal and I've never seen this technique used in practice.[/color
]

I'm actually considering adding a per source Makefile that can be used
to tailor compilation of each source (if needed).  I have not needed to
do this yet.

>
> What are other people doing?

MakeXS does this.  See if the strategy I employed there works for you.

www.makexs.com


Report this thread to moderator Post Follow-up to this message
Old Post
Gianni Mariani
04-12-05 08:58 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Unix Programming archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:06 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.