Makefile timestamp check to make file rebuild

J

Jeff

Ive searched google for this answer as well as the gnu makefile
documentation page and I cant seem to find what Im looking for.

Im using gmake on solaris to build a project. I know that this would
work for a single file:

file.o: file.cpp
CC -c file.cpp -o file.o

But what I want to do is more general, since I have a list of OBJECTS
I want OBJECTS to somehow check all their associated .cpp files
and rebuild if one of them has been changed without having to
list each file seperately as above.

something like:

$(OBJECTS): ($SOURCES)
CC -c $*.cpp -o $@

How do I make this work?
 
W

Walter Roberson

Ive searched google for this answer as well as the gnu makefile
documentation page and I cant seem to find what Im looking for.
Im using gmake on solaris to build a project.

The details of gmake are not relevant to the C language. Please
ask in a newsgroup that deals with your development environment.

But what I want to do is more general, since I have a list of OBJECTS
I want OBJECTS to somehow check all their associated .cpp files
and rebuild if one of them has been changed without having to
list each file seperately as above.
something like:
$(OBJECTS): ($SOURCES)
CC -c $*.cpp -o $@
How do I make this work?

[OT]
Read the gmake documentation about "Inference rules".
 
R

Robbie Hatley

Jeff said:
(a question about gnu make)

This is off-topic in this group as it has nothing to do with C.

For help with gnu utils (such as make), ask in the following
newsgroup:

gnu.utils.help
 
R

Richard

Robbie Hatley said:
This is off-topic in this group as it has nothing to do with C.

For help with gnu utils (such as make), ask in the following
newsgroup:

gnu.utils.help

Aha. I thought so.

One can always tell.
 
M

Micah Cowan

IOW, nobody here gives a shit about you or your problems.

Said in response to a message which, unlike yours, actually gave the
poster advice on where to find the answer.
 
K

Kenny McCormack

Said in response to a message which, unlike yours, actually gave the
poster advice on where to find the answer.

It did? Show me where.

(Unless you've clipped something relevant, the above looks like "Not
here - try someplace else")
 
S

santosh

Kenny said:
It did? Show me where.

(Unless you've clipped something relevant, the above looks like "Not
here - try someplace else")

*You* clipped the following from Walter's reply to the OP:
But what I want to do is more general, since I have a list of OBJECTS
I want OBJECTS to somehow check all their associated .cpp files
and rebuild if one of them has been changed without having to
list each file seperately as above.
something like:
$(OBJECTS): ($SOURCES)
   CC -c $*.cpp -o $@
How do I make this work?

[OT]
Read the gmake documentation about "Inference rules".

<<<<

So not only did Walter give a suggestion as to which group to post to,
he also gave a hint as to where to look in gmake's documentation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top