pkgname = my-x200
exts := md html confd initd sh deb dsc orig.tar.gz debian.tar.xz
findopts := $(foreach ext,$(exts),-or -iname "*.$(ext)")
pkgver := 0.7
all: install
clean:
rm -rf .backup
find -iname "*~" | xargs rm -rf
rm -rf $(pkgname)-$(pkgver)
find ./* -type f -iname "makefile" $(findopts) > ls-R
find ./* -type d -iname "debian" >> ls-R
rm -rf etc
rsync -avPr --files-from=ls-R . .backup
rm -rf *
cp -p -r .backup/* .
rm -rf .backup
pandoc --toc -s README.md -o about.html
prepare:
rm -rf $(pkgname)-$(pkgver)
rm -f $(pkgname)*.orig.tar.gz
debian/rules clean
rsync -avPr --exclude .git ./ $(pkgname)-$(pkgver)
tar czf $(pkgname)_$(pkgver).orig.tar.gz $(pkgname)-$(pkgver)
debian: prepare
$(MAKE) --directory=$(pkgname)-$(pkgver) debian_package
debian_package:
debuild
install:
install -Dm755 my-x200.initd $(DESTDIR)etc/init.d/my-x200
install -Dm644 my-x200.confd $(DESTDIR)etc/default/my-x200
install -Dm644 my-x200-lid.sh $(DESTDIR)etc/acpi/events/my-x200-lid
install -Dm644 my-x200-sleep.sh $(DESTDIR)etc/acpi/events/my-x200-sleep
install -Dm644 my-x200-suspend.sh $(DESTDIR)etc/acpi/events/my-x200-suspend
install -Dm644 my-x200-thinkvantage.sh $(DESTDIR)etc/acpi/events/my-x200-thinkvantage
install -Dm755 my-x200.sh $(DESTDIR)etc/acpi/my-x200.sh
uninstall:
rm -rf $(DESTDIR)etc/init.d/my-x200
rm -rf $(DESTDIR)etc/default/my-x200
rm -rf $(DESTDIR)etc/acpi/events/my-x200-lid
rm -rf $(DESTDIR)etc/acpi/events/my-x200-sleep
rm -rf $(DESTDIR)etc/acpi/events/my-x200-suspend
rm -rf $(DESTDIR)etc/acpi/events/my-x200-thinkvantage
rm -rf $(DESTDIR)etc/acpi/my-x200.sh
.PHONY: all clean install uninstall prepare debian debian_package