File: rules

package info (click to toggle)
mmv 1.01b-15
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 116 kB
  • ctags: 288
  • sloc: ansic: 2,611; makefile: 91
file content (98 lines) | stat: -rwxr-xr-x 2,732 bytes parent folder | download
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#! /usr/bin/make -f

INSTALL_PROGRAM=install
CC = gcc
LDFLAGS =
CFLAGS = -g -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64


ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
    CFLAGS += -O0
else
    CFLAGS += -O2
endif

ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
    INSTALL_PROGRAM += -s
    LDFLAGS += -s
    STRIP = true
endif

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    MAKEFLAGS += -j$(NUMJOBS)
endif


# The package
p = mmv
# The version
v = $(shell dpkg-parsechangelog | sed -n 's/^Version: //p')
# The architecture
a = $(shell dpkg --print-architecture)

dir = `pwd`

build:
# Builds the binary package.
	$(checkdir)
	$(MAKE) CC="$(CC)" LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)"
	touch build

clean:
# Undoes the effect of `make -f debian/rules build'.
	$(checkdir)
	[ ! -f Makefile ] || $(MAKE) clean
	-rm -f debian/files* debian/substvars* debian/*~ core */core *~
	rm -rf debian/tmp
	-rm build

binary: binary-arch binary-indep

binary-indep:
	$(checkdir)

binary-arch: build
	$(checkdir)
	test -f build || $(MAKE) -f debian/rules build
# Makes a binary package.
	/bin/rm -rf debian/tmp
	test -f stamp-build || $(MAKE) -f debian/rules build
	install -d -g root -m 755 -o root debian/tmp
	chmod g-s debian/tmp
	install -d -g root -m 755 -o root debian/tmp/DEBIAN
	install -d -g root -m 755 -o root debian/tmp/usr/bin
	install -d -g root -m 755 -o root debian/tmp/usr/share/man/man1
	$(INSTALL_PROGRAM) -g root -o root -m 755 mmv debian/tmp/usr/bin
	test "$(STRIP)" != true || strip \
		--remove-section=.comment --remove-section=.note \
		debian/tmp/usr/bin/mmv
	install -g root -o root -m 644 mmv.1 debian/tmp/usr/share/man/man1
	gzip -9f debian/tmp/usr/share/man/man1/mmv.1
	(cd debian/tmp/usr/bin;\
	 ln -s mmv mcp; \
	 ln -s mmv mad; \
	 ln -s mmv mln;)
	(cd debian/tmp/usr/share/man/man1;\
	 ln -s mmv.1.gz mcp.1.gz; \
	 ln -s mmv.1.gz mad.1.gz; \
	 ln -s mmv.1.gz mln.1.gz;)
	install -d -g root -m 755 -o root debian/tmp/usr/share/doc/$(p)
	install -g root -m 644 -o root READ.ME \
		debian/tmp/usr/share/doc/$(p)
	install -g root -m 644 -o root debian/changelog \
		debian/tmp/usr/share/doc/$(p)/changelog.Debian
	gzip -f9 debian/tmp/usr/share/doc/$(p)/*
	install -g root -m 644 -o root debian/copyright \
	  debian/tmp/usr/share/doc/$(p)
	chmod -R g-sw debian/tmp/usr/share/doc/$(p)
	chown -R root.root debian/tmp/usr/share/doc/$(p)
	dpkg-shlibdeps debian/tmp/usr/bin/mmv
	dpkg-gencontrol -isp
	cd debian/tmp && find * -type f ! -regex '^DEBIAN/.*' -print0 | \
                xargs -r0 md5sum > DEBIAN/md5sums
	dpkg --build debian/tmp && dpkg-name -o -s .. debian/tmp.deb

define checkdir
        test -f mmv.1
endef