replace a few unnecessary $(shell) calls
authorFelix Fietkau <nbd@openwrt.org>
Tue, 3 Mar 2009 14:55:53 +0000 (14:55 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 3 Mar 2009 14:55:53 +0000 (14:55 +0000)
SVN-Revision: 14739

include/kernel.mk
include/package-defaults.mk
include/quilt.mk
include/target.mk
rules.mk

index 39be10a5777ad1960fe037d606b84e0a5de3a76d..5d5c9e9172b2f0ab39a6e11150e9b984bef31cdc 100644 (file)
@@ -30,7 +30,7 @@ else
     KERNEL_CROSS?=$(TARGET_CROSS)
   endif
 
-  PATCH_DIR ?= ./patches$(shell [ -d "./patches-$(KERNEL_PATCHVER)" ] && printf -- "-$(KERNEL_PATCHVER)" || true )
+  PATCH_DIR ?= ./patches$(if $(wildcard ./patches-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
   FILES_DIR ?= $(foreach dir,$(wildcard ./files ./files-$(KERNEL_PATCHVER)),"$(dir)")
   KERNEL_BUILD_DIR ?= $(BUILD_DIR_BASE)/linux-$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET))$(if $(BUILD_SUFFIX),_$(BUILD_SUFFIX))
   LINUX_DIR ?= $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
@@ -50,10 +50,10 @@ else
 endif
 
 ifneq (,$(findstring uml,$(BOARD)))
-  LINUX_KARCH:=um
+  LINUX_KARCH=um
 else
   ifeq (,$(LINUX_KARCH))
-    LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/x86/' \
+    LINUX_KARCH=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/x86/' \
          -e 's/mipsel/mips/' \
          -e 's/mipseb/mips/' \
          -e 's/sh[234]/sh/' \
@@ -159,7 +159,11 @@ define AutoLoad
   add_module $(1) "$(2)";
 endef
 
-define CompareKernelPatchVer
-  $(shell [ $$(echo $(1) | tr . 0) -$(2) $$(echo $(3) | tr . 0) ] && echo 1 || echo 0)
-endef
+ifdef DUMP
+  CompareKernelPatchVer=0
+else
+  define CompareKernelPatchVer
+    $(shell [ $$(echo $(1) | tr . 0) -$(2) $$(echo $(3) | tr . 0) ] && echo 1 || echo 0)
+  endef
+endif
 
index f7f5bd0ef2df676fa6cc5336e138258333a0f1fe..e375722af905f91ec7979f62beee0b757b4e73cb 100644 (file)
@@ -13,7 +13,7 @@ define Package/Default
   PROVIDES:=
   EXTRA_DEPENDS:=
   MAINTAINER:=OpenWrt Developers Team <openwrt-devel@openwrt.org>
-  SOURCE:=$(patsubst $(TOPDIR)/%,%,${shell pwd})
+  SOURCE:=$(patsubst $(TOPDIR)/%,%,$(CURDIR))
   ifneq ($(PKG_VERSION),)
     ifneq ($(PKG_RELEASE),)
       VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)
index c5245a8aeecbdc3baab7d112855eed48b6568fc4..0d63e62fd234a05aca19a00774c326b337b74805 100644 (file)
@@ -56,7 +56,7 @@ $(call PatchDir/$(if $(strip $(QUILT)),Quilt,Default),$(strip $(1)),$(strip $(2)
 endef
 
 ifneq ($(PKG_BUILD_DIR),)
-  QUILT?=$(strip $(shell test -f $(PKG_BUILD_DIR)/.quilt_used && echo y))
+  QUILT?=$(if $(wildcard $(PKG_BUILD_DIR)/.quilt_used),y)
   ifneq ($(QUILT),)
     STAMP_PATCHED:=$(PKG_BUILD_DIR)/.quilt_patched
     STAMP_CHECKED:=$(PKG_BUILD_DIR)/.quilt_checked
@@ -67,7 +67,7 @@ ifneq ($(PKG_BUILD_DIR),)
 endif
 
 ifneq ($(HOST_BUILD_DIR),)
-  HOST_QUILT?=$(strip $(shell test -f $(if $(PKG_BUILD_DIR),$(PKG_BUILD_DIR),$(HOST_BUILD_DIR))/.quilt_used && echo y))
+  HOST_QUILT?=$(if $(wildcard $(if $(PKG_BUILD_DIR),$(PKG_BUILD_DIR),$(HOST_BUILD_DIR))/.quilt_used),y)
   ifneq ($(HOST_QUILT),)
     HOST_STAMP_PATCHED:=$(HOST_BUILD_DIR)/.quilt_patched
     HOST_STAMP_CHECKED:=$(HOST_BUILD_DIR)/.quilt_checked
index d3c149aa18ab46797c645f6f6734ab1838355ba9..ace3db0ffde3e9bde5ce7504320ee1f78ac4aa05 100644 (file)
@@ -109,7 +109,7 @@ ifneq ($(TARGET_BUILD)$(if $(DUMP),,1),)
 endif
 
 GENERIC_PLATFORM_DIR := $(TOPDIR)/target/linux/generic-$(KERNEL)
-GENERIC_PATCH_DIR := $(GENERIC_PLATFORM_DIR)/patches$(shell [ -d "$(GENERIC_PLATFORM_DIR)/patches-$(KERNEL_PATCHVER)" ] && printf -- "-$(KERNEL_PATCHVER)" || true )
+GENERIC_PATCH_DIR := $(GENERIC_PLATFORM_DIR)/patches$(if $(wildcard $(GENERIC_PLATFORM_DIR)/patches-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
 GENERIC_FILES_DIR := $(foreach dir,$(wildcard $(GENERIC_PLATFORM_DIR)/files $(GENERIC_PLATFORM_DIR)/files-$(KERNEL_PATCHVER)),"$(dir)")
 
 GENERIC_LINUX_CONFIG?=$(firstword $(wildcard $(GENERIC_PLATFORM_DIR)/config-$(KERNEL_PATCHVER) $(GENERIC_PLATFORM_DIR)/config-default))
index 1ccaf41595e64012da0e5a4b82e9a54e739b495c..315e998b94b91a6c42e3c6ab5f4602b52950d440 100644 (file)
--- a/rules.mk
+++ b/rules.mk
@@ -19,9 +19,7 @@ TMP_DIR:=$(TOPDIR)/tmp
 
 export SHELL=/usr/bin/env bash -c '. $(TOPDIR)/include/shell.sh; eval "$$2"' --
 
-define qstrip
-$(strip $(subst ",,$(1)))
-endef
+qstrip=$(strip $(subst ",,$(1)))
 #"))
 
 empty:=
@@ -31,7 +29,7 @@ confvar=$(call merge,$(foreach v,$(1),$(if $($(v)),y,n)))
 strip_last=$(patsubst %.$(lastword $(subst .,$(space),$(1))),%,$(1))
 
 _SINGLE=export MAKEFLAGS=$(space);
-ARCH:=$(call qstrip,$(shell echo $(CONFIG_ARCH) | sed -e 's/i[3-9]86/i386/'))
+ARCH:=$(subst i486,i386,$(subst i586,i386,$(subst i686,i386,$(call qstrip,$(CONFIG_ARCH)))))
 BOARD:=$(call qstrip,$(CONFIG_TARGET_BOARD))
 TARGET_OPTIMIZATION:=$(call qstrip,$(CONFIG_TARGET_OPTIMIZATION))
 TARGET_SUFFIX=$(call qstrip,$(CONFIG_TARGET_SUFFIX))
@@ -41,7 +39,7 @@ LIBC:=$(call qstrip,$(CONFIG_LIBC))
 LIBCV:=$(call qstrip,$(CONFIG_LIBC_VERSION))
 SUBDIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR})
 
-OPTIMIZE_FOR_CPU=$(shell echo $(ARCH) | sed -e 's/i386/i486/')
+OPTIMIZE_FOR_CPU=$(subst i386,i486,$(ARCH))
 
 ifeq ($(ARCH),powerpc)
   FPIC:=-fPIC