Pregunta

I asked a question about setting the '-j8' flag globally, and the answer suggested setting MAKEFLAGS="-j8" in /etc/environment, but they said it could be a problem for recursive make.

However, GNU documentation says that -j8 will be treated in a special way and will not be passed down to recursive invocations of make:

The ‘-j’ option is a special case (see Parallel Execution). If you set it to some numeric value ‘N’ and your operating system supports it (most any UNIX system will; others typically won't), the parent make and all the sub-makes will communicate to ensure that there are only ‘N’ jobs running at the same time between them all. Note that any job that is marked recursive (see Instead of Executing Recipes) doesn't count against the total jobs (otherwise we could get ‘N’ sub-makes running and have no slots left over for any real work!)

So is setting MAKEFLAGS="-j8" in /etc/environment problematic or not?

¿Fue útil?

Solución

If your operating system supports it, it's not problematic. If for some reason it doesn't, or your make isn't gnu make, it's not a good idea. Also, it's not clear if you execute a program in your make that executes another make, whether or not the two makes will communicate.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top