Linux OR BSD: How to speed up compile time with GNU make

www.lau‮.irutt‬com
Linux OR BSD: How to speed up compile time with GNU make

There are a few strategies you can use to speed up compile time when using GNU make on Linux or BSD systems:

  1. Use make -j to enable parallel builds: By default, make builds targets sequentially. You can use the -j option to specify the number of jobs (targets) that can be built in parallel. For example, make -j4 will allow make to build up to four targets at the same time.

  2. Use make -l to specify the number of concurrent jobs: The -l option allows you to specify the number of jobs that can be run concurrently. This can be useful if you want to limit the load on your system.

  3. Use make --load-average=N to specify the maximum load average: The --load-average option allows you to specify the maximum load average that should be maintained during the build process. This can be useful if you want to limit the impact of the build on your system's performance.

  4. Use make -k to continue building after errors: By default, make stops building when it encounters an error. The -k option allows make to continue building as many targets as possible, even if some targets fail. This can be useful if you want to complete as much of the build process as possible, even if some targets fail.

  5. Use a faster build tool: If you're using make and you're still not satisfied with the build times, you may want to consider using a faster build tool such as ninja or scons. These tools can often build projects faster than make, especially for larger projects with many targets.

Created Time:2017-10-30 10:17:37  Author:lautturi