add some fixes for parallel build (does not work with -j4 yet, but it gets most packa...
[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 .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,BRCM_WL,brcm-wl,\
43 $(MODULES_DIR)/kernel/drivers/net/wl/wl.o \
44 ,CONFIG_WL))
45 $(eval $(call KMOD_template,BRCM_ET,brcm-et,\
46 $(MODULES_DIR)/kernel/drivers/net/et/et.o \
47 ,CONFIG_ET))
48 $(eval $(call KMOD_template,ARPT,arptables,\
49 $(MODULES_DIR)/kernel/net/ipv4/netfilter/arp*.o \
50 ,CONFIG_IP_NF_ARPTABLES))
51 $(eval $(call KMOD_template,EBT,ebtables,\
52 $(MODULES_DIR)/kernel/net/bridge/netfilter/*.o \
53 ,CONFIG_BRIDGE_NF_EBTABLES))
54 $(eval $(call KMOD_template,IPT4,iptables-extra,\
55 $(MODULES_DIR)/kernel/net/ipv4/netfilter/ip*.o \
56 ))
57 $(eval $(call KMOD_template,IPT6,ip6tables,\
58 $(MODULES_DIR)/kernel/net/ipv6/netfilter/ip*.o \
59 ,CONFIG_IP6_NF_IPTABLES))
60 $(eval $(call KMOD_template,IPV6,ipv6,\
61 $(MODULES_DIR)/kernel/net/ipv6/ipv6.o \
62 ,CONFIG_IPV6))
63 $(eval $(call KMOD_template,CIFS,cifs,\
64 $(MODULES_DIR)/kernel/fs/cifs/cifs.o \
65 ,CONFIG_CIFS))
66 $(eval $(call KMOD_template,NFS,nfs,\
67 $(MODULES_DIR)/kernel/fs/lockd/*.o \
68 $(MODULES_DIR)/kernel/fs/nfs/*.o \
69 $(MODULES_DIR)/kernel/net/sunrpc/*.o \
70 ,CONFIG_NFS_FS))
71 $(eval $(call KMOD_template,USB,usb-core,\
72 $(MODULES_DIR)/kernel/drivers/usb/usbcore.o \
73 ,CONFIG_USB))
74 $(eval $(call KMOD_template,USB_UHCI,usb-uhci,\
75 $(MODULES_DIR)/kernel/drivers/usb/host/uhci.o \
76 ,CONFIG_USB_UHCI_ALT))
77 $(eval $(call KMOD_template,USB_OHCI,usb-ohci,\
78 $(MODULES_DIR)/kernel/drivers/usb/host/usb-ohci.o \
79 ,CONFIG_USB_OHCI))
80 $(eval $(call KMOD_template,USB2,usb2,\
81 $(MODULES_DIR)/kernel/drivers/usb/host/ehci-hcd.o \
82 ,CONFIG_USB_EHCI_HCD))
83 $(eval $(call KMOD_template,USB_STORAGE,usb-storage,\
84 $(MODULES_DIR)/kernel/drivers/scsi/*.o \
85 $(MODULES_DIR)/kernel/drivers/usb/storage/*.o \
86 ,CONFIG_USB_STORAGE))
87 $(eval $(call KMOD_template,USB_PRINTER,usb-printer,\
88 $(MODULES_DIR)/kernel/drivers/usb/printer.o \
89 ,CONFIG_USB_PRINTER))
90 $(eval $(call KMOD_template,LP,lp,\
91 $(MODULES_DIR)/kernel/drivers/parport/parport.o \
92 $(MODULES_DIR)/kernel/drivers/parport/parport_splink.o \
93 $(MODULES_DIR)/kernel/drivers/char/lp.o \
94 ,CONFIG_PARPORT))
95 $(eval $(call KMOD_template,VFAT,vfat,\
96 $(MODULES_DIR)/kernel/fs/vfat/vfat.o \
97 $(MODULES_DIR)/kernel/fs/fat/fat.o \
98 $(MODULES_DIR)/kernel/fs/msdos/msdos.o \
99 ,CONFIG_VFAT_FS))
100 $(eval $(call KMOD_template,CRYPTO,crypto,\
101 $(MODULES_DIR)/kernel/crypto/*.o \
102 ))
103 $(eval $(call KMOD_template,PPP,ppp,\
104 $(MODULES_DIR)/kernel/drivers/net/ppp_async.o \
105 $(MODULES_DIR)/kernel/drivers/net/ppp_generic.o \
106 $(MODULES_DIR)/kernel/drivers/net/slhc.o \
107 ,CONFIG_PPP))
108 $(eval $(call KMOD_template,MPPE,mppe,\
109 $(MODULES_DIR)/kernel/drivers/net/ppp_mppe_mppc.o \
110 ,CONFIG_PPP_MPPE_MPPC))
111 $(eval $(call KMOD_template,PPPOE,pppoe,\
112 $(MODULES_DIR)/kernel/drivers/net/pppoe.o \
113 $(MODULES_DIR)/kernel/drivers/net/pppox.o \
114 ,CONFIG_PPPOE))
115 $(eval $(call KMOD_template,TUN,tun,\
116 $(MODULES_DIR)/kernel/drivers/net/tun.o \
117 ,CONFIG_TUN))
118 $(eval $(call KMOD_template,GRE,gre,\
119 $(MODULES_DIR)/kernel/net/ipv4/ip_gre.o \
120 ,CONFIG_NET_IPGRE))
121 $(eval $(call KMOD_template,SCHED,sched,\
122 $(MODULES_DIR)/kernel/net/sched/*.o \
123 ))
124
125 $(TARGETS): $(PACKAGE_DIR)
126
127 $(PACKAGE_DIR):
128 mkdir -p $(PACKAGE_DIR)
129
130 source: linux-source
131 prepare: $(LINUX_DIR)/.configured
132 compile: $(LINUX_DIR)/.modules_done $(TARGETS)
133
134 install: compile $(TARGET_MODULES_DIR)
135 @[ "$(INSTALL_TARGETS)" != "" ] && $(IPKG) install $(INSTALL_TARGETS) || true
136
137 clean: linux-dirclean
138 rm -f $(TARGETS)
This page took 0.049952 seconds and 5 git commands to generate.