busybox: streamline Makefile
authorMatthias Schiffer <mschiffer@universe-factory.net>
Sun, 10 Dec 2017 17:01:42 +0000 (18:01 +0100)
committerMatthias Schiffer <mschiffer@universe-factory.net>
Thu, 28 Dec 2017 11:24:25 +0000 (12:24 +0100)
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@universe-factory.net>
package/utils/busybox/Makefile

index 3a8dde821738bb9b8fdb09b4b5d74006e2f2c557..54ad986e66a75bd8e1e76baf81725a924cd59356 100644 (file)
@@ -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