ar71xx: fix micrel phy patch (Patch from #8041.)
[openwrt/svn-archive/archive.git] / rules.mk
index 49044c8cfbf4b87a8468742d4cb8abe51d62d4d9..09b4f5447a9d6e56ab5ef3022375e6b49c4c5708 100644 (file)
--- a/rules.mk
+++ b/rules.mk
@@ -28,6 +28,10 @@ merge=$(subst $(space),,$(1))
 confvar=$(call merge,$(foreach v,$(1),$(if $($(v)),y,n)))
 strip_last=$(patsubst %.$(lastword $(subst .,$(space),$(1))),%,$(1))
 
+define sep
+
+endef
+
 _SINGLE=export MAKEFLAGS=$(space);
 CFLAGS:=
 ARCH:=$(subst i486,i386,$(subst i586,i386,$(subst i686,i386,$(call qstrip,$(CONFIG_ARCH)))))
@@ -47,6 +51,8 @@ else
   FPIC:=-fpic
 endif
 
+HOST_FPIC:=-fPIC
+
 ARCH_SUFFIX:=
 ifneq ($(findstring -mips32r2,$(TARGET_OPTIMIZATION)),)
   ARCH_SUFFIX:=_r2
@@ -247,6 +253,16 @@ define include_mk
 $(eval -include $(if $(DUMP),,$(STAGING_DIR)/mk/$(strip $(1))))
 endef
 
+# Execute commands under flock
+# $(1) => The shell expression.
+# $(2) => The lock name. If not given, the global lock will be used.
+define locked
+       SHELL= \
+       $(STAGING_DIR_HOST)/bin/flock \
+               $(TMP_DIR)/.$(if $(2),$(strip $(2)),global).flock \
+               -c '$(subst ','\'',$(1))'
+endef
+
 # file extension
 ext=$(word $(words $(subst ., ,$(1))),$(subst ., ,$(1)))
 
@@ -254,4 +270,16 @@ all:
 FORCE: ;
 .PHONY: FORCE
 
+val.%:
+       @$(if $(filter undefined,$(origin $*)),\
+               echo "$* undefined" >&2, \
+               echo '$(subst ','"'"',$($*))' \
+       )
+
+var.%:
+       @$(if $(filter undefined,$(origin $*)),\
+               echo "$* undefined" >&2, \
+               echo "$*='"'$(subst ','"'\"'\"'"',$($*))'"'" \
+       )
+
 endif #__rules_inc