Debian Codegraph @

Makefile

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 #
2 # Makefile for DAHDI Linux kernel modules
3 #
4 # Copyright (C) 2001-2010 Digium, Inc.
5 #
6 #
7
8 PWD:=$(shell pwd)
9
10 DAHDI_MODULES_EXTRA:=$(MODULES_EXTRA:%=%.o) $(SUBDIRS_EXTRA:%=%/)
11
12 # If you want to build for a kernel other than the current kernel, set KVERS
13 ifndef KVERS
14 KVERS:=$(shell uname -r)
15 endif
16 ifndef KSRC
17 ifneq (,$(wildcard /lib/modules/$(KVERS)/build))
18 KSRC:=/lib/modules/$(KVERS)/build
19 else
20 KSRC_SEARCH_PATH:=/usr/src/linux
21 KSRC:=$(shell for dir in $(KSRC_SEARCH_PATH); do if [ -d $$dir ]; then echo $$dir; break; fi; done)
22 endif
23 endif
24 KVERS_MAJ:=$(shell echo $(KVERS) | cut -d. -f1-2)
25 KINCLUDES:=$(KSRC)/include
26
27 # We use the kernel's .config file as an indication that the KSRC
28 # directory is indeed a valid and configured kernel source (or partial
29 # source) directory.
30 #
31 # We also source it, as it has the format of Makefile variables list.
32 # Thus we will have many CONFIG_* variables from there.
33 KCONFIG:=$(KSRC)/.config
34 ifneq (,$(wildcard $(KCONFIG)))
35 HAS_KSRC:=yes
36 include $(KCONFIG)
37 else
38 HAS_KSRC:=no
39 endif
40
41 CHECKSTACK=$(KSRC)/scripts/checkstack.pl
42
43 # Set HOTPLUG_FIRMWARE=no to override automatic building with hotplug support
44 # if it is enabled in the kernel.
45
46 ifeq (yes,$(HAS_KSRC))
47 HOTPLUG_FIRMWARE:=$(shell if grep -q '^CONFIG_FW_LOADER=[ym]' $(KCONFIG); then echo "yes"; else echo "no"; fi)
48 endif
49
50 MODULE_ALIASES:=wcfxs wctdm8xxp wct2xxp
51
52 INST_HEADERS:=kernel.h user.h fasthdlc.h wctdm_user.h dahdi_config.h
53
54 DAHDI_BUILD_ALL:=m
55
56 KMAKE=+$(MAKE) -C $(KSRC) KBUILD_EXTMOD=$(PWD)/drivers/dahdi DAHDI_INCLUDE=$(PWD)/include DAHDI_MODULES_EXTRA="$(DAHDI_MODULES_EXTRA)" HOTPLUG_FIRMWARE=$(HOTPLUG_FIRMWARE)
57
58 ROOT_PREFIX:=
59
60 ASCIIDOC:=asciidoc
61 ASCIIDOC_CMD:=$(ASCIIDOC) -n -a toc -a toclevels=4
62
63 GENERATED_DOCS:=README.html
64
65 DAHDIVERSION:=$(shell build_tools/make_version . dahdi/linux)
66
67 all: modules
68
69 modules: prereq
70 ifeq (no,$(HAS_KSRC))
71 @echo "You do not appear to have the sources for the $(KVERS) kernel installed."
72 @exit 1
73 endif
74 $(KMAKE) modules DAHDI_BUILD_ALL=$(DAHDI_BUILD_ALL)
75
76 include/dahdi/version.h: FORCE
77 @DAHDIVERSION="${DAHDIVERSION}" build_tools/make_version_h > [email protected]
78 @if cmp -s [email protected] $@ ; then :; else \
79 mv [email protected] $@ ; \
80 fi
81 @rm -f [email protected]
82
•83 prereq: include/dahdi/version.h
84
85 stackcheck: $(CHECKSTACK) modules
86 objdump -d drivers/dahdi/*.ko drivers/dahdi/*/*.ko | $(CHECKSTACK)
87
88 install: all install-modules install-include install-firmware install-xpp-firm
89 @echo "###################################################"
90 @echo "###"
91 @echo "### DAHDI installed successfully."
92 @echo "### If you have not done so before, install the package"
93 @echo "### dahdi-tools."
94 @echo "###"
95 @echo "###################################################"
96
97 uninstall: uninstall-modules uninstall-include uninstall-firmware
98
99 install-modconf:
100 build_tools/genmodconf $(BUILDVER) "$(ROOT_PREFIX)" "$(filter-out dahdi dahdi_dummy xpp dahdi_transcode dahdi_dynamic,$(BUILD_MODULES)) $(MODULE_ALIASES)"
101 @if [ -d /etc/modutils ]; then \
102 /sbin/update-modules ; \
103 fi
104
105 install-xpp-firm:
106 $(MAKE) -C drivers/dahdi/xpp/firmwares install
107
108
109 install-firmware:
110 ifeq ($(HOTPLUG_FIRMWARE),yes)
111 $(MAKE) -C drivers/dahdi/firmware hotplug-install DESTDIR=$(DESTDIR) HOTPLUG_FIRMWARE=$(HOTPLUG_FIRMWARE)
112 endif
113
114 uninstall-firmware:
115 $(MAKE) -C drivers/dahdi/firmware hotplug-uninstall DESTDIR=$(DESTDIR)
116
117 firmware-loaders:
•118 @echo "Disabled firmware download"
119
120 install-include:
121 for hdr in $(INST_HEADERS); do \
122 install -D -m 644 include/dahdi/$$hdr $(DESTDIR)/usr/include/dahdi/$$hdr; \
123 done
124 @rm -rf $(DESTDIR)/usr/include/zaptel
125
126 uninstall-include:
127 for hdr in $(INST_HEADERS); do \
128 rm -f $(DESTDIR)/usr/include/dahdi/$$hdr; \
129 done
130 -rmdir $(DESTDIR)/usr/include/dahdi
131
132 install-modules: modules
133 ifndef DESTDIR
134 @if modinfo zaptel > /dev/null 2>&1; then \
135 echo -n "Removing Zaptel modules for kernel $(KVERS), please wait..."; \
136 build_tools/uninstall-modules zaptel $(KVERS); \
137 rm -rf /lib/modules/$(KVERS)/zaptel; \
138 echo "done."; \
139 fi
140 build_tools/uninstall-modules dahdi $(KVERS)
141 endif
142 $(KMAKE) INSTALL_MOD_PATH=$(DESTDIR) INSTALL_MOD_DIR=dahdi modules_install
143 [ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || :
144
145 uninstall-modules:
146 ifdef DESTDIR
147 @echo "Uninstalling modules is not supported with a DESTDIR specified."
148 @exit 1
149 else
150 @if modinfo dahdi > /dev/null 2>&1 ; then \
151 echo -n "Removing DAHDI modules for kernel $(KVERS), please wait..."; \
152 build_tools/uninstall-modules dahdi $(KVERS); \
153 rm -rf /lib/modules/$(KVERS)/dahdi; \
154 echo "done."; \
155 fi
156 [ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || :
157 endif
158
159 update:
160 @if [ -d .svn ]; then \
161 echo "Updating from Subversion..." ; \
162 svn update | tee update.out; \
163 rm -f .version; \
164 if [ `grep -c ^C update.out` -gt 0 ]; then \
165 echo ; echo "The following files have conflicts:" ; \
166 grep ^C update.out | cut -b4- ; \
167 fi ; \
168 rm -f update.out; \
169 else \
170 echo "Not under version control"; \
171 fi
172
173 dist:
174 @./build_tools/make_dist "dahdi-linux" "$(DAHDIVERSION)"
175
176 clean:
177 ifneq (no,$(HAS_KSRC))
178 $(KMAKE) clean
179 endif
180 @rm -f $(GENERATED_DOCS)
181 $(MAKE) -C drivers/dahdi/firmware clean
182 $(MAKE) -C $(KSRC) M='$(PWD)/drivers/dahdi/oct612x' clean
183
184 distclean: dist-clean
185
186 dist-clean: clean
187 @rm -f include/dahdi/version.h
188 @$(MAKE) -C drivers/dahdi/firmware dist-clean
189 @rm -f drivers/dahdi/vpmadt032_loader/*.o_shipped
190
191 firmware-download:
192 @$(MAKE) -C drivers/dahdi/firmware all
193
194 ifneq (,$(wildcard test-script))
195 test:
196 ./test-script $(DESTDIR)/lib/modules/$(KVERS) dahdi
197 endif
198
199 docs: $(GENERATED_DOCS)
200
201 README.html: README
202 date=`stat -c "%y" $<`
203 $(ASCIIDOC_CMD) -a revdate="$$date" -o $@ $<
204
205 dahdi-api.html: drivers/dahdi/dahdi-base.c
206 build_tools/kernel-doc --kernel $(KSRC) $^ >$@
207
208 .PHONY: distclean dist-clean clean all install devices modules stackcheck install-udev update install-modules install-include uninstall-modules firmware-download install-xpp-firm firmware-loaders dist
209
210 FORCE: