aboutsummaryrefslogtreecommitdiff
path: root/makefile
blob: e5feedb08488dc1501c1b316280f6473751682fe (plain)
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
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