File: rules

package info (click to toggle)
util-linux 2.12r-19etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 8,932 kB
  • ctags: 5,101
  • sloc: ansic: 46,134; sh: 8,074; makefile: 1,111; perl: 86; csh: 62; sed: 55
file content (361 lines) | stat: -rwxr-xr-x 14,644 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
#! /usr/bin/make -f
include /usr/share/dpatch/dpatch.make

SHELL = bash
PACKAGE = util-linux

ifndef DEB_HOST_ARCH
DEB_BUILD_ARCH := $(shell dpkg --print-installation-architecture)
DEB_HOST_ARCH = $(DEB_BUILD_ARCH)
endif

ifndef DEB_HOST_GNU_SYSTEM
DEB_HOST_GNU_SYSTEM := $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
endif

ifndef DEB_HOST_ARCH_OS
DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
endif


ifeq ($(DEB_HOST_GNU_SYSTEM),linux)
# Take account of old dpkg-architecture output.
DEB_HOST_GNU_SYSTEM := linux-gnu
endif

export arch = $(DEB_HOST_ARCH)
version := $(shell sed -e '1{;s|^util-linux (\(.*\))\ .*|\1|;q;}' debian/changelog)

fdisk_arch = $(findstring $(arch),alpha i386 powerpc ppc64 arm armeb armel mips mipsel hppa ia64 hurd-i386 amd64 s390)
rdev_arch = $(findstring $(arch),i386 amd64)
sparc = $(findstring $(arch),sparc sparc64)
nohwclock = $(findstring $(arch),s390)

SUBDIRS=po lib getopt disk-utils login-utils misc-utils mount sys-utils text-utils
ifeq ($(arch),$(fdisk_arch))
SUBDIRS += fdisk
endif
ifeq ($(arch),$(sparc))
SUBDIRS += fdisk
endif
ifeq ($(DEB_HOST_ARCH_OS),linux)
ifneq ($(arch),$(nohwclock))
SUBDIRS += hwclock 
endif
endif

ifneq ($(DEB_HOST_ARCH_OS),linux)
util-linux_Conflicts = getty
endif

CFDISK_PO_DIR=cfdisk-po
CFDISK_POT=$(CFDISK_PO_DIR)/cfdisk.pot

build: patch
	$(checkdir)
	./configure
	$(MAKE) all CPU=$(arch) arch=$(arch) SUBDIRS="${SUBDIRS}"
	# $(MAKE) disk-utils/raw - this is done above if linux/raw.h exists
	touch build

clean: unpatch
	$(checkdir)
	rm -f build sys-utils/rdev
	touch make_include
	$(MAKE) distclean
	find . -name '*~' -print0 | xargs -0r rm
	find . -name '*.orig' -print0 | xargs -0r rm
	find . -name '*.rej' -print0 | xargs -0r rm
	rm -rf debian/tmp* debian/files* debian/substvars po/messages
	rm -rf $(CFDISK_PO_DIR)

# Architecture independant stuff

SUIDFILES = debian/tmp-mount/bin/{u,}mount
BINFILES  = sys-utils/arch text-utils/more
UBINFILES = sys-utils/{ipcs,ipcrm,setsid} \
	misc-utils/{namei,setterm,mcookie,whereis,ddate} \
	getopt/getopt text-utils/{rev,line,pg}
SBINFILES = disk-utils/mkswap

ifeq ($(DEB_HOST_ARCH_OS),linux)
ifneq ($(arch),$(nohwclock))
INITFILES = debian/hwclock.sh
SBINFILES += hwclock/hwclock
endif
BINFILES  += sys-utils/dmesg
SBINFILES += disk-utils/{blockdev,raw,isosize} mount/pivot_root login-utils/agetty
UBINFILES += disk-utils/fdformat
USBINFILES = sys-utils/readprofile disk-utils/elvtune # disk-utils/setfdprm
endif

UBINFILES2= misc-utils/chkdupexe # debian/fdformat # don't strip these

ifeq ($(DEB_HOST_ARCH_OS),linux)
MOUNTBINFILES  = mount/mount mount/umount
MOUNTSBINFILES = mount/swapon mount/losetup
endif

#BSDBINFILES = # misc-utils/kill
BSDUBINFILES = misc-utils/script misc-utils/logger sys-utils/renice \
               login-utils/wall
               # misc-utils/scriptreplay is handled seperately
BSDMAN1FILES = login-utils/wall.1 misc-utils/script.1 \
               misc-utils/logger.1 misc-utils/scriptreplay.1 # misc-utils/kill.1
BSDMAN8FILES = sys-utils/renice.8
BSDDOCFILES = debian/README.script

# Architecture independant docs

MAN1FILES = text-utils/{pg,more,line,rev}.1 misc-utils/{namei.1,mcookie.1} \
            misc-utils/{chkdupexe.1,setterm.1,whereis.1,ddate.1} \
	    sys-utils/arch.1 getopt/getopt.1
MAN8FILES = sys-utils/{ipcrm.8,ipcs.8,setsid.8} disk-utils/mkswap.8
ifeq ($(DEB_HOST_ARCH_OS),linux)
ifneq ($(arch),$(nohwclock))
MAN8FILES += hwclock/hwclock.8
endif
MAN1FILES += sys-utils/readprofile.1
MAN8FILES += login-utils/agetty.8 disk-utils/{blockdev.8,elvtune.8,isosize.8} \
	     sys-utils/dmesg.8 mount/pivot_root.8 \
	     disk-utils/fdformat.8 disk-utils/raw.8 # disk-utils/setfdprm.8
endif


EXAMPLES = fdisk/sfdisk.examples getopt/getopt-{test,parse}.{ba,tc}sh
ifeq ($(DEB_HOST_ARCH_OS),linux)
EXAMPLES += debian/fstab.example2
endif

INFOFILES = sys-utils/ipc.info
ifeq ($(DEB_HOST_ARCH_OS),linux)
DOCFILES  = login-utils/{README.getty,README.modems-with-agetty,README.poeigl}
ifneq ($(arch),$(nohwclock))
DOCFILES += debian/README.Debian.hwclock
endif
endif

ifeq ($(DEB_HOST_ARCH_OS),linux)
MOUNTMAN5FILES = mount/fstab.5 mount/nfs.5
MOUNTMAN8FILES = mount/losetup.8 mount/swapoff.8 mount/umount.8 \
		 mount/mount.8 mount/swapon.8
MOUNTDOCFILES  = mount/README.mount
endif

ifneq ($(arch),$(sparc))
SBINFILES := $(SBINFILES) disk-utils/{{fsck,mkfs}.{minix,cramfs},mkfs}
MAN8FILES := $(MAN8FILES) disk-utils/{{fsck,mkfs}.minix.8,mkfs.8}	# no cramfs man
endif
ifeq ($(arch),$(fdisk_arch))
SBINFILES := $(SBINFILES) fdisk/{cfdisk,fdisk,sfdisk}
MAN8FILES := $(MAN8FILES) fdisk/{cfdisk.8,fdisk.8,sfdisk.8}
DOCFILES  := $(DOCFILES) fdisk/README.{c,}fdisk
ifeq ($(DEB_HOST_ARCH_OS),linux)
USBINFILES:= $(USBINFILES) sys-utils/{tunelp,cytune}
MAN8FILES := $(MAN8FILES) sys-utils/{tunelp.8,cytune.8}
endif
endif
ifeq ($(arch),$(sparc))
SBINFILES := $(SBINFILES) fdisk/fdisk
MAN8FILES := $(MAN8FILES) fdisk/fdisk.8
DOCFILES  := $(DOCFILES) fdisk/README.fdisk
endif
ifeq ($(arch),$(rdev_arch))
USBINFILES:= $(USBINFILES) sys-utils/rdev
MAN8FILES := $(MAN8FILES) sys-utils/{rdev.8,vidmode.8} \
		sys-utils/{ramsize.8,rootflags.8}
endif

install:

binary-indep:	checkroot build binary-arch
	$(checkdir)
	# This assumes non-native, and only one hyphen in the version number.
	dpkg-gencontrol -isp -putil-linux-locales -Pdebian/tmp-util-linux-locales -VUpstream=$$(sed 's/^.*(\(.*\)-.*).*/\1/; q' debian/changelog)
	dpkg --build debian/tmp-util-linux-locales ..

binary-arch:	checkroot build $(INITFILES)
	rm -rf debian/tmp*
	install -d debian/tmp/{DEBIAN,bin,sbin,etc/init.d,usr/{bin,sbin,lib/mime/packages,share/{locale/{ca,cs,da,de,es,et,fi,fr,it,ja,nl,pt_BR,sl,sv,tr}/LC_MESSAGES,man/{man1,man8},info,$(PACKAGE),doc/$(PACKAGE)/examples,lintian/overrides}}}

	install -s $(BINFILES)  debian/tmp/bin
	install -s $(SBINFILES) debian/tmp/sbin
	install -s $(UBINFILES) debian/tmp/usr/bin
	install    $(UBINFILES2) debian/tmp/usr/bin
ifneq ($(USBINFILES),)
	install -s $(USBINFILES) debian/tmp/usr/sbin
ifeq ($(arch),$(rdev_arch))
	ln -s rdev debian/tmp/usr/sbin/ramsize
	ln -s rdev debian/tmp/usr/sbin/vidmode
	ln -s rdev debian/tmp/usr/sbin/rootflags
endif
endif
ifneq ($(INITFILES),)
	install -m 755 $(INITFILES) debian/tmp/etc/init.d
endif
	install -m 644 $(MAN1FILES) debian/tmp/usr/share/man/man1
	install -m 644 $(MAN8FILES) debian/tmp/usr/share/man/man8
	install -m 644 $(INFOFILES) debian/tmp/usr/share/info
	install -m 644 debian/lintian-override debian/tmp/usr/share/lintian/overrides/$(PACKAGE)
	cd po && make install DESTDIR=../debian/tmp
ifneq ($(DOCFILES),)
	install -m 644 $(DOCFILES)  debian/tmp/usr/share/doc/$(PACKAGE)
endif
	install -m 644 $(EXAMPLES)  debian/tmp/usr/share/doc/$(PACKAGE)/examples
ifeq ($(arch),$(findstring $(arch),powerpc ppc64))
	mv -f debian/tmp/sbin/fdisk debian/tmp/sbin/ddisk
	mv -f debian/tmp/usr/share/man/man8/fdisk.8 debian/tmp/usr/share/man/man8/ddisk.8
endif
ifeq ($(DEB_HOST_GNU_SYSTEM),gnu)
	(cd debian/tmp/sbin ; mv mkswap mkswap.linux)
	(cd debian/tmp/usr/share/man/man8 ; mv mkswap.8 mkswap.linux.8)
endif
ifeq ($(DEB_HOST_ARCH_OS),linux)
	(cd debian/tmp/sbin ; mv agetty getty)
	(cd debian/tmp/usr/share/man/man8 ; mv agetty.8 getty.8)
ifneq ($(arch), $(nohwclock))
ifneq ($(arch),$(findstring $(arch),powerpc ppc64))
	(cd debian/tmp/usr/share/man/man8 && ln -s hwclock.8.gz clock.8.gz)
endif
endif
	(cd debian/tmp/usr/share/doc/$(PACKAGE) ; mv README.modems-with-agetty README.modems-with-getty )
	perl -pi.bak -e 's/agetty/getty/g' debian/tmp/usr/share/man/man8/getty.8 \
	debian/tmp/usr/share/doc/$(PACKAGE)/README.getty \
	debian/tmp/usr/share/doc/$(PACKAGE)/README.modems-with-getty
	rm `find debian/tmp/usr -name \*.bak`
endif
	install -m 644 debian/changelog \
	  debian/tmp/usr/share/doc/$(PACKAGE)/changelog.Debian
	install -m 644 HISTORY debian/tmp/usr/share/doc/$(PACKAGE)/changelog
	find debian/tmp/usr/share/{info,doc,man} -type f | xargs gzip -9
	install -m 644 debian/mime.$(PACKAGE) debian/tmp/usr/lib/mime/packages/$(PACKAGE)
	install -m 644 debian/copyright debian/tmp/usr/share/doc/$(PACKAGE)/copyright
	install debian/{preinst,postinst,prerm,postrm} debian/tmp/DEBIAN/
ifeq ($(DEB_HOST_ARCH_OS),linux)
ifneq ($(arch),$(nohwclock))
	install -m 644 debian/conffiles debian/tmp/DEBIAN/
endif
endif
	ls debian/tmp/{bin,sbin,usr/{bin,sbin}}/* | xargs dpkg-shlibdeps -putil-linux
	install -d debian/tmp-util-linux-locales/usr/share/doc/util-linux-locales
	install -d debian/tmp-util-linux-locales/DEBIAN
	install -m 755 debian/util-linux-locales.postinst debian/tmp-util-linux-locales/DEBIAN/postinst
	install -m 755 debian/util-linux-locales.prerm debian/tmp-util-linux-locales/DEBIAN/prerm
	mv debian/tmp/usr/share/locale debian/tmp-util-linux-locales/usr/share/
	install -m 644 HISTORY debian/tmp-util-linux-locales/usr/share/doc/util-linux-locales/changelog
	install -m 644 debian/changelog debian/tmp-util-linux-locales/usr/share/doc/util-linux-locales/changelog.Debian
	find debian/tmp-util-linux-locales/usr/share/doc -type f | xargs gzip -9
	install -m 644 debian/copyright debian/tmp-util-linux-locales/usr/share/doc/util-linux-locales/copyright
	dpkg-gencontrol -isp -putil-linux -Vutil-linux:Conflicts="$(util-linux_Conflicts)"
	dpkg --build debian/tmp ..

ifeq ($(arch),$(fdisk_arch))
# Do the udeb
	install -d debian/tmp-{c,}fdisk-udeb/usr/sbin
	install -d debian/tmp-{c,}fdisk-udeb/DEBIAN
	install -m 755 fdisk/cfdisk debian/tmp-cfdisk-udeb/usr/sbin
	install -m 755 fdisk/fdisk fdisk/sfdisk debian/tmp-fdisk-udeb/usr/sbin
	strip --remove-section=.comment --remove-section=.note \
			debian/tmp-{c,}fdisk-udeb/usr/sbin/*

	# Generate a po translations needed for cfdisk
	mkdir $(CFDISK_PO_DIR)
	xgettext --default-domain=util-linux -C --keyword=_ --keyword=N_ -o $(CFDISK_POT) fdisk/*.c
	for po in po/*.po ; do  \
		LANG=`basename $$po | cut -f1 -d.` ; \
		msgmerge $$po $(CFDISK_POT)  > $(CFDISK_PO_DIR)/$$LANG.po ; \
		msgfmt $(CFDISK_PO_DIR)/$$LANG.po -o $(CFDISK_PO_DIR)/$$LANG.gmo ; \
		mkdir -p debian/tmp-cfdisk-udeb/usr/share/locale/$$LANG/LC_MESSAGES ; \
		cp $(CFDISK_PO_DIR)/$$LANG.gmo debian/tmp-cfdisk-udeb/usr/share/locale/$$LANG/LC_MESSAGES/util-linux.mo ; \
	done

	ls debian/tmp-fdisk-udeb/usr/sbin/* | xargs dpkg-shlibdeps -pfdisk-udeb -tudeb
	dpkg-gencontrol -isp -pfdisk-udeb -Pdebian/tmp-fdisk-udeb -fdebian/files~
	dpkg-distaddfile fdisk-udeb_$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)_$(arch).udeb debian-installer extra
	dpkg --build debian/tmp-fdisk-udeb ../fdisk-udeb_$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)_$(arch).udeb

	ls debian/tmp-cfdisk-udeb/usr/sbin/* | xargs dpkg-shlibdeps -pcfdisk-udeb -tudeb
	dpkg-gencontrol -isp -pcfdisk-udeb -Pdebian/tmp-cfdisk-udeb -fdebian/files~
	dpkg-distaddfile cfdisk-udeb_$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)_$(arch).udeb debian-installer extra
	dpkg --build debian/tmp-cfdisk-udeb ../cfdisk-udeb_$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)_$(arch).udeb
endif
ifeq ($(arch),$(sparc))
# Do the udeb
	install -d debian/tmp-fdisk-udeb/usr/sbin
	install -d debian/tmp-fdisk-udeb/DEBIAN
	install -m 755 fdisk/fdisk debian/tmp-fdisk-udeb/usr/sbin
	strip --remove-section=.comment --remove-section=.note \
			debian/tmp-fdisk-udeb/usr/sbin/*

	ls debian/tmp-fdisk-udeb/usr/sbin/* | xargs dpkg-shlibdeps -pfdisk-udeb
	dpkg-gencontrol -isp -pfdisk-udeb -Pdebian/tmp-fdisk-udeb -fdebian/files~
	dpkg-distaddfile fdisk-udeb_$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)_$(arch).udeb debian-installer extra
	dpkg --build debian/tmp-fdisk-udeb ../fdisk-udeb_$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)_$(arch).udeb
endif

ifeq ($(DEB_HOST_ARCH_OS),linux)
	# Mount
	install -d debian/tmp-mount/{DEBIAN,bin,sbin,usr/share/{man/{man8,man5},doc/mount/examples}}
	install -m 4755 -o root -s $(MOUNTBINFILES) debian/tmp-mount/bin/.
	install -m 755 -s $(MOUNTSBINFILES) debian/tmp-mount/sbin/.
	install -m 644 $(MOUNTMAN8FILES) debian/tmp-mount/usr/share/man/man8
	install -m 644 $(MOUNTMAN5FILES) debian/tmp-mount/usr/share/man/man5
	install -m 644 $(MOUNTDOCFILES) debian/tmp-mount/usr/share/doc/mount
	(cd debian/tmp-mount/sbin ; ln -s swapon swapoff)
	install -m 644 debian/mount.fstab \
	  debian/tmp-mount/usr/share/doc/mount/examples/fstab
	install -m 644 debian/changelog \
	  debian/tmp-mount/usr/share/doc/mount/changelog.Debian
	install -m 644 debian/changelog.Debian-mount.old \
	  debian/tmp-mount/usr/share/doc/mount/changelog.Debian-mount.old
	install -m 644 HISTORY debian/tmp-mount/usr/share/doc/mount/changelog
	find debian/tmp-mount/usr/share/{doc,man} -type f | xargs gzip -9
	install -m 644 debian/copyright debian/tmp-mount/usr/share/doc/mount/copyright
	install debian/mount.postinst debian/tmp-mount/DEBIAN/postinst
	install debian/mount.prerm   debian/tmp-mount/DEBIAN/prerm
	ls debian/tmp-mount/{bin,sbin}/* | xargs dpkg-shlibdeps -pmount
	dpkg-gencontrol -isp -pmount -Pdebian/tmp-mount
	dpkg --build debian/tmp-mount ..
endif

	# Bsdutils
	install -d debian/tmp-bsd/{DEBIAN,bin,usr/{bin,share/man/{man8,man1},share/doc/bsdutils}}
	# install -m 755 -o root -s $(BSDBINFILES) debian/tmp-bsd/bin/.
	install -m 755 -s $(BSDUBINFILES) debian/tmp-bsd/usr/bin/.
	cp misc-utils/scriptreplay.pl debian/tmp-bsd/usr/bin/scriptreplay
	chmod 755 debian/tmp-bsd/usr/bin/scriptreplay
	install -m 644 $(BSDMAN8FILES) debian/tmp-bsd/usr/share/man/man8
	mv debian/tmp-bsd/usr/share/man/man8/renice.8 debian/tmp-bsd/usr/share/man/man1/renice.1
	install -m 644 $(BSDMAN1FILES) debian/tmp-bsd/usr/share/man/man1
	install -m 644 $(BSDDOCFILES) debian/tmp-bsd/usr/share/doc/bsdutils
	chown root:tty debian/tmp-bsd/usr/bin/wall
	chmod g+s debian/tmp-bsd/usr/bin/wall
	install -m 644 debian/changelog \
	  debian/tmp-bsd/usr/share/doc/bsdutils/changelog.Debian
	install -m 644 HISTORY debian/tmp-bsd/usr/share/doc/bsdutils/changelog
	find debian/tmp-bsd/usr/share/{doc,man} -type f | xargs gzip -9
	install -m 644 debian/copyright debian/tmp-bsd/usr/share/doc/bsdutils/copyright
	install debian/bsdutils.postinst debian/tmp-bsd/DEBIAN/postinst
	install debian/bsdutils.prerm   debian/tmp-bsd/DEBIAN/prerm
	ls debian/tmp-bsd/usr/bin/* | xargs dpkg-shlibdeps -pbsdutils
	dpkg-gencontrol -isp -pbsdutils -Pdebian/tmp-bsd -v1:$(version)
	dpkg --build debian/tmp-bsd ..

define checkdir
	test -f fdisk/fdisk.c -a -f debian/rules
endef

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

# Local Variables:
# mode:Makefile
# End: