Add an install target to the Makefile.
[mythtv-status.git] / Makefile
1 #!/usr/bin/make -f
2
3 BINDIR=$(DESTDIR)/usr/bin
4 MANDIR=$(DESTDIR)/usr/man
5
6 package=mythtv-status
7 releases=sid
8 release=sid
9 sponsor_keyid=19D03486
10
11 build=dpkg-buildpackage -rfakeroot -i'(.git|build|.gitignore|testing)*' -I.git -Ibuild -I.gitignore -Itesting -tc -k0C62B791
12 version=$(shell git tag -l | grep '^[0-9]' | sort -t"." -k 1,1 -k 2,2 -k 3,3 -n | tail -1)
13 deb_version=$(shell git tag -l | grep ^debian-$(release)-[[:digit:]] | sort -t"." -k 1,1 -k 2,2 -k 3,3 -n | tail -1 | sed 's/debian-$(release)-//' | sed 's/@/~/')
14
15 deb=$(package)_$(deb_version)_all.deb
16 orig_tarball=../$(package)_$(version).orig.tar.gz
17 tarball=build/tarball/$(package)-$(version).tar.gz
18 tarball_dir=../$(package)_tarballs
19
20 DEBS=$(foreach release, $(releases), build/$(release)/$(deb))
21
22 RELEASE_FILES=$(orig_tarball) build/tarball/mythtv-status-${version}.tar.gz $(DEBS)
23
24 TEST_VERBOSE=0
25 TEST_FILES=t/*.t
26
27 all: test release
28
29 release: $(RELEASE_FILES)
30
31 $(orig_tarball): $(tarball)
32         @rm -f $@
33         @ln -s `basename \`pwd\``/$< $@
34
35 sponsor: $(orig_tarball)
36         dpkg-buildpackage -rfakeroot -k$(sponsor_keyid) -i'(.git|build|Makefile|testing)' -I.git -IMakefile -I.gitignore -Ibuild -Itesting -tc
37
38 $(tarball):
39         @mkdir -p $(@D)
40         @git archive --format=tar --prefix=$(package)-$(version)/ $(version) `git ls-tree --name-only $(version) | egrep -v "(.gitignore|debian|Makefile|testing)"` | gzip > $(tarball)
41
42 build/$(release)/$(deb): 
43         @echo Building $(release)
44         @ssh -t build-$(release)-i386 "cd `pwd`; $(build)"
45         @ssh build-$(release)-i386 "cd `pwd`/..; /usr/bin/lintian -i -I $(package)_$(version)*.changes" || true
46         #@ssh build-$(release)-i386 "cd `pwd`/..; /usr/bin/linda -i $(package)_$(version)*.changes" || true
47         @mkdir -p build/$(release)
48         @cp ../$(deb)  \
49                 ../$(package)_$(deb_version)_i386.changes \
50                 ../$(package)_$(deb_version).dsc \
51                 ../$(package)_$(version).orig.tar.gz \
52                 ../$(package)_$(deb_version).debian.tar.gz \
53                 build/$(release)
54
55 publish: $(RELEASE_FILES)
56         for release in $(releases); do reprepro includedsc $$release build/$$release/$(package)_$(deb_version).dsc; done
57         @cp $(tarball) $(tarball_dir)
58         @chmod o+r $(tarball_dir)/*-$(version).*
59         @ln -sf `basename $(tarball)` $(tarball_dir)/$(package)-latest.tar.gz
60
61 upload: $(RELEASE_FILES)
62         for release in $(releases); do cd build/$$release; dput $(package)_$(deb_version)*.changes; done
63
64 install:
65         install -d $(BINDIR)
66         install -d $(MANDIR)/man1
67         install -m 775 bin/mythtv-status $(BINDIR)
68         install -m 775 bin/mythtv_recording_now $(BINDIR)
69         install -m 775 bin/mythtv_recording_soon $(BINDIR)
70         pod2man bin/mythtv-status > $(MANDIR)/man1/mythtv-status.1
71         install -m 644 man/mythtv_recording_now.1 $(MANDIR)/man1
72         install -m 644 man/mythtv_recording_soon.1 $(MANDIR)/man1
73
74 test:
75         PERL_DL_NONLAZY=1 perl "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE))" $(TEST_FILES)
76
77
78 clean:
79         @rm -rf build
80         @rm -f ../$(package)*.changes ../$(package)*.dsc ../$(package)*.tar.gz ../$(package)*.deb
81
82 .PHONY: release clean sponsor install test