]> git.deb.at Git - pkg/mmv.git/blob - debian/rules
Use dh_clean
[pkg/mmv.git] / debian / rules
1 #! /usr/bin/make -f
2
3 INSTALL_PROGRAM=install
4 CC = gcc
5 LDFLAGS =
6 CFLAGS = -g -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
7
8
9 ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
10     CFLAGS += -O0
11 else
12     CFLAGS += -O2
13 endif
14
15 ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
16     INSTALL_PROGRAM += -s
17     LDFLAGS += -s
18     STRIP = true
19 endif
20
21 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
22     NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
23     MAKEFLAGS += -j$(NUMJOBS)
24 endif
25
26
27 # The package
28 p = mmv
29 # The version
30 v = $(shell dpkg-parsechangelog | sed -n 's/^Version: //p')
31 # The architecture
32 a = $(shell dpkg --print-architecture)
33
34 dir = `pwd`
35
36 build:
37 # Builds the binary package.
38         dh_testdir
39         $(MAKE) CC="$(CC)" LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)"
40         touch build
41
42 clean:
43 # Undoes the effect of `make -f debian/rules build'.
44         dh_testdir
45         dh_auto_clean
46         dh_clean build debian/substvars
47
48 binary: binary-arch binary-indep
49
50 binary-indep:
51         dh_testdir
52
53 binary-arch: build
54         dh_testdir
55         test -f build || $(MAKE) -f debian/rules build
56 # Makes a binary package.
57         /bin/rm -rf debian/tmp
58         test -f stamp-build || $(MAKE) -f debian/rules build
59         install -d -g root -m 755 -o root debian/tmp
60         chmod g-s debian/tmp
61         install -d -g root -m 755 -o root debian/tmp/DEBIAN
62         install -d -g root -m 755 -o root debian/tmp/usr/bin
63         install -d -g root -m 755 -o root debian/tmp/usr/share/man/man1
64         install -d -g root -m 755 -o root debian/tmp/usr/share/lintian/overrides
65         $(INSTALL_PROGRAM) -g root -o root -m 755 mmv debian/tmp/usr/bin
66         test "$(STRIP)" != true || strip \
67                 --remove-section=.comment --remove-section=.note \
68                 debian/tmp/usr/bin/mmv
69         install -g root -o root -m 644 mmv.1 debian/tmp/usr/share/man/man1
70         gzip -9f debian/tmp/usr/share/man/man1/mmv.1
71         (cd debian/tmp/usr/bin;\
72          ln -s mmv mcp; \
73          ln -s mmv mad; \
74          ln -s mmv mln;)
75         (cd debian/tmp/usr/share/man/man1;\
76          ln -s mmv.1.gz mcp.1.gz; \
77          ln -s mmv.1.gz mad.1.gz; \
78          ln -s mmv.1.gz mln.1.gz;)
79         install -d -g root -m 755 -o root debian/tmp/usr/share/doc/$(p)
80         install -g root -m 644 -o root READ.ME \
81                 debian/tmp/usr/share/doc/$(p)
82         install -g root -m 644 -o root debian/changelog \
83                 debian/tmp/usr/share/doc/$(p)/changelog.Debian
84         gzip -f9 debian/tmp/usr/share/doc/$(p)/*
85         install -g root -m 644 -o root debian/copyright \
86           debian/tmp/usr/share/doc/$(p)
87         install -g root -m 644 -o root debian/lintian-overrides \
88           debian/tmp/usr/share/lintian/overrides/mmv
89         chmod -R g-sw debian/tmp/usr/share/doc/$(p)
90         chown -R root.root debian/tmp/usr/share/doc/$(p)
91         dpkg-shlibdeps debian/tmp/usr/bin/mmv
92         dpkg-gencontrol -isp
93         cd debian/tmp && find * -type f ! -regex '^DEBIAN/.*' -print0 | \
94                 xargs -r0 md5sum > DEBIAN/md5sums
95         dpkg --build debian/tmp && dpkg-name -o -s .. debian/tmp.deb