rules revision 7512f1366277d89b85c05ee2944a70f8e0a5d970
12cfd52c507bd5790457a171eb9bcb39019cc6860Chris Lattner#! /usr/bin/make -f
2c140c4803dc3e10e08138670829bc0494986abe9David Goodwin# -*- makefile -*-
3c140c4803dc3e10e08138670829bc0494986abe9David Goodwin#
4c140c4803dc3e10e08138670829bc0494986abe9David Goodwin# Invoke each target with `./debian/rules <target>'.  All targets should be
5c140c4803dc3e10e08138670829bc0494986abe9David Goodwin# invoked with the package root as the current directory.
6c140c4803dc3e10e08138670829bc0494986abe9David Goodwin#
7c140c4803dc3e10e08138670829bc0494986abe9David Goodwin# The `binary' target must be run as root, as it needs to install files with
8c140c4803dc3e10e08138670829bc0494986abe9David Goodwin# specific ownerships.
9c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
10c140c4803dc3e10e08138670829bc0494986abe9David Goodwin# be paranoid
11c140c4803dc3e10e08138670829bc0494986abe9David Goodwinexport LC_ALL=C
12c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
13c140c4803dc3e10e08138670829bc0494986abe9David Goodwin# These are used for cross-compiling and for saving the configure script
14c140c4803dc3e10e08138670829bc0494986abe9David Goodwin# from having to guess our platform (since we know it already)
15c140c4803dc3e10e08138670829bc0494986abe9David GoodwinDEB_HOST_ARCH   ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
16c140c4803dc3e10e08138670829bc0494986abe9David GoodwinDEB_BUILD_ARCH   ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
17c140c4803dc3e10e08138670829bc0494986abe9David GoodwinDEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
18c140c4803dc3e10e08138670829bc0494986abe9David GoodwinDEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
19c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
20c140c4803dc3e10e08138670829bc0494986abe9David Goodwin# find the version for the main package, from changelog file
21c140c4803dc3e10e08138670829bc0494986abe9David GoodwinMAIN_VERSION = $(shell head -n 1 debian/changelog | cut '-d ' -f 2 | sed 's/[()]//g')
22c140c4803dc3e10e08138670829bc0494986abe9David Goodwin# find versions for libraries going into their own packages, from their Makefile.in's,
23db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwin# and sonames for all libs
24c140c4803dc3e10e08138670829bc0494986abe9David GoodwinCOMERR_VERSION = $(shell grep ELF_VERSION lib/et/Makefile.in | cut '-d ' -f3)
25c140c4803dc3e10e08138670829bc0494986abe9David GoodwinCOMERR_SOVERSION = $(shell grep ELF_SO_VERSION lib/et/Makefile.in | cut '-d ' -f3)
26c140c4803dc3e10e08138670829bc0494986abe9David GoodwinSS_VERSION = $(shell grep ELF_VERSION lib/ss/Makefile.in | cut '-d ' -f3)
27c140c4803dc3e10e08138670829bc0494986abe9David GoodwinSS_SOVERSION = $(shell grep ELF_SO_VERSION lib/ss/Makefile.in | cut '-d ' -f3)
28c140c4803dc3e10e08138670829bc0494986abe9David GoodwinUUID_VERSION = $(shell grep ELF_VERSION lib/uuid/Makefile.in | cut '-d ' -f3)
29c140c4803dc3e10e08138670829bc0494986abe9David GoodwinUUID_SOVERSION = $(shell grep ELF_SO_VERSION lib/uuid/Makefile.in | cut '-d ' -f3)
30c140c4803dc3e10e08138670829bc0494986abe9David GoodwinBLKID_VERSION = $(shell grep ELF_VERSION lib/blkid/Makefile.in | cut '-d ' -f3)
31c140c4803dc3e10e08138670829bc0494986abe9David GoodwinBLKID_SOVERSION = $(shell grep ELF_SO_VERSION lib/blkid/Makefile.in | cut '-d ' -f3)
32c140c4803dc3e10e08138670829bc0494986abe9David GoodwinEXT2FS_SOVERSION = $(shell grep ELF_SO_VERSION lib/ext2fs/Makefile.in | cut '-d ' -f3)
33c140c4803dc3e10e08138670829bc0494986abe9David GoodwinE2P_SOVERSION = $(shell grep ELF_SO_VERSION lib/e2p/Makefile.in | cut '-d ' -f3)
34c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
35c140c4803dc3e10e08138670829bc0494986abe9David Goodwinpackage=e2fsprogs
36c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
37c140c4803dc3e10e08138670829bc0494986abe9David Goodwintopdir=$(shell pwd)
38c140c4803dc3e10e08138670829bc0494986abe9David Goodwindebdir=${topdir}/debian
39c140c4803dc3e10e08138670829bc0494986abe9David Goodwintmpdir=${debdir}/tmp
40c140c4803dc3e10e08138670829bc0494986abe9David Goodwinudebdir=${debdir}/e2fsprogs-udeb
41c140c4803dc3e10e08138670829bc0494986abe9David Goodwinblkidudebdir=${debdir}/libblkid1-udeb
42c140c4803dc3e10e08138670829bc0494986abe9David Goodwinuuidudebdir=${debdir}/libuuid1-udeb
43c140c4803dc3e10e08138670829bc0494986abe9David Goodwinmaindir=${debdir}/e2fsprogs
44c140c4803dc3e10e08138670829bc0494986abe9David Goodwinstdbuilddir=${debdir}/BUILD-STD
45c140c4803dc3e10e08138670829bc0494986abe9David Goodwinbfbuilddir=${debdir}/BUILD-BF
46c140c4803dc3e10e08138670829bc0494986abe9David Goodwinmipsbuilddir=${debdir}/BUILD-MIPS
47c140c4803dc3e10e08138670829bc0494986abe9David Goodwinmipsbuilddir64=${debdir}/BUILD-MIPS-64
48c140c4803dc3e10e08138670829bc0494986abe9David Goodwin# docdir=${maindir}/usr/share/doc/${package}
49db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid GoodwinMANDIR=/usr/share/man
50c140c4803dc3e10e08138670829bc0494986abe9David Goodwinmandir=${tmpdir}${MANDIR}
51c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
52c140c4803dc3e10e08138670829bc0494986abe9David GoodwinUDEB_NAME = $(package)-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb
53c140c4803dc3e10e08138670829bc0494986abe9David GoodwinUDEB_PRIORITY = $(shell grep '^Package: e2fsprogs-udeb' debian/control -A 10 | grep ^Priority: | cut -d ' ' -f 2)
54c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
55db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid GoodwinBLKID_UDEB_NAME = libblkid1-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb
56b5619f42f4fdf347380d28357549df09b9ca3946Evan ChengBLKID_UDEB_PRIORITY = $(shell grep '^Package: libblkid1-udeb' debian/control -A 10 | grep ^Priority: | cut -d ' ' -f 2)
57b5619f42f4fdf347380d28357549df09b9ca3946Evan Cheng
58db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid GoodwinUUID_UDEB_NAME = libuuid1-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb
5977521f5232e679aa3de10aaaed2464aa91d7ff55David GoodwinUUID_UDEB_PRIORITY = $(shell grep '^Package: libuuid1-udeb' debian/control -A 10 | grep ^Priority: | cut -d ' ' -f 2)
6077521f5232e679aa3de10aaaed2464aa91d7ff55David Goodwin
6177521f5232e679aa3de10aaaed2464aa91d7ff55David GoodwinSTAMPSDIR=debian/stampdir
62db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid GoodwinCFGSTDSTAMP=${STAMPSDIR}/configure-std-stamp
63c140c4803dc3e10e08138670829bc0494986abe9David GoodwinCFGBFSTAMP=${STAMPSDIR}/configure-bf-stamp
648295d99bff6f8e3dfdfdaf1871cb72adab423f20Evan ChengBUILDSTDSTAMP=${STAMPSDIR}/build-std-stamp
658295d99bff6f8e3dfdfdaf1871cb72adab423f20Evan ChengBUILDBFSTAMP=${STAMPSDIR}/build-bf-stamp
668295d99bff6f8e3dfdfdaf1871cb72adab423f20Evan Cheng
678295d99bff6f8e3dfdfdaf1871cb72adab423f20Evan ChengCCOPTS = -g -fsigned-char
68c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
69c140c4803dc3e10e08138670829bc0494986abe9David GoodwinINSTALL = install
70c140c4803dc3e10e08138670829bc0494986abe9David GoodwinINSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 0755
71c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
72c140c4803dc3e10e08138670829bc0494986abe9David Goodwinifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
73c140c4803dc3e10e08138670829bc0494986abe9David GoodwinCCOPTS += -O2
74c140c4803dc3e10e08138670829bc0494986abe9David Goodwinendif
75c140c4803dc3e10e08138670829bc0494986abe9David Goodwinifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
76c140c4803dc3e10e08138670829bc0494986abe9David GoodwinINSTALL_PROGRAM += -s
772cfd52c507bd5790457a171eb9bcb39019cc6860Chris Lattnerendif
78c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
79c140c4803dc3e10e08138670829bc0494986abe9David Goodwinifeq (${DEB_HOST_ARCH},alpha)
80c140c4803dc3e10e08138670829bc0494986abe9David GoodwinCCOPTS += -DHAVE_NETINET_IN_H
81c140c4803dc3e10e08138670829bc0494986abe9David Goodwinelse
82c140c4803dc3e10e08138670829bc0494986abe9David GoodwinCCOPTS += -D__NO_STRING_INLINES
83c140c4803dc3e10e08138670829bc0494986abe9David Goodwinendif
84c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
85c140c4803dc3e10e08138670829bc0494986abe9David GoodwinBF_CCOPTS = -Os -fomit-frame-pointer
86c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
87c140c4803dc3e10e08138670829bc0494986abe9David GoodwinCOMMON_CONF_FLAGS =  \
88c140c4803dc3e10e08138670829bc0494986abe9David Goodwin                --enable-elf-shlibs --enable-dynamic-e2fsck \
89c140c4803dc3e10e08138670829bc0494986abe9David Goodwin                --infodir=/usr/share/info --enable-fsck
90c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
9198a0104014e9bb6ed89c2572f615351fd526674aEvan ChengSTD_CONF_FLAGS = --with-ccopts="${CCOPTS}" --enable-compression \
9298a0104014e9bb6ed89c2572f615351fd526674aEvan Cheng		--enable-blkid-devmapper
93c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
94c140c4803dc3e10e08138670829bc0494986abe9David GoodwinBF_CONF_FLAGS = --with-ccopts="${CCOPTS} ${BF_CCOPTS}" \
95c140c4803dc3e10e08138670829bc0494986abe9David Goodwin	--disable-nls --disable-swapfs --disable-imager \
96c140c4803dc3e10e08138670829bc0494986abe9David Goodwin	--disable-debugfs  --disable-e2initrd-helper
97c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
98c140c4803dc3e10e08138670829bc0494986abe9David GoodwinMIPS_NOPIC_CONF_FLAGS = --with-ccopts="${CCOPTS}" \
99c140c4803dc3e10e08138670829bc0494986abe9David Goodwin	--disable-nls \
100c140c4803dc3e10e08138670829bc0494986abe9David Goodwin	--disable-swapfs --disable-imager \
101c140c4803dc3e10e08138670829bc0494986abe9David Goodwin        --disable-resizer # --disable-debugfs
102c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
103c140c4803dc3e10e08138670829bc0494986abe9David Goodwin# we can't use those flags at configure time
104c140c4803dc3e10e08138670829bc0494986abe9David GoodwinMIPS_CFLAGS= -G 0 -fno-pic -mno-abicalls
105c140c4803dc3e10e08138670829bc0494986abe9David GoodwinMIPS_CFLAGS_64= -mabi=64 -G 0 -fno-pic -mno-abicalls
106c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
107c140c4803dc3e10e08138670829bc0494986abe9David Goodwinifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
108c140c4803dc3e10e08138670829bc0494986abe9David Goodwinifneq (,$(findstring $(DEB_BUILD_ARCH),mips mipsel))
109db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwinismips=ismips
110db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwinendif
111db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwinendif
112db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwin
113db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwin${CFGSTDSTAMP}:
11477521f5232e679aa3de10aaaed2464aa91d7ff55David Goodwin	dh_testdir
115378445303b10b092a898a75131141a8259cff50bEvan Cheng
116378445303b10b092a898a75131141a8259cff50bEvan Cheng	# Make sure we don't try to rebuild the configure scripts
117db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwin	find . -name configure | xargs touch
118db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwin
119db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwin	mkdir -p ${stdbuilddir}
120db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwinifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
121db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwin	cd ${stdbuilddir} && AWK=/usr/bin/awk \
122db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwin		${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS}
123db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwinelse
124db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwin	cd ${stdbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \
125db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwin		${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} \
126db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwin		--build=$(DEB_BUILD_GNU_TYPE) $(DEB_HOST_GNU_TYPE)
127db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwinendif
128db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwin
129db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwin  # specially-built MIPS libs
130db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwinifneq ($(ismips),)
1316495f63945e8dbde81f03a1dc2ab421993b9a495Evan Cheng	mkdir -p ${mipsbuilddir} ${mipsbuilddir64}
1326495f63945e8dbde81f03a1dc2ab421993b9a495Evan Cheng	cd ${mipsbuilddir} && AWK=/usr/bin/awk \
133db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwin		${topdir}/configure ${MIPS_NOPIC_CONF_FLAGS}
134db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwin	cd ${mipsbuilddir64} && AWK=/usr/bin/awk \
135db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwin		${topdir}/configure ${MIPS_NOPIC_CONF_FLAGS}
136db5a71a8e01ed9a0d93a19176df6ea0aea510d7bDavid Goodwinendif
137c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
138ee42fd309ee6a8febfafb97c2f3b6f2069758c5eEvan Cheng	mkdir -p ${STAMPSDIR}
139ee42fd309ee6a8febfafb97c2f3b6f2069758c5eEvan Cheng	touch ${CFGSTDSTAMP}
140c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
141c140c4803dc3e10e08138670829bc0494986abe9David Goodwin${CFGBFSTAMP}:
142c140c4803dc3e10e08138670829bc0494986abe9David Goodwin	dh_testdir
143c140c4803dc3e10e08138670829bc0494986abe9David Goodwin	rm -f config.cache
144c140c4803dc3e10e08138670829bc0494986abe9David Goodwin
145c140c4803dc3e10e08138670829bc0494986abe9David Goodwin	mkdir -p ${bfbuilddir}
146c140c4803dc3e10e08138670829bc0494986abe9David Goodwinifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
147c140c4803dc3e10e08138670829bc0494986abe9David Goodwin	cd ${bfbuilddir} && AWK=/usr/bin/awk \
148		${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS}
149else
150	cd ${bfbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \
151		${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} \
152		--build=$(DEB_BUILD_GNU_TYPE) $(DEB_HOST_GNU_TYPE)
153endif
154	mkdir -p ${STAMPSDIR}
155	touch ${CFGBFSTAMP}
156
157build: build-std build-bf
158
159build-std: ${BUILDSTDSTAMP}
160${BUILDSTDSTAMP}: ${CFGSTDSTAMP}
161	dh_testdir
162	make -C ${stdbuilddir} all
163
164	( cd ${stdbuilddir}/doc && \
165	  texi2html -split_chapter ${topdir}/doc/libext2fs.texinfo )
166	( cd ${stdbuilddir}/lib/et && make com_err.info && \
167	  texi2html -split_chapter -expandinfo ${topdir}/lib/et/com_err.texinfo )
168
169  # specially-built MIPS libs
170ifneq ($(ismips),)
171	make -C ${mipsbuilddir}/util
172	make -C ${mipsbuilddir} \
173		CFLAGS="${CCOPTS} ${MIPS_CFLAGS}" \
174		LIB_SUBDIRS="lib/et lib/ext2fs" libs
175	make -C ${mipsbuilddir64}/util
176	make -C ${mipsbuilddir64} \
177		CFLAGS="${CCOPTS} ${MIPS_CFLAGS_64}" \
178		LIB_SUBDIRS="lib/et lib/ext2fs" libs
179endif
180
181	touch ${BUILDSTDSTAMP}
182
183build-bf: ${BUILDBFSTAMP}
184${BUILDBFSTAMP}: ${CFGBFSTAMP}
185	dh_testdir
186	make -C ${bfbuilddir} libs
187	make -C ${bfbuilddir}/e2fsck all
188	make -C ${bfbuilddir}/misc all
189	touch ${BUILDBFSTAMP}
190
191clean:
192	dh_testdir
193	rm -rf ${STAMPSDIR}
194	-make -C ${stdbuilddir} -i distclean
195	-make -C ${bfbuilddir} -i distclean
196	rm -rf ${stdbuilddir} ${bfbuilddir} ${mipsbuilddir} ${mipsbuilddir64}
197	rm -f doc/libext2fs/*.html lib/et/com_err/*.html debian/*.substvars
198	dh_clean
199
200install: cleanup install-std
201
202# This rule allows to factorize the dh_clean between the 2 install rules
203# This must be launched before install-* (if launching them by hand, for
204# exemple) or results are unpredictable
205cleanup:
206	dh_testdir
207	dh_testroot
208	dh_clean -k
209
210install-std: DH_OPTIONS=
211install-std: build
212	dh_testdir
213	dh_testroot
214	dh_installdirs
215
216	mkdir -p ${tmpdir}/sbin
217	make -C ${stdbuilddir} install DESTDIR=${tmpdir} \
218		INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
219  # static libs and .h files
220	make -C ${stdbuilddir} install-libs DESTDIR=${tmpdir} LDCONFIG=true
221
222  # statically-linked fsck
223	${INSTALL_PROGRAM} ${stdbuilddir}/e2fsck/e2fsck.static ${tmpdir}/sbin
224	ln -s e2fsck.8.gz ${mandir}/man8/e2fsck.static.8.gz
225
226	ln -s et/com_err.h ${tmpdir}/usr/include
227
228	dh_movefiles
229	test -z `find ${tmpdir} -type f`
230
231  # specially-built MIPS libs
232ifneq ($(ismips),)
233	$(INSTALL) -p -m 0644 ${mipsbuilddir}/lib/libext2fs.a \
234		${debdir}/e2fslibs-dev/usr/lib/libext2fs-nopic.a
235	$(INSTALL) -p -m 0644 ${mipsbuilddir64}/lib/libext2fs.a \
236		${debdir}/e2fslibs-dev/usr/lib/lib64ext2fs-nopic.a
237endif
238
239install-udeb: DH_OPTIONS=
240install-udeb: build
241	dh_testdir
242	dh_testroot
243
244	make -C ${bfbuilddir} install-shlibs-libs-recursive DESTDIR=${udebdir} \
245		INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
246	make -C ${bfbuilddir}/e2fsck install DESTDIR=${udebdir} \
247		INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
248	make -C ${bfbuilddir}/misc install DESTDIR=${udebdir} \
249		INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
250	make -C ${bfbuilddir}/resize install DESTDIR=${udebdir} \
251		INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
252
253	rm -rf ${udebdir}/usr
254	find ${udebdir}/sbin -type f -a ! -name e2fsck \
255		-a ! -name mke2fs -a ! -name tune2fs \
256		-a ! -name resize2fs -a ! -name badblocks -print | xargs rm
257
258	(cd ${udebdir}/sbin; ln -s e2fsck fsck.ext2 ; \
259		ln -s e2fsck fsck.ext3 ; ln -s mke2fs mkfs.ext2 ; \
260		ln -s mke2fs mkfs.ext3)
261
262	mkdir -p ${blkidudebdir}/lib
263	mv ${udebdir}/lib/libblkid.* ${blkidudebdir}/lib
264
265	mkdir -p ${uuidudebdir}/lib
266	mv ${udebdir}/lib/libuuid.* ${uuidudebdir}/lib
267
268binary-indep: 
269  # no arch-independant debs.
270
271binary-arch: DH_OPTIONS= -a
272binary-arch: install install-udeb
273	dh_testdir
274	dh_testroot
275
276  # lintian overrides
277	for i in $$(cd debian && echo *.lintian-overrides); do \
278		pkg=$${i%.lintian-overrides} ;\
279		$(INSTALL) -m 0644 -D -p debian/$$i ${debdir}/$${pkg}/usr/share/lintian/overrides/$${pkg} ;\
280	done
281
282  # mkinitrd script
283	mkdir -p debian/e2fsprogs/usr/share/initrd-tools/scripts
284	$(INSTALL) -p -o root -g root -m 0755 debian/initrd-tools.e2fsprogs \
285		debian/e2fsprogs/usr/share/initrd-tools/scripts/e2fsprogs
286
287  # initrd script
288	mkdir -p debian/e2fsprogs/usr/share/e2fsprogs
289	$(INSTALL) -p -o root -g root -m 0755 debian/initrd.ext3-add-journal \
290		debian/e2fsprogs/usr/share/e2fsprogs/initrd.ext3-add-journal
291
292
293  # symlinks to prepare dh_installdocs run
294	mkdir -p ${debdir}/e2fsck-static/usr/share/doc/
295	ln -sf e2fsprogs ${debdir}/e2fsck-static/usr/share/doc/e2fsck-static
296
297	mkdir -p ${debdir}/libblkid${BLKID_SOVERSION}/usr/share/doc/libblkid${BLKID_SOVERSION}
298	mkdir -p ${debdir}/libblkid-dev/usr/share/doc
299	ln -sf libblkid${BLKID_SOVERSION} ${debdir}/libblkid-dev/usr/share/doc/libblkid-dev
300
301	mkdir -p ${debdir}/libss${SS_SOVERSION}/usr/share/doc/libss${SS_SOVERSION}
302	mkdir -p ${debdir}/ss-dev/usr/share/doc
303	ln -sf libss${SS_SOVERSION} ${debdir}/ss-dev/usr/share/doc/ss-dev
304
305	mkdir -p ${debdir}/libcomerr${COMERR_SOVERSION}/usr/share/doc/libcomerr${COMERR_SOVERSION}
306	mkdir -p ${debdir}/comerr-dev/usr/share/doc
307	ln -sf libcomerr${COMERR_SOVERSION} ${debdir}/comerr-dev/usr/share/doc/comerr-dev
308
309	mkdir -p ${debdir}/libuuid${UUID_SOVERSION}/usr/share/doc/libuuid${UUID_SOVERSION}
310	mkdir -p ${debdir}/uuid-dev/usr/share/doc
311	ln -sf libuuid${UUID_SOVERSION} ${debdir}/uuid-dev/usr/share/doc/uuid-dev
312
313	mkdir -p ${debdir}/e2fslibs/usr/share/doc/e2fslibs
314	mkdir -p ${debdir}/e2fslibs-dev/usr/share/doc
315	ln -sf e2fslibs ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev
316
317	$(INSTALL) -p -m 0644 debian/libblkid.copyright \
318		${debdir}/libblkid${BLKID_SOVERSION}/usr/share/doc/libblkid${BLKID_SOVERSION}/copyright
319
320	dh_installdocs -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
321
322  # HTML docs
323	$(INSTALL) -d ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs/html-info/
324	$(INSTALL) -p -m 0644 ${stdbuilddir}/doc/libext2fs/*.html \
325	   ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs/html-info/
326	$(INSTALL) -d ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/html-info/
327	$(INSTALL) -p -m 0644 ${stdbuilddir}/lib/et/com_err/*.html \
328	   ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/html-info/
329
330  # texinfo docs
331	mkdir -p ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}
332	$(INSTALL) -p -m 0644 ${topdir}/doc/libext2fs.texinfo \
333	   ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs/libext2fs.texi
334	$(INSTALL) -p -m 0644 ${topdir}/lib/et/com_err.texinfo \
335	   ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/com_err.texi
336
337	$(INSTALL) -d ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/examples
338	$(INSTALL) -p -m 0644 lib/ss/ss_err.et \
339		${stdbuilddir}/lib/ext2fs/ext2_err.et \
340		${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/examples
341	$(INSTALL) -d ${debdir}/ss-dev/usr/share/doc/libss${SS_SOVERSION}/examples
342	$(INSTALL) -p -m 0644 debugfs/debug_cmds.ct \
343		${debdir}/ss-dev/usr/share/doc/libss${SS_SOVERSION}/examples
344
345	$(INSTALL) -d ${debdir}/uuid-dev/usr/share/doc/libuuid${UUID_SOVERSION}
346	$(INSTALL) -p -m 0644 doc/draft-leach-uuids-guids-01.txt \
347		${debdir}/uuid-dev/usr/share/doc/libuuid${UUID_SOVERSION}
348
349	dh_installinfo -pcomerr-dev ${stdbuilddir}/lib/et/com_err.info
350	dh_installinfo -pe2fslibs-dev ${stdbuilddir}/doc/libext2fs.info
351
352	DH_OPTIONS= dh_installchangelogs -pe2fsprogs -plibblkid${BLKID_SOVERSION}
353	DH_OPTIONS= dh_installchangelogs -pe2fsprogs -plibcomerr${COMERR_SOVERSION}
354	DH_OPTIONS= dh_installchangelogs -pe2fsprogs -plibss${SS_SOVERSION}
355	DH_OPTIONS= dh_installchangelogs -pe2fsprogs -plibuuid${UUID_SOVERSION}
356	DH_OPTIONS= dh_installchangelogs -pe2fsprogs -pe2fslibs
357
358ifneq ($(ismips),)
359	dh_strip -Xlib64ext2fs-nopic.a
360else
361	dh_strip
362endif
363
364	dh_compress
365	dh_fixperms
366
367	dh_makeshlibs -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
368	dh_makeshlibs -plibcomerr${COMERR_SOVERSION} \
369		-V 'libcomerr2 (>= 1.33-3)'
370	echo "udeb: libblkid 1 libblkid1-udeb" >> \
371		debian/libblkid1/DEBIAN/shlibs
372	echo "udeb: libuuid 1 libuuid1-udeb" >> debian/libuuid1/DEBIAN/shlibs
373
374	dh_installdeb
375	dh_shlibdeps -l${stdbuilddir}/lib
376	dh_shlibdeps -pe2fsprogs -l${stdbuilddir}/lib \
377		-u"-Ldebian/e2fsprogs.shlibs.local"
378	dh_shlibdeps -pe2fsprogs-udeb -l${stdbuilddir}/lib \
379		-u"-Ldebian/e2fsprogs-udeb.shlibs.local"
380
381	dh_gencontrol -Ncomerr-dev -Nss-dev -Nuuid-dev \
382		-Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
383	DH_OPTIONS= dh_gencontrol -pcomerr-dev \
384	  -u '-v${COMERR_VERSION}-${MAIN_VERSION}'
385	DH_OPTIONS= dh_gencontrol -pss-dev \
386	  -u '-v${SS_VERSION}-${MAIN_VERSION}'
387	DH_OPTIONS= dh_gencontrol -puuid-dev \
388	  -u '-v${UUID_VERSION}-${MAIN_VERSION}'
389
390	dh_md5sums -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
391	dh_builddeb -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
392
393	# udeb stuff
394	dh_gencontrol	-pe2fsprogs-udeb -- -fdebian/files~
395	dpkg-distaddfile $(UDEB_NAME) debian-installer $(UDEB_PRIORITY)
396	dh_builddeb -pe2fsprogs-udeb --filename=$(UDEB_NAME)
397
398	dh_gencontrol	-plibblkid1-udeb -- -fdebian/files~
399	dpkg-distaddfile $(BLKID_UDEB_NAME) debian-installer $(BLKID_UDEB_PRIORITY)
400	dh_builddeb -plibblkid1-udeb --filename=$(BLKID_UDEB_NAME)
401
402	dh_gencontrol	-plibuuid1-udeb -- -fdebian/files~
403	dpkg-distaddfile $(UUID_UDEB_NAME) debian-installer $(UUID_UDEB_PRIORITY)
404	dh_builddeb -plibuuid1-udeb --filename=$(UUID_UDEB_NAME)
405
406binary: binary-indep binary-arch
407
408.PHONY: binary binary-arch binary-indep clean checkroot
409