summaryrefslogtreecommitdiff
path: root/drivers/dahdi/Kbuild
blob: 1c2d1e30a85ee69f0f99941f3e11f2dd0175a269 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI)			+= dahdi.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_DUMMY)		+= dahdi_dummy.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_DYNAMIC)		+= dahdi_dynamic.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_DYNAMIC_LOC)	+= dahdi_dynamic_loc.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_DYNAMIC_ETH)	+= dahdi_dynamic_eth.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_TRANSCODE)		+= dahdi_transcode.o

obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCT4XXP)		+= wct4xxp/
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTC4XXP)		+= wctc4xxp/
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTDM24XXP)	+= wctdm24xxp/
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTE12XP)		+= wcte12xp/
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTDM)		+= wctdm.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_VOICEBUS)		+= voicebus/
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCB4XXP)		+= wcb4xxp/

obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCT1XXP)		+= wct1xxp.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTE11XP)		+= wcte11xp.o

obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCFXO)		+= wcfxo.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_TOR2)		+= tor2.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_PCIRADIO)		+= pciradio.o

obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_XPP)		+= xpp/

obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_JPAH)	+= dahdi_echocan_jpah.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_STEVE)	+= dahdi_echocan_sec.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_STEVE2)	+= dahdi_echocan_sec2.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_KB1)	+= dahdi_echocan_kb1.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_MG2)	+= dahdi_echocan_mg2.o

obj-m += $(DAHDI_MODULES_EXTRA)

# Only enable this if you think you know what you're doing. This is not
# supported yet:
#obj-m += dahdi_echocan_oslec.o
#
# A quick and dirty way to build OSLEC, if you happened to place it
# yourself in the dahdi source tree. This is experimental. See README
# regarding OSLEC.
#obj-m += ../staging/echo/

CFLAGS_MODULE += -I$(DAHDI_INCLUDE) -I$(src)

ifndef HOTPLUG_FIRMWARE
ifneq (,$(filter y m,$(CONFIG_FW_LOADER)))
HOTPLUG_FIRMWARE := yes
else
HOTPLUG_FIRMWARE := no
endif
export HOTPLUG_FIRMWARE
endif

# fix typo present in CentOS and RHEL 2.6.9 kernels
BAD_KERNELS_VERS := 22 34 34.0.1 34.0.2
BAD_KERNELS := $(foreach ver,$(BAD_KERNELS_VERS),2.6.9-$(ver).EL 2.6.9-$(ver).ELsmp)
ifneq (,$(filter $(KVERS),$(BAD_KERNELS)))
EXTRA_CFLAGS+=-Drw_lock_t=rwlock_t
endif

# A number of Fedora 10 (9 also?) kernels backported hrtimer to 2.6.27
# as part of an ALSA backport. TODO: Any better way to detect that?
ifeq (1,$(shell fgrep -q ' hrtimer_set_expires' include/linux/hrtimer.h 2>/dev/null && echo 1))
EXTRA_CFLAGS+=-DHAVE_HRTIMER_ACCESSORS=1
endif

dahdi-objs := dahdi-base.o

###############################################################################
# Find appropriate ARCH value for VPMADT032 and HPEC binary modules
###############################################################################

ifeq ($(ARCH),i386)
  DAHDI_ARCH=x86_32
else ifeq ($(ARCH),x86_64)
  DAHDI_ARCH=x86_64
else ifeq ($(ARCH),x86)
  ifeq ($(CONFIG_X86_32),y)
    DAHDI_ARCH=x86_32
  else
    DAHDI_ARCH=x86_64
  endif
else
$(warning CPU Architecture '$(ARCH)' does not support VPMADT032 or HPEC. Skipping.)
endif

###############################################################################
# VPMADT032 Loader
###############################################################################

dahdi_vpmadt032_loader-objs := vpmadt032_loader/dahdi_vpmadt032_loader.o 

ifneq ($(DAHDI_ARCH),)
  ifneq ($(wildcard $(src)/vpmadt032_loader/vpmadt032_$(DAHDI_ARCH).o_shipped),)
    VPMADT032_LOADER_PRESENT=yes
    dahdi_vpmadt032_loader-objs += vpmadt032_loader/vpmadt032_$(DAHDI_ARCH).o
    obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_VPMADT032_LOADER)	+= dahdi_vpmadt032_loader.o
  endif
endif

###############################################################################
# HPEC Support 
###############################################################################

dahdi_echocan_hpec-objs := hpec/dahdi_echocan_hpec.o
CFLAGS_dahdi_echocan_hpec.o := -I$(src)/hpec

ifneq ($(DAHDI_ARCH),)
  ifneq ($(wildcard $(src)/hpec/hpec_$(DAHDI_ARCH).o_shipped),)
    HPEC_PRESENT=yes
    dahdi_echocan_hpec-objs += hpec/hpec_$(DAHDI_ARCH).o
  endif
endif

ifeq ($(HPEC_PRESENT),yes)
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_HPEC)	+= dahdi_echocan_hpec.o
endif

$(obj)/pciradio.o: $(obj)/radfw.h
$(obj)/tor2.o: $(obj)/tor2fw.h

hostprogs-y := $(obj)/makefw

$(obj)/tor2fw.h: $(src)/tormenta2.rbt $(obj)/makefw 
	$(obj)/makefw $< tor2fw > $@

$(obj)/radfw.h: $(src)/pciradio.rbt $(obj)/makefw
	$(obj)/makefw $< radfw > $@

$(obj)/makefw: $(src)/makefw.c
	$(HOSTCC) -o $@ $^

clean-files	:= radfw.h tor2fw.h