Makefile.parallel 570 B

1234567891011121314151617181920212223242526
  1. #
  2. # Do a parallel build with multiple jobs, based on the number of CPUs online
  3. # in this system: 'make -j8' on a 8-CPU system, etc.
  4. #
  5. # (To override it, run 'make JOBS=1' and similar.)
  6. #
  7. ifeq ($(JOBS),)
  8. JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null)
  9. ifeq ($(JOBS),)
  10. JOBS := 1
  11. endif
  12. endif
  13. export JOBS
  14. $(info $(shell printf '# [ perf build: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build. ]\n'))
  15. #
  16. # Needed if no target specified:
  17. #
  18. all:
  19. @$(MAKE) --no-print-directory -j$(JOBS) $@
  20. %:
  21. @$(MAKE) --no-print-directory -j$(JOBS) $@