#!/usr/bin/make -f
# common debian/rules for packages providing kernel modules

MODULES := $(shell grep ^Source: debian/control | cut -d ' ' -f 2 | \
	cut -d - -f 1)

build: build-stamp
build-stamp:
	[ -e debian/control ]
	m-a -u . build $(MODULES)
	mv *.deb ..
	touch $@

clean:
	[ -e debian/control ]
	rm -rf build-stamp usr_src var_cache_modass debian/files

binary-indep:

binary-arch: build
	[ -e debian/control ]
	for file in ../*.deb ; do dpkg-distaddfile `basename $$file` \
		`dpkg-deb -f $$file Section` `dpkg-deb -f $$file Priority` ; \
		done

binary: binary-arch
.PHONY: build clean binary-indep binary-arch binary

KVERS ?= $(shell uname -r)

debian/control:
	sed -e "s/@KVERS@/$(KVERS)/" $@.in > $@

.PHONY: debian/control
