1 #! /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 10 -include debian/rules.custom 11 12 # be paranoid 13 export LC_ALL ?= C 14 15 # These are used for cross-compiling and for saving the configure script 16 # from having to guess our platform (since we know it already) 17 DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) 18 DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH) 19 DEB_HOST_OS ?= $(shell dpkg-architecture -qDEB_HOST_OS) 20 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) 21 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) 22 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null) 23 24 # Allow distro-specific behaviour 25 DISTRO :=$(shell sed -ne '/DISTRIB_ID/s/.*=//p' /etc/lsb-release 2>/dev/null || echo Debian) 26 SYS_BLKID_VER := $(shell dpkg-query -W libblkid1:$(DEB_HOST_ARCH) | cut -f 2 | cut -b 1) 27 ifeq ($(SYS_BLKID_VER),2) 28 UTIL_LINUX_NG ?= yes 29 endif 30 31 # find the version for the main package, from changelog file 32 MAIN_VERSION = $(shell head -n 1 debian/changelog | cut '-d ' -f 2 | sed 's/[()]//g') 33 # find versions for libraries going into their own packages, from their Makefile.in's, 34 # and sonames for all libs 35 COMERR_VERSION ?= $(shell grep ELF_VERSION lib/et/Makefile.in | cut '-d ' -f3) 36 COMERR_SOVERSION ?= $(shell grep ELF_SO_VERSION lib/et/Makefile.in | cut '-d ' -f3) 37 SS_VERSION ?= $(shell grep ELF_VERSION lib/ss/Makefile.in | cut '-d ' -f3) 38 SS_SOVERSION ?= $(shell grep ELF_SO_VERSION lib/ss/Makefile.in | cut '-d ' -f3) 39 40 ifneq ($(UTIL_LINUX_NG),yes) 41 UUID_VERSION ?= $(shell grep ELF_VERSION lib/uuid/Makefile.in | cut '-d ' -f3) 42 UUID_SOVERSION ?= $(shell grep ELF_SO_VERSION lib/uuid/Makefile.in | cut '-d ' -f3) 43 44 BLKID_VERSION ?= $(shell grep ELF_VERSION lib/blkid/Makefile.in | cut '-d ' -f3) 45 BLKID_SOVERSION ?= $(shell grep ELF_SO_VERSION lib/blkid/Makefile.in | cut '-d ' -f3) 46 endif 47 48 EXT2FS_SOVERSION ?= $(shell grep ELF_SO_VERSION lib/ext2fs/Makefile.in | cut '-d ' -f3) 49 E2P_SOVERSION ?= $(shell grep ELF_SO_VERSION lib/e2p/Makefile.in | cut '-d ' -f3) 50 51 package ?= e2fsprogs 52 53 topdir ?= $(shell pwd) 54 debdir ?= ${topdir}/debian 55 tmpdir ?= ${debdir}/tmp 56 udebdir ?= ${debdir}/e2fsprogs-udeb 57 ifneq ($(UTIL_LINUX_NG),yes) 58 blkidudebdir ?= ${debdir}/libblkid1-udeb 59 uuidudebdir ?= ${debdir}/libuuid1-udeb 60 endif 61 libcomerrdir ?= ${debdir}/libcomerr${COMERR_SOVERSION} 62 comerrdevdir ?= ${debdir}/comerr-dev 63 libcomerrdbgdir ?= ${debdir}/libcomerr2-dbg 64 libssdir ?= ${debdir}/libss${SS_SOVERSION} 65 ssdevdir ?= ${debdir}/ss-dev 66 libssdbgdir ?= ${debdir}/libss2-dbg 67 ifneq ($(UTIL_LINUX_NG),yes) 68 libblkiddir ?= ${debdir}/libblkid${BLKID_SOVERSION} 69 libblkiddevdir ?= ${debdir}/libblkid-dev 70 libblkiddbgdir ?= ${debdir}/libblkid1-dbg 71 libuuiddir ?= ${debdir}/libuuid${UUID_SOVERSION} 72 uuiddevdir ?= ${debdir}/uuid-dev 73 libuuiddbgdir ?= ${debdir}/libuuid1-dbg 74 uuidruntimedir ?= ${debdir}/uuid-runtime 75 uuidruntimedbgdir ?= ${debdir}/uuid-runtime-dbg 76 endif 77 libext2dir ?= ${debdir}/e2fslibs 78 libext2devdir ?= ${debdir}/e2fslibs-dev 79 libext2dbgdir ?= ${debdir}/e2fslibs-dbg 80 maindir ?= ${debdir}/e2fsprogs 81 e2fsckstaticdir ?= ${debdir}/e2fsck-static 82 debugdir ?= ${debdir}/e2fsprogs-dbg 83 stdbuilddir ?= ${debdir}/BUILD-STD 84 staticbuilddir ?= ${debdir}/BUILD-STATIC 85 mipsbuilddir ?= ${debdir}/BUILD-MIPS 86 mipsbuilddir64 ?= ${debdir}/BUILD-MIPS-64 87 # docdir ?= ${maindir}/usr/share/doc/${package} 88 MANDIR ?= /usr/share/man 89 mandir ?= ${tmpdir}${MANDIR} 90 91 UDEB_NAME ?= $(package)-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb 92 UDEB_PRIORITY ?= $(shell grep '^Package: e2fsprogs-udeb' debian/control.in -A 10 | grep ^Priority: | cut -d ' ' -f 2) 93 94 ifneq ($(UTIL_LINUX_NG),yes) 95 BLKID_UDEB_NAME ?= libblkid1-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb 96 BLKID_UDEB_PRIORITY ?= $(shell grep '^Package: libblkid1-udeb' debian/control.in -A 10 | grep ^Priority: | cut -d ' ' -f 2) 97 98 UUID_UDEB_NAME ?= libuuid1-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb 99 UUID_UDEB_PRIORITY ?= $(shell grep '^Package: libuuid1-udeb' debian/control.in -A 10 | grep ^Priority: | cut -d ' ' -f 2) 100 endif 101 102 STAMPSDIR ?= debian/stampdir 103 CFGSTDSTAMP ?= ${STAMPSDIR}/configure-std-stamp 104 CFGBFSTAMP ?= ${STAMPSDIR}/configure-bf-stamp 105 CFGSTATICSTAMP ?= ${STAMPSDIR}/configure-static-stamp 106 BUILDSTDSTAMP ?= ${STAMPSDIR}/build-std-stamp 107 BUILDBFSTAMP ?= ${STAMPSDIR}/build-bf-stamp 108 BUILDSTATICSTAMP ?=${STAMPSDIR}/build-static-stamp 109 110 INSTALL ?= install 111 INSTALL_PROGRAM ?= $(INSTALL) -p -o root -g root -m 0755 112 113 #ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) 114 #INSTALL_PROGRAM += -s 115 #endif 116 117 DEFAULT_CFLAGS ?= -g -O2 118 DEFAULT_LDFLAGS ?= -Wl,-Bsymbolic-functions 119 120 CFLAGS ?= $(shell if dpkg-buildflags > /dev/null 2>&1 ; then \ 121 dpkg-buildflags --get CFLAGS; else echo $(DEFAULT_CFLAGS) ; fi) 122 LDFLAGS ?= $(shell if dpkg-buildflags > /dev/null 2>&1 ; then \ 123 dpkg-buildflags --get LDFLAGS; else echo $(DEFAULT_LDFLAGS) ; fi) 124 CPPFLAGS ?= $(shell if dpkg-buildflags > /dev/null 2>&1 ; then \ 125 dpkg-buildflags --get CPPFLAGS; fi) 126 127 ifeq (${DEB_HOST_ARCH},alpha) 128 CFLAGS += -DHAVE_NETINET_IN_H 129 else 130 CFLAGS += -D__NO_STRING_INLINES 131 endif 132 133 ifneq (${DEB_HOST_ARCH_OS},linux) 134 SKIP_STATIC = yes 135 endif 136 137 ifeq ($(SKIP_STATIC),yes) 138 BUILD_STATIC = 139 E2FSCK_STATIC = ${stdbuilddir}/e2fsck/e2fsck.static 140 else 141 BUILD_STATIC = build-static 142 E2FSCK_STATIC = ${staticbuilddir}/e2fsck/e2fsck.static 143 endif 144 145 ifeq ($(SKIP_BF),yes) 146 BUILD_BF = 147 bfbuilddir ?= ${stdbuilddir} 148 else 149 BUILD_BF = build-bf 150 bfbuilddir ?= ${debdir}/BUILD-BF 151 endif 152 153 BF_CFLAGS = -Os -fomit-frame-pointer 154 155 COMMON_CONF_FLAGS = --disable-e2initrd-helper --enable-elf-shlibs \ 156 --enable-quota --infodir=/usr/share/info 157 ifeq ($(UTIL_LINUX_NG),yes) 158 COMMON_CONF_FLAGS += --disable-fsck --disable-libblkid \ 159 --disable-libuuid --disable-uuidd 160 else 161 COMMON_CONF_FLAGS += --enable-fsck 162 endif 163 164 ifneq ($(strip $(DEB_HOST_MULTIARCH)),) 165 MULTIARCH_CONF ?= --with-multiarch=$(DEB_HOST_MULTIARCH) 166 # 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) 169 USRLIB ?= /usr/lib 170 else 171 USRLIB ?= /usr/lib 172 endif 173 174 BACKTRACE_CONF_FLAGS ?= $(shell if ${debdir}/scripts/test-backtrace ; then echo --disable-backtrace ; fi) 175 176 STD_CONF_FLAGS ?= --enable-symlink-install $(MULTIARCH_CONF) $(BACKTRACE_CONF_FLAGS) 177 178 BF_CONF_FLAGS ?= --disable-nls --disable-imager --disable-testio-debug \ 179 --disable-uuidd --disable-tls --disable-debugfs 180 181 STATIC_CONF_FLAGS ?= --disable-nls --disable-imager \ 182 --disable-uuidd --disable-tls 183 184 MIPS_NOPIC_CONF_FLAGS ?= --disable-nls --disable-imager \ 185 --disable-uuidd --disable-tls \ 186 --disable-resizer # --disable-debugfs 187 188 # we can't use those flags at configure time 189 MIPS_CFLAGS ?= -G 0 -fno-pic -mno-abicalls 190 MIPS_CFLAGS_64 ?= -mabi=64 -G 0 -fno-pic -mno-abicalls 191 192 ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) 193 ifneq (,$(findstring $(DEB_BUILD_ARCH),mips mipsel)) 194 ismips=ismips 195 endif 196 endif 197 198 M4_ARGS= 199 ifeq ($(UTIL_LINUX_NG),yes) 200 M4_ARGS+=-DUTIL_LINUX_NG 201 else 202 M4_ARGS+=-UUTIL_LINUX_NG 203 endif 204 205 ifneq ($(strip $(DEB_HOST_MULTIARCH)),) 206 M4_ARGS+=-DDO_MULTIARCH 207 else 208 M4_ARGS+=-UDO_MULTIARCH 209 endif 210 211 ifneq ($(SKIP_DIETLIBC),) 212 M4_ARGS+=-UDIETLIBC 213 WITH_DIET_LIBC = 214 else 215 M4_ARGS+=-DDIETLIBC 216 WITH_DIET_LIBC = --with-diet-libc 217 endif 218 219 ifneq ($(BUILD_E2FSCK_STATIC),no) 220 M4_ARGS+=-DE2FSCK_STATIC 221 else 222 M4_ARGS+=-UE2FSCK_STATIC 223 endif 224 225 FILES_FIXUP= libcomerr2.files comerr-dev.files libss2.files ss-dev.files \ 226 libuuid1.files uuid-dev.files libblkid1.files libblkid-dev.files \ 227 e2fslibs.files e2fslibs-dev.files 228 229 debian-files: debian/control debian/e2fsprogs.shlibs.local 230 ifeq ($(strip $(DEB_HOST_MULTIARCH)),) 231 for i in $(FILES_FIXUP); do \ 232 sed -e 's;lib/\*/;lib/;' debian/$$i.in > debian/$$i; \ 233 done 234 else 235 for i in $(FILES_FIXUP); do cp debian/$$i.in debian/$$i; done 236 endif 237 238 mrproper: clean 239 rm debian/control debian/e2fsprogs.shlibs.local 240 241 debian/control: debian/control.in debian/rules 242 m4 $(M4_ARGS) < debian/control.in | grep -v ^REMOVE_ME$$ > $@ 243 244 debian/e2fsprogs.shlibs.local: debian/e2fsprogs.shlibs.local.in 245 m4 $(M4_ARGS) < debian/e2fsprogs.shlibs.local.in > $@ 246 247 ${CFGSTDSTAMP}: 248 dh_testdir 249 250 # Make sure we don't try to rebuild the configure scripts 251 find . -name configure | xargs touch 252 253 mkdir -p ${stdbuilddir} 254 ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) 255 cd ${stdbuilddir} && AWK=/usr/bin/awk \ 256 ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} ${EXTRA_CONF_FLAGS} \ 257 CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" 258 else 259 cd ${stdbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \ 260 ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} ${EXTRA_CONF_FLAGS} \ 261 --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \ 262 CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" 263 endif 264 265 # specially-built MIPS libs 266 ifneq ($(ismips),) 267 mkdir -p ${mipsbuilddir} ${mipsbuilddir64} 268 cd ${mipsbuilddir} && AWK=/usr/bin/awk \ 269 ${topdir}/configure ${MIPS_NOPIC_CONF_FLAGS} \ 270 CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" 271 cd ${mipsbuilddir64} && AWK=/usr/bin/awk \ 272 ${topdir}/configure ${MIPS_NOPIC_CONF_FLAGS} \ 273 CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" 274 endif 275 276 mkdir -p ${STAMPSDIR} 277 touch ${CFGSTDSTAMP} 278 279 ${CFGBFSTAMP}: 280 dh_testdir 281 rm -f config.cache 282 283 mkdir -p ${bfbuilddir} 284 ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) 285 cd ${bfbuilddir} && AWK=/usr/bin/awk \ 286 ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} ${EXTRA_CONF_FLAGS} \ 287 CFLAGS="${CFLAGS} ${BF_CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" 288 else 289 cd ${bfbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \ 290 ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} ${EXTRA_CONF_FLAGS} \ 291 --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \ 292 CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" 293 endif 294 mkdir -p ${STAMPSDIR} 295 touch ${CFGBFSTAMP} 296 297 ${CFGSTATICSTAMP}: 298 dh_testdir 299 rm -f config.cache 300 301 mkdir -p ${staticbuilddir} 302 ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) 303 if type diet > /dev/null 2>&1 ; then \ 304 cd ${staticbuilddir} && AWK=/usr/bin/awk \ 305 ${topdir}/configure ${STATIC_CONF_FLAGS} ${EXTRA_CONF_FLAGS} \ 306 ${WITH_DIET_LIBC} CFLAGS="${CFLAGS}" \ 307 CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"; \ 308 else \ 309 cd ${staticbuilddir} && AWK=/usr/bin/awk \ 310 ${topdir}/configure ${STATIC_CONF_FLAGS} ${EXTRA_CONF_FLAGS} \ 311 CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" \ 312 LDFLAGS="$(LDFLAGS)"; \ 313 fi 314 else 315 cd ${staticbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \ 316 ${topdir}/configure ${COMMON_CONF_FLAGS} ${STATIC_CONF_FLAGS} ${EXTRA_CONF_FLAGS} \ 317 --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \ 318 CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" 319 endif 320 mkdir -p ${STAMPSDIR} 321 touch ${CFGSTATICSTAMP} 322 323 build-arch: build 324 build-indep: build 325 build: build-std $(BUILD_BF) $(BUILD_STATIC) 326 327 build-std: ${BUILDSTDSTAMP} 328 ${BUILDSTDSTAMP}: ${CFGSTDSTAMP} 329 dh_testdir 330 $(MAKE) -C ${stdbuilddir} V=1 all 331 ifneq ($(BUILD_E2FSCK_STATIC),no) 332 $(MAKE) -C ${stdbuilddir}/e2fsck V=1 e2fsck.static 333 endif 334 $(MAKE) -C ${stdbuilddir}/po V=1 update-gmo 335 336 ( cd ${stdbuilddir}/doc && $(MAKE) V=1 libext2fs.html ) 337 ( cd ${stdbuilddir}/lib/et && $(MAKE) V=1 com_err.info com_err.html ) 338 339 # specially-built MIPS libs 340 ifneq ($(ismips),) 341 $(MAKE) -C ${mipsbuilddir}/util V=1 342 $(MAKE) -C ${mipsbuilddir} V=1 \ 343 CFLAGS="${CFLAGS} ${MIPS_CFLAGS}" \ 344 LIB_SUBDIRS="lib/et lib/ext2fs" libs 345 $(MAKE) -C ${mipsbuilddir64}/util V=1 346 $(MAKE) -C ${mipsbuilddir64} V=1 \ 347 CFLAGS="${CFLAGS} ${MIPS_CFLAGS_64}" \ 348 LIB_SUBDIRS="lib/et lib/ext2fs" libs 349 endif 350 351 touch ${BUILDSTDSTAMP} 352 353 build-bf: ${BUILDBFSTAMP} 354 ${BUILDBFSTAMP}: ${CFGBFSTAMP} 355 dh_testdir 356 $(MAKE) -C ${bfbuilddir} V=1 libs 357 $(MAKE) -C ${bfbuilddir}/e2fsck V=1 all 358 $(MAKE) -C ${bfbuilddir}/misc V=1 all 359 $(MAKE) -C ${bfbuilddir}/resize V=1 all 360 touch ${BUILDBFSTAMP} 361 362 build-static: ${BUILDSTATICSTAMP} 363 ${BUILDSTATICSTAMP}: ${CFGSTATICSTAMP} 364 dh_testdir 365 $(MAKE) -C ${staticbuilddir} V=1 libs 366 ifneq ($(BUILD_E2FSCK_STATIC),no) 367 $(MAKE) -C ${staticbuilddir}/e2fsck V=1 all e2fsck.static 368 endif 369 touch ${BUILDSTATICSTAMP} 370 371 clean: 372 dh_testdir 373 rm -rf ${STAMPSDIR} 374 [ ! -f ${stdbuilddir}/Makefile ] || $(MAKE) -C ${stdbuilddir} V=1 distclean 375 [ ! -f ${bfbuilddir}/Makefile ] || $(MAKE) -C ${bfbuilddir} V=1 distclean 376 [ ! -f ${staticbuilddir}/Makefile ] || $(MAKE) -C ${staticbuilddir} V=1 distclean 377 rm -rf ${stdbuilddir} ${bfbuilddir} ${staticbuilddir} ${mipsbuilddir} ${mipsbuilddir64} 378 rm -f debian/*.substvars 379 dh_clean 380 381 install: cleanup install-std 382 383 # This rule allows to factorize the dh_clean between the 2 install rules 384 # This must be launched before install-* (if launching them by hand, for 385 # exemple) or results are unpredictable 386 cleanup: 387 dh_testdir 388 dh_testroot 389 dh_prep 390 391 install-std: DH_OPTIONS= 392 install-std: build 393 dh_testdir 394 dh_testroot 395 dh_installdirs 396 397 mkdir -p ${tmpdir}/sbin 398 $(MAKE) -C ${stdbuilddir} V=1 install DESTDIR=${tmpdir} \ 399 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true 400 # static libs and .h files 401 $(MAKE) -C ${stdbuilddir} V=1 install-libs DESTDIR=${tmpdir} LDCONFIG=true 402 403 ifneq ($(BUILD_E2FSCK_STATIC),no) 404 # statically-linked fsck 405 ${INSTALL_PROGRAM} $(E2FSCK_STATIC) ${tmpdir}/sbin 406 cp ${mandir}/man8/e2fsck.8 ${mandir}/man8/e2fsck.static.8 407 endif 408 409 # remove static quota library for now 410 rm ${tmpdir}/usr/include/quota/mkquota.h 411 find ${tmpdir} -name quota.pc -o -name libquota.a | xargs rm 412 413 ifeq ($(DEB_BUILD_GNU_SYSTEM), gnu) 414 ${INSTALL} -m 0644 misc/mke2fs-hurd.conf ${tmpdir}/etc/mke2fs.conf 415 endif 416 417 dh_movefiles 418 test -z "`find ${tmpdir} -type f`" 419 420 # specially-built MIPS libs 421 ifneq ($(ismips),) 422 $(INSTALL) -p -m 0644 ${mipsbuilddir}/lib/libext2fs.a \ 423 ${debdir}/e2fslibs-dev/usr/lib/libext2fs-nopic.a 424 $(INSTALL) -p -m 0644 ${mipsbuilddir64}/lib/libext2fs.a \ 425 ${debdir}/e2fslibs-dev/usr/lib/lib64ext2fs-nopic.a 426 endif 427 428 install-udeb: DH_OPTIONS= 429 install-udeb: build 430 dh_testdir 431 dh_testroot 432 433 $(MAKE) -C ${bfbuilddir} V=1 install-shlibs-libs-recursive DESTDIR=${udebdir} \ 434 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true 435 $(MAKE) -C ${bfbuilddir}/e2fsck V=1 install DESTDIR=${udebdir} \ 436 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true 437 $(MAKE) -C ${bfbuilddir}/misc V=1 install DESTDIR=${udebdir} \ 438 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true 439 $(MAKE) -C ${bfbuilddir}/resize V=1 install DESTDIR=${udebdir} \ 440 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true 441 442 rm -rf ${udebdir}/usr 443 find ${udebdir}/sbin -type f -a ! -name e2fsck \ 444 -a ! -name mke2fs -a ! -name tune2fs \ 445 -a ! -name resize2fs -a ! -name badblocks -print | xargs rm 446 447 (cd ${udebdir}/sbin; ln -sf e2fsck fsck.ext2 ; \ 448 ln -sf e2fsck fsck.ext3 ; ln -sf e2fsck fsck.ext4 ; \ 449 ln -sf mke2fs mkfs.ext2 ; ln -sf mke2fs mkfs.ext3 ; \ 450 ln -sf mke2fs mkfs.ext4) 451 452 ifneq ($(UTIL_LINUX_NG),yes) 453 mkdir -p ${blkidudebdir}/lib 454 mv ${udebdir}/lib/libblkid.* ${blkidudebdir}/lib 455 456 mkdir -p ${uuidudebdir}/lib 457 mv ${udebdir}/lib/libuuid.* ${uuidudebdir}/lib 458 endif 459 460 binary-indep: 461 # no arch-independant debs. 462 463 binary-arch: DH_OPTIONS= -a 464 binary-arch: install install-udeb 465 dh_testdir 466 dh_testroot 467 468 # lintian overrides 469 for i in $$(cd debian && echo *.lintian-overrides); do \ 470 pkg=$${i%.lintian-overrides} ;\ 471 if test "$${pkg}" != source ; then \ 472 $(INSTALL) -m 0644 -D -p debian/$$i ${debdir}/$${pkg}/usr/share/lintian/overrides/$${pkg} ;\ 473 fi ;\ 474 done 475 476 # symlinks to prepare dh_installdocs run 477 478 ifneq ($(UTIL_LINUX_NG),yes) 479 mkdir -p ${debdir}/libblkid${BLKID_SOVERSION}/usr/share/doc/libblkid${BLKID_SOVERSION} 480 mkdir -p ${debdir}/libblkid-dev/usr/share/doc 481 ln -sf libblkid${BLKID_SOVERSION} ${debdir}/libblkid-dev/usr/share/doc/libblkid-dev 482 endif 483 484 mkdir -p ${debdir}/libss${SS_SOVERSION}/usr/share/doc/libss${SS_SOVERSION} 485 mkdir -p ${debdir}/ss-dev/usr/share/doc 486 ln -sf libss${SS_SOVERSION} ${debdir}/ss-dev/usr/share/doc/ss-dev 487 488 mkdir -p ${debdir}/libcomerr${COMERR_SOVERSION}/usr/share/doc/libcomerr${COMERR_SOVERSION} 489 mkdir -p ${debdir}/comerr-dev/usr/share/doc 490 ln -sf libcomerr${COMERR_SOVERSION} ${debdir}/comerr-dev/usr/share/doc/comerr-dev 491 492 ifneq ($(UTIL_LINUX_NG),yes) 493 mkdir -p ${debdir}/libuuid${UUID_SOVERSION}/usr/share/doc/libuuid${UUID_SOVERSION} 494 mkdir -p ${debdir}/uuid-dev/usr/share/doc 495 # ln -sf libuuid${UUID_SOVERSION} ${debdir}/uuid-dev/usr/share/doc/uuid-dev 496 endif 497 498 mkdir -p ${debdir}/e2fslibs/usr/share/doc/e2fslibs 499 mkdir -p ${debdir}/e2fslibs-dev/usr/share/doc 500 ln -sf e2fslibs ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev 501 502 ifneq ($(UTIL_LINUX_NG),yes) 503 $(INSTALL) -p -m 0644 debian/libblkid.copyright \ 504 ${debdir}/libblkid${BLKID_SOVERSION}/usr/share/doc/libblkid${BLKID_SOVERSION}/copyright 505 endif 506 507 dh_installdocs -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb 508 509 # HTML docs 510 $(INSTALL) -d ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs/html-info/ 511 $(INSTALL) -p -m 0644 ${stdbuilddir}/doc/*.html \ 512 ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs/html-info/ 513 $(INSTALL) -d ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/html-info/ 514 $(INSTALL) -p -m 0644 ${stdbuilddir}/lib/et/*.html \ 515 ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/html-info/ 516 517 # texinfo docs 518 mkdir -p ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION} 519 $(INSTALL) -p -m 0644 ${topdir}/doc/libext2fs.texinfo \ 520 ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs/libext2fs.texi 521 $(INSTALL) -p -m 0644 ${topdir}/lib/et/com_err.texinfo \ 522 ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/com_err.texi 523 524 $(INSTALL) -d ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/examples 525 $(INSTALL) -p -m 0644 lib/ss/ss_err.et \ 526 ${stdbuilddir}/lib/ext2fs/ext2_err.et \ 527 ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/examples 528 $(INSTALL) -d ${debdir}/ss-dev/usr/share/doc/libss${SS_SOVERSION}/examples 529 $(INSTALL) -p -m 0644 debugfs/debug_cmds.ct \ 530 ${debdir}/ss-dev/usr/share/doc/libss${SS_SOVERSION}/examples 531 532 dh_installinfo -pcomerr-dev ${stdbuilddir}/lib/et/com_err.info 533 dh_installinfo -pe2fslibs-dev ${stdbuilddir}/doc/libext2fs.info 534 535 DH_OPTIONS= dh_installchangelogs -pe2fsprogs \ 536 -plibcomerr${COMERR_SOVERSION} \ 537 -plibss${SS_SOVERSION} \ 538 -pe2fslibs \ 539 -pe2fsprogs-dbg -pe2fslibs-dbg \ 540 -plibcomerr2-dbg -plibss2-dbg 541 ifneq ($(BUILD_E2FSCK_STATIC),no) 542 DH_OPTIONS= dh_installchangelogs -pe2fsck-static 543 endif 544 ifneq ($(UTIL_LINUX_NG),yes) 545 DH_OPTIONS= dh_installchangelogs -plibuuid${UUID_SOVERSION} \ 546 -puuid-dev -puuid-runtime -puuid-runtime-dbg -plibuuid1-dbg \ 547 -plibblkid${BLKID_SOVERSION} -plibblkid1-dbg 548 endif 549 550 dh_fixperms 551 ifneq ($(ismips),) 552 dh_strip -k -Xlib64ext2fs-nopic.a 553 else 554 dh_strip -k 555 endif 556 557 # debug package stuff 558 rm -rf ${udebdir}/usr 559 ifneq ($(UTIL_LINUX_NG),yes) 560 rm -rf ${blkidudebdir}/usr 561 rm -rf ${uuidudebdir}/usr 562 endif 563 564 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) 565 mkdir -p ${debugdir}/$(USRLIB) 566 mv ${maindir}/usr/lib/debug ${debugdir}/$(USRLIB) 567 rm -rf ${maindir}/usr/lib/debug 568 569 ifneq ($(BUILD_E2FSCK_STATIC),no) 570 mv ${e2fsckstaticdir}/usr/lib/debug/sbin/* \ 571 ${debugdir}/$(USRLIB)/debug 572 rm -rf ${e2fsckstaticdir}/usr/lib 573 endif 574 575 ifneq ($(UTIL_LINUX_NG),yes) 576 mkdir -p ${uuidruntimedbgdir}/$(USRLIB) 577 mv ${uuidruntimedir}/usr/lib/debug ${uuidruntimedbgdir}/$(USRLIB) 578 rmdir ${uuidruntimedir}/usr/lib 579 endif 580 581 mkdir -p ${libext2dbgdir}/$(USRLIB) 582 mv ${libext2dir}/usr/lib/debug ${libext2dbgdir}/$(USRLIB) 583 rmdir ${libext2dir}/usr/lib 584 585 mkdir -p ${libcomerrdbgdir}/$(USRLIB) 586 mv ${libcomerrdir}/usr/lib/debug ${libcomerrdbgdir}/$(USRLIB) 587 rmdir ${libcomerrdir}/usr/lib 588 589 mkdir -p ${libssdbgdir}/$(USRLIB) 590 mv ${libssdir}/usr/lib/debug ${libssdbgdir}/$(USRLIB) 591 rmdir ${libssdir}/usr/lib 592 593 ifneq ($(UTIL_LINUX_NG),yes) 594 mkdir -p ${libuuiddbgdir}/$(USRLIB) 595 mv ${libuuiddir}/usr/lib/debug ${libuuiddbgdir}/$(USRLIB) 596 rmdir ${libuuiddir}/usr/lib 597 598 mkdir -p ${libblkiddbgdir}/$(USRLIB) 599 mv ${libblkiddir}/usr/lib/debug ${libblkiddbgdir}/$(USRLIB) 600 rmdir ${libblkiddir}/usr/lib 601 endif 602 endif 603 604 # dpkg symbol handling 605 ifneq (,$(findstring update-symbols,$(DEB_BUILD_OPTIONS))) 606 SYMBOL_LIBS := e2fslibs libcomerr2 libss2 607 ifneq ($(UTIL_LINUX_NG),yes) 608 SYMBOL_LIBS += libblkid1 libuuid1 609 endif 610 for i in $(SYMBOL_LIBS); \ 611 do \ 612 echo "Generating symbols for $$i..."; \ 613 dpkg-gensymbols -p$$i -Pdebian/$$i > debian/$$i.tmp-patch; \ 614 cat debian/$$i.tmp-patch; \ 615 patch debian/$$i.symbols < debian/$$i.tmp-patch; \ 616 /bin/rm debian/$$i.tmp-patch; \ 617 done 618 endif 619 620 for i in e2fsprogs e2fsprogs-dbg e2fslibs e2fslibs-dbg; do \ 621 $(INSTALL) -p -m 0644 debian/copyright \ 622 ${debdir}/$$i/usr/share/doc/$$i/copyright; \ 623 done 624 625 ifneq ($(UTIL_LINUX_NG),yes) 626 $(INSTALL) -p -m 0644 debian/uuid-runtime.copyright \ 627 ${uuidruntimedbgdir}/usr/share/doc/uuid-runtime-dbg/copyright 628 endif 629 630 $(INSTALL) -p -m 0644 debian/libcomerr2.copyright \ 631 ${libcomerrdbgdir}/usr/share/doc/libcomerr2-dbg/copyright 632 633 $(INSTALL) -p -m 0644 debian/libss2.copyright \ 634 ${libssdbgdir}/usr/share/doc/libss2-dbg/copyright 635 636 ifneq ($(UTIL_LINUX_NG),yes) 637 $(INSTALL) -p -m 0644 debian/libblkid.copyright \ 638 ${libblkiddbgdir}/usr/share/doc/libblkid1-dbg/copyright 639 640 $(INSTALL) -p -m 0644 debian/libuuid1.copyright \ 641 ${libuuiddbgdir}/usr/share/doc/libuuid1-dbg/copyright 642 endif 643 644 dh_compress 645 646 dh_makeshlibs -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb 647 dh_makeshlibs --add-udeb=e2fsprogs-udeb -plibcomerr${COMERR_SOVERSION} \ 648 -V 'libcomerr2 (>= 1.33-3)' 649 ifneq ($(UTIL_LINUX_NG),yes) 650 dh_makeshlibs -plibblkid${BLKID_SOVERSION} -V 'libblkid1 (>= 1.39-1)' 651 echo "udeb: libblkid 1 libblkid1-udeb" >> \ 652 debian/libblkid1/DEBIAN/shlibs 653 echo "udeb: libuuid 1 libuuid1-udeb" >> debian/libuuid1/DEBIAN/shlibs 654 endif 655 656 dh_installdeb 657 dh_shlibdeps -l${stdbuilddir}/lib 658 dh_shlibdeps -pe2fsprogs -l${stdbuilddir}/lib \ 659 -u"-Ldebian/e2fsprogs.shlibs.local" 660 dh_shlibdeps -pe2fsprogs-udeb -l${stdbuilddir}/lib \ 661 -u"-Ldebian/e2fsprogs-udeb.shlibs.local" 662 663 dh_gencontrol -Ncomerr-dev -Nss-dev -Nuuid-dev \ 664 -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb 665 DH_OPTIONS= dh_gencontrol -pcomerr-dev \ 666 -u '-v${COMERR_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}' 667 DH_OPTIONS= dh_gencontrol -pss-dev \ 668 -u '-v${SS_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}' 669 ifneq ($(UTIL_LINUX_NG),yes) 670 DH_OPTIONS= dh_gencontrol -puuid-dev \ 671 -u '-v${UUID_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}' 672 endif 673 dh_gencontrol -pe2fsprogs-udeb -- -fdebian/files~ 674 ifneq ($(UTIL_LINUX_NG),yes) 675 dh_gencontrol -plibblkid1-udeb -- -fdebian/files~ 676 dh_gencontrol -plibuuid1-udeb -- -fdebian/files~ 677 endif 678 679 dpkg-distaddfile $(UDEB_NAME) debian-installer $(UDEB_PRIORITY) 680 ifneq ($(UTIL_LINUX_NG),yes) 681 dpkg-distaddfile $(BLKID_UDEB_NAME) debian-installer $(BLKID_UDEB_PRIORITY) 682 dpkg-distaddfile $(UUID_UDEB_NAME) debian-installer $(UUID_UDEB_PRIORITY) 683 endif 684 dh_md5sums -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb 685 dh_builddeb -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb 686 dh_builddeb -pe2fsprogs-udeb --filename=$(UDEB_NAME) 687 ifneq ($(UTIL_LINUX_NG),yes) 688 dh_builddeb -plibblkid1-udeb --filename=$(BLKID_UDEB_NAME) 689 dh_builddeb -plibuuid1-udeb --filename=$(UUID_UDEB_NAME) 690 endif 691 692 binary: binary-indep binary-arch 693 694 .PHONY: binary binary-arch binary-indep clean checkroot mrproper \ 695 debug_flags debian-files 696 697 debug_flags: 698 @echo CFLAGS is $(CFLAGS) 699 @echo LDFLAGS is $(LDFLAGS) 700 @echo CPPFLAGS is $(CPPFLAGS) 701