blob: cf8e070c1e63248efb51a0b473006248c35f5c2e [file] [log] [blame]
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +00001#! /usr/bin/make -f
2# -*- makefile -*-
3#
4# Invoke each target with `./debian/rules <target>'. All targets should be
5# invoked with the package root as the current directory.
6#
7# The `binary' target must be run as root, as it needs to install files with
8# specific ownerships.
9
Theodore Ts'od973c182012-03-26 17:37:10 -070010-include debian/rules.custom
11
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +000012# be paranoid
Theodore Ts'od973c182012-03-26 17:37:10 -070013export LC_ALL ?= C
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +000014
Theodore Ts'o95f65c32009-07-18 22:14:58 -040015# Allow distro-specific behaviour
Theodore Ts'o686c4c12009-08-23 10:09:36 -040016DISTRO :=$(shell sed -ne '/DISTRIB_ID/s/.*=//p' /etc/lsb-release 2>/dev/null || echo Debian)
17SYS_BLKID_VER := $(shell dpkg-query -W libblkid1 | cut -f 2 | cut -b 1)
Theodore Ts'o95f65c32009-07-18 22:14:58 -040018ifeq ($(SYS_BLKID_VER),2)
19UTIL_LINUX_NG ?= yes
20endif
21
Theodore Ts'of85cc2a2003-07-26 00:48:08 -040022# These are used for cross-compiling and for saving the configure script
23# from having to guess our platform (since we know it already)
Theodore Ts'od973c182012-03-26 17:37:10 -070024DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
25DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
26DEB_HOST_OS ?= $(shell dpkg-architecture -qDEB_HOST_OS)
27DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
28DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
29DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null)
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +000030
31# find the version for the main package, from changelog file
Theodore Ts'o56eb4d42004-09-17 19:54:22 -040032MAIN_VERSION = $(shell head -n 1 debian/changelog | cut '-d ' -f 2 | sed 's/[()]//g')
Theodore Ts'oe5b16432002-08-17 21:11:29 -040033# find versions for libraries going into their own packages, from their Makefile.in's,
34# and sonames for all libs
Theodore Ts'od973c182012-03-26 17:37:10 -070035COMERR_VERSION ?= $(shell grep ELF_VERSION lib/et/Makefile.in | cut '-d ' -f3)
36COMERR_SOVERSION ?= $(shell grep ELF_SO_VERSION lib/et/Makefile.in | cut '-d ' -f3)
37SS_VERSION ?= $(shell grep ELF_VERSION lib/ss/Makefile.in | cut '-d ' -f3)
38SS_SOVERSION ?= $(shell grep ELF_SO_VERSION lib/ss/Makefile.in | cut '-d ' -f3)
Theodore Ts'o95f65c32009-07-18 22:14:58 -040039
40ifneq ($(UTIL_LINUX_NG),yes)
Theodore Ts'od973c182012-03-26 17:37:10 -070041UUID_VERSION ?= $(shell grep ELF_VERSION lib/uuid/Makefile.in | cut '-d ' -f3)
42UUID_SOVERSION ?= $(shell grep ELF_SO_VERSION lib/uuid/Makefile.in | cut '-d ' -f3)
Theodore Ts'o95f65c32009-07-18 22:14:58 -040043
Theodore Ts'od973c182012-03-26 17:37:10 -070044BLKID_VERSION ?= $(shell grep ELF_VERSION lib/blkid/Makefile.in | cut '-d ' -f3)
45BLKID_SOVERSION ?= $(shell grep ELF_SO_VERSION lib/blkid/Makefile.in | cut '-d ' -f3)
Theodore Ts'o95f65c32009-07-18 22:14:58 -040046endif
47
Theodore Ts'od973c182012-03-26 17:37:10 -070048EXT2FS_SOVERSION ?= $(shell grep ELF_SO_VERSION lib/ext2fs/Makefile.in | cut '-d ' -f3)
49E2P_SOVERSION ?= $(shell grep ELF_SO_VERSION lib/e2p/Makefile.in | cut '-d ' -f3)
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +000050
Theodore Ts'od973c182012-03-26 17:37:10 -070051package ?= e2fsprogs
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +000052
Theodore Ts'od973c182012-03-26 17:37:10 -070053topdir ?= $(shell pwd)
54debdir ?= ${topdir}/debian
55tmpdir ?= ${debdir}/tmp
56udebdir ?= ${debdir}/e2fsprogs-udeb
Theodore Ts'o95f65c32009-07-18 22:14:58 -040057ifneq ($(UTIL_LINUX_NG),yes)
Theodore Ts'od973c182012-03-26 17:37:10 -070058blkidudebdir ?= ${debdir}/libblkid1-udeb
59uuidudebdir ?= ${debdir}/libuuid1-udeb
Theodore Ts'o95f65c32009-07-18 22:14:58 -040060endif
Theodore Ts'od973c182012-03-26 17:37:10 -070061libcomerrdir ?= ${debdir}/libcomerr${COMERR_SOVERSION}
62comerrdevdir ?= ${debdir}/comerr-dev
63libcomerrdbgdir ?= ${debdir}/libcomerr2-dbg
64libssdir ?= ${debdir}/libss${SS_SOVERSION}
65ssdevdir ?= ${debdir}/ss-dev
66libssdbgdir ?= ${debdir}/libss2-dbg
Theodore Ts'o95f65c32009-07-18 22:14:58 -040067ifneq ($(UTIL_LINUX_NG),yes)
Theodore Ts'od973c182012-03-26 17:37:10 -070068libblkiddir ?= ${debdir}/libblkid${BLKID_SOVERSION}
69libblkiddevdir ?= ${debdir}/libblkid-dev
70libblkiddbgdir ?= ${debdir}/libblkid1-dbg
71libuuiddir ?= ${debdir}/libuuid${UUID_SOVERSION}
72uuiddevdir ?= ${debdir}/uuid-dev
73libuuiddbgdir ?= ${debdir}/libuuid1-dbg
74uuidruntimedir ?= ${debdir}/uuid-runtime
75uuidruntimedbgdir ?= ${debdir}/uuid-runtime-dbg
Theodore Ts'o95f65c32009-07-18 22:14:58 -040076endif
Theodore Ts'od973c182012-03-26 17:37:10 -070077libext2dir ?= ${debdir}/e2fslibs
78libext2devdir ?= ${debdir}/e2fslibs-dev
79libext2dbgdir ?= ${debdir}/e2fslibs-dbg
80maindir ?= ${debdir}/e2fsprogs
81e2fsckstaticdir ?= ${debdir}/e2fsck-static
82debugdir ?= ${debdir}/e2fsprogs-dbg
83stdbuilddir ?= ${debdir}/BUILD-STD
Theodore Ts'od973c182012-03-26 17:37:10 -070084staticbuilddir ?= ${debdir}/BUILD-STATIC
85mipsbuilddir ?= ${debdir}/BUILD-MIPS
86mipsbuilddir64 ?= ${debdir}/BUILD-MIPS-64
87# docdir ?= ${maindir}/usr/share/doc/${package}
88MANDIR ?= /usr/share/man
89mandir ?= ${tmpdir}${MANDIR}
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +000090
Theodore Ts'od973c182012-03-26 17:37:10 -070091UDEB_NAME ?= $(package)-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb
92UDEB_PRIORITY ?= $(shell grep '^Package: e2fsprogs-udeb' debian/control.in -A 10 | grep ^Priority: | cut -d ' ' -f 2)
Theodore Ts'odd198d62002-10-31 03:44:35 -050093
Theodore Ts'o95f65c32009-07-18 22:14:58 -040094ifneq ($(UTIL_LINUX_NG),yes)
Theodore Ts'od973c182012-03-26 17:37:10 -070095BLKID_UDEB_NAME ?= libblkid1-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb
96BLKID_UDEB_PRIORITY ?= $(shell grep '^Package: libblkid1-udeb' debian/control.in -A 10 | grep ^Priority: | cut -d ' ' -f 2)
Theodore Ts'o417781a2003-04-10 00:18:56 -040097
Theodore Ts'od973c182012-03-26 17:37:10 -070098UUID_UDEB_NAME ?= libuuid1-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb
99UUID_UDEB_PRIORITY ?= $(shell grep '^Package: libuuid1-udeb' debian/control.in -A 10 | grep ^Priority: | cut -d ' ' -f 2)
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400100endif
Theodore Ts'oe254d052003-12-07 01:57:04 -0500101
Theodore Ts'od973c182012-03-26 17:37:10 -0700102STAMPSDIR ?= debian/stampdir
103CFGSTDSTAMP ?= ${STAMPSDIR}/configure-std-stamp
104CFGBFSTAMP ?= ${STAMPSDIR}/configure-bf-stamp
105CFGSTATICSTAMP ?= ${STAMPSDIR}/configure-static-stamp
106BUILDSTDSTAMP ?= ${STAMPSDIR}/build-std-stamp
107BUILDBFSTAMP ?= ${STAMPSDIR}/build-bf-stamp
108BUILDSTATICSTAMP ?=${STAMPSDIR}/build-static-stamp
Theodore Ts'o541d1732002-02-23 21:23:26 -0500109
Theodore Ts'od973c182012-03-26 17:37:10 -0700110INSTALL ?= install
111INSTALL_PROGRAM ?= $(INSTALL) -p -o root -g root -m 0755
Theodore Ts'o1893e712001-05-21 02:48:41 +0000112
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400113#ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
114#INSTALL_PROGRAM += -s
115#endif
Theodore Ts'o1893e712001-05-21 02:48:41 +0000116
Theodore Ts'od973c182012-03-26 17:37:10 -0700117DEFAULT_CFLAGS ?= -g -O2
118DEFAULT_LDFLAGS ?= -Wl,-Bsymbolic-functions
Theodore Ts'o910fae92012-02-15 18:29:37 -0500119
Theodore Ts'o95decc52012-03-26 22:23:24 -0700120CFLAGS ?= $(shell if dpkg-buildflags > /dev/null 2>&1 ; then \
121 dpkg-buildflags --get CFLAGS; else echo $(DEFAULT_CFLAGS) ; fi)
122LDFLAGS ?= $(shell if dpkg-buildflags > /dev/null 2>&1 ; then \
123 dpkg-buildflags --get LDFLAGS; else echo $(DEFAULT_LDFLAGS) ; fi)
124CPPFLAGS ?= $(shell if dpkg-buildflags > /dev/null 2>&1 ; then \
125 dpkg-buildflags --get CPPFLAGS; fi)
Theodore Ts'o910fae92012-02-15 18:29:37 -0500126
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000127ifeq (${DEB_HOST_ARCH},alpha)
Theodore Ts'o0b5b9f92009-09-06 21:28:47 -0400128CFLAGS += -DHAVE_NETINET_IN_H
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000129else
Theodore Ts'o0b5b9f92009-09-06 21:28:47 -0400130CFLAGS += -D__NO_STRING_INLINES
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000131endif
132
Theodore Ts'ofb8bcfc2012-03-26 21:44:11 -0700133ifneq (${DEB_HOST_ARCH_OS},linux)
134SKIP_STATIC = yes
135endif
136
137ifeq ($(SKIP_STATIC),yes)
138BUILD_STATIC =
139E2FSCK_STATIC = ${stdbuilddir}/e2fsck/e2fsck.static
140else
Theodore Ts'oa827a2a2007-12-31 17:17:39 -0500141BUILD_STATIC = build-static
142E2FSCK_STATIC = ${staticbuilddir}/e2fsck/e2fsck.static
Samuel Thibault3e416082007-08-14 11:25:45 +0200143endif
144
Theodore Ts'obe241782012-03-26 21:41:47 -0700145ifeq ($(SKIP_BF),yes)
146BUILD_BF =
147bfbuilddir ?= ${stdbuilddir}
148else
149BUILD_BF = build-bf
150bfbuilddir ?= ${debdir}/BUILD-BF
151endif
152
Theodore Ts'o0b5b9f92009-09-06 21:28:47 -0400153BF_CFLAGS = -Os -fomit-frame-pointer
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000154
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400155COMMON_CONF_FLAGS = --disable-e2initrd-helper --enable-elf-shlibs \
Theodore Ts'o7becb202011-11-14 10:40:43 -0500156 --enable-quota --infodir=/usr/share/info
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400157ifeq ($(UTIL_LINUX_NG),yes)
158COMMON_CONF_FLAGS += --disable-fsck --disable-libblkid \
159 --disable-libuuid --disable-uuidd
160else
161COMMON_CONF_FLAGS += --enable-fsck
162endif
Theodore Ts'o79786212001-06-22 23:05:23 -0400163
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400164ifneq ($(strip $(DEB_HOST_MULTIARCH)),)
Theodore Ts'od973c182012-03-26 17:37:10 -0700165MULTIARCH_CONF ?= --with-multiarch=$(DEB_HOST_MULTIARCH)
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400166# This doesn't work yet because gdb and lintian don't expect and/or
167# don't work with /usr/lib/<triplet>/debug
168#USRLIB = /usr/lib/$(DEB_HOST_MULTIARCH)
Theodore Ts'od973c182012-03-26 17:37:10 -0700169USRLIB ?= /usr/lib
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400170else
Theodore Ts'od973c182012-03-26 17:37:10 -0700171USRLIB ?= /usr/lib
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400172endif
173
Theodore Ts'od973c182012-03-26 17:37:10 -0700174STD_CONF_FLAGS ?= --enable-symlink-install $(MULTIARCH_CONF)
Theodore Ts'o79786212001-06-22 23:05:23 -0400175
Theodore Ts'od973c182012-03-26 17:37:10 -0700176BF_CONF_FLAGS ?= --disable-nls --disable-imager --disable-testio-debug \
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400177 --disable-uuidd --disable-tls --disable-debugfs
Theodore Ts'o79786212001-06-22 23:05:23 -0400178
Theodore Ts'od973c182012-03-26 17:37:10 -0700179STATIC_CONF_FLAGS ?= --disable-nls --disable-imager \
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400180 --disable-uuidd --disable-tls
Theodore Ts'oa827a2a2007-12-31 17:17:39 -0500181
Theodore Ts'od973c182012-03-26 17:37:10 -0700182MIPS_NOPIC_CONF_FLAGS ?= --disable-nls --disable-imager \
Theodore Ts'o61a679d2007-12-31 11:20:01 -0500183 --disable-uuidd --disable-tls \
Theodore Ts'odd198d62002-10-31 03:44:35 -0500184 --disable-resizer # --disable-debugfs
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500185
Theodore Ts'o2a4c77b2002-09-24 01:30:00 -0400186# we can't use those flags at configure time
Theodore Ts'od973c182012-03-26 17:37:10 -0700187MIPS_CFLAGS ?= -G 0 -fno-pic -mno-abicalls
188MIPS_CFLAGS_64 ?= -mabi=64 -G 0 -fno-pic -mno-abicalls
Theodore Ts'oe5b16432002-08-17 21:11:29 -0400189
190ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
191ifneq (,$(findstring $(DEB_BUILD_ARCH),mips mipsel))
192ismips=ismips
193endif
194endif
195
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400196M4_ARGS=
197ifeq ($(UTIL_LINUX_NG),yes)
198M4_ARGS+=-DUTIL_LINUX_NG
199else
200M4_ARGS+=-UUTIL_LINUX_NG
201endif
202
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400203ifneq ($(strip $(DEB_HOST_MULTIARCH)),)
204M4_ARGS+=-DDO_MULTIARCH
205else
206M4_ARGS+=-UDO_MULTIARCH
207endif
208
Theodore Ts'o81d72f72012-03-26 16:31:06 -0700209ifneq ($(SKIP_DIETLIBC),)
210M4_ARGS+=-UDIETLIBC
211WITH_DIET_LIBC =
212else
213M4_ARGS+=-DDIETLIBC
214WITH_DIET_LIBC = --with-diet-libc
215endif
216
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400217FILES_FIXUP= libcomerr2.files comerr-dev.files libss2.files ss-dev.files \
218 libuuid1.files uuid-dev.files libblkid1.files libblkid-dev.files \
219 e2fslibs.files e2fslibs-dev.files
220
Theodore Ts'oe54e7002010-06-03 11:50:42 -0400221debian-files: debian/control debian/e2fsprogs.shlibs.local
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400222ifeq ($(strip $(DEB_HOST_MULTIARCH)),)
223 for i in $(FILES_FIXUP); do \
224 sed -e 's;lib/\*/;lib/;' debian/$$i.in > debian/$$i; \
225 done
226else
227 for i in $(FILES_FIXUP); do cp debian/$$i.in debian/$$i; done
228endif
Theodore Ts'oe54e7002010-06-03 11:50:42 -0400229
230mrproper: clean
231 rm debian/control debian/e2fsprogs.shlibs.local
232
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400233debian/control: debian/control.in debian/rules
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400234 m4 $(M4_ARGS) < debian/control.in | grep -v ^REMOVE_ME$$ > $@
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400235
Theodore Ts'oe54e7002010-06-03 11:50:42 -0400236debian/e2fsprogs.shlibs.local: debian/e2fsprogs.shlibs.local.in
237 m4 $(M4_ARGS) < debian/e2fsprogs.shlibs.local.in > $@
238
Theodore Ts'o541d1732002-02-23 21:23:26 -0500239${CFGSTDSTAMP}:
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000240 dh_testdir
Theodore Ts'o541d1732002-02-23 21:23:26 -0500241
Theodore Ts'o41b6ae62004-09-24 10:07:05 -0400242 # Make sure we don't try to rebuild the configure scripts
243 find . -name configure | xargs touch
244
Theodore Ts'o79786212001-06-22 23:05:23 -0400245 mkdir -p ${stdbuilddir}
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000246ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
Theodore Ts'obe5a72d2005-03-17 01:16:34 -0500247 cd ${stdbuilddir} && AWK=/usr/bin/awk \
Theodore Ts'o0b5b9f92009-09-06 21:28:47 -0400248 ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} \
Theodore Ts'o910fae92012-02-15 18:29:37 -0500249 CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000250else
Theodore Ts'obe5a72d2005-03-17 01:16:34 -0500251 cd ${stdbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \
Theodore Ts'o79786212001-06-22 23:05:23 -0400252 ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} \
Theodore Ts'o0b5b9f92009-09-06 21:28:47 -0400253 --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \
Theodore Ts'o910fae92012-02-15 18:29:37 -0500254 CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000255endif
Theodore Ts'oe5b16432002-08-17 21:11:29 -0400256
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500257 # specially-built MIPS libs
258ifneq ($(ismips),)
259 mkdir -p ${mipsbuilddir} ${mipsbuilddir64}
260 cd ${mipsbuilddir} && AWK=/usr/bin/awk \
Theodore Ts'oc1986ec2012-06-13 15:29:13 -0400261 ${topdir}/configure ${MIPS_NOPIC_CONF_FLAGS} \
262 CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500263 cd ${mipsbuilddir64} && AWK=/usr/bin/awk \
Theodore Ts'oc1986ec2012-06-13 15:29:13 -0400264 ${topdir}/configure ${MIPS_NOPIC_CONF_FLAGS} \
265 CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500266endif
Theodore Ts'oe5b16432002-08-17 21:11:29 -0400267
Theodore Ts'o541d1732002-02-23 21:23:26 -0500268 mkdir -p ${STAMPSDIR}
269 touch ${CFGSTDSTAMP}
Theodore Ts'o79786212001-06-22 23:05:23 -0400270
Theodore Ts'o541d1732002-02-23 21:23:26 -0500271${CFGBFSTAMP}:
Theodore Ts'o79786212001-06-22 23:05:23 -0400272 dh_testdir
Theodore Ts'o541d1732002-02-23 21:23:26 -0500273 rm -f config.cache
274
Theodore Ts'o79786212001-06-22 23:05:23 -0400275 mkdir -p ${bfbuilddir}
276ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
Theodore Ts'obe5a72d2005-03-17 01:16:34 -0500277 cd ${bfbuilddir} && AWK=/usr/bin/awk \
Theodore Ts'o0b5b9f92009-09-06 21:28:47 -0400278 ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} \
Theodore Ts'o910fae92012-02-15 18:29:37 -0500279 CFLAGS="${CFLAGS} ${BF_CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
Theodore Ts'o79786212001-06-22 23:05:23 -0400280else
Theodore Ts'obe5a72d2005-03-17 01:16:34 -0500281 cd ${bfbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \
Theodore Ts'o79786212001-06-22 23:05:23 -0400282 ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} \
Theodore Ts'o0b5b9f92009-09-06 21:28:47 -0400283 --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \
Theodore Ts'o910fae92012-02-15 18:29:37 -0500284 CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
Theodore Ts'o79786212001-06-22 23:05:23 -0400285endif
Theodore Ts'o541d1732002-02-23 21:23:26 -0500286 mkdir -p ${STAMPSDIR}
287 touch ${CFGBFSTAMP}
Theodore Ts'o79786212001-06-22 23:05:23 -0400288
Theodore Ts'oa827a2a2007-12-31 17:17:39 -0500289${CFGSTATICSTAMP}:
290 dh_testdir
291 rm -f config.cache
292
293 mkdir -p ${staticbuilddir}
294ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
Theodore Ts'o4f2e8f12008-01-27 17:20:44 -0500295 if type diet > /dev/null 2>&1 ; then \
Theodore Ts'o3218dc92008-09-12 09:26:45 -0400296 cd ${staticbuilddir} && AWK=/usr/bin/awk \
Theodore Ts'o0b5b9f92009-09-06 21:28:47 -0400297 ${topdir}/configure ${STATIC_CONF_FLAGS} \
Theodore Ts'oc1986ec2012-06-13 15:29:13 -0400298 ${WITH_DIET_LIBC} CFLAGS="${CFLAGS}" \
299 CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"; \
Theodore Ts'o3218dc92008-09-12 09:26:45 -0400300 else \
301 cd ${staticbuilddir} && AWK=/usr/bin/awk \
Theodore Ts'o0b5b9f92009-09-06 21:28:47 -0400302 ${topdir}/configure ${STATIC_CONF_FLAGS} \
Theodore Ts'oc1986ec2012-06-13 15:29:13 -0400303 CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" \
304 LDFLAGS="$(LDFLAGS)"; \
Theodore Ts'o4f2e8f12008-01-27 17:20:44 -0500305 fi
Theodore Ts'oa827a2a2007-12-31 17:17:39 -0500306else
307 cd ${staticbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \
308 ${topdir}/configure ${COMMON_CONF_FLAGS} ${STATIC_CONF_FLAGS} \
Theodore Ts'o0b5b9f92009-09-06 21:28:47 -0400309 --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \
Theodore Ts'o910fae92012-02-15 18:29:37 -0500310 CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
Theodore Ts'oa827a2a2007-12-31 17:17:39 -0500311endif
312 mkdir -p ${STAMPSDIR}
313 touch ${CFGSTATICSTAMP}
314
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400315build-arch: build
316build-indep: build
Theodore Ts'obe241782012-03-26 21:41:47 -0700317build: build-std $(BUILD_BF) $(BUILD_STATIC)
Theodore Ts'o79786212001-06-22 23:05:23 -0400318
Theodore Ts'o541d1732002-02-23 21:23:26 -0500319build-std: ${BUILDSTDSTAMP}
320${BUILDSTDSTAMP}: ${CFGSTDSTAMP}
Theodore Ts'o79786212001-06-22 23:05:23 -0400321 dh_testdir
Theodore Ts'of921eda2012-02-20 18:17:37 -0500322 $(MAKE) -C ${stdbuilddir} V=1 all
323 $(MAKE) -C ${stdbuilddir}/e2fsck V=1 e2fsck.static
324 $(MAKE) -C ${stdbuilddir}/po V=1 update-gmo
Theodore Ts'oe5b16432002-08-17 21:11:29 -0400325
Theodore Ts'of921eda2012-02-20 18:17:37 -0500326 ( cd ${stdbuilddir}/doc && $(MAKE) V=1 libext2fs_abt.html )
327 ( cd ${stdbuilddir}/lib/et && $(MAKE) V=1 com_err.info com_err_abt.html )
Theodore Ts'oe5b16432002-08-17 21:11:29 -0400328
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500329 # specially-built MIPS libs
330ifneq ($(ismips),)
Theodore Ts'of921eda2012-02-20 18:17:37 -0500331 $(MAKE) -C ${mipsbuilddir}/util V=1
332 $(MAKE) -C ${mipsbuilddir} V=1 \
Theodore Ts'o0b5b9f92009-09-06 21:28:47 -0400333 CFLAGS="${CFLAGS} ${MIPS_CFLAGS}" \
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500334 LIB_SUBDIRS="lib/et lib/ext2fs" libs
Theodore Ts'of921eda2012-02-20 18:17:37 -0500335 $(MAKE) -C ${mipsbuilddir64}/util V=1
336 $(MAKE) -C ${mipsbuilddir64} V=1 \
Theodore Ts'o0b5b9f92009-09-06 21:28:47 -0400337 CFLAGS="${CFLAGS} ${MIPS_CFLAGS_64}" \
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500338 LIB_SUBDIRS="lib/et lib/ext2fs" libs
339endif
Theodore Ts'oe5b16432002-08-17 21:11:29 -0400340
Theodore Ts'o541d1732002-02-23 21:23:26 -0500341 touch ${BUILDSTDSTAMP}
Theodore Ts'o79786212001-06-22 23:05:23 -0400342
Theodore Ts'o541d1732002-02-23 21:23:26 -0500343build-bf: ${BUILDBFSTAMP}
344${BUILDBFSTAMP}: ${CFGBFSTAMP}
Theodore Ts'o79786212001-06-22 23:05:23 -0400345 dh_testdir
Theodore Ts'of921eda2012-02-20 18:17:37 -0500346 $(MAKE) -C ${bfbuilddir} V=1 libs
347 $(MAKE) -C ${bfbuilddir}/e2fsck V=1 all
348 $(MAKE) -C ${bfbuilddir}/misc V=1 all
Theodore Ts'oc1986ec2012-06-13 15:29:13 -0400349 $(MAKE) -C ${bfbuilddir}/resize V=1 all
Theodore Ts'o541d1732002-02-23 21:23:26 -0500350 touch ${BUILDBFSTAMP}
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000351
Theodore Ts'oa827a2a2007-12-31 17:17:39 -0500352build-static: ${BUILDSTATICSTAMP}
353${BUILDSTATICSTAMP}: ${CFGSTATICSTAMP}
354 dh_testdir
Theodore Ts'of921eda2012-02-20 18:17:37 -0500355 $(MAKE) -C ${staticbuilddir} V=1 libs
356 $(MAKE) -C ${staticbuilddir}/e2fsck V=1 all e2fsck.static
Theodore Ts'oa827a2a2007-12-31 17:17:39 -0500357 touch ${BUILDSTATICSTAMP}
358
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000359clean:
360 dh_testdir
Theodore Ts'o541d1732002-02-23 21:23:26 -0500361 rm -rf ${STAMPSDIR}
Theodore Ts'oc1986ec2012-06-13 15:29:13 -0400362 [ ! -f ${stdbuilddir}/Makefile ] || $(MAKE) -C ${stdbuilddir} V=1 distclean
363 [ ! -f ${bfbuilddir}/Makefile ] || $(MAKE) -C ${bfbuilddir} V=1 distclean
364 [ ! -f ${staticbuilddir}/Makefile ] || $(MAKE) -C ${staticbuilddir} V=1 distclean
Theodore Ts'oa827a2a2007-12-31 17:17:39 -0500365 rm -rf ${stdbuilddir} ${bfbuilddir} ${staticbuilddir} ${mipsbuilddir} ${mipsbuilddir64}
Theodore Ts'o4534f8b2009-11-29 20:19:10 -0500366 rm -f debian/*.substvars
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000367 dh_clean
368
Theodore Ts'o62775dc2003-05-08 10:39:50 -0400369install: cleanup install-std
Theodore Ts'o79786212001-06-22 23:05:23 -0400370
371# This rule allows to factorize the dh_clean between the 2 install rules
372# This must be launched before install-* (if launching them by hand, for
373# exemple) or results are unpredictable
374cleanup:
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000375 dh_testdir
376 dh_testroot
Theodore Ts'oef797132009-04-20 08:12:15 -0400377 dh_prep
Theodore Ts'o79786212001-06-22 23:05:23 -0400378
379install-std: DH_OPTIONS=
380install-std: build
381 dh_testdir
382 dh_testroot
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000383 dh_installdirs
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000384
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000385 mkdir -p ${tmpdir}/sbin
Theodore Ts'oc1986ec2012-06-13 15:29:13 -0400386 $(MAKE) -C ${stdbuilddir} V=1 install DESTDIR=${tmpdir} \
Theodore Ts'o79786212001-06-22 23:05:23 -0400387 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
388 # static libs and .h files
Theodore Ts'oc1986ec2012-06-13 15:29:13 -0400389 $(MAKE) -C ${stdbuilddir} V=1 install-libs DESTDIR=${tmpdir} LDCONFIG=true
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000390
Theodore Ts'o1893e712001-05-21 02:48:41 +0000391 # statically-linked fsck
Theodore Ts'oa827a2a2007-12-31 17:17:39 -0500392 ${INSTALL_PROGRAM} $(E2FSCK_STATIC) ${tmpdir}/sbin
Theodore Ts'oec3bb412006-10-04 09:12:35 -0400393 cp ${mandir}/man8/e2fsck.8 ${mandir}/man8/e2fsck.static.8
Theodore Ts'o8f9d7082011-09-19 13:39:38 -0400394 # remove static quota library for now
395 rm ${tmpdir}/usr/include/quota/mkquota.h
396 find ${tmpdir}/usr/lib -name quota.pc -o -name libquota.a | xargs rm
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000397
Theodore Ts'ob1c828e2011-09-28 23:12:45 -0400398ifeq ($(DEB_BUILD_GNU_SYSTEM), gnu)
399 ${INSTALL} -m 0644 misc/mke2fs-hurd.conf ${tmpdir}/etc/mke2fs.conf
400endif
401
Theodore Ts'o2a4c77b2002-09-24 01:30:00 -0400402 dh_movefiles
Theodore Ts'o15fdc402010-05-26 11:01:06 -0400403 test -z "`find ${tmpdir} -type f`"
Theodore Ts'o2a4c77b2002-09-24 01:30:00 -0400404
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500405 # specially-built MIPS libs
406ifneq ($(ismips),)
407 $(INSTALL) -p -m 0644 ${mipsbuilddir}/lib/libext2fs.a \
408 ${debdir}/e2fslibs-dev/usr/lib/libext2fs-nopic.a
409 $(INSTALL) -p -m 0644 ${mipsbuilddir64}/lib/libext2fs.a \
410 ${debdir}/e2fslibs-dev/usr/lib/lib64ext2fs-nopic.a
411endif
Theodore Ts'oe5b16432002-08-17 21:11:29 -0400412
Theodore Ts'o62775dc2003-05-08 10:39:50 -0400413install-udeb: DH_OPTIONS=
414install-udeb: build
Theodore Ts'o79786212001-06-22 23:05:23 -0400415 dh_testdir
416 dh_testroot
Theodore Ts'o79786212001-06-22 23:05:23 -0400417
Theodore Ts'oc1986ec2012-06-13 15:29:13 -0400418 $(MAKE) -C ${bfbuilddir} V=1 install-shlibs-libs-recursive DESTDIR=${udebdir} \
Theodore Ts'o79786212001-06-22 23:05:23 -0400419 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
Theodore Ts'oc1986ec2012-06-13 15:29:13 -0400420 $(MAKE) -C ${bfbuilddir}/e2fsck V=1 install DESTDIR=${udebdir} \
Theodore Ts'o62775dc2003-05-08 10:39:50 -0400421 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
Theodore Ts'oc1986ec2012-06-13 15:29:13 -0400422 $(MAKE) -C ${bfbuilddir}/misc V=1 install DESTDIR=${udebdir} \
Theodore Ts'o62775dc2003-05-08 10:39:50 -0400423 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
Theodore Ts'oc1986ec2012-06-13 15:29:13 -0400424 $(MAKE) -C ${bfbuilddir}/resize V=1 install DESTDIR=${udebdir} \
Theodore Ts'o8a8a12c2005-12-10 22:56:21 -0500425 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
Theodore Ts'o79786212001-06-22 23:05:23 -0400426
Theodore Ts'o62775dc2003-05-08 10:39:50 -0400427 rm -rf ${udebdir}/usr
Theodore Ts'oe3075ae2003-07-12 16:28:09 -0400428 find ${udebdir}/sbin -type f -a ! -name e2fsck \
Theodore Ts'o8a8a12c2005-12-10 22:56:21 -0500429 -a ! -name mke2fs -a ! -name tune2fs \
430 -a ! -name resize2fs -a ! -name badblocks -print | xargs rm
Theodore Ts'oe3075ae2003-07-12 16:28:09 -0400431
Theodore Ts'obe241782012-03-26 21:41:47 -0700432 (cd ${udebdir}/sbin; ln -sf e2fsck fsck.ext2 ; \
433 ln -sf e2fsck fsck.ext3 ; ln -sf e2fsck fsck.ext4 ; \
434 ln -sf mke2fs mkfs.ext2 ; ln -sf mke2fs mkfs.ext3 ; \
435 ln -sf mke2fs mkfs.ext4)
Theodore Ts'o2a4c77b2002-09-24 01:30:00 -0400436
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400437ifneq ($(UTIL_LINUX_NG),yes)
Theodore Ts'o417781a2003-04-10 00:18:56 -0400438 mkdir -p ${blkidudebdir}/lib
439 mv ${udebdir}/lib/libblkid.* ${blkidudebdir}/lib
Theodore Ts'o79786212001-06-22 23:05:23 -0400440
Theodore Ts'oe254d052003-12-07 01:57:04 -0500441 mkdir -p ${uuidudebdir}/lib
442 mv ${udebdir}/lib/libuuid.* ${uuidudebdir}/lib
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400443endif
Theodore Ts'oe254d052003-12-07 01:57:04 -0500444
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000445binary-indep:
446 # no arch-independant debs.
447
448binary-arch: DH_OPTIONS= -a
Theodore Ts'odd198d62002-10-31 03:44:35 -0500449binary-arch: install install-udeb
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000450 dh_testdir
451 dh_testroot
452
Theodore Ts'o541d1732002-02-23 21:23:26 -0500453 # lintian overrides
454 for i in $$(cd debian && echo *.lintian-overrides); do \
455 pkg=$${i%.lintian-overrides} ;\
Theodore Ts'o636019e2011-10-01 00:08:12 -0400456 if test "$${pkg}" != source ; then \
457 $(INSTALL) -m 0644 -D -p debian/$$i ${debdir}/$${pkg}/usr/share/lintian/overrides/$${pkg} ;\
458 fi ;\
Theodore Ts'o541d1732002-02-23 21:23:26 -0500459 done
Theodore Ts'o79786212001-06-22 23:05:23 -0400460
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000461 # symlinks to prepare dh_installdocs run
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000462
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400463ifneq ($(UTIL_LINUX_NG),yes)
Theodore Ts'o6fe7d112003-03-16 19:58:25 -0500464 mkdir -p ${debdir}/libblkid${BLKID_SOVERSION}/usr/share/doc/libblkid${BLKID_SOVERSION}
465 mkdir -p ${debdir}/libblkid-dev/usr/share/doc
466 ln -sf libblkid${BLKID_SOVERSION} ${debdir}/libblkid-dev/usr/share/doc/libblkid-dev
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400467endif
Theodore Ts'o6fe7d112003-03-16 19:58:25 -0500468
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400469 mkdir -p ${debdir}/libss${SS_SOVERSION}/usr/share/doc/libss${SS_SOVERSION}
470 mkdir -p ${debdir}/ss-dev/usr/share/doc
471 ln -sf libss${SS_SOVERSION} ${debdir}/ss-dev/usr/share/doc/ss-dev
472
473 mkdir -p ${debdir}/libcomerr${COMERR_SOVERSION}/usr/share/doc/libcomerr${COMERR_SOVERSION}
474 mkdir -p ${debdir}/comerr-dev/usr/share/doc
475 ln -sf libcomerr${COMERR_SOVERSION} ${debdir}/comerr-dev/usr/share/doc/comerr-dev
476
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400477ifneq ($(UTIL_LINUX_NG),yes)
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400478 mkdir -p ${debdir}/libuuid${UUID_SOVERSION}/usr/share/doc/libuuid${UUID_SOVERSION}
479 mkdir -p ${debdir}/uuid-dev/usr/share/doc
Theodore Ts'oec3bb412006-10-04 09:12:35 -0400480# ln -sf libuuid${UUID_SOVERSION} ${debdir}/uuid-dev/usr/share/doc/uuid-dev
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400481endif
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400482
483 mkdir -p ${debdir}/e2fslibs/usr/share/doc/e2fslibs
484 mkdir -p ${debdir}/e2fslibs-dev/usr/share/doc
485 ln -sf e2fslibs ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000486
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400487ifneq ($(UTIL_LINUX_NG),yes)
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500488 $(INSTALL) -p -m 0644 debian/libblkid.copyright \
Theodore Ts'o6fe7d112003-03-16 19:58:25 -0500489 ${debdir}/libblkid${BLKID_SOVERSION}/usr/share/doc/libblkid${BLKID_SOVERSION}/copyright
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400490endif
Theodore Ts'o6fe7d112003-03-16 19:58:25 -0500491
Theodore Ts'oe254d052003-12-07 01:57:04 -0500492 dh_installdocs -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000493
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000494 # HTML docs
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500495 $(INSTALL) -d ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs/html-info/
Theodore Ts'o4534f8b2009-11-29 20:19:10 -0500496 $(INSTALL) -p -m 0644 ${stdbuilddir}/doc/*.html \
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400497 ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs/html-info/
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500498 $(INSTALL) -d ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/html-info/
Theodore Ts'o4534f8b2009-11-29 20:19:10 -0500499 $(INSTALL) -p -m 0644 ${stdbuilddir}/lib/et/*.html \
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400500 ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/html-info/
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000501
502 # texinfo docs
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400503 mkdir -p ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500504 $(INSTALL) -p -m 0644 ${topdir}/doc/libext2fs.texinfo \
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400505 ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs/libext2fs.texi
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500506 $(INSTALL) -p -m 0644 ${topdir}/lib/et/com_err.texinfo \
Theodore Ts'oe5b16432002-08-17 21:11:29 -0400507 ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/com_err.texi
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000508
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500509 $(INSTALL) -d ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/examples
510 $(INSTALL) -p -m 0644 lib/ss/ss_err.et \
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400511 ${stdbuilddir}/lib/ext2fs/ext2_err.et \
512 ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/examples
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500513 $(INSTALL) -d ${debdir}/ss-dev/usr/share/doc/libss${SS_SOVERSION}/examples
514 $(INSTALL) -p -m 0644 debugfs/debug_cmds.ct \
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400515 ${debdir}/ss-dev/usr/share/doc/libss${SS_SOVERSION}/examples
516
Theodore Ts'o541d1732002-02-23 21:23:26 -0500517 dh_installinfo -pcomerr-dev ${stdbuilddir}/lib/et/com_err.info
Theodore Ts'o79786212001-06-22 23:05:23 -0400518 dh_installinfo -pe2fslibs-dev ${stdbuilddir}/doc/libext2fs.info
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000519
Theodore Ts'oec3bb412006-10-04 09:12:35 -0400520 DH_OPTIONS= dh_installchangelogs -pe2fsprogs \
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400521 -plibcomerr${COMERR_SOVERSION} \
522 -plibss${SS_SOVERSION} \
523 -pe2fslibs -pe2fsck-static \
524 -pe2fsprogs-dbg -pe2fslibs-dbg \
525 -plibcomerr2-dbg -plibss2-dbg
526ifneq ($(UTIL_LINUX_NG),yes)
527 DH_OPTIONS= dh_installchangelogs -plibuuid${UUID_SOVERSION} \
Theodore Ts'o1be2ce02009-09-01 20:27:29 -0400528 -puuid-dev -puuid-runtime -puuid-runtime-dbg -plibuuid1-dbg \
529 -plibblkid${BLKID_SOVERSION} -plibblkid1-dbg
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400530endif
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000531
Theodore Ts'oa3f464f2007-07-04 14:51:18 -0400532 dh_fixperms
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500533ifneq ($(ismips),)
Theodore Ts'o30f142e2008-07-15 11:38:33 -0400534 dh_strip -k -Xlib64ext2fs-nopic.a
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500535else
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400536 dh_strip -k
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500537endif
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000538
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400539 # debug package stuff
540 rm -rf ${udebdir}/usr
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400541ifneq ($(UTIL_LINUX_NG),yes)
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400542 rm -rf ${blkidudebdir}/usr
543 rm -rf ${uuidudebdir}/usr
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400544endif
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400545
Theodore Ts'o20d79492011-09-25 15:40:24 -0400546ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400547 mkdir -p ${debugdir}/$(USRLIB)
548 mv ${maindir}/usr/lib/debug ${debugdir}/$(USRLIB)
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400549 rm -rf ${maindir}/usr/lib/debug
550 mv ${e2fsckstaticdir}/usr/lib/debug/sbin/* \
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400551 ${debugdir}/$(USRLIB)/debug
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400552 rm -rf ${e2fsckstaticdir}/usr/lib
553
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400554ifneq ($(UTIL_LINUX_NG),yes)
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400555 mkdir -p ${uuidruntimedbgdir}/$(USRLIB)
556 mv ${uuidruntimedir}/usr/lib/debug ${uuidruntimedbgdir}/$(USRLIB)
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400557 rmdir ${uuidruntimedir}/usr/lib
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400558endif
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400559
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400560 mkdir -p ${libext2dbgdir}/$(USRLIB)
561 mv ${libext2dir}/usr/lib/debug ${libext2dbgdir}/$(USRLIB)
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400562 rmdir ${libext2dir}/usr/lib
563
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400564 mkdir -p ${libcomerrdbgdir}/$(USRLIB)
565 mv ${libcomerrdir}/usr/lib/debug ${libcomerrdbgdir}/$(USRLIB)
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400566 rmdir ${libcomerrdir}/usr/lib
567
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400568 mkdir -p ${libssdbgdir}/$(USRLIB)
569 mv ${libssdir}/usr/lib/debug ${libssdbgdir}/$(USRLIB)
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400570 rmdir ${libssdir}/usr/lib
571
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400572ifneq ($(UTIL_LINUX_NG),yes)
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400573 mkdir -p ${libuuiddbgdir}/$(USRLIB)
574 mv ${libuuiddir}/usr/lib/debug ${libuuiddbgdir}/$(USRLIB)
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400575 rmdir ${libuuiddir}/usr/lib
576
Theodore Ts'o55e00a22011-09-18 23:53:23 -0400577 mkdir -p ${libblkiddbgdir}/$(USRLIB)
578 mv ${libblkiddir}/usr/lib/debug ${libblkiddbgdir}/$(USRLIB)
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400579 rmdir ${libblkiddir}/usr/lib
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400580endif
Theodore Ts'o20d79492011-09-25 15:40:24 -0400581endif
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400582
Theodore Ts'o649bd282008-08-25 00:00:35 -0400583 # dpkg symbol handling
584ifneq (,$(findstring update-symbols,$(DEB_BUILD_OPTIONS)))
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400585SYMBOL_LIBS := e2fslibs libcomerr2 libss2
586ifneq ($(UTIL_LINUX_NG),yes)
587SYMBOL_LIBS += libblkid1 libuuid1
588endif
589 for i in $(SYMBOL_LIBS); \
Theodore Ts'o649bd282008-08-25 00:00:35 -0400590 do \
591 echo "Generating symbols for $$i..."; \
592 dpkg-gensymbols -p$$i -Pdebian/$$i > debian/$$i.tmp-patch; \
593 cat debian/$$i.tmp-patch; \
594 patch debian/$$i.symbols < debian/$$i.tmp-patch; \
595 /bin/rm debian/$$i.tmp-patch; \
596 done
597endif
598
Theodore Ts'o3c643f82011-09-25 01:20:41 -0400599 for i in e2fsprogs e2fsprogs-dbg e2fslibs e2fslibs-dbg; do \
600 $(INSTALL) -p -m 0644 debian/copyright \
601 ${debdir}/$$i/usr/share/doc/$$i/copyright; \
602 done
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400603
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400604ifneq ($(UTIL_LINUX_NG),yes)
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400605 $(INSTALL) -p -m 0644 debian/uuid-runtime.copyright \
606 ${uuidruntimedbgdir}/usr/share/doc/uuid-runtime-dbg/copyright
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400607endif
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400608
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400609 $(INSTALL) -p -m 0644 debian/libcomerr2.copyright \
610 ${libcomerrdbgdir}/usr/share/doc/libcomerr2-dbg/copyright
611
612 $(INSTALL) -p -m 0644 debian/libss2.copyright \
613 ${libssdbgdir}/usr/share/doc/libss2-dbg/copyright
614
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400615ifneq ($(UTIL_LINUX_NG),yes)
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400616 $(INSTALL) -p -m 0644 debian/libblkid.copyright \
617 ${libblkiddbgdir}/usr/share/doc/libblkid1-dbg/copyright
618
619 $(INSTALL) -p -m 0644 debian/libuuid1.copyright \
620 ${libuuiddbgdir}/usr/share/doc/libuuid1-dbg/copyright
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400621endif
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400622
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000623 dh_compress
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000624
Theodore Ts'oe254d052003-12-07 01:57:04 -0500625 dh_makeshlibs -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
Theodore Ts'oddad0382012-03-27 11:48:18 -0700626 dh_makeshlibs --add-udeb=e2fsprogs-udeb -plibcomerr${COMERR_SOVERSION} \
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400627 -V 'libcomerr2 (>= 1.33-3)'
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400628ifneq ($(UTIL_LINUX_NG),yes)
Theodore Ts'oa1788522007-03-04 08:17:18 -0500629 dh_makeshlibs -plibblkid${BLKID_SOVERSION} -V 'libblkid1 (>= 1.39-1)'
Theodore Ts'o7512f132006-03-29 19:03:38 -0500630 echo "udeb: libblkid 1 libblkid1-udeb" >> \
631 debian/libblkid1/DEBIAN/shlibs
632 echo "udeb: libuuid 1 libuuid1-udeb" >> debian/libuuid1/DEBIAN/shlibs
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400633endif
Theodore Ts'o6fe7d112003-03-16 19:58:25 -0500634
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000635 dh_installdeb
Theodore Ts'o79786212001-06-22 23:05:23 -0400636 dh_shlibdeps -l${stdbuilddir}/lib
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400637 dh_shlibdeps -pe2fsprogs -l${stdbuilddir}/lib \
638 -u"-Ldebian/e2fsprogs.shlibs.local"
Theodore Ts'o7a15db22003-07-29 22:15:33 -0400639 dh_shlibdeps -pe2fsprogs-udeb -l${stdbuilddir}/lib \
640 -u"-Ldebian/e2fsprogs-udeb.shlibs.local"
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000641
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400642 dh_gencontrol -Ncomerr-dev -Nss-dev -Nuuid-dev \
Theodore Ts'oe254d052003-12-07 01:57:04 -0500643 -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000644 DH_OPTIONS= dh_gencontrol -pcomerr-dev \
Theodore Ts'od8a1a672008-01-30 07:20:54 -0500645 -u '-v${COMERR_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}'
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000646 DH_OPTIONS= dh_gencontrol -pss-dev \
Theodore Ts'od8a1a672008-01-30 07:20:54 -0500647 -u '-v${SS_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}'
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400648ifneq ($(UTIL_LINUX_NG),yes)
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000649 DH_OPTIONS= dh_gencontrol -puuid-dev \
Theodore Ts'od8a1a672008-01-30 07:20:54 -0500650 -u '-v${UUID_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}'
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400651endif
Theodore Ts'obf5498c2008-09-04 22:49:15 -0400652 dh_gencontrol -pe2fsprogs-udeb -- -fdebian/files~
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400653ifneq ($(UTIL_LINUX_NG),yes)
Theodore Ts'obf5498c2008-09-04 22:49:15 -0400654 dh_gencontrol -plibblkid1-udeb -- -fdebian/files~
655 dh_gencontrol -plibuuid1-udeb -- -fdebian/files~
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400656endif
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000657
Theodore Ts'obf5498c2008-09-04 22:49:15 -0400658 dpkg-distaddfile $(UDEB_NAME) debian-installer $(UDEB_PRIORITY)
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400659ifneq ($(UTIL_LINUX_NG),yes)
Theodore Ts'obf5498c2008-09-04 22:49:15 -0400660 dpkg-distaddfile $(BLKID_UDEB_NAME) debian-installer $(BLKID_UDEB_PRIORITY)
661 dpkg-distaddfile $(UUID_UDEB_NAME) debian-installer $(UUID_UDEB_PRIORITY)
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400662endif
Theodore Ts'oe254d052003-12-07 01:57:04 -0500663 dh_md5sums -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
664 dh_builddeb -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
Theodore Ts'odd198d62002-10-31 03:44:35 -0500665 dh_builddeb -pe2fsprogs-udeb --filename=$(UDEB_NAME)
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400666ifneq ($(UTIL_LINUX_NG),yes)
Theodore Ts'o417781a2003-04-10 00:18:56 -0400667 dh_builddeb -plibblkid1-udeb --filename=$(BLKID_UDEB_NAME)
Theodore Ts'oe254d052003-12-07 01:57:04 -0500668 dh_builddeb -plibuuid1-udeb --filename=$(UUID_UDEB_NAME)
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400669endif
Theodore Ts'oe254d052003-12-07 01:57:04 -0500670
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000671binary: binary-indep binary-arch
672
Theodore Ts'o910fae92012-02-15 18:29:37 -0500673.PHONY: binary binary-arch binary-indep clean checkroot mrproper \
674 debug_flags debian-files
675
676debug_flags:
677 @echo CFLAGS is $(CFLAGS)
678 @echo LDFLAGS is $(LDFLAGS)
679 @echo CPPFLAGS is $(CPPFLAGS)