Menu

#386 Makefile question: how to avoid retrying things?

open
nobody
None
1
2013-07-31
2013-01-08
Lee Worden
No

The bug tracker is a funny place for this, but why not...

I want to use make dependencies to keep track of what depends on what correctly. Unfortunately, when something in the middle of the chain fails, this can lead to WW trying that step over and over, because it's part of making a whole bunch of things that are made from it. In a wiki page with multiple image files and .out files, if one expensive step fails it can be rerun many times, which takes a long time.

I'd like to have a way to program make so that it will try to make a given .out file once when its prerequisites change, and then not again until a prerequisite changes again. I think Jonathan and I talked about this before, but I don't think we came up with an answer.

Discussion

  • Jonathan Dushoff

    There are a lot of different potential issues here when you talk about chains, and failing in the middle. But to answer your direct question:

    a.out.try: <prereqs>
        - $(MAKE) a.out
        touch $@
    

    You can make a default rule, and specify the prereqs separately:

    a.out.try: <prereqs>
    
    %.try: 
        - $(MAKE) $*
        touch $@
    

    I don't know if there's a practical way to get around specifying the prereqs by hand, using magical make variable manipulation ...

    You can then do things like (not tested):

    a.sim: a.out.try
        a.out > $@
    
     
  • Lee Worden

    Lee Worden - 2013-07-31

    Ticket moved from /p/workingwiki/feature-requests/58/

     

Anonymous
Anonymous

Add attachments
Cancel