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

前端 未结 10 940
伪装坚强ぢ
伪装坚强ぢ 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:06

    It appears that the MAKEFLAGS environment variable can pass flags that are part of every make run (at least for GNU make). I haven't had much luck with this myself, but it might be possible to use -l rather than -j to automatically run as many jobs as are appropriate for the number of cores you have available.

提交回复
热议问题