split usb packages and add usb2 support
[openwrt.git] / openwrt / package / linux / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4 include ./linux.mk
5 include ./linux.config
6
7 PKG_BUILD_DIR := $(BUILD_DIR)/linux-modules
8 PKG_RELEASE := 1
9
10 TARGETS :=
11 INSTALL_TARGETS :=
12
13
14 define KMOD_template
15 ifeq ($$(strip $(4)),)
16 KDEPEND_$(1):=m
17 else
18 KDEPEND_$(1):=$($(4))
19 endif
20
21 PKG_$(1) := $(PACKAGE_DIR)/kmod-$(2)_$(LINUX_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
22 I_$(1) := $(PKG_BUILD_DIR)/ipkg/$(2)
23
24 ifeq ($$(KDEPEND_$(1)),m)
25 ifneq ($(BR2_PACKAGE_KMOD_$(1)),)
26 TARGETS += $$(PKG_$(1))
27 endif
28 ifeq ($(BR2_PACKAGE_KMOD_$(1)),y)
29 INSTALL_TARGETS += $$(PKG_$(1))
30 endif
31 endif
32
33 $$(PKG_$(1)): $(LINUX_DIR)/.modules_done
34 mkdir -p $$(I_$(1))/lib/modules/$(LINUX_VERSION)
35 $(SCRIPT_DIR)/make-ipkg-dir.sh $$(I_$(1)) control/kmod-$(2).control $(LINUX_VERSION)-$(PKG_RELEASE) $(ARCH)
36 cp $(3) $$(I_$(1))/lib/modules/$(LINUX_VERSION)
37 $(IPKG_BUILD) $$(I_$(1)) $(PACKAGE_DIR)
38
39 endef
40
41 $(eval $(call KMOD_template,ARPT,arptables,\
42 $(MODULES_DIR)/kernel/net/ipv4/netfilter/arp*.o \
43 ,CONFIG_IP_NF_ARPTABLES))
44 $(eval $(call KMOD_template,EBT,ebtables,\
45 $(MODULES_DIR)/kernel/net/bridge/netfilter/*.o \
46 ,CONFIG_BRIDGE_NF_EBTABLES))
47 $(eval $(call KMOD_template,IPT4,iptables-extra,\
48 $(MODULES_DIR)/kernel/net/ipv4/netfilter/ip*.o \
49 ))
50 $(eval $(call KMOD_template,IPT6,ip6tables,\
51 $(MODULES_DIR)/kernel/net/ipv6/netfilter/ip*.o \
52 ,CONFIG_IP6_NF_IPTABLES))
53 $(eval $(call KMOD_template,IPV6,ipv6,\
54 $(MODULES_DIR)/kernel/net/ipv6/ipv6.o \
55 ,CONFIG_IPV6))
56 $(eval $(call KMOD_template,CIFS,cifs,\
57 $(MODULES_DIR)/kernel/fs/cifs/cifs.o \
58 ,CONFIG_CIFS))
59 $(eval $(call KMOD_template,NFS,nfs,\
60 $(MODULES_DIR)/kernel/fs/lockd/*.o \
61 $(MODULES_DIR)/kernel/fs/nfs/*.o \
62 $(MODULES_DIR)/kernel/net/sunrpc/*.o \
63 ,CONFIG_NFS_FS))
64 $(eval $(call KMOD_template,USB,usb-core,\
65 $(MODULES_DIR)/kernel/drivers/usb/usbcore.o \
66 ,CONFIG_USB))
67 $(eval $(call KMOD_template,USB_UHCI,usb-uhci,\
68 $(MODULES_DIR)/kernel/drivers/usb/host/uhci.o \
69 ,CONFIG_USB_UHCI_ALT))
70 $(eval $(call KMOD_template,USB_OHCI,usb-ohci,\
71 $(MODULES_DIR)/kernel/drivers/usb/host/usb-ohci.o \
72 ,CONFIG_USB_OHCI))
73 $(eval $(call KMOD_template,USB2,usb2,\
74 $(MODULES_DIR)/kernel/drivers/usb/host/ehci-hcd.o \
75 ,CONFIG_USB_EHCI_HCD))
76 $(eval $(call KMOD_template,USB_STORAGE,usb-storage,\
77 $(MODULES_DIR)/kernel/drivers/scsi/*.o \
78 $(MODULES_DIR)/kernel/drivers/usb/storage/*.o \
79 ,CONFIG_USB_STORAGE))
80 $(eval $(call KMOD_template,USB_PRINTER,usb-printer,\
81 $(MODULES_DIR)/kernel/drivers/usb/printer.o \
82 ,CONFIG_USB_PRINTER))
83 $(eval $(call KMOD_template,LP,lp,\
84 $(MODULES_DIR)/kernel/drivers/parport/parport.o \
85 $(MODULES_DIR)/kernel/drivers/parport/parport_splink.o \
86 $(MODULES_DIR)/kernel/drivers/char/lp.o \
87 ,CONFIG_PARPORT))
88 $(eval $(call KMOD_template,VFAT,vfat,\
89 $(MODULES_DIR)/kernel/fs/vfat/vfat.o \
90 $(MODULES_DIR)/kernel/fs/fat/fat.o \
91 $(MODULES_DIR)/kernel/fs/msdos/msdos.o \
92 ,CONFIG_VFAT_FS))
93 $(eval $(call KMOD_template,CRYPTO,crypto,\
94 $(MODULES_DIR)/kernel/crypto/*.o \
95 ))
96 $(eval $(call KMOD_template,PPP,ppp,\
97 $(MODULES_DIR)/kernel/drivers/net/ppp_async.o \
98 $(MODULES_DIR)/kernel/drivers/net/ppp_generic.o \
99 $(MODULES_DIR)/kernel/drivers/net/slhc.o \
100 ,CONFIG_PPP))
101 $(eval $(call KMOD_template,MPPE,mppe,\
102 $(MODULES_DIR)/kernel/drivers/net/ppp_mppe_mppc.o \
103 ,CONFIG_PPP_MPPE_MPPC))
104 $(eval $(call KMOD_template,PPPOE,pppoe,\
105 $(MODULES_DIR)/kernel/drivers/net/pppoe.o \
106 $(MODULES_DIR)/kernel/drivers/net/pppox.o \
107 ,CONFIG_PPPOE))
108 $(eval $(call KMOD_template,TUN,tun,\
109 $(MODULES_DIR)/kernel/drivers/net/tun.o \
110 ,CONFIG_TUN))
111 $(eval $(call KMOD_template,GRE,gre,\
112 $(MODULES_DIR)/kernel/net/ipv4/ip_gre.o \
113 ,CONFIG_NET_IPGRE))
114 $(eval $(call KMOD_template,SCHED,sched,\
115 $(MODULES_DIR)/kernel/net/sched/*.o \
116 ))
117
118 $(TARGETS): $(PACKAGE_DIR)
119
120 $(PACKAGE_DIR):
121 mkdir -p $(PACKAGE_DIR)
122
123 source: linux-source
124 prepare: $(LINUX_DIR)/.configured
125 compile: $(LINUX_DIR)/.modules_done $(TARGETS)
126
127 install: compile $(TARGET_MODULES_DIR)
128 @[ "$(INSTALL_TARGETS)" != "" ] && $(IPKG) install $(INSTALL_TARGETS) || true
129
130 clean: linux-dirclean
131 rm -f $(TARGETS)
This page took 0.056552 seconds and 5 git commands to generate.