[LEDE-DEV] [PATCH 2/3] busybox: streamline Makefile

Matthias Schiffer mschiffer at universe-factory.net
Sun Dec 10 09:36:50 PST 2017


Use default Build/Install steps where possible. No binary change in default
configuration, so PKG_RELEASE is not incremented.

Signed-off-by: Matthias Schiffer <mschiffer at universe-factory.net>
---
 package/utils/busybox/Makefile | 67 +++++++++++-------------------------------
 1 file changed, 17 insertions(+), 50 deletions(-)

diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index 4b1bbed67b..f8a611a4a7 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -20,6 +20,7 @@ PKG_HASH:=9d4be516b61e6480f156b11eb42577a13529f75d3383850bb75c50c285de63df
 PKG_BUILD_DEPENDS:=BUSYBOX_USE_LIBRPC:librpc BUSYBOX_CONFIG_PAM:libpam
 PKG_BUILD_PARALLEL:=1
 PKG_CHECK_FORMAT_SECURITY:=0
+PKG_INSTALL:=1
 
 PKG_LICENSE:=GPL-2.0
 PKG_LICENSE_FILES:=LICENSE archival/libarchive/bz/LICENSE
@@ -31,12 +32,6 @@ ifeq ($(DUMP),)
   STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep '^CONFIG_BUSYBOX_' $(TOPDIR)/.config | mkhash md5)
 endif
 
-ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
-  BB_MAKE_VERBOSE := V=1
-else
-  BB_MAKE_VERBOSE :=
-endif
-
 BUSYBOX_SYM=$(if $(CONFIG_BUSYBOX_CUSTOM),CONFIG,DEFAULT)
 BUSYBOX_IF_ENABLED=$(if $(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_$(1)),$(2))
 
@@ -76,59 +71,31 @@ endef
 # don't create a version string containing the actual timestamp
 export KCONFIG_NOTIMESTAMP=1
 
-define Build/Configure
-	rm -f $(PKG_BUILD_DIR)/.configured*
-	grep 'CONFIG_BUSYBOX_$(BUSYBOX_SYM)' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_$(BUSYBOX_SYM)_\\(.*\\),\\1CONFIG_\\2,g" > $(PKG_BUILD_DIR)/.config
-	yes 'n' | $(MAKE) -C $(PKG_BUILD_DIR) \
-		CC="$(TARGET_CC)" \
-		CROSS_COMPILE="$(TARGET_CROSS)" \
-		KBUILD_HAVE_NLS=no \
-		ARCH="$(ARCH)" \
-		$(BB_MAKE_VERBOSE) \
-		oldconfig
-endef
 
 LDLIBS:=m crypt
+LDLIBS += $(call BUSYBOX_IF_ENABLED,PAM,pam pam_misc pthread)
 ifdef CONFIG_BUSYBOX_USE_LIBRPC
-  TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
-  export LDFLAGS=$(TARGET_LDFLAGS)
   LDLIBS += rpc
 endif
-
-ifdef CONFIG_BUSYBOX_CONFIG_PAM
-  TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
-  export LDFLAGS=$(TARGET_LDFLAGS)
-  LDLIBS += pam pam_misc pthread
+ifeq ($(CONFIG_USE_GLIBC),y)
+  LDLIBS += $(call BUSYBOX_IF_ENABLED,NSLOOKUP_OPENWRT,resolv)
 endif
 
-ifdef CONFIG_BUSYBOX_DEFAULT_NSLOOKUP_OPENWRT
-  ifeq ($(CONFIG_USE_GLIBC),y)
-	LDLIBS += resolv
-  endif
+MAKE_VARS :=
+MAKE_FLAGS += \
+	EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
+	LDLIBS="$(LDLIBS)" \
+	SKIP_STRIP=y
+ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
+  MAKE_FLAGS += V=1
 endif
 
-define Build/Compile
-	+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
-		CC="$(TARGET_CC)" \
-		CROSS_COMPILE="$(TARGET_CROSS)" \
-		KBUILD_HAVE_NLS=no \
-		EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
-		ARCH="$(ARCH)" \
-		SKIP_STRIP=y \
-		LDLIBS="$(LDLIBS)" \
-		$(BB_MAKE_VERBOSE) \
-		all
-	rm -rf $(PKG_INSTALL_DIR)
-	$(FIND) $(PKG_BUILD_DIR) -lname "*busybox" -exec rm \{\} \;
-	$(MAKE) -C $(PKG_BUILD_DIR) \
-		CC="$(TARGET_CC)" \
-		CROSS_COMPILE="$(TARGET_CROSS)" \
-		EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
-		ARCH="$(ARCH)" \
-		CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
-		LDLIBS="$(LDLIBS)" \
-		$(BB_MAKE_VERBOSE) \
-		install
+MAKE_INSTALL_FLAGS += CONFIG_PREFIX="$(PKG_INSTALL_DIR)"
+
+
+define Build/Configure
+	grep 'CONFIG_BUSYBOX_$(BUSYBOX_SYM)' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_$(BUSYBOX_SYM)_\\(.*\\),\\1CONFIG_\\2,g" > $(PKG_BUILD_DIR)/.config
+	yes 'n' | $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS) oldconfig
 endef
 
 define Package/busybox/install
-- 
2.15.1




More information about the Lede-dev mailing list