Makefile timestamp check to make file rebuild

Discussion in 'C Programming' started by Jeff, Mar 6, 2008.

  1. Jeff

    Jeff Guest

    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?
     
    Jeff, Mar 6, 2008
    #1
    1. Advertising

  2. In article <>,
    Jeff <> wrote:
    >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".

    --
    "To all, to each! a fair good-night,
    And pleasing dreams, and slumbers light" -- Sir Walter Scott
     
    Walter Roberson, Mar 6, 2008
    #2
    1. Advertising

  3. "Jeff" <> wrote:

    > (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

    --
    Cheers,
    Robbie Hatley
    lonewolf aatt well dott com
    www dott well dott com slant user slant lonewolf slant
     
    Robbie Hatley, Mar 7, 2008
    #3
  4. Jeff

    Richard Guest

    "Robbie Hatley" <> writes:

    > "Jeff" <> wrote:
    >
    >> (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


    Aha. I thought so.

    One can always tell.
     
    Richard, Mar 7, 2008
    #4
  5. In article <fqpbc4$7mv$>,
    Walter Roberson <-cnrc.gc.ca> wrote:
    >In article <>,
    >Jeff <> wrote:
    >>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.


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

    You may find some or all of the following links helpful in understanding
    why this is so:

    http://en.wikipedia.org/wiki/Aspergers
    http://en.wikipedia.org/wiki/Clique
    http://en.wikipedia.org/wiki/C_programming_language
     
    Kenny McCormack, Mar 7, 2008
    #5
  6. Jeff

    Micah Cowan Guest

    (Kenny McCormack) writes:

    > In article <fqpbc4$7mv$>,
    > Walter Roberson <-cnrc.gc.ca> wrote:
    >>In article <>,
    >>Jeff <> wrote:
    >>The details of gmake are not relevant to the C language. Please
    >>ask in a newsgroup that deals with your development environment.

    >
    > 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.

    --
    Micah J. Cowan
    Programmer, musician, typesetting enthusiast, gamer...
    http://micah.cowan.name/
     
    Micah Cowan, Mar 7, 2008
    #6
  7. In article <>,
    Micah Cowan <> wrote:
    > (Kenny McCormack) writes:
    >
    >> In article <fqpbc4$7mv$>,
    >> Walter Roberson <-cnrc.gc.ca> wrote:
    >>>In article

    ><>,
    >>>Jeff <> wrote:
    >>>The details of gmake are not relevant to the C language. Please
    >>>ask in a newsgroup that deals with your development environment.

    >>
    >> 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.


    It did? Show me where.

    (Unless you've clipped something relevant, the above looks like "Not
    here - try someplace else")
     
    Kenny McCormack, Mar 7, 2008
    #7
  8. Jeff

    santosh Guest

    Kenny McCormack wrote:

    > In article <>,
    > Micah Cowan <> wrote:
    >> (Kenny McCormack) writes:
    >>
    >>> In article <fqpbc4$7mv$>,
    >>> Walter Roberson <-cnrc.gc.ca> wrote:
    >>>>In article

    >><>,
    >>>>Jeff <> wrote:
    >>>>The details of gmake are not relevant to the C language. Please
    >>>>ask in a newsgroup that deals with your development environment.
    >>>
    >>> 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.

    >
    > 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.
     
    santosh, Mar 7, 2008
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gary McGill
    Replies:
    9
    Views:
    4,900
    smith
    Dec 6, 2004
  2. Bennett Haselton
    Replies:
    5
    Views:
    616
    Bennett Haselton
    Aug 19, 2003
  3. Chris
    Replies:
    3
    Views:
    1,220
    Chris
    Feb 4, 2004
  4. =?Utf-8?B?ZGhucml2ZXJzaWRl?=

    Oops.. how can I rebuild a RESX file?

    =?Utf-8?B?ZGhucml2ZXJzaWRl?=, Feb 2, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    8,286
    =?Utf-8?B?ZGhucml2ZXJzaWRl?=
    Feb 2, 2005
  5. Abraham Khalil
    Replies:
    0
    Views:
    374
    Abraham Khalil
    Sep 29, 2003
Loading...

Share This Page