File: rules

package info (click to toggle)
debianutils 4.8.1.1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 1,412 kB
  • sloc: sh: 1,675; ansic: 841; makefile: 159
file content (135 lines) | stat: -rwxr-xr-x 4,171 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#! /usr/bin/make -f

package = debianutils

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

DEB_BUILD_ARCH_OS ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)
DEB_BUILD_GNU_TYPE = $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE = $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

STRIP=strip

ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
CONFARGS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
STRIP=$(DEB_HOST_GNU_TYPE)-strip
endif

CFLAGS := $(shell dpkg-buildflags --get CFLAGS)
CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS)
LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)

BUILD_DATE := $(shell dpkg-parsechangelog | sed -n -e 's/^Date: //p')

build: build-indep build-arch
build-indep:

build-arch:
	$(checkdir)
	./configure CFLAGS="$(CFLAGS)" \
			CPPFLAGS="$(CPPFLAGS)" \
			LDFLAGS="$(LDFLAGS)" \
			--prefix=/usr \
			--mandir=/usr/share/man $(CONFARGS)
	$(MAKE)
	touch build-arch

clean:
	$(checkdir)
	test ! -f Makefile || $(MAKE) distclean
	$(RM) -rf autom4te.cache
	$(RM) -r debian/tmp* debianutils*
	$(RM) build-arch debian/files* debian/substvars
	find . -name '*~' -print0 | xargs -0 rm -f

binary-indep:	checkroot build
	$(checkdir)

binary-arch:	checkroot build
	$(checkdir)
	-rm -rf debian/tmp
	$(INSTALL_DIR) debian/tmp/DEBIAN \
		       debian/tmp/bin \
		       debian/tmp/sbin \
		       debian/tmp/usr/bin \
		       debian/tmp/usr/sbin \
		       debian/tmp/usr/share/man/man1 \
		       debian/tmp/usr/share/man/man8 \
		       debian/tmp/usr/share/doc/$(package) \
		       debian/tmp/usr/share/$(package)
	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp INSTALL_PROGRAM="$(INSTALL_PROGRAM)"
	mv debian/tmp/usr/bin/run-parts \
	   debian/tmp/usr/bin/tempfile \
	   debian/tmp/usr/bin/which \
	   debian/tmp/bin/

ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	$(STRIP) --remove-section=.comment --remove-section=.note \
		debian/tmp/bin/run-parts \
	   	debian/tmp/bin/tempfile \
	   	debian/tmp/usr/bin/ischroot
endif

ifeq ($(DEB_HOST_ARCH_OS),linux)
	mv debian/tmp/usr/sbin/installkernel debian/tmp/sbin/
else
	rm debian/tmp/usr/sbin/installkernel \
	   debian/tmp/usr/share/man/man8/installkernel.8
endif
	$(INSTALL_FILE) debian/shells debian/tmp/usr/share/$(package)
	$(INSTALL_FILE) debian/changelog debian/tmp/usr/share/doc/$(package)
	$(INSTALL_FILE) debian/README.shells debian/tmp/usr/share/doc/$(package)
	find debian/tmp/usr/share/man/man[18] \
	     debian/tmp/usr/share/man/de/man[18] \
	     debian/tmp/usr/share/man/es/man[18] \
	     debian/tmp/usr/share/man/fr/man[18] \
	     debian/tmp/usr/share/man/it/man[18] \
	     debian/tmp/usr/share/man/ja/man[18] \
	     debian/tmp/usr/share/man/pl/man[18] \
	     debian/tmp/usr/share/man/sl/man[18] \
             debian/tmp/usr/share/doc/$(package) -type f | xargs gzip -9n
	$(INSTALL_FILE) debian/copyright debian/tmp/usr/share/doc/$(package)
	$(INSTALL_SCRIPT) debian/postinst debian/tmp/DEBIAN/
	$(INSTALL_SCRIPT) debian/postrm debian/tmp/DEBIAN/

	cd debian/tmp && find * -type f ! -regex '^DEBIAN/.*' -print0 | LC_ALL=C sort -z | xargs -r0 md5sum > DEBIAN/md5sums

	find debian/tmp ! -type l -print0 | xargs -0r chmod go=rX,u+rw,a-s

	dpkg-shlibdeps debian/tmp/bin/run-parts \
			debian/tmp/bin/tempfile \
			debian/tmp/usr/bin/ischroot
	dpkg-gencontrol -isp
	find debian/tmp -depth -newermt '$(BUILD_DATE)' -print0 | \
		xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
	dpkg --build debian/tmp ..

define checkdir
	test -f run-parts.c && test -f debian/rules
endef

binary:	binary-indep binary-arch

checkroot:
	$(checkdir)
	test 0 = `id -u`

prebuild:
	printf "define(DEBIANUTILS_VERSION, %s)\n" $$(dpkg-parsechangelog | sed -n '/^Version: \(.*\)$$/ {s//\1/;p}') >acinclude.m4

	autoreconf -fi
	$(RM) -rf autom4te.cache

	cd po4a && po4a --no-backups po4a.conf


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

# Local Variables:
# mode:Makefile
# End: