- $(CP) $(PKG_BUILD_DIR) $(PKG_BUILD_DIR)_$(1)
- $(CP) ./files/$(1).config $(PKG_BUILD_DIR)_$(1)/.config
-ifneq ($(CONFIG_PACKAGE_kmod-madwifi),)
- echo "CONFIG_DRIVER_MADWIFI=y" >> $(PKG_BUILD_DIR)_$(1)/.config
-endif
-ifneq ($(CONFIG_PACKAGE_kmod-mac80211),)
- echo "CONFIG_DRIVER_DEVICESCAPE=y" >> $(PKG_BUILD_DIR)_$(1)/.config
-endif
+ rm -rf $(PKG_BUILD_DIR)/hostapd.$(1)
+ mkdir -p $(PKG_BUILD_DIR)/hostapd.$(1)
+ $(CP) \
+ $(PKG_BUILD_DIR)/hostapd \
+ $(PKG_BUILD_DIR)/src \
+ $(PKG_BUILD_DIR)/hostapd.$(1)/
+ $(CP) ./files/$(1).config $(PKG_BUILD_DIR)/hostapd.$(1)/hostapd/.config
+ $(if $(CONFIG_PACKAGE_kmod-mac80211),,$(SED) 's,^CONFIG_DRIVER_NL80211,#CONFIG_DRIVER_NL80211,g' $(PKG_BUILD_DIR)/hostapd.$(1)/hostapd/.config)
+ $(if $(CONFIG_PACKAGE_kmod-madwifi),,$(SED) 's,^CONFIG_DRIVER_MADWIFI,#CONFIG_DRIVER_MADWIFI,g' $(PKG_BUILD_DIR)/hostapd.$(1)/hostapd/.config)