#!/usr/bin/make -f # Written by Steve Kowalik 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