base.mk 1.2 KB

12345678910111213141516171819202122232425
  1. # infrastructure for makefilet itself
  2. # run jobs in parallel (if more than one CPU core is available)
  3. # Call make with the argument "-j 1" in order to disable automatic parallel processing.
  4. ifneq "$(findstring -j,$(MAKEFLAGS)))" ""
  5. MAX_PARALLEL_JOBS ?= $(shell { nproc || getconf "_NPROCESSORS_ONLN" || echo "1"; } 2>/dev/null)
  6. ifneq "$(MAX_PARALLEL_JOBS)" ""
  7. MAKEFLAGS += --jobs=$(MAX_PARALLEL_JOBS)
  8. # group output by target (no interleaving of output from different targets)
  9. ifneq "$(findstring -O,$(MAKEFLAGS)))" ""
  10. MAKEFILET_OUTPUT_SYNCHRONIZATION ?= line
  11. MAKEFLAGS += --output-sync=$(MAKEFILET_OUTPUT_SYNCHRONIZATION)
  12. endif
  13. endif
  14. endif
  15. ifneq "$(MAKEFILET_DOWNLOAD_VERSION)" ""
  16. # the requested download version shall not be newer than the active version
  17. ifneq "$(MAKEFILET_DOWNLOAD_VERSION)" "$(shell printf '%s\n' '$(MAKEFILET_DOWNLOAD_VERSION)' 'v$(MAKEFILET_CURRENT_VERSION)' | sort --version-sort | head -1)"
  18. # "$(warning ...)" is not allowed outside of a target - thus we inject an error message via an assignment
  19. _ = $(shell echo >&2 "WARNING: The currently active version of makefilet is older than the version specified via 'MAKEFILET_DOWNLOAD_VERSION' (v$(MAKEFILET_CURRENT_VERSION) < $(MAKEFILET_DOWNLOAD_VERSION)).")
  20. endif
  21. endif