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.
I like the MAKEFLAGS
approach suggested by John Marshall in lieu of make
supporting something like an automatic .makerc project config file. However, I didn't want to have to remember to source a .env or similar environment variables beforehand (and unsetting them afterward).
A solution to this is to put the MAKEFLAGS
assignment at the top of the Makefile
itself:
#!/usr/bin/env make
MAKEFLAGS=s
.PHONY: foo
foo:
echo "hello, make"
Run it:
$ make foo
hello, make
Compared to running without the MAKEFLAGS=...
line:
$ make foo
echo "hello, make"
hello, make