Build: let a parent make control the wxWidgets build jobs (#1903)

* Build: let a parent make control the wxWidgets build jobs

The wxbuild target always runs the wxWidgets sub-make with -j 4. When
VeraCrypt is built from a parent "make -jN" (for example by a
distribution or embedded build system), the explicit -j 4 overrides the
parent's job count and jobserver: the wx build ignores -j1 and the
configured parallelism and can oversubscribe the machine.

Keep -j 4 as the default for a standalone build, but leave the job count
to the parent make when it was started with -j: MFLAGS then contains -j,
-jN or the jobserver option (-j1 since GNU make 4.2; older makes treat a
-j1 parent like a serial one without -j). MFLAGS is used rather than
MAKEFLAGS because it holds only options, not command-line variable
definitions, so a variable value containing "-j" cannot match.

See also #717, which proposed dropping -j 4 for the same reason.

Signed-off-by: Ville Takio <ville+git@takio.fi>

* Build: also detect grouped -j flags; pass OpenWrt jobs to wxbuild

Address review:

- GNU make 3.81 can group single-letter options in MFLAGS, e.g. "-sj"
  for the -s this Makefile adds plus a bare -j, which the previous
  pattern missed. Look for "j" in every single-dash option word instead,
  skipping the options that take an argument (-C, -E, -I, -O, -W, -f,
  -o). An option argument containing a space followed by "-j" can still
  be mistaken for a job option; this is documented next to the variable.
- The OpenWrt recipe built wxWidgets without the package's job settings,
  so it still ran 4 jobs. Pass $(PKG_JOBS) and an empty WX_MAKE_JOBS, so
  the wxWidgets build follows OpenWrt's settings, including serial
  builds.

Signed-off-by: Ville Takio <ville+git@takio.fi>

---------

Signed-off-by: Ville Takio <ville+git@takio.fi>
This commit is contained in:
Ville Takio
2026-10-10 12:10:26 +09:00
committed by GitHub
parent 37ce73775f
commit 98ef739cd8
2 changed files with 12 additions and 2 deletions
@@ -74,7 +74,7 @@ VC_COMMON_MAKE_FLAGS = \
define Build/Compile
+$(MAKE) -C "$(PKG_BUILD_DIR)/veracrypt/src" $(VC_COMMON_MAKE_FLAGS) clean
+$(MAKE) -C "$(PKG_BUILD_DIR)/veracrypt/src" $(VC_COMMON_MAKE_FLAGS) wxbuild
+$(MAKE) -C "$(PKG_BUILD_DIR)/veracrypt/src" $(PKG_JOBS) $(VC_COMMON_MAKE_FLAGS) WX_MAKE_JOBS= wxbuild
+$(MAKE) -C "$(PKG_BUILD_DIR)/veracrypt/src" $(PKG_JOBS) $(VC_COMMON_MAKE_FLAGS)
endef