#!/usr/bin/make -f # -*- makefile -*- # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 DEB_SOURCE := $(shell dpkg-parsechangelog | grep Source: | sed -e 's/Source: //') DEB_VERSION := $(shell dpkg-parsechangelog | grep Version: | sed -e 's/Version: //') DEB_UPSTREAM_VERSION := $(shell echo $(DEB_VERSION) | sed -e 's/-[^-]*$$//') BUILD_DATE := $(shell dpkg-parsechangelog --show-field Date) SVN_URL = http://scholarzhang.googlecode.com/svn/trunk/west-chamber # package version pver:=$(shell dpkg-parsechangelog | grep Version: | sed -e 's/Version: //' | sed -e 's/-[^-]*$$//') # The short upstream name, used for the module source directory dkmssname := west-chamber-$(pver) # Name of the DKMS package dkmssource:=west-chamber-dkms # some default definitions, important! # Name of the source package psource:=west-chamber-source # The short upstream name, used for the module source directory sname:=west-chamber # The name of the common userspace package cname:=west-chamber-common %: dh $@ --with dkms override_dh_auto_configure: ./autogen.sh dh_auto_configure override_dh_auto_build: dh_auto_build -- -C extensions user-all-local override_dh_auto_clean: dh_auto_clean dh_auto_clean -- distclean override_dh_auto_install: # Create the directories to install the source into mkdir -p $(CURDIR)/debian/$(psource)/usr/src/modules/$(sname)/debian mkdir -p $(CURDIR)/debian/$(psource)/usr/src/modules/$(sname)/extensions mkdir -p $(CURDIR)/debian/$(psource)/usr/src/modules/$(sname)/m4 # Copy only the driver source to the proper location cp extensions/*.c extensions/Makefile.am \ extensions/?build \ debian/$(psource)/usr/src/modules/$(sname)/extensions cp Makefile.am Makefile.extra Makefile.iptrules.in Makefile.mans.in \ autogen.sh configure.ac mconfig west-chamber.8.in \ debian/$(psource)/usr/src/modules/$(sname) # Copy the needed debian/ pieces to the proper location cp debian/*modules.in* \ debian/$(psource)/usr/src/modules/$(sname)/debian cp debian/changelog debian/copyright debian/clean \ debian/compat debian/control \ debian/$(psource)/usr/src/modules/$(sname)/debian/ cp debian/rules.modules \ debian/$(psource)/usr/src/modules/$(sname)/debian/rules cd debian/$(psource)/usr/src && tar c --mtime="$(BUILD_DATE)" \ --sort=name \ --owner=0 --group=0 --numeric-owner \ --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \ modules | bzip2 -9 > $(sname).tar.bz2 && rm -rf modules # DKMS # DKMS: Create the directories to install the source into mkdir -p $(CURDIR)/debian/$(dkmssource)/usr/src/$(dkmssname)/extensions # DKMS: Copy only the driver source to the proper location cp extensions/*.c debian/$(dkmssource)/usr/src/$(dkmssname)/extensions cp extensions/Kbuild extensions/Makefile.in debian/$(dkmssource)/usr/src/$(dkmssname)/extensions cp Makefile.* \ mconfig \ debian/$(dkmssource)/usr/src/$(dkmssname) find debian/$(dkmssource)/usr/src -name ".gitignore" -o -name Makefile.iptrules -delete #sed 's/compat_xtables.o//' extensions/Kbuild > debian/$(dkmssource)/usr/src/$(dkmssname)/Kbuild echo 'ccflags-y += -I$${XTABLESDIR}/extensions -I.' >> debian/$(dkmssource)/usr/src/$(dkmssname)/extensions/Kbuild # Add here commands to install the package into debian/west-chamber. #dh_auto_install override_dh_auto_test: get-orig-source: set -e; if echo $(DEB_VERSION) | grep -c "svn"; \ then \ svn_version=`echo $(DEB_VERSION) | sed -e 's/^.*svn\([0-9]*\)*\.\(.*\)-.*$$/\2/g'`; \ else \ svn_version=$(DEB_UPSTREAM_VERSION); \ fi; \ tmpdir=`mktemp -d -t`; \ cd $$tmpdir; \ echo "checkout upstream repository ..."; \ svn checkout -r $$svn_version $(SVN_URL) west-chamber; echo "getting specific upstream revision/tag: $$svn_version"; \ tar --exclude=.svn -cjvf $(CURDIR)/$(DEB_SOURCE)_$(DEB_UPSTREAM_VERSION).orig.tar.bz2 `ls | head -n 1`; \ cd $(CURDIR); \ rm -rf $$tmpdir .PHONY: get-orig-source