File: rules

package info (click to toggle)
cpio 2.6-18.1%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 3,248 kB
  • ctags: 1,730
  • sloc: ansic: 14,893; sh: 4,793; makefile: 234; sed: 16
file content (111 lines) | stat: -rwxr-xr-x 2,995 bytes parent folder | download | duplicates (2)
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
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/make -f
# -*- makefile -*-

package=cpio

CFLAGS = -Wall -g
INSTALL = install
INSTALL_FILE    = $(INSTALL) -p    -o root -g root  -m  644
INSTALL_PROGRAM = $(INSTALL) -p    -o root -g root  -m  755
INSTALL_SCRIPT  = $(INSTALL) -p    -o root -g root  -m  755
INSTALL_DIR     = $(INSTALL) -p -d -o root -g root  -m  755

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

ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
INSTALL_PROGRAM += -s
endif

Makefile:
	$(checkdir)
	CFLAGS='$(CFLAGS)' CPIO_MT_PROG=mt ./configure --prefix=/usr \
	       --mandir=/usr/share/man \
	       --infodir=/usr/share/info \
	       --bindir=/bin \
	       --libexecdir=/usr/sbin

	touch tests/testsuite

build:	Makefile
	$(checkdir)
	$(MAKE)
	$(MAKE) check
	touch build

clean:
	$(checkdir)
	$(RM) build
	-$(MAKE) -i distclean
	$(RM) config.cache
	$(RM) -r *~ debian/tmp debian/*~ debian/files*
	$(RM) -f po/*.gmo debian/substvars

binary-indep:	checkroot build
	$(checkdir)

binary-arch:	checkroot build
	$(checkdir)
	$(RM) -r debian/tmp
	$(INSTALL_DIR) debian/tmp debian/tmp/DEBIAN
	$(INSTALL_DIR) debian/tmp/usr/share/doc/$(package)
# Install Debian package control information files
	$(INSTALL_SCRIPT) debian/preinst debian/postinst \
		debian/prerm debian/tmp/DEBIAN/.
# Install directories
	$(INSTALL_DIR) 	\
		debian/tmp/bin	\
		debian/tmp/usr/share/man/man1	\
		debian/tmp/usr/share/info
# Install files
	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
	rm -rf debian/tmp/usr/libexec
	mv debian/tmp/bin/mt debian/tmp/bin/mt-gnu 
	mv debian/tmp/usr/share/man/man1/mt.1 \
	  debian/tmp/usr/share/man/man1/mt-gnu.1
# Strip binaries (including hack by policy wonks)
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	strip -R.note -R.comment debian/tmp/bin/*
endif
	rm -rf debian/tmp/usr/sbin
# Install documentation
	install -m 644 ChangeLog debian/tmp/usr/share/doc/$(package)/changelog
	install -m 644 NEWS README debian/tmp/usr/share/doc/$(package)/.
# Install changelog & copyright
	install -m 644 debian/changelog \
	  debian/tmp/usr/share/doc/$(package)/changelog.Debian
	gzip -9v debian/tmp/usr/share/doc/$(package)/*
	gzip -9v debian/tmp/usr/share/man/*/*
	gzip -9v debian/tmp/usr/share/info/*
	install -m 644 debian/copyright debian/tmp/usr/share/doc/$(package)/.
# Determine shared library dependencies
	dpkg-shlibdeps debian/tmp/bin/cpio debian/tmp/bin/mt-gnu

# Generate md5sums
	cd debian/tmp && find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums

# Generate deb file
	dpkg-gencontrol -isp
	chown -R root.root debian/tmp
	chmod -R g-ws debian/tmp
	dpkg-deb --build debian/tmp ..

define checkdir
	test -f src/$(package).h && test -f debian/rules
endef

# Below here is fairly generic really

binary:		binary-indep binary-arch

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

checkroot:
	$(checkdir)
	test root = "`whoami`"

.PHONY: binary binary-arch binary-indep clean checkroot