add kernel package with version-specific /etc/modules
[openwrt.git] / target / linux / rules.mk
1 define KMOD_template
2 ifeq ($$(strip $(4)),)
3 KDEPEND_$(1):=m
4 else
5 KDEPEND_$(1):=$($(4))
6 endif
7
8 PKG_$(1) := $(PACKAGE_DIR)/kmod-$(2)_$(LINUX_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
9 I_$(1) := $(PKG_BUILD_DIR)/ipkg/$(2)
10
11 ifeq ($$(KDEPEND_$(1)),m)
12 ifneq ($(BR2_PACKAGE_KMOD_$(1)),)
13 TARGETS += $$(PKG_$(1))
14 endif
15 ifeq ($(BR2_PACKAGE_KMOD_$(1)),y)
16 INSTALL_TARGETS += $$(PKG_$(1))
17 endif
18 endif
19
20 $$(PKG_$(1)): $(LINUX_DIR)/.modules_done
21         mkdir -p $$(I_$(1))/lib/modules/$(LINUX_VERSION)
22         $(SCRIPT_DIR)/make-ipkg-dir.sh $$(I_$(1)) ../control/kmod-$(2).control $(LINUX_VERSION)-$(PKG_RELEASE) $(ARCH)
23         cp $(3) $$(I_$(1))/lib/modules/$(LINUX_VERSION)
24         $(IPKG_BUILD) $$(I_$(1)) $(PACKAGE_DIR)
25
26 endef