musl: update to 1.1.12 + git from 2016-01-22
[openwrt.git] / rules.mk
index f95568a..11ed809 100644 (file)
--- a/rules.mk
+++ b/rules.mk
@@ -59,9 +59,10 @@ export EXTRA_OPTIMIZATION:=$(call qstrip,$(CONFIG_EXTRA_OPTIMIZATION))
 TARGET_SUFFIX=$(call qstrip,$(CONFIG_TARGET_SUFFIX))
 BUILD_SUFFIX:=$(call qstrip,$(CONFIG_BUILD_SUFFIX))
 SUBDIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR})
+BUILD_SUBDIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR})
 export SHELL:=/usr/bin/env bash
 
-IS_PACKAGE_BUILD := $(if $(filter package/%,$(SUBDIR)),1)
+IS_PACKAGE_BUILD := $(if $(filter package/%,$(BUILD_SUBDIR)),1)
 
 OPTIMIZE_FOR_CPU=$(subst i386,i486,$(ARCH))
 
@@ -332,12 +333,16 @@ endef
 # Execute commands under flock
 # $(1) => The shell expression.
 # $(2) => The lock name. If not given, the global lock will be used.
-define locked
+ifneq ($(wildcard $(STAGING_DIR_HOST)/bin/flock),)
+  define locked
        SHELL= \
-       $(STAGING_DIR_HOST)/bin/flock \
+       flock \
                $(TMP_DIR)/.$(if $(2),$(strip $(2)),global).flock \
                -c '$(subst ','\'',$(1))'
-endef
+  endef
+else
+  locked=$(1)
+endif
 
 # Recursively copy paths into another directory, purge dangling
 # symlinks before.