[buildroot] add an abstract $(LIBRPC_DEPENDS) variable for feed packages to rely on
[openwrt/svn-archive/archive.git] / rules.mk
index 23445bfaeed6d7a2642a1cd55becec9895fa5d0e..efe7a6d65bdc81393fe91ad754962a725e2cf0e5 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)))))
@@ -50,20 +54,17 @@ endif
 HOST_FPIC:=-fPIC
 
 ARCH_SUFFIX:=
+GCC_ARCH:=
+
+ifneq ($(filter -march=armv%,$(TARGET_OPTIMIZATION)),)
+  ARCH_SUFFIX:=_$(patsubst -march=arm%,%,$(filter -march=armv%,$(TARGET_OPTIMIZATION)))
+  GCC_ARCH:=$(patsubst -march=%,%,$(filter -march=armv%,$(TARGET_OPTIMIZATION)))
+endif
 ifneq ($(findstring -mips32r2,$(TARGET_OPTIMIZATION)),)
   ARCH_SUFFIX:=_r2
 endif
-ifneq ($(findstring -march=armv4,$(TARGET_OPTIMIZATION)),)
-  ARCH_SUFFIX:=_v4
-endif
-ifneq ($(findstring -march=armv4t,$(TARGET_OPTIMIZATION)),)
-  ARCH_SUFFIX:=_v4t
-endif
-ifneq ($(findstring -march=armv5t,$(TARGET_OPTIMIZATION)),)
-  ARCH_SUFFIX:=_v5t
-endif
-ifneq ($(findstring -march=armv5te,$(TARGET_OPTIMIZATION)),)
-  ARCH_SUFFIX:=_v5te
+ifdef CONFIG_HAS_SPE_FPU
+  TARGET_SUFFIX:=$(TARGET_SUFFIX)spe
 endif
 
 DL_DIR:=$(if $(call qstrip,$(CONFIG_DOWNLOAD_FOLDER)),$(call qstrip,$(CONFIG_DOWNLOAD_FOLDER)),$(TOPDIR)/dl)
@@ -110,6 +111,10 @@ TARGET_CFLAGS:=$(TARGET_OPTIMIZATION)$(if $(CONFIG_DEBUG), -g3)
 TARGET_CPPFLAGS:=-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include
 TARGET_LDFLAGS:=-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib
 LIBGCC_S=$(if $(wildcard $(TOOLCHAIN_DIR)/lib/libgcc_s.so),-L$(TOOLCHAIN_DIR)/lib -lgcc_s,$(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc.a))
+ifdef CONFIG_USE_UCLIBC
+LIBRPC=-lrpc
+endif
+LIBRPC_DEPENDS=+USE_UCLIBC:librpc
 
 ifndef DUMP
   ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
@@ -224,12 +229,6 @@ else
   DISABLE_IPV6:=--disable-ipv6
 endif
 
-ifeq ($(CONFIG_LARGEFILE),y)
-  DISABLE_LARGEFILE:=
-else
-  DISABLE_LARGEFILE:=--disable-largefile
-endif
-
 ifeq ($(CONFIG_TAR_VERBOSITY),y)
   TAR_OPTIONS:=-xvf -
 else
@@ -249,6 +248,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)))