-LIBC_VERSION:=${shell cat $(STAGING_DIR)/uclibc_version}
-IDIR_LIBC:=$(BUILD_DIR)/uclibc
-IPKG_LIBC:=$(PACKAGE_DIR)/uclibc_$(LIBC_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
+UCLIBC_VERSION:=${shell cat $(STAGING_DIR)/uclibc_version}
+IDIR_UCLIBC:=$(PKG_BUILD_DIR)/uclibc
+IPKG_UCLIBC:=$(PACKAGE_DIR)/uclibc_$(UCLIBC_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
+
+LIBGCC_VERSION:=${shell cat $(STAGING_DIR)/gcc_version}
+IDIR_LIBGCC:=$(PKG_BUILD_DIR)/libgcc
+IPKG_LIBGCC:=$(PACKAGE_DIR)/libgcc_$(LIBGCC_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
+
+PACKAGES:=$(IPKG_BASE) $(IPKG_UCLIBC)
+PACKAGES_INSTALL:=$(IPKG_BASE) $(IPKG_UCLIBC)
+
+ifeq ($(BR2_PACKAGE_LIBGCC),y)
+PACKAGES+=$(IPKG_LIBGCC)
+PACKAGES_INSTALL+=$(IPKG_LIBGCC)
+endif
+ifeq ($(BR2_PACKAGE_LIBGCC),m)
+PACKAGES+=$(IPKG_LIBGCC)
+endif