File: rules

package info (click to toggle)
sysvinit 2.86.ds1-38
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 1,260 kB
  • ctags: 655
  • sloc: ansic: 7,385; sh: 4,399; makefile: 405; perl: 244
file content (316 lines) | stat: -rwxr-xr-x 12,279 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
#! /usr/bin/make -f
#
#	debian/rules file for sysvinit
#

tmp     = $(shell pwd)/debian/tmp
doc	= /usr/share/doc

SHELL	= /bin/bash
LC_ALL	= POSIX

DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_HOST_GNU_SYSTEM ?= $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
export DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null || true)

# Handle fact that sarge dpkg-architecture doesn't have DEB_HOST_ARCH_OS
ifeq ($(DEB_HOST_ARCH_OS),)
  DEB_HOST_ARCH_OS := $(subst -gnu,,$(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM))
  ifeq ($(DEB_HOST_ARCH_OS),gnu)
    DEB_HOST_ARCH_OS := hurd
  endif
endif

LIBC6	= libc6
ifeq ($(DEB_HOST_ARCH), alpha)
LIBC6	= libc6.1
endif
ifeq ($(DEB_HOST_ARCH), ia64)
LIBC6	= libc6.1
endif

define checkdir
	test -f src/init.c
endef

build: patch-stamp
# Builds the binary package.
	$(checkdir)
ifeq ($(DEB_HOST_ARCH_OS),linux)
	(cd src; make DISTRO=Debian WITH_SELINUX="yes")
else
	(cd src; make DISTRO=Debian)
endif
	make -C debian/startpar
	cc -W -Wall -s -o debian/readlink debian/readlink.c
	touch build

# Make a binary package (.deb file)
binary-arch:	build checkroot
	#
	# sysvinit package
	#
	-rm -rf $(tmp)
	install -d -o root -g root -m 755 $(tmp)
	install -d -o root -g root -m 755 $(tmp)/{DEBIAN,etc}
	install -d -o root -g root -m 755 $(tmp)/usr/share/sysvinit
	install -d -o root -g root -m 755 $(tmp)/usr/include
	install -d -o root -g root -m 755 $(tmp)$(doc)/sysvinit
	install -o root -g root -m 644 doc/Changelog \
		$(tmp)$(doc)/sysvinit/changelog
	install -o root -g root -m 644 debian/changelog \
		$(tmp)$(doc)/sysvinit/changelog.Debian
	install -o root -g root -m 644 debian/NEWS \
		$(tmp)$(doc)/sysvinit/NEWS.Debian
	gzip -9f $(tmp)$(doc)/sysvinit/changelog*
	gzip -9f $(tmp)$(doc)/sysvinit/NEWS.Debian
	if test -e debian/share/inittab.$(DEB_HOST_GNU_TYPE) ; \
	then \
		install -o root -g root -m 644 \
			debian/share/inittab.$(DEB_HOST_GNU_TYPE) \
			$(tmp)/usr/share/sysvinit/inittab ; \
	elif test -e debian/share/inittab.$(DEB_HOST_GNU_SYSTEM) ; \
	then \
		install -o root -g root -m 644 \
			debian/share/inittab.$(DEB_HOST_GNU_SYSTEM) \
			$(tmp)/usr/share/sysvinit/inittab ; \
	else \
		install -o root -g root -m 644 debian/share/inittab \
			$(tmp)/usr/share/sysvinit/inittab ; \
	fi
	install -o root -g root -m 755 debian/share/update-rc.d \
		$(tmp)/usr/share/sysvinit
	install -d -o root -g root -m 755 $(tmp)/{bin,sbin,lib,usr}
	install -d -o root -g root -m 755 $(tmp)/usr/bin
	install -d -o root -g root -m 755 $(tmp)/usr/sbin
	install -d -o root -g root -m 755 $(tmp)/usr/share/man
	install -d -o root -g root -m 755 $(tmp)/usr/share/man/man{1,5,8}
	(cd src; make ROOT=$(tmp) DISTRO=Debian install )
	make -C debian/startpar DESTDIR=$(tmp) install
	strip -s -R comment -R .comment $(tmp)/sbin/startpar
ifeq ($(DEB_HOST_ARCH), hurd-i386)
	# The Hurd has its own halt and reboot commands.
	rm -f $(tmp)/usr/share/man/man8/halt.8
	rm -f $(tmp)/usr/share/man/man8/reboot.8
	rm -f $(tmp)/sbin/halt
	rm -f $(tmp)/sbin/reboot
endif
	rm -f $(tmp)/usr/share/man/man8/killall5.8
	rm -f $(tmp)/usr/share/man/man8/sulogin.8
	rm -f $(tmp)/usr/share/man/man1/last.1
	rm -f $(tmp)/usr/share/man/man1/lastb.1
	rm -f $(tmp)/usr/share/man/man1/mesg.1
	rm -f $(tmp)/usr/share/man/man8/pidof.8
	rm -f $(tmp)/usr/share/man/man1/mountpoint.1
	rm -f $(tmp)/sbin/killall5
	rm -f $(tmp)/sbin/sulogin
	rm -f $(tmp)/usr/bin/last
	rm -f $(tmp)/usr/bin/lastb
	rm -f $(tmp)/usr/bin/mesg
	rm -f $(tmp)/bin/pidof
	rm -f $(tmp)/bin/mountpoint
	rmdir $(tmp)/usr/share/man/man1
	rmdir $(tmp)/usr/sbin
	rmdir $(tmp)/usr/bin
	rmdir $(tmp)/bin
	gzip -9f $(tmp)/usr/share/man/man*/*.[0-9]
	install -o root -g root -m 644 debian/copyright \
	  $(tmp)$(doc)/sysvinit/copyright
	cat COPYRIGHT >> $(tmp)$(doc)/sysvinit/copyright
	install -o root -g root -m 755 debian/postinst $(tmp)/DEBIAN/postinst
	dpkg-shlibdeps src/init debian/startpar/startpar
	dpkg-gencontrol -psysvinit -P$(tmp) -isp
	dpkg --build $(tmp) ..
	rm -rf $(tmp)
	#
	# sysvinit-utils package
	#
	-rm -rf $(tmp)
	install -d -o root -g root -m 755 $(tmp)
	install -d -o root -g root -m 755 $(tmp)/DEBIAN
	install -d -o root -g root -m 755 $(tmp)$(doc)/sysvinit-utils
	install -o root -g root -m 644 doc/Changelog \
		$(tmp)$(doc)/sysvinit-utils/changelog
	install -o root -g root -m 644 debian/changelog \
		$(tmp)$(doc)/sysvinit-utils/changelog.Debian
	gzip -9f $(tmp)$(doc)/sysvinit-utils/changelog*
	install -d -o root -g root -m 755 $(tmp)/{bin,sbin,lib,usr}
	install -d -o root -g root -m 755 $(tmp)/usr/bin
	install -d -o root -g root -m 755 $(tmp)/usr/share/man
	install -d -o root -g root -m 755 $(tmp)/usr/share/man/man{1,8}
	install -o root -g root -m 755 src/killall5 $(tmp)/sbin
	install -o root -g root -m 755 src/sulogin $(tmp)/sbin
	install -o root -g root -m 755 src/last $(tmp)/usr/bin
	install -o root -g root -m 755 src/mesg $(tmp)/usr/bin
	strip -s -R .comment $(tmp)/sbin/killall5
	strip -s -R .comment $(tmp)/sbin/sulogin
	strip -s -R .comment $(tmp)/usr/bin/last
	strip -s -R .comment $(tmp)/usr/bin/mesg
	ln -sf ../sbin/killall5 $(tmp)/bin/pidof
	ln -sf last $(tmp)/usr/bin/lastb
	install -o root -g root -m 644 man/killall5.8 $(tmp)/usr/share/man/man8
	install -o root -g root -m 644 man/sulogin.8 $(tmp)/usr/share/man/man8
	install -o root -g root -m 644 man/last.1 $(tmp)/usr/share/man/man1
	install -o root -g root -m 644 man/lastb.1 $(tmp)/usr/share/man/man1
	install -o root -g root -m 644 man/mesg.1 $(tmp)/usr/share/man/man1
	install -o root -g root -m 644 man/pidof.8 $(tmp)/usr/share/man/man8
	gzip -9f $(tmp)/usr/share/man/man*/*.[0-9]
	install -o root -g root -m 644 debian/copyright \
	  $(tmp)$(doc)/sysvinit-utils/copyright
	cat COPYRIGHT >> $(tmp)$(doc)/sysvinit-utils/copyright
	dpkg-shlibdeps src/init
	dpkg-gencontrol -psysvinit-utils -P$(tmp) -isp
	dpkg --build $(tmp) ..
	rm -rf $(tmp)
	#
	# initscripts package
	#
	-rm -rf $(tmp)
	install -d -o root -g root -m 755 $(tmp)
	install -d -o root -g root -m 755 $(tmp)/{DEBIAN,sbin,lib,etc}
ifeq ($(DEB_HOST_ARCH_OS),linux)
	install -d -o root -g root -m 755 $(tmp)/sys
endif
	install -d -o root -g root -m 755 $(tmp)/lib/init
	install -d -o root -g root -m 755 $(tmp)/lib/init/rw
	install -d -o root -g root -m 755 $(tmp)/usr/share/initscripts
	install -d -o root -g root -m 755 $(tmp)/var/lib/initscripts
	install -d -o root -g root -m 755 $(tmp)/var/log/fsck
	install -d -o root -g root -m 755 $(tmp)$(doc)/initscripts
	install -o root -g root -m 644 debian/initscripts/doc/* $(tmp)$(doc)/initscripts
	sed -ne '/sysvinit (2.84-3)/q' -e p < debian/changelog \
		> $(tmp)$(doc)/initscripts/changelog.Debian
	chmod 644 $(tmp)$(doc)/initscripts/changelog.Debian
	gzip -9f $(tmp)$(doc)/initscripts/*
	cp -afv debian/initscripts/share/* $(tmp)/usr/share/initscripts
	cp -afv debian/initscripts/etc/* $(tmp)/etc
	cp -afv debian/initscripts/lib/* $(tmp)/lib
	chmod 755 $(tmp)/etc/init.d/[a-z]*
	chmod 755 $(tmp)/etc/network/if-up.d/[a-z]*
	chmod 644 $(tmp)/lib/init/*.sh
	chmod 644 $(tmp)/etc/init.d/skeleton
	chmod -R g-w $(tmp)
	chown -R root:root $(tmp)
	install -d -o root -g root -m 755 $(tmp)/bin
	install -d -o root -g root -m 755 $(tmp)/etc/default
	install -d -o root -g root -m 755 $(tmp)/usr/share/man/man1
	install -d -o root -g root -m 755 $(tmp)/usr/share/man/man5
	install -d -o root -g root -m 755 $(tmp)/usr/share/man/man8
	install -d -o root -g root -m 755 $(tmp)/var/lib/urandom
	install -o root -g root -m 755 debian/initscripts/sbin/fsck.nfs \
		$(tmp)/sbin/fsck.nfs
	install -o root -g root -m 644 debian/initscripts/man/fsck.nfs.8 \
		$(tmp)/usr/share/man/man8/fsck.nfs.8
	install -o root -g root -m 644 debian/initscripts/rcS.5 \
		$(tmp)/usr/share/man/man5
	install -o root -g root -m 755 src/mountpoint $(tmp)/bin
	strip -s -R .comment $(tmp)/bin/mountpoint
	install -o root -g root -m 644 man/mountpoint.1 $(tmp)/usr/share/man/man1
	install -o root -g root -m 755 debian/readlink $(tmp)/lib/init
	strip -s -R .comment $(tmp)/lib/init/readlink
	gzip -9f $(tmp)/usr/share/man/man*/*.[0-9]
	install -d -o root -g root -m 755 $(tmp)/usr/share/lintian/overrides
	install -o root -g root -m 644 \
		debian/initscripts/lintian.overrides \
		$(tmp)/usr/share/lintian/overrides/initscripts
	install -d -o root -g root -m 755 $(tmp)/usr/share/linda/overrides
	install -o root -g root -m 644 \
		debian/initscripts/linda.overrides \
		$(tmp)/usr/share/linda/overrides/initscripts
	install -o root -g root -m 644 debian/initscripts/copyright \
	  $(tmp)$(doc)/initscripts/copyright
	install -o root -g root -m 755 debian/initscripts/preinst  $(tmp)/DEBIAN
	install -o root -g root -m 755 debian/initscripts/postinst $(tmp)/DEBIAN
	install -o root -g root -m 755 debian/initscripts/postrm $(tmp)/DEBIAN
	install -o root -g root -m 644 debian/initscripts/conffiles \
	  $(tmp)/DEBIAN/conffiles
	dpkg-shlibdeps debian/readlink
	sh debian/deps-mount >> debian/substvars
	sh debian/deps-glibc >> debian/substvars
	dpkg-gencontrol -pinitscripts -P$(tmp) -isp
	dpkg --build $(tmp) ..
	rm -rf $(tmp)


# Architecture independant files.
binary-indep:   build checkroot
	#
	# sysv-rc package
	#
	-rm -rf $(tmp)
	install -d -o root -g root -m 755 $(tmp)/{DEBIAN,etc}
	install -d -o root -g root -m 755 $(tmp)/usr/share
	install -d -o root -g root -m 755 $(tmp)$(doc)/sysv-rc
	install -o root -g root -m 644 debian/sysv-rc/doc/* $(tmp)$(doc)/sysv-rc
	sed -ne '/sysvinit (2.84-3)/q' -e p < debian/changelog \
		> $(tmp)$(doc)/sysv-rc/changelog.Debian
	chmod 644 $(tmp)$(doc)/sysv-rc/changelog.Debian
	gzip -9f $(tmp)$(doc)/sysv-rc/*
	install -d -o root -g root -m 755 $(tmp)/etc/rc{2,3,4,5}.d
	cp -af debian/sysv-rc/etc/* $(tmp)/etc
	for N in 2 3 4 5 ; do \
		install -o root -g root -m 644 debian/sysv-rc/rc2-5.d-README \
			$(tmp)/etc/rc$${N}.d/README ; \
	done
	chmod 755 $(tmp)/etc/init.d/[a-z]*
	chmod 644 $(tmp)/etc/init.d/README
	chmod -R go=u-w $(tmp)/etc
	chown -R root:root $(tmp)/etc
	install -d -o root -g root -m 755 $(tmp)/usr/sbin
	install -d -o root -g root -m 755 $(tmp)/usr/share/man/man5
	install -d -o root -g root -m 755 $(tmp)/usr/share/man/man8
	install -d -o root -g root -m 755 $(tmp)/usr/share/man/ja/man8
	install -d -o root -g root -m 755 $(tmp)/usr/share/man/fr/man8
	install -d -o root -g root -m 755 $(tmp)/usr/share/man/es/man8
	install -o root -g root -m 644 debian/sysv-rc/man8/*.8 \
		$(tmp)/usr/share/man/man8
	install -o root -g root -m 644 debian/sysv-rc/man8/ja/*.8 \
		$(tmp)/usr/share/man/ja/man8
	install -o root -g root -m 644 debian/sysv-rc/man8/fr/*.8 \
		$(tmp)/usr/share/man/fr/man8
	install -o root -g root -m 644 debian/sysv-rc/man8/es/*.8 \
		$(tmp)/usr/share/man/es/man8
	install -o root -g root -m 755 debian/sysv-rc/sbin/invoke-rc.d $(tmp)/usr/sbin
	install -o root -g root -m 755 debian/sysv-rc/sbin/update-rc.d $(tmp)/usr/sbin
	gzip -9f $(tmp)/usr/share/man/man*/*.[0-9] \
		 $(tmp)/usr/share/man/??/man*/*.[0-9]
	install -d -o root -g root -m 755 $(tmp)/usr/share/lintian/overrides
	install -o root -g root -m 644 \
		debian/sysv-rc/lintian.overrides \
		$(tmp)/usr/share/lintian/overrides/sysv-rc
	install -d -o root -g root -m 755 $(tmp)/usr/share/linda/overrides
	install -o root -g root -m 644 \
		debian/sysv-rc/linda.overrides \
		$(tmp)/usr/share/linda/overrides/sysv-rc
	install -o root -g root -m 644 debian/sysv-rc/copyright \
	  $(tmp)$(doc)/sysv-rc/copyright
	install -o root -g root -m 755 debian/sysv-rc/postrm $(tmp)/DEBIAN/postrm
	dpkg-gencontrol -psysv-rc -P$(tmp) -isp
	dpkg --build $(tmp) ..
	rm -rf $(tmp)

clean:	checkroot unpatch
	(cd src; make clobber )
	-make -C debian/startpar clean
	rm -f build debian/files debian/substvars debian/readlink
	rm -rf $(tmp)
	find . -name '*.bak' -o -name '*~' | xargs -r rm -f --

binary: binary-arch binary-indep

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

buildfromsvn:
	version=`dpkg-parsechangelog | grep Version: | awk '{print $$2}'`; \
	rm -rf ../sysvinit-$$version; \
	svn export . ../sysvinit-$$version; \
	cp debian/changelog ../sysvinit-$$version/debian/changelog; \
	chmod -R a-s ../sysvinit-$$version; \
	(cd ../sysvinit-$$version && debuild $(DEBUILDFLAGS))

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

include /usr/share/dpatch/dpatch.make