I want to tell make that it shall always use -j4
option even if I didn't specify it vie command line. Normally i would do this in some configuration file (i.e. ~/.makerc
).
Does such file exist for gnu make?
Well, yes and no --- normally you would use an include file. Put your common configuration items together in a file, say common.mk
and add
include common.mk
at the top of your makefile. If the flag doesn't have a matching way to configure it from inside the make file, you can use a function
function mk {
make -j4 $*
}
Have a read about the $(MAKEFLAGS) variable:
export MAKEFLAGS=j4
However this will likely interfere with recursive-make-based builds (not that sensible people are using recursive make anyway!), by interfering with GNU make's ability to communicate with its sub-makes.
So the more sensible approach is probably a wrapper script or an alias or shell function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With