0

Is there a way to set make to always do 8 jobs simultaneously, akin to 'make -j 8', but in a permanent way, even between restarts of the computer?

Some environment variable, perhaps? I'm using Ubuntu.

sashoalm
  • 75,001
  • 122
  • 434
  • 781
  • yes, you are close. use alias; add it to your .bashrc (assuming bash). alias pmake="make -j8" – devnull Jul 04 '13 at 17:21
  • Would that also work for scripts, or when make is invoked by an IDE? – sashoalm Jul 04 '13 at 17:34
  • I assume that it'd work unless your IDE knows nothing about env. – devnull Jul 04 '13 at 17:37
  • Aliases and functions typically won't work in scripts or IDE. Sometimes the shell is not used at all, when make is invoked from an IDE, and when the shell is invoked it's often run in a mode where these are not available. You could create a wrapper script and use that instead of `make` or use the `MAKEFLAGS` variable. – MadScientist Jul 04 '13 at 18:30

1 Answers1

1

You can try the $(MAKEFLAGS) variable:

export MAKEFLAGS=j8

But read the caveats and suggestions here.

Community
  • 1
  • 1
Keith Flower
  • 4,032
  • 25
  • 16
  • I just found this in [make documentation](http://www.gnu.org/software/make/manual/html_node/Options_002fRecursion.html) - "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’... – sashoalm Jul 05 '13 at 06:29