Automatically setting jobs (-j) flag for a multicore machine?

前端 未结 10 927
伪装坚强ぢ
伪装坚强ぢ 2020-12-12 22:23

I have a Makefile on a machine that has a ton of cores in it, but I always seem to forget to write -jX when compiling my project and it takes way longer than it

10条回答
  •  醉梦人生
    2020-12-12 23:26

    On Ubuntu 16.4 using all CPU cores:

    export MAKEFLAGS='-j$(nproc)'
    

    or

    export MAKEFLAGS='-j 2'
    

提交回复
热议问题