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
|
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export HOTPLUG_FIRMWARE=1
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
CFLAGS += -g
endif
# For DKMS. Use the full release (e.g.: 2.2.1+dfsg-1ubuntu1)
include /usr/share/dpkg/pkg-info.mk
CVERSION = DEB_VERSION
## MODULE-ASSISTANT STUFF
# prefix of the target package name
PREFIX:=dahdi
SKPG:=$(PREFIX)-source
PACKAGE:=$(PREFIX)-modules
PACKAGE_SRC:=$(PREFIX)-linux
# modifieable for experiments or debugging m-a
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
# If the makefile was properly-writen, there was a good separation
# between kernel and userspace. As things stand now I'd like to work
# around problems with bilding stuff with HOSTCC by simply providing
# the generated headers as part of the source:
GENERATED_SOURCES := include/dahdi/version.h
BUILD_DATE=$(shell dpkg-parsechangelog --show-field Date)
%:
dh $@
kdist_clean: clean
kdist_config: prep-deb-files
binary-modules: prep-deb-files
dh_testdir
dh_testroot
dh_prep
#cp -a $(CURDIR)/debian/generated/* .
make modules KERNEL_SOURCES=$(KSRC) MODVERSIONS=detect KERNEL=linux-$(KVERS)
make install-modules KERNELRELEASE=$(KVERS) DESTDIR=$(CURDIR)/debian/$(PKGNAME)
# The modules are way too big. This is only in kernel 2.6
# (Removed for now: breaks cross-building)
#find debian/$(PKGNAME)/lib/modules -name '*.ko' |xargs strip -g
$(RM) -f debian/$(PKGNAME)/lib/modules/$(KVERS)/modules.*
dh_installmodules
dh_installdebconf
dh_installdocs
dh_installchangelogs
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol -- -v$(VERSION)
dh_md5sums
dh_builddeb --destdir=$(DEB_DESTDIR)
## END OF M-A SECTION
override_dh_auto_build:
ifneq ($(wildcard drivers/dahdi/xpp/firmwares/USB_FW.hex),)
@echo "Tarball is not DFSG-compliant. Use './debian/rules get-orig-source'"
exit 1
endif
# For DKMS
sed -e "s|#CVERSION#|$(CVERSION)|" \
debian/dkms.conf.in > debian/dkms.conf
sed -e "s|#CVERSION#|$(CVERSION)|" \
debian/dahdi-dkms.install.in > debian/dahdi-dkms.install
$(MAKE) docs
$(MAKE) $(GENERATED_SOURCES)
override_dh_auto_clean:
# Delete the generated dkms files
rm -f debian/dahdi-dkms.install
rm -f debian/dkms.conf
rm -f $(GENERATED_SOURCES)
rm -f dahdi/include/version.h
[ ! -f Makefile ] || $(MAKE) dist-clean || true
TARPARDIR=$(CURDIR)/debian/tmp
TARDIR=$(TARPARDIR)/modules/$(PREFIX)
override_dh_auto_install:
$(MAKE) install-include DESTDIR=$(CURDIR)/debian/$(SKPG)
override_dh_install:
dh_install
# driver source code
mkdir -p $(TARDIR)/debian/generated
cp Makefile $(TARDIR)/
cp -p .version $(TARDIR)/
for dir in build_tools firmware include drivers; do \
if [ -d $$dir ]; then cp -r $$dir $(TARDIR); fi; \
done
# Packaging infrastructure
cp -r debian/rules debian/changelog debian/copyright\
debian/control debian/compat \
debian/control.modules.in \
$(TARDIR)/debian/
tar cjf debian/$(SKPG)/usr/src/$(PREFIX).tar.bz2 \
-C $(TARPARDIR) modules \
--mode=go=rX,u+rw,a-s --sort=name --mtime="$(BUILD_DATE)"
rm -rf $(TARPARDIR)/modules
# Adding a call explicitly, as 'dh --with dkms' breaks m-i
dh_dkms
|