6823d535fa3c1635e4bd62ca97b8a6ee431cc010
[openwrt.git] / 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 .NOTPARALLEL:
14
15 define KMOD_template
16 ifeq ($$(strip $(4)),)
17 KDEPEND_$(1):=m
18 else
19 KDEPEND_$(1):=$($(4))
20 endif
21
22 PKG_$(1) := $(PACKAGE_DIR)/kmod-$(2)_$(LINUX_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
23 I_$(1) := $(PKG_BUILD_DIR)/ipkg/$(2)
24
25 ifeq ($$(KDEPEND_$(1)),m)
26 ifneq ($(BR2_PACKAGE_KMOD_$(1)),)
27 TARGETS += $$(PKG_$(1))
28 endif
29 ifeq ($(BR2_PACKAGE_KMOD_$(1)),y)
30 INSTALL_TARGETS += $$(PKG_$(1))
31 endif
32 endif
33
34 $$(PKG_$(1)): $(LINUX_DIR)/.modules_done
35 mkdir -p $$(I_$(1))/lib/modules/$(LINUX_VERSION)
36 $(SCRIPT_DIR)/make-ipkg-dir.sh $$(I_$(1)) control/kmod-$(2).control $(LINUX_VERSION)-$(PKG_RELEASE) $(ARCH)
37 cp $(3) $$(I_$(1))/lib/modules/$(LINUX_VERSION)
38 $(IPKG_BUILD) $$(I_$(1)) $(PACKAGE_DIR)
39
40 endef
41
42 $(eval $(call KMOD_template,DIAG,diag,\
43 $(MODULES_DIR)/kernel/drivers/net/diag/diag.o \
44 ))
45 $(eval $(call KMOD_template,BRCM_WL,brcm-wl,\
46 $(MODULES_DIR)/kernel/drivers/net/wl/wl.o \
47 ,CONFIG_WL))
48 $(eval $(call KMOD_template,B44,b44,\
49 $(MODULES_DIR)/kernel/drivers/net/b44.o \
50 ,CONFIG_B44))
51 $(eval $(call KMOD_template,BRCM_ET,brcm-et,\
52 $(MODULES_DIR)/kernel/drivers/net/et/et.o \
53 ,CONFIG_ET))
54 $(eval $(call KMOD_template,ARPT,arptables,\
55 $(MODULES_DIR)/kernel/net/ipv4/netfilter/arp*.o \
56 ,CONFIG_IP_NF_ARPTABLES))
57 $(eval $(call KMOD_template,EBT,ebtables,\
58 $(MODULES_DIR)/kernel/net/bridge/netfilter/*.o \
59 ,CONFIG_BRIDGE_NF_EBTABLES))
60 $(eval $(call KMOD_template,IPT4,iptables-extra,\
61 $(MODULES_DIR)/kernel/net/ipv4/netfilter/ip*.o \
62 ))
63 $(eval $(call KMOD_template,IPT6,ip6tables,\
64 $(MODULES_DIR)/kernel/net/ipv6/netfilter/ip*.o \
65 ,CONFIG_IP6_NF_IPTABLES))
66 $(eval $(call KMOD_template,IPV6,ipv6,\
67 $(MODULES_DIR)/kernel/net/ipv6/ipv6.o \
68 ,CONFIG_IPV6))
69 $(eval $(call KMOD_template,CIFS,cifs,\
70 $(MODULES_DIR)/kernel/fs/cifs/cifs.o \
71 ,CONFIG_CIFS))
72 $(eval $(call KMOD_template,NFS,nfs,\
73 $(MODULES_DIR)/kernel/fs/lockd/*.o \
74 $(MODULES_DIR)/kernel/fs/nfs/*.o \
75 $(MODULES_DIR)/kernel/net/sunrpc/*.o \
76 ,CONFIG_NFS_FS))
77 $(eval $(call KMOD_template,USB,usb-core,\
78 $(MODULES_DIR)/kernel/drivers/usb/usbcore.o \
79 ,CONFIG_USB))
80 $(eval $(call KMOD_template,USB_UHCI,usb-uhci,\
81 $(MODULES_DIR)/kernel/drivers/usb/host/uhci.o \
82 ,CONFIG_USB_UHCI_ALT))
83 $(eval $(call KMOD_template,USB_OHCI,usb-ohci,\
84 $(MODULES_DIR)/kernel/drivers/usb/host/usb-ohci.o \
85 ,CONFIG_USB_OHCI))
86 $(eval $(call KMOD_template,USB2,usb2,\
87 $(MODULES_DIR)/kernel/drivers/usb/host/ehci-hcd.o \
88 ,CONFIG_USB_EHCI_HCD))
89 $(eval $(call KMOD_template,USB_STORAGE,usb-storage,\
90 $(MODULES_DIR)/kernel/drivers/scsi/*.o \
91 $(MODULES_DIR)/kernel/drivers/usb/storage/*.o \
92 ,CONFIG_USB_STORAGE))
93 $(eval $(call KMOD_template,USB_PRINTER,usb-printer,\
94 $(MODULES_DIR)/kernel/drivers/usb/printer.o \
95 ,CONFIG_USB_PRINTER))
96 $(eval $(call KMOD_template,LP,lp,\
97 $(MODULES_DIR)/kernel/drivers/parport/parport.o \
98 $(MODULES_DIR)/kernel/drivers/parport/parport_splink.o \
99 $(MODULES_DIR)/kernel/drivers/char/lp.o \
100 ,CONFIG_PARPORT))
101 $(eval $(call KMOD_template,IDE,ide,\
102 $(MODULES_DIR)/kernel/drivers/ide/*.o \
103 ,CONFIG_IDE))
104 $(eval $(call KMOD_template,EXT2,ext2,\
105 $(MODULES_DIR)/kernel/fs/ext2/*.o \
106 ,CONFIG_EXT2_FS))
107 $(eval $(call KMOD_template,EXT3,ext3,\
108 $(MODULES_DIR)/kernel/fs/ext3/*.o \
109 $(MODULES_DIR)/kernel/fs/jbd/*.o \
110 ,CONFIG_EXT3_FS))
111 $(eval $(call KMOD_template,XFS,xfs,\
112 $(MODULES_DIR)/kernel/fs/xfs/*.o \
113 ,CONFIG_XFS_FS))
114 $(eval $(call KMOD_template,HFSPLUS,hfsplus,\
115 $(MODULES_DIR)/kernel/fs/hfsplus/*.o \
116 ,CONFIG_HFSPLUS_FS))
117 $(eval $(call KMOD_template,VFAT,vfat,\
118 $(MODULES_DIR)/kernel/fs/vfat/vfat.o \
119 $(MODULES_DIR)/kernel/fs/fat/fat.o \
120 ,CONFIG_VFAT_FS))
121 $(eval $(call KMOD_template,CRYPTO,crypto,\
122 $(MODULES_DIR)/kernel/crypto/*.o \
123 ))
124 $(eval $(call KMOD_template,PPP,ppp,\
125 $(MODULES_DIR)/kernel/drivers/net/ppp_async.o \
126 $(MODULES_DIR)/kernel/drivers/net/ppp_generic.o \
127 $(MODULES_DIR)/kernel/drivers/net/slhc.o \
128 ,CONFIG_PPP))
129 $(eval $(call KMOD_template,MPPE,mppe,\
130 $(MODULES_DIR)/kernel/drivers/net/ppp_mppe_mppc.o \
131 ,CONFIG_PPP_MPPE_MPPC))
132 $(eval $(call KMOD_template,PPPOE,pppoe,\
133 $(MODULES_DIR)/kernel/drivers/net/pppoe.o \
134 $(MODULES_DIR)/kernel/drivers/net/pppox.o \
135 ,CONFIG_PPPOE))
136 $(eval $(call KMOD_template,TUN,tun,\
137 $(MODULES_DIR)/kernel/drivers/net/tun.o \
138 ,CONFIG_TUN))
139 $(eval $(call KMOD_template,GRE,gre,\
140 $(MODULES_DIR)/kernel/net/ipv4/ip_gre.o \
141 ,CONFIG_NET_IPGRE))
142 $(eval $(call KMOD_template,SCHED,sched,\
143 $(MODULES_DIR)/kernel/net/sched/*.o \
144 ))
145
146 $(TARGETS): $(PACKAGE_DIR)
147
148 $(PACKAGE_DIR):
149 mkdir -p $(PACKAGE_DIR)
150
151 source: linux-source
152 prepare: $(LINUX_DIR)/.configured
153 compile: $(LINUX_DIR)/.modules_done $(TARGETS)
154
155 install: compile $(TARGET_MODULES_DIR)
156 @[ "$(INSTALL_TARGETS)" != "" ] && $(IPKG) install $(INSTALL_TARGETS) || true
157
158 clean: linux-dirclean
159 rm -f $(TARGETS)
This page took 0.051251 seconds and 3 git commands to generate.