2

Always when i want to compile using make command in linux I run it with -j9 to set number of threads to be used. Is there any way to set it permanently in the environment path or .bashrc file or any other way?

abdolahS
  • 663
  • 12
  • 35

1 Answers1

8

You can set GNUMAKEFLAGS environment variable with extra flags to pass to GNU make, e.g.:

export GNUMAKEFLAGS=-j9

in your shell start-up scripts.

GNUMAKEFLAGS

Other flags parsed by make. You can set this in the environment or a makefile to set make command-line flags. GNU make never sets this variable itself. This variable is only needed if you’d like to set GNU make-specific flags in a POSIX-compliant makefile. This variable will be seen by GNU make and ignored by other make implementations. It’s not needed if you only use GNU make; just use MAKEFLAGS directly.

Maxim Egorushkin
  • 131,725
  • 17
  • 180
  • 271
  • 3
    Just a note, `GNUMAKEFLAGS` is only available in GNU make 4.0 and above. `MAKEFLAGS` is always available but note the caveat in the documentation above. – MadScientist Dec 12 '16 at 14:01