Detect number of CPU cores used for `make`

Alt. implementation of #401, #434
Merge branch 'num-cpu-cores'