multiple targets from one recipe and parallel execution

后端 未结 5 1265
醉梦人生
醉梦人生 2020-12-03 15:19

I have a project which includes a code generator which generates several .c and .h files from one input file with just one invocation of the code generator. I have a rule w

5条回答
  •  抹茶落季
    2020-12-03 15:47

    Here is the solution that seemed to work for me (credit to @Ivan Zaentsev for the main solution and to @alexei for pointing out the problem with it). It is similar to the original approach with one major change. Instead of generating temporary files (*.gen as suggested), it just touches the files that depend on the INTERMEDIATE file. :

    default: f
    
    .INTERMEDIATE: temp
    a b c: temp
        touch $@
    
    temp: i1 i2
        echo "BUILD: a b c"
        cat i1 i2 > a
        cat i1 i2 > b
        cat i1 i2 > c
    
    e: a b c
        echo "BUILD: e"
        touch $@
    
    f: e
        echo "BUILD: f"
        touch $@
    

提交回复
热议问题