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
|
#!/usr/bin/make -f
# debug
#export DH_VERBOSE=y
#export TO_NULL=&>/dev/null
#TO_NULL=&>/dev/null
#MAKEFLAGS+=-s --no-print-directory
# used by debian/config-for-lwng that is sourced by ./Configure
# in this way modules are built
ENV=BUILD_MODULES=y BUILD_UTILS=n
# KSRC is something like '/usr/src/linux'
# KVERS is something like '2.6.11-9-amd64-k8'
# KDREV is something like '2.6.11-2'
#
# a sample invocation by m-a is
# debian/rules KSRC=/usr/src/linux KVERS=2.6.11-9-amd64-k8 KDREV=2.6.11-2 \
# kdist_image
#
# all the above are passed by m-a
PACKAGE=linux-wlan-ng-modules-$(KVERS)
MA_DIR ?= /usr/share/modass
# load generic variable handling
-include $(MA_DIR)/include/generic.make
# load default rules
-include $(MA_DIR)/include/common-rules.make
# Remove epoch from kdrev, and add the kdrev to the front of this
# package's version number.
LWN_VERSION=$(shell dpkg-parsechangelog |grep ^Version: | cut -d ' ' -f 2)
LWN_VERSION_MAJOR=$(shell echo '$(LWN_VERSION)'|sed 's/pre.*//'|sed 's/rc.*//')
DEBVERS=$(shell echo '$(KDREV)' | sed 's/[0-9]*://')+$(LWN_VERSION)
# Architecture
DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
# linux-image vs kernel-image
ksublevel:=$(shell egrep '^SUBLEVEL +=' $(KSRC)/Makefile 2>/dev/null | \
sed -e 's/[^0-9]*\([0-9]*\)/\1/')
ifeq "$(shell test $(strip $(ksublevel)) -le 11 && echo yes )" "yes"
KLINUX=kernel
else
KLINUX=linux
endif
prepare_all-stamp: prepare_all
prepare_all:
@if [ "$(DH_VERBOSE)" = 'y' ] ; then \
echo 'KDREV' $(KDREV) ;\
echo 'KVERS' $(KVERS) ;\
echo 'KSRC' $(KSRC) ;\
echo 'KMAINT' $(KMAINT) ;\
echo 'DEBVERS' $(DEBVERS) ;\
echo 'LWN_VERSION' $(LWN_VERSION) ;\
echo 'LWN_VERSION_MAJOR' $(LWN_VERSION_MAJOR) ;\
echo 'KLINUX' $(KLINUX) ;\
fi
# generate control file suitable for modules package
cat debian/control.modules.in | \
sed 's/$${lwnversmajor}/$(LWN_VERSION_MAJOR)/g' | \
sed 's/$${lwnvers}/$(LWN_VERSION)/g' | \
sed 's/$${kvers}/$(KVERS)/g' | \
sed 's/$${arch}/$(DEB_HOST_ARCH)/g' \
> debian/control
cp debian/install.modules.in \
debian/$(PACKAGE).install
touch prepare_all-stamp
build: build-stamp
build-stamp: prepare_all-stamp
dh_testdir
@if [ -f debian/config-foo ]; then \
$(ENV) CC=$(CC) ./Configure -d debian/config-foo $(TO_NULL); \
else \
$(ENV) CC=$(CC) ./Configure -d debian/config-for-lwng $(TO_NULL); \
fi
$(MAKE) all $(TO_NULL)
touch build-stamp
clean: prepare_all
dh_testdir
dh_testroot
$(MAKE) mrproper $(TO_NULL)
dh_clean debian/postinst build-stamp prepare_all-stamp
binary-modules: build-stamp
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
$(MAKE) install $(TO_NULL)
dh_install -Xrc.d
dh_installchangelogs CHANGES
dh_installdocs
dh_installmodules
dh_fixperms
dh_installdeb
dh_gencontrol -- -Vkvers=$(KVERS) -VKLINUX=$(KLINUX)
dh_compress
dh_md5sums
dh_builddeb --destdir=$(DEB_DESTDIR)
# These targets are used by make-kpkg. Just stub in to the real targets.
kdist_config: prepare_all-stamp
kdist_clean: clean
.PHONY: build clean binary-indep binary-arch binary
.PHONY: kdist_config kdist_build kdist_clean kdist_image
|