0086-build-don-t-add-j-for-parallel-builds-with-Make-4.2.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Wed, 15 Jun 2016 19:31:34 +0200
  3. Subject: build: don't add -j for parallel builds with Make 4.2+
  4. Make usually passes -j and jobserver arguments as part of MAKEFLAGS. LEDE
  5. removes MAKEFLAGS to have better control of the build, and re-adds the
  6. jobserver arguments with -j to the Make commandline where desired.
  7. Make 4.2+ behave differently with these arguments passed on the commandline
  8. than in MAKEFLAGS: -j will override the jobserver argument and the job
  9. count will be unlimited.
  10. Moving the flags to MAKEFLAGS will need many packages to be changed and
  11. tested; therefore, we opt for a less invasive change for now and just
  12. remove -j for Make 4.2+, as the jobserver argument alone is enough to
  13. enable parallel builds for these Make versions.
  14. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
  15. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
  16. Backport of LEDE 6fb212f2933bbbdf2935124205717c9d0ca72b32
  17. diff --git a/include/host-build.mk b/include/host-build.mk
  18. index e2b5f2f..44401b8 100644
  19. --- a/include/host-build.mk
  20. +++ b/include/host-build.mk
  21. @@ -10,7 +10,7 @@ HOST_INSTALL_DIR ?= $(HOST_BUILD_DIR)/host-install
  22. HOST_BUILD_PARALLEL ?=
  23. ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),)
  24. - HOST_MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) -j)
  25. + HOST_MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j))
  26. else
  27. HOST_MAKE_J:=-j$(CONFIG_PKG_BUILD_JOBS)
  28. endif
  29. diff --git a/include/package.mk b/include/package.mk
  30. index c69d928..a99cdc6 100644
  31. --- a/include/package.mk
  32. +++ b/include/package.mk
  33. @@ -23,7 +23,7 @@ PKG_RELRO_PARTIAL ?= 1
  34. PKG_RELRO_FULL ?= 1
  35. ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),)
  36. - MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) -j)
  37. + MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j))
  38. else
  39. MAKE_J:=-j$(CONFIG_PKG_BUILD_JOBS)
  40. endif