Kbuild: Fix OSLEC build error
[dahdi/linux.git] / drivers / dahdi / Kbuild
1 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI)                   += dahdi.o
2 #obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_DUMMY)            += dahdi_dummy.o
3 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_DYNAMIC)           += dahdi_dynamic.o
4 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_DYNAMIC_LOC)       += dahdi_dynamic_loc.o
5 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_DYNAMIC_ETH)       += dahdi_dynamic_eth.o
6 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_DYNAMIC_ETHMF)     += dahdi_dynamic_ethmf.o
7 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_TRANSCODE)         += dahdi_transcode.o
8
9 ifdef CONFIG_PCI
10 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCT4XXP)           += wct4xxp/
11 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTC4XXP)          += wctc4xxp/
12 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTDM24XXP)        += wctdm24xxp/
13 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTE12XP)          += wcte12xp/
14 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTDM)             += wctdm.o
15 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_VOICEBUS)          += voicebus/
16 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCB4XXP)           += wcb4xxp/
17
18 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCT1XXP)           += wct1xxp.o
19 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTE11XP)          += wcte11xp.o
20
21 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCFXO)             += wcfxo.o
22 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_TOR2)              += tor2.o
23 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_PCIRADIO)          += pciradio.o
24 endif
25
26 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_XPP)               += xpp/
27
28 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_JPAH)      += dahdi_echocan_jpah.o
29 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_STEVE)     += dahdi_echocan_sec.o
30 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_STEVE2)    += dahdi_echocan_sec2.o
31 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_KB1)       += dahdi_echocan_kb1.o
32 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_MG2)       += dahdi_echocan_mg2.o
33
34 obj-m += $(DAHDI_MODULES_EXTRA)
35
36 # If you want to build OSLEC, include the code in the standard location:
37 # drivers/staging/echo . The DAHDI OSLEC echo canceller will be built as
38 # well:
39 ifneq (,$(wildcard $(src)/../staging/echo/echo.c))
40 obj-m += dahdi_echocan_oslec.o
41 obj-m += ../staging/echo/echo.o
42 endif
43
44 CFLAGS_MODULE += -I$(DAHDI_INCLUDE) -I$(src)
45
46 ifndef HOTPLUG_FIRMWARE
47 ifneq (,$(filter y m,$(CONFIG_FW_LOADER)))
48 HOTPLUG_FIRMWARE := yes
49 else
50 HOTPLUG_FIRMWARE := no
51 endif
52 export HOTPLUG_FIRMWARE
53 endif
54
55 # fix typo present in CentOS and RHEL 2.6.9 kernels
56 BAD_KERNELS_VERS := 22 34 34.0.1 34.0.2
57 BAD_KERNELS := $(foreach ver,$(BAD_KERNELS_VERS),2.6.9-$(ver).EL 2.6.9-$(ver).ELsmp)
58 ifneq (,$(filter $(KVERS),$(BAD_KERNELS)))
59 EXTRA_CFLAGS+=-Drw_lock_t=rwlock_t
60 endif
61
62 # A number of Fedora 10 (9 also?) kernels backported hrtimer to 2.6.27
63 # as part of an ALSA backport. TODO: Any better way to detect that?
64 ifeq (1,$(shell fgrep -q ' hrtimer_set_expires' include/linux/hrtimer.h 2>/dev/null && echo 1))
65 EXTRA_CFLAGS+=-DHAVE_HRTIMER_ACCESSORS=1
66 endif
67
68 ifeq (1,$(shell fgrep -q 'wait_for_completion_timeout' include/linux/completion.h 2>/dev/null && echo 1))
69 CFLAGS_MODULE+=-DHAVE_WAIT_FOR_COMPLETION_TIMEOUT=1
70 endif
71
72 # In 2.6.18 skb_linearize changed; however, some distros backported the change
73 ifneq (,$(wildcard $(srctree)/include/linux/skbuff.h))
74 ifeq ($(shell grep "skb_linearize.*(.*, .* gfp)" $(srctree)/include/linux/skbuff.h),)
75 CFLAGS_dahdi_dynamic_eth.o := -DNEW_SKB_LINEARIZE
76 CFLAGS_dahdi_dynamic_ethmf.o := -DNEW_SKB_LINEARIZE
77 endif
78 endif
79
80 dahdi-objs := dahdi-base.o dahdi-sysfs.o dahdi-version.o
81
82 ###############################################################################
83 # Find appropriate ARCH value for VPMADT032 and HPEC binary modules
84 ###############################################################################
85
86 ifeq ($(ARCH),i386)
87   DAHDI_ARCH=x86_32
88 else
89   ifeq ($(ARCH),x86_64)
90     DAHDI_ARCH=x86_64
91   else
92     ifeq ($(ARCH),x86)
93       ifeq ($(CONFIG_X86_32),y)
94         DAHDI_ARCH=x86_32
95       else
96         DAHDI_ARCH=x86_64
97       endif
98     else
99 $(warning CPU Architecture '$(ARCH)' does not support VPMADT032 or HPEC. Skipping.)
100     endif
101   endif
102 endif
103
104 ###############################################################################
105 # VPMADT032 Loader
106 ###############################################################################
107
108 dahdi_vpmadt032_loader-objs := vpmadt032_loader/dahdi_vpmadt032_loader.o 
109
110 ifneq ($(DAHDI_ARCH),)
111   ifneq ($(wildcard $(src)/vpmadt032_loader/vpmadt032_$(DAHDI_ARCH).o_shipped),)
112     VPMADT032_LOADER_PRESENT=yes
113     dahdi_vpmadt032_loader-objs += vpmadt032_loader/vpmadt032_$(DAHDI_ARCH).o
114     obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_VPMADT032_LOADER)      += dahdi_vpmadt032_loader.o
115   endif
116 endif
117
118 ###############################################################################
119 # HPEC Support 
120 ###############################################################################
121
122 dahdi_echocan_hpec-objs := hpec/dahdi_echocan_hpec.o
123 CFLAGS_dahdi_echocan_hpec.o := -I$(src)/hpec
124
125 ifneq ($(DAHDI_ARCH),)
126   ifneq ($(wildcard $(src)/hpec/hpec_$(DAHDI_ARCH).o_shipped),)
127     HPEC_PRESENT=yes
128     dahdi_echocan_hpec-objs += hpec/hpec_$(DAHDI_ARCH).o
129   endif
130 endif
131
132 ifeq ($(HPEC_PRESENT),yes)
133 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_HPEC)      += dahdi_echocan_hpec.o
134 endif
135
136 $(obj)/pciradio.o: $(obj)/radfw.h
137 $(obj)/tor2.o: $(obj)/tor2fw.h
138
139 hostprogs-y := makefw
140
141 $(obj)/tor2fw.h: $(src)/tormenta2.rbt $(obj)/makefw 
142         $(obj)/makefw $< tor2fw > $@
143
144 $(obj)/radfw.h: $(src)/pciradio.rbt $(obj)/makefw
145         $(obj)/makefw $< radfw > $@
146
147 clean-files     := radfw.h tor2fw.h