GNU make's -j option

前端 未结 6 539
走了就别回头了
走了就别回头了 2021-01-31 07:21

Ever since I learned about -j I\'ve used -j8 blithely. The other day I was compiling an atlas installation and the make failed. Eventually I tracked it down to things being ma

6条回答
  •  抹茶落季
    2021-01-31 08:06

    Just thought I would add to subsetbrew's answer as it does not show the effect clearly. However adding some sleep commands does. Well it works on linux.

    Then running make shows differences with:

    • make
    • make -j4

    all: toprule1
    
    toprule1: botrule2 subrule1 subrule2
        @echo toprule 1 start
        @sleep 0.01
        @echo toprule 1 done
    
    subrule1: botrule1
        @echo subrule 1 start
        @sleep 0.08
        @echo subrule 1 done
    
    subrule2: botrule1
        @echo subrule 2 start
        @sleep 0.05
        @echo subrule 2 done
    
    botrule1:
        @echo botrule 1 start
        @sleep 0.20
        @echo "botrule 1 done (good prerequiste in sub)"
    
    botrule2:
        @echo "botrule 2 start"
        @sleep 0.30
        @echo "botrule 2 done (bad prerequiste in top)"
    

提交回复
热议问题