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
|
#!/usr/bin/make -f
# debian/rules for thinkpad-modules-$KVERS
# Copyright (C) 2002, 2003 Thomas Hood
# Distributable under the terms of the GNU GPL version 2 (or later).
export DH_COMPAT=3
# Use no get-root command if we're already root
ifeq ($(shell id -u),0)
ROOT_CMD=
endif
# make-kpkg calls one of the targets:
# kdist, kdist_configure, kdist_changes or kdist_image
# with the following variables set:
# KVERS
# KSRC
# KEMAIL
# KMAINT
# KDREV
KSRC ?= /usr/src/linux
KTYPE=$(shell echo $(KVERS) | sed -e 's/^\([2-9].[0-9]\).*/\1/' )
NONEPOCH=$(shell echo $(KDREV) | sed -e 's/^[0-9]*://')
EPOCHT=$(shell echo $(KDREV) | sed -e 's/$(NONEPOCH)$$//g')
EPOCH=$(shell echo $(EPOCHT) | sed -e 's/://g')
VERSION=$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)
ARCH=$(shell dpkg --print-architecture)
CHFILE=$(KSRC)/../thinkpad-modules-$(KVERS)_$(VERSION)_$(ARCH).changes
DEB=$(shell pwd)/debian/thinkpad-modules-$(KVERS)
ifeq ($(KTYPE),2.6)
MODSUF := ko
else
MODSUF := o
endif
SCRIPT=s!\$$KVERS!$(KVERS)!g; \
s!\$$KSRC!$(KSRC)!; \
s!\$$KEMAIL!$(KEMAIL)!; \
s!\$$KMAINT!$(KMAINT)!; \
s!\$$NONEPOCH!$(NONEPOCH)!; \
s!\$$EPOCH!$(EPOCH)!; \
s!\$$DEBDATE!$(shell 822-date)!
debian/control: debian/control.sed
sed -e "$(SCRIPT)" $< > $@
chmod ugo+x $@
debian/changelog: debian/changelog.sed
sed -e "$(SCRIPT)" $< > $@
chmod ugo+x $@
debian/postinst: debian/postinst.sed
sed -e "$(SCRIPT)" $< > $@
chmod ugo+x $@
debian/postrm: debian/postrm.sed
sed -e "$(SCRIPT)" $< > $@
chmod ugo+x $@
kdist_configure: debian/control debian/changelog debian/postinst debian/postrm
build-modules:
cd $(KTYPE)/drivers && $(MAKE)
binary-modules: build-modules
dh_testdir
dh_testroot
install -d $(DEB)/lib/modules/$(KVERS)/thinkpad
cd $(KTYPE)/drivers && install -c -m 0644 *.$(MODSUF) $(DEB)/lib/modules/$(KVERS)/thinkpad
rm -f $(DEB)/lib/modules/$(KVERS)/thinkpad/smapi_*.$(MODSUF)
dh_installdocs
dh_installchangelogs
dh_link
dh_strip
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb --destdir=$(KSRC)/..
kdist_image: kdist_configure
$(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules binary-modules
kdist_changes: kdist_image
dpkg-genchanges -b -e"$(KMAINT) <$(KEMAIL)>" -u"$(KSRC)/.." > $(CHFILE)
debsign -e"$(KMAINT) <$(KEMAIL)>" $(CHFILE) || true
kdist: kdist_changes
kdist_clean:
test -d debian
dh_clean debian/control debian/changelog debian/postinst debian/postrm
cd $(KTYPE)/drivers && $(MAKE) clean
.PHONY: debian/changelog debian/control debian/postinst debian/postrm
.PHONY: kdist kdist_image kdist_changes kdist_configure
.PHONY: binary binary-arch binary-indep source diff build install configure
|