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 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
|
#!/usr/bin/make -f
# Written by Steve Kowalik <stevenk@debian.org> for the New Alsa-Source.
# Loosely based on the rules file from pcmcia-cs and the old alsa-source.
KSRC ?= /usr/src/linux
KDREV ?= unknown
KVERS ?= unknown
ifeq ($(KDEP),)
KDEPC =
else
KDEPC = $(KDEP),
endif
# See if we can work out the compiler used
ifeq ($(origin CC),default)
ifneq "$(wildcard $(KSRC)/include/linux/compile.h)" ""
CC = gcc-$(shell grep LINUX_COMPILER $(KSRC)/include/linux/compile.h | sed 's/.* \([0-9]\+\.[0-9]\+\).*/\1/')
else
CC = gcc
endif
endif
# Special case gcc 2.7.2
ifeq ($(CC),gcc-2.7)
CC = gcc272
endif
# If they didn't set $(KVERS), see if we can do it for them.
ifeq ($(KVERS),unknown)
ifneq "$(wildcard $(KSRC)/include/linux/version.h)" ""
KVERS = $(shell head -1 $(KSRC)/include/linux/version.h | sed 's/.*"\(.*\)"$$/\1/')
endif
endif
# Clear root command if already root
ifeq ($(shell id -u),0)
ROOT_CMD=
endif
# Use updates/ subdirectory so that the modules in alsa-modules-$KVERS
# are given priority (by depmod) over modules under kernel/.
CONFIGURE_OPT = --prefix=/usr \
--with-kernel=$(KSRC) \
--with-build=$(KSRC) \
--with-moddir=/lib/modules/$(KVERS)/updates/alsa \
--with-sequencer=yes
ifneq (,$(findstring 2.2.,$(KVERS)))
MODULELOADERDEP = modutils (>= 2.3.5)
PCMCIAMODULESSUG = kernel-pcmcia-modules-$(KVERS) | pcmcia-modules-$(KVERS)
# See SF bug #550435
CONFIGURE_OPT += --disable-verbose-printk
else
ifneq (,$(findstring 2.4.,$(KVERS)))
MODULELOADERDEP = modutils (>= 2.3.5)
PCMCIAMODULESSUG = kernel-pcmcia-modules-$(KVERS) | pcmcia-modules-$(KVERS)
else
MODULELOADERDEP = module-init-tools (>= 3.1)
PCMCIAMODULESSUG =
endif
endif
# Read in config file, generated by debconf.
ifeq (/etc/alsa/alsa-source.conf,$(wildcard /etc/alsa/alsa-source.conf))
include /etc/alsa/alsa-source.conf
endif
ifeq ($(HOME)/.alsa-source.conf,$(wildcard $(HOME)/.alsa-source.conf))
include $(HOME)/.alsa-source.conf
endif
ifeq ($(CURDIR)/debian/alsa-source.conf,$(wildcard $(CURDIR)/debian/alsa-source.conf))
include $(CURDIR)/debian/alsa-source.conf
endif
ifeq ($(ALSA_NOPNP),"y")
CONFIGURE_OPT += --with-isapnp=no
else
CONFIGURE_OPT += --with-isapnp=yes
endif
ifeq ($(ALSA_DEBUG),"y")
CONFIGURE_OPT += --with-debug=detect
endif
ifneq ($(ALSA_CARDS),"")
CONFIGURE_OPT += --with-cards=$(ALSA_CARDS)
endif
ifneq ($(ALSA_CARD_OPTIONS),"")
CONFIGURE_OPT += --with-card-options=$(ALSA_CARD_OPTIONS)
endif
ifneq ($(CONCURRENCY_LEVEL),)
MAKE_OPT = -j $(CONCURRENCY_LEVEL)
endif
VERSION = $(shell dpkg-parsechangelog | grep ^Vers | cut -d\ -f2)
ifneq ($(KDREV),unknown)
ifeq ($(findstring :,$(KDREV)),:)
VERSION := $(subst :,:$(VERSION)+,$(KDREV))
else
VERSION := $(VERSION)+$(KDREV)
endif
endif
echo-vars:
@echo "I've been configured using:"
@echo " - Kernel source of $(KSRC)"
@echo " - Kernel version of $(KVERS)"
@echo " - Kernel revision of $(KDREV)"
@echo " - C compiler of $(CC)"
@echo " - Make options of $(MAKE_OPT)"
@echo " - Version of $(VERSION)"
configure: configure-stamp
configure-stamp:
@if [ ! -x /usr/bin/$(CC) ]; then echo "You don't have the compiler that your kernel was built with installed"; exit 1; fi
CC="$(CC)" ./configure $(CONFIGURE_OPT)
touch configure-stamp
build: build-stamp
build-stamp: configure-stamp
$(MAKE) $(MAKE_OPT) compile
install: install-stamp
install-stamp: build-stamp
$(MAKE) $(MAKE_OPT) DESTDIR=$(CURDIR)/debian/$(shell dh_listpackages) install-modules
control-munge:
for i in control postinst postrm ; do \
cp -p debian/$$i debian/$$i.orig; \
cat debian/$$i | sed \
-e 's/_KVERS_/$(KVERS)/g' \
-e 's/_KDEP_/$(KDEPC)/g' \
-e 's/_MODULELOADERDEP_/$(MODULELOADERDEP)/g' \
-e 's/_PCMCIAMODULESSUG_/$(PCMCIAMODULESSUG)/g' \
-e '/^Suggests:[[:space:]]*$$/d' \
> debian/$$i.tmp; \
mv -f debian/$$i.tmp debian/$$i; \
done
touch control-munge
clean-control-munge:
for i in control postinst postrm ; do \
if [ -f debian/$$i.orig ]; then \
mv -f debian/$$i.orig debian/$$i ; \
fi ; \
done
-$(RM) control-munge
clean: clean-control-munge
-make mrproper
$(RM) configure-stamp
$(RM) build-stamp
binary_modules: binary-modules
binary-modules: configure-stamp build-stamp control-munge install-stamp
dh_testdir
dh_testroot
dh_installdirs usr/share/bug/alsa-modules-$(KVERS)
dh_installchangelogs debian/changelog.ALSA
# alsa-modules-i386 adds changelog.alsa-driver.Debian
if [ -f debian/changelog.alsa-driver.Debian ] ; then \
dh_installdocs debian/changelog.alsa-driver.Debian ; \
else \
dh_installdocs ; \
fi
dh_install debian/bug/control usr/share/bug/alsa-modules-$(KVERS)
dh_installmodules
dh_strip
dh_compress
dh_fixperms
dh_installdeb
dh_shlibdeps
dh_gencontrol -- -v"$(VERSION)"
dh_md5sums
ifeq "$(origin KPKG_DEST_DIR)" "undefined"
ifeq "$(origin KMAINT)" "undefined"
dh_builddeb --destdir=$(CURDIR)/..
else
dh_builddeb --destdir=$(KSRC)/..
endif
else
dh_builddeb --destdir=$(KPKG_DEST_DIR)
endif
binary:
@echo "Binary target not supported. Use binary-modules or make-kpkg."
exit 1
# Targets that kernel-package uses.
kdist_configure: configure-stamp
kdist_config: configure-stamp
kdist_image:
$(ROOT_CMD) $(MAKE) -f debian/rules binary-modules
$(ROOT_CMD) $(MAKE) -f debian/rules clean
kdist_clean: clean
kdist:
$(ROOT_CMD) $(MAKE) -f debian/rules binary-modules
.PHONY: configure build clean binary-modules binary_modules binary kdist_configure kdist_config kdist_image kdist_clean kdist
|