458ad1d15e826358af546ad8180406357d434f1c
[openwrt.git] / openwrt / package / linux / Makefile
1 include $(TOPDIR)/rules.mk
2 include ./linux.mk
3
4 PKG_BUILD_DIR := $(BUILD_DIR)/linux-modules
5 PKG_RELEASE := 1
6
7 TARGETS :=
8 INSTALL_TARGETS :=
9
10 define KMOD_template
11 PKG_$(1) := $(PACKAGE_DIR)/kmod-$(2)_$(LINUX_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
12 I_$(1) := $(PKG_BUILD_DIR)/ipkg/$(2)
13 ifneq ($(BR2_PACKAGE_KMOD_$(1)),)
14 TARGETS += $$(PKG_$(1))
15 endif
16 ifeq ($(BR2_PACKAGE_KMOD_$(1)),y)
17 INSTALL_TARGETS += $$(PKG_$(1))
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
27
28 $(eval $(call KMOD_template,ARPT,arptables,\
29 $(MODULES_DIR)/kernel/net/ipv4/netfilter/arp*.o \
30 ))
31 $(eval $(call KMOD_template,EBT,ebtables,\
32 $(MODULES_DIR)/kernel/net/bridge/netfilter/*.o \
33 ))
34 $(eval $(call KMOD_template,IPT4,iptables-extra,\
35 $(MODULES_DIR)/kernel/net/ipv4/netfilter/ip*.o \
36 ))
37 $(eval $(call KMOD_template,IPT6,ip6tables,\
38 $(MODULES_DIR)/kernel/net/ipv6/netfilter/ip*.o \
39 ))
40 $(eval $(call KMOD_template,IPV6,ipv6,\
41 $(MODULES_DIR)/kernel/net/ipv6/ipv6.o \
42 ))
43 $(eval $(call KMOD_template,NFS,nfs,\
44 $(MODULES_DIR)/kernel/fs/lockd/*.o \
45 $(MODULES_DIR)/kernel/fs/nfs/*.o \
46 $(MODULES_DIR)/kernel/net/sunrpc/*.o \
47 ))
48 $(eval $(call KMOD_template,USB,usb,\
49 $(MODULES_DIR)/kernel/drivers/scsi/*.o \
50 $(MODULES_DIR)/kernel/drivers/usb/*.o \
51 $(MODULES_DIR)/kernel/drivers/usb/*/*.o \
52 ))
53 $(eval $(call KMOD_template,LP,lp,\
54 $(MODULES_DIR)/kernel/drivers/parport/parport.o \
55 $(MODULES_DIR)/kernel/drivers/parport/parport_pc.o \
56 $(MODULES_DIR)/kernel/drivers/char/lp.o \
57 ))
58 $(eval $(call KMOD_template,VFAT,vfat,\
59 $(MODULES_DIR)/kernel/fs/vfat/vfat.o \
60 $(MODULES_DIR)/kernel/fs/fat/fat.o \
61 $(MODULES_DIR)/kernel/fs/msdos/msdos.o \
62 ))
63 $(eval $(call KMOD_template,CRYPTO,crypto,\
64 $(MODULES_DIR)/kernel/crypto/*.o \
65 ))
66 $(eval $(call KMOD_template,PPP,ppp,\
67 $(MODULES_DIR)/kernel/drivers/net/ppp_generic.o \
68 $(MODULES_DIR)/kernel/drivers/net/slhc.o \
69 ))
70 $(eval $(call KMOD_template,MPPE,mppe,\
71 $(MODULES_DIR)/kernel/drivers/net/ppp_mppe_mppc.o \
72 ))
73 $(eval $(call KMOD_template,TUN,tun,\
74 $(MODULES_DIR)/kernel/drivers/net/tun.o \
75 ))
76 $(eval $(call KMOD_template,GRE,gre,\
77 $(MODULES_DIR)/kernel/net/ipv4/ip_gre.o \
78 ))
79 $(eval $(call KMOD_template,SCHED,sched,\
80 $(MODULES_DIR)/kernel/net/sched/*.o \
81 ))
82
83 $(TARGETS): $(PACKAGE_DIR)
84
85 $(PACKAGE_DIR):
86 mkdir -p $(PACKAGE_DIR)
87
88 source: linux-source
89 prepare: $(LINUX_DIR)/.configured
90 compile: $(LINUX_DIR)/.modules_done $(TARGETS)
91
92 install: compile $(TARGET_MODULES_DIR)
93 @[ "$(INSTALL_TARGETS)" != "" ] && $(IPKG) install $(INSTALL_TARGETS) || true
94
95 clean: linux-dirclean
96 rm -f $(TARGETS)
This page took 0.041771 seconds and 3 git commands to generate.