[PATCH 1/1] Makefile: prevent race making libbb

Juro Bystricky juro.bystricky at intel.com
Mon Sep 12 21:37:41 UTC 2016


This patch fixes the following error due to a race condition with parallel make:

libbb/appletlib.c:164:13: error: 'NUM_APPLETS' undeclared (first use in this function)
  while (i < NUM_APPLETS) {
             ^~~~~~~~~~~

The race condition is fairly rare, nevertheless it occures from time to time.
The patch assures libbb is built last, at which point all include files that are
generated are present.

Signed-off-by: Juro Bystricky <juro.bystricky at intel.com>
---
 Makefile | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 5cfc763..69f3831 100644
--- a/Makefile
+++ b/Makefile
@@ -738,9 +738,18 @@ $(sort $(busybox-all)): $(busybox-dirs) ;
 # Error messages still appears in the original language
 
 PHONY += $(busybox-dirs)
-$(busybox-dirs): prepare scripts
+
+libbb-dir = $(filter libbb,$(busybox-dirs))
+busybox-dirs1 = $(filter-out libbb,$(busybox-dirs))
+
+$(busybox-dirs1): prepare scripts
 	$(Q)$(MAKE) $(build)=$@
 
+ifneq ($(libbb-dir),)
+$(libbb-dir): | $(busybox-dirs1)
+	$(Q)$(MAKE) $(build)=$@
+endif
+
 # Build the kernel release string
 # The KERNELRELEASE is stored in a file named .kernelrelease
 # to be used when executing for example make install or make modules_install
-- 
2.7.4



More information about the busybox mailing list