Message ID | 1387363007-19846-8-git-send-email-fabio.porcedda@gmail.com |
---|---|
State | Superseded |
Headers | show |
On 18/12/13 11:36, Fabio Porcedda wrote: > Add '+' prefix to the $($(PKG)_BUILD_CMDS) and $($(PKG)_INSTALL*_CMDS) > commands to enable jobserver for the sub-make. > > Without the '+' prefix GNU make does not detect the sub-make so it > disable the jobserver for the sub-make. $(PKG)_BUILD_CMDS is a multiline define, and the recursive make call may not be the first command. Can you check if this still works if the build commands are something like: define FOO_BUILD_CMDS echo "Hello world!" $(MAKE) -C $(@D) endef Regards, Arnout > > From GNU make documentation: > Using the MAKE variable has the same effect as using a ‘+’ character > at the beginning of the recipe line. This special feature is only > enabled if the MAKE variable appears directly in the recipe: it does > not apply if the MAKE variable is referenced through expansion of > another variable. In the latter case you must use the ‘+’ token to get > these special effects. > > Signed-off-by: Fabio Porcedda<fabio.porcedda@gmail.com> [snip]
>>>>> "Fabio" == Fabio Porcedda <fabio.porcedda@gmail.com> writes: > Add '+' prefix to the $($(PKG)_BUILD_CMDS) and $($(PKG)_INSTALL*_CMDS) > commands to enable jobserver for the sub-make. > Without the '+' prefix GNU make does not detect the sub-make so it > disable the jobserver for the sub-make. > From GNU make documentation: > Using the MAKE variable has the same effect as using a ‘+’ character > at the beginning of the recipe line. This special feature is only > enabled if the MAKE variable appears directly in the recipe: it does > not apply if the MAKE variable is referenced through expansion of > another variable. In the latter case you must use the ‘+’ token to get > these special effects. Wouldn't it make more sense to add the '+' to MAKE / MAKE1?
Hi Peter, thanks for reviewing, On Thu, Dec 19, 2013 at 9:32 PM, Peter Korsgaard <jacmet@uclibc.org> wrote: >>>>>> "Fabio" == Fabio Porcedda <fabio.porcedda@gmail.com> writes: > > > Add '+' prefix to the $($(PKG)_BUILD_CMDS) and $($(PKG)_INSTALL*_CMDS) > > commands to enable jobserver for the sub-make. > > > Without the '+' prefix GNU make does not detect the sub-make so it > > disable the jobserver for the sub-make. > > > From GNU make documentation: > > Using the MAKE variable has the same effect as using a ‘+’ character > > at the beginning of the recipe line. This special feature is only > > enabled if the MAKE variable appears directly in the recipe: it does > > not apply if the MAKE variable is referenced through expansion of > > another variable. In the latter case you must use the ‘+’ token to get > > these special effects. > > Wouldn't it make more sense to add the '+' to MAKE / MAKE1? Unfortunately that does not work, the '+' must be the first character of the command line, e.g.: PATH=/home/fabiopo/buildroot/output/host/bin:/home/fabiopo/buildroot/output/host/usr/bin:/home/fabiopo/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games LD_LIBRARY_PATH="/home/fabiopo/buildroot/output/host/usr/lib:" PKG_CONFIG="/home/fabiopo/buildroot/output/host/usr/bin/pkg-config" PKG_CONFIG_SYSROOT_DIR="/" PKG_CONFIG_LIBDIR="/home/fabiopo/buildroot/output/host/usr/lib/pkgconfig" PERLLIB="/home/fabiopo/buildroot/output/host/usr/lib/perl" +/usr/bin/make -j5 -C /home/fabiopo/buildroot/output/build/host-binutils-2.22/ /bin/sh: +/usr/bin/make: No such file or directory make: *** [/home/fabiopo/buildroot/output/build/host-binutils-2.22/.stamp_built] Error 127 Best regards
On Thu, Dec 19, 2013 at 6:27 PM, Arnout Vandecappelle <arnout@mind.be> wrote: > On 18/12/13 11:36, Fabio Porcedda wrote: >> >> Add '+' prefix to the $($(PKG)_BUILD_CMDS) and $($(PKG)_INSTALL*_CMDS) >> commands to enable jobserver for the sub-make. >> >> Without the '+' prefix GNU make does not detect the sub-make so it >> disable the jobserver for the sub-make. > > > $(PKG)_BUILD_CMDS is a multiline define, and the recursive make call may > not be the first command. Can you check if this still works if the build > commands are something like: > > define FOO_BUILD_CMDS > echo "Hello world!" > $(MAKE) -C $(@D) > endef The following test seems to work fine: define test echo test $($(PKG)_BUILD_CMDS) endef # Build $(BUILD_DIR)/%/.stamp_built:: @$(call step_start,build) @$(call MESSAGE,"Building") +$(test) ... Test output: ----- $ make BR2_JLEVEL= -j$((`getconf _NPROCESSORS_ONLN`+1)) -s wget-build >>> wget 1.14 Building test Making all in lib Making all in src Making all in doc Making all in po Making all in tests Making all in util ---- If i remove the '+' charter: ---- $ make BR2_JLEVEL= -j$((`getconf _NPROCESSORS_ONLN`+1)) -s wget-build >>> wget 1.14 Building test make[1]: warning: jobserver unavailable: using -j1. Add `+' to parent make rule. Making all in lib Making all in src Making all in doc Making all in po Making all in tests Making all in util ---- Best regards
>>>>> "Fabio" == Fabio Porcedda <fabio.porcedda@gmail.com> writes: Hi, >> Wouldn't it make more sense to add the '+' to MAKE / MAKE1? > Unfortunately that does not work, the '+' must be the first character > of the command line, e.g.: Ahh, ok :/
On 20/12/13 14:24, Fabio Porcedda wrote: > On Thu, Dec 19, 2013 at 6:27 PM, Arnout Vandecappelle <arnout@mind.be> wrote: >> On 18/12/13 11:36, Fabio Porcedda wrote: >>> >>> Add '+' prefix to the $($(PKG)_BUILD_CMDS) and $($(PKG)_INSTALL*_CMDS) >>> commands to enable jobserver for the sub-make. >>> >>> Without the '+' prefix GNU make does not detect the sub-make so it >>> disable the jobserver for the sub-make. >> >> >> $(PKG)_BUILD_CMDS is a multiline define, and the recursive make call may >> not be the first command. Can you check if this still works if the build >> commands are something like: >> >> define FOO_BUILD_CMDS >> echo "Hello world!" >> $(MAKE) -C $(@D) >> endef > > The following test seems to work fine: OK, good! Regards, Arnout > > define test > echo test > $($(PKG)_BUILD_CMDS) > endef > > # Build > $(BUILD_DIR)/%/.stamp_built:: > @$(call step_start,build) > @$(call MESSAGE,"Building") > +$(test) > ... > > Test output: > ----- > $ make BR2_JLEVEL= -j$((`getconf _NPROCESSORS_ONLN`+1)) -s wget-build >>>> wget 1.14 Building > test > Making all in lib > Making all in src > Making all in doc > Making all in po > Making all in tests > Making all in util > ---- > > If i remove the '+' charter: > ---- > $ make BR2_JLEVEL= -j$((`getconf _NPROCESSORS_ONLN`+1)) -s wget-build >>>> wget 1.14 Building > test > make[1]: warning: jobserver unavailable: using -j1. Add `+' to parent > make rule. > Making all in lib > Making all in src > Making all in doc > Making all in po > Making all in tests > Making all in util > ---- > > Best regards >
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index fc2e04e..95e56bc 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -170,7 +170,7 @@ $(BUILD_DIR)/%/.stamp_configured: $(BUILD_DIR)/%/.stamp_built:: @$(call step_start,build) @$(call MESSAGE,"Building") - $($(PKG)_BUILD_CMDS) + +$($(PKG)_BUILD_CMDS) $(foreach hook,$($(PKG)_POST_BUILD_HOOKS),$(call $(hook))$(sep)) $(Q)touch $@ @$(call step_end,build) @@ -179,7 +179,7 @@ $(BUILD_DIR)/%/.stamp_built:: $(BUILD_DIR)/%/.stamp_host_installed: @$(call step_start,install-host) @$(call MESSAGE,"Installing to host directory") - $($(PKG)_INSTALL_CMDS) + +$($(PKG)_INSTALL_CMDS) $(foreach hook,$($(PKG)_POST_INSTALL_HOOKS),$(call $(hook))$(sep)) $(Q)touch $@ @$(call step_end,install-host) @@ -188,7 +188,7 @@ $(BUILD_DIR)/%/.stamp_host_installed: $(BUILD_DIR)/%/.stamp_staging_installed: @$(call step_start,install-staging) @$(call MESSAGE,"Installing to staging directory") - $($(PKG)_INSTALL_STAGING_CMDS) + +$($(PKG)_INSTALL_STAGING_CMDS) $(foreach hook,$($(PKG)_POST_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep)) $(Q)if test -n "$($(PKG)_CONFIG_SCRIPTS)" ; then \ $(call MESSAGE,"Fixing package configuration files") ;\ @@ -204,7 +204,7 @@ $(BUILD_DIR)/%/.stamp_staging_installed: $(BUILD_DIR)/%/.stamp_images_installed: @$(call step_start,install-image) @$(call MESSAGE,"Installing to images directory") - $($(PKG)_INSTALL_IMAGES_CMDS) + +$($(PKG)_INSTALL_IMAGES_CMDS) $(foreach hook,$($(PKG)_POST_INSTALL_IMAGES_HOOKS),$(call $(hook))$(sep)) $(Q)touch $@ @$(call step_end,install-image) @@ -217,7 +217,7 @@ $(BUILD_DIR)/%/.stamp_target_installed: $($(PKG)_INSTALL_INIT_SYSTEMD)) $(if $(BR2_INIT_SYSV)$(BR2_INIT_BUSYBOX),\ $($(PKG)_INSTALL_INIT_SYSV)) - $($(PKG)_INSTALL_TARGET_CMDS) + +$($(PKG)_INSTALL_TARGET_CMDS) $(foreach hook,$($(PKG)_POST_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep)) $(Q)if test -n "$($(PKG)_CONFIG_SCRIPTS)" ; then \ $(RM) -f $(addprefix $(TARGET_DIR)/usr/bin/,$($(PKG)_CONFIG_SCRIPTS)) ; \
Add '+' prefix to the $($(PKG)_BUILD_CMDS) and $($(PKG)_INSTALL*_CMDS) commands to enable jobserver for the sub-make. Without the '+' prefix GNU make does not detect the sub-make so it disable the jobserver for the sub-make. From GNU make documentation: Using the MAKE variable has the same effect as using a ‘+’ character at the beginning of the recipe line. This special feature is only enabled if the MAKE variable appears directly in the recipe: it does not apply if the MAKE variable is referenced through expansion of another variable. In the latter case you must use the ‘+’ token to get these special effects. Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com> --- package/pkg-generic.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)