X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=rules.mk;h=d3521649a52da662301b3f29eafc6486fe60e3b5;hb=d67201d8cc3e4f60a7905e1c3e1f3bd222596a86;hp=23445bfaeed6d7a2642a1cd55becec9895fa5d0e;hpb=a46c332411bcfa9daf71ec6edd7d1bf8dbb38a74;p=openwrt%2Fstaging%2Fwigyori.git diff --git a/rules.mk b/rules.mk index 23445bfaee..d3521649a5 100644 --- a/rules.mk +++ b/rules.mk @@ -249,6 +249,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)))