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 -s README.md -o about.html
prepare:
rm -rf $(pkgname)-$(pkgver)
debian/rules clean
rsync -avPr ./ $(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 -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/my-x200.sh
.PHONY: all clean install uninstall prepare debian debian_package