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 13export 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) 17DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) 18DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH) 19DEB_HOST_OS ?= $(shell dpkg-architecture -qDEB_HOST_OS) 20DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) 21DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) 22DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null) 23 24# Allow distro-specific behaviour 25DISTRO :=$(shell sed -ne '/DISTRIB_ID/s/.*=//p' /etc/lsb-release 2>/dev/null || echo Debian) 26SYS_BLKID_VER := $(shell dpkg-query -W libblkid1:$(DEB_HOST_ARCH) | cut -f 2 | cut -b 1) 27ifeq ($(SYS_BLKID_VER),2) 28UTIL_LINUX_NG ?= yes 29endif 30 31# find the version for the main package, from changelog file 32MAIN_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 35COMERR_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) 39 40ifneq ($(UTIL_LINUX_NG),yes) 41UUID_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) 43 44BLKID_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) 46endif 47 48EXT2FS_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) 50 51package ?= e2fsprogs 52 53topdir ?= $(shell pwd) 54debdir ?= ${topdir}/debian 55tmpdir ?= ${debdir}/tmp 56udebdir ?= ${debdir}/e2fsprogs-udeb 57ifneq ($(UTIL_LINUX_NG),yes) 58blkidudebdir ?= ${debdir}/libblkid1-udeb 59uuidudebdir ?= ${debdir}/libuuid1-udeb 60endif 61libcomerrdir ?= ${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 67ifneq ($(UTIL_LINUX_NG),yes) 68libblkiddir ?= ${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 76endif 77libext2dir ?= ${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 84staticbuilddir ?= ${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} 90 91UDEB_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) 93 94ifneq ($(UTIL_LINUX_NG),yes) 95BLKID_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) 97 98UUID_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) 100endif 101 102STAMPSDIR ?= 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 109 110INSTALL ?= install 111INSTALL_PROGRAM ?= $(INSTALL) -p -o root -g root -m 0755 112 113#ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) 114#INSTALL_PROGRAM += -s 115#endif 116 117DEFAULT_CFLAGS ?= -g -O2 118DEFAULT_LDFLAGS ?= -Wl,-Bsymbolic-functions 119 120CFLAGS ?= $(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) 126 127ifeq (${DEB_HOST_ARCH},alpha) 128CFLAGS += -DHAVE_NETINET_IN_H 129else 130CFLAGS += -D__NO_STRING_INLINES 131endif 132 133ifneq (${DEB_HOST_ARCH_OS},linux) 134SKIP_STATIC = yes 135endif 136 137ifeq ($(SKIP_STATIC),yes) 138BUILD_STATIC = 139E2FSCK_STATIC = ${stdbuilddir}/e2fsck/e2fsck.static 140else 141BUILD_STATIC = build-static 142E2FSCK_STATIC = ${staticbuilddir}/e2fsck/e2fsck.static 143endif 144 145ifeq ($(SKIP_BF),yes) 146BUILD_BF = 147bfbuilddir ?= ${stdbuilddir} 148else 149BUILD_BF = build-bf 150bfbuilddir ?= ${debdir}/BUILD-BF 151endif 152 153BF_CFLAGS = -Os -fomit-frame-pointer 154 155COMMON_CONF_FLAGS = --disable-e2initrd-helper --enable-elf-shlibs \ 156 --enable-quota --infodir=/usr/share/info 157ifeq ($(UTIL_LINUX_NG),yes) 158COMMON_CONF_FLAGS += --disable-fsck --disable-libblkid \ 159 --disable-libuuid --disable-uuidd 160else 161COMMON_CONF_FLAGS += --enable-fsck 162endif 163 164ifneq ($(strip $(DEB_HOST_MULTIARCH)),) 165MULTIARCH_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) 169USRLIB ?= /usr/lib 170else 171USRLIB ?= /usr/lib 172endif 173 174BACKTRACE_CONF_FLAGS ?= $(shell if ${debdir}/scripts/test-backtrace ; then echo --disable-backtrace ; fi) 175 176STD_CONF_FLAGS ?= --enable-symlink-install $(MULTIARCH_CONF) $(BACKTRACE_CONF_FLAGS) 177 178BF_CONF_FLAGS ?= --disable-nls --disable-imager --disable-testio-debug \ 179 --disable-uuidd --disable-tls --disable-debugfs 180 181STATIC_CONF_FLAGS ?= --disable-nls --disable-imager \ 182 --disable-uuidd --disable-tls 183 184MIPS_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 189MIPS_CFLAGS ?= -G 0 -fno-pic -mno-abicalls 190MIPS_CFLAGS_64 ?= -mabi=64 -G 0 -fno-pic -mno-abicalls 191 192ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) 193ifneq (,$(findstring $(DEB_BUILD_ARCH),mips mipsel)) 194ismips=ismips 195endif 196endif 197 198M4_ARGS= 199ifeq ($(UTIL_LINUX_NG),yes) 200M4_ARGS+=-DUTIL_LINUX_NG 201else 202M4_ARGS+=-UUTIL_LINUX_NG 203endif 204 205ifneq ($(strip $(DEB_HOST_MULTIARCH)),) 206M4_ARGS+=-DDO_MULTIARCH 207else 208M4_ARGS+=-UDO_MULTIARCH 209endif 210 211ifneq ($(SKIP_DIETLIBC),) 212M4_ARGS+=-UDIETLIBC 213WITH_DIET_LIBC = 214else 215M4_ARGS+=-DDIETLIBC 216WITH_DIET_LIBC = --with-diet-libc 217endif 218 219ifneq ($(BUILD_E2FSCK_STATIC),no) 220M4_ARGS+=-DE2FSCK_STATIC 221else 222M4_ARGS+=-UE2FSCK_STATIC 223endif 224 225FILES_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 229debian-files: debian/control debian/e2fsprogs.shlibs.local 230ifeq ($(strip $(DEB_HOST_MULTIARCH)),) 231 for i in $(FILES_FIXUP); do \ 232 sed -e 's;lib/\*/;lib/;' debian/$$i.in > debian/$$i; \ 233 done 234else 235 for i in $(FILES_FIXUP); do cp debian/$$i.in debian/$$i; done 236endif 237 238mrproper: clean 239 rm debian/control debian/e2fsprogs.shlibs.local 240 241debian/control: debian/control.in debian/rules 242 m4 $(M4_ARGS) < debian/control.in | grep -v ^REMOVE_ME$$ > $@ 243 244debian/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} 254ifeq ($(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)" 258else 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)" 263endif 264 265 # specially-built MIPS libs 266ifneq ($(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)" 274endif 275 276 mkdir -p ${STAMPSDIR} 277 touch ${CFGSTDSTAMP} 278 279${CFGBFSTAMP}: 280 dh_testdir 281 rm -f config.cache 282 283 mkdir -p ${bfbuilddir} 284ifeq ($(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)" 288else 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)" 293endif 294 mkdir -p ${STAMPSDIR} 295 touch ${CFGBFSTAMP} 296 297${CFGSTATICSTAMP}: 298 dh_testdir 299 rm -f config.cache 300 301 mkdir -p ${staticbuilddir} 302ifeq ($(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 314else 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)" 319endif 320 mkdir -p ${STAMPSDIR} 321 touch ${CFGSTATICSTAMP} 322 323build-arch: build 324build-indep: build 325build: build-std $(BUILD_BF) $(BUILD_STATIC) 326 327build-std: ${BUILDSTDSTAMP} 328${BUILDSTDSTAMP}: ${CFGSTDSTAMP} 329 dh_testdir 330 $(MAKE) -C ${stdbuilddir} V=1 all 331ifneq ($(BUILD_E2FSCK_STATIC),no) 332 $(MAKE) -C ${stdbuilddir}/e2fsck V=1 e2fsck.static 333endif 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 340ifneq ($(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 349endif 350 351 touch ${BUILDSTDSTAMP} 352 353build-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 362build-static: ${BUILDSTATICSTAMP} 363${BUILDSTATICSTAMP}: ${CFGSTATICSTAMP} 364 dh_testdir 365 $(MAKE) -C ${staticbuilddir} V=1 libs 366ifneq ($(BUILD_E2FSCK_STATIC),no) 367 $(MAKE) -C ${staticbuilddir}/e2fsck V=1 all e2fsck.static 368endif 369 touch ${BUILDSTATICSTAMP} 370 371clean: 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 381install: 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 386cleanup: 387 dh_testdir 388 dh_testroot 389 dh_prep 390 391install-std: DH_OPTIONS= 392install-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 403ifneq ($(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 407endif 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 413ifeq ($(DEB_BUILD_GNU_SYSTEM), gnu) 414 ${INSTALL} -m 0644 misc/mke2fs-hurd.conf ${tmpdir}/etc/mke2fs.conf 415endif 416 417 dh_movefiles 418 test -z "`find ${tmpdir} -type f`" 419 420 # specially-built MIPS libs 421ifneq ($(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 426endif 427 428install-udeb: DH_OPTIONS= 429install-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 452ifneq ($(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 458endif 459 460binary-indep: 461 # no arch-independant debs. 462 463binary-arch: DH_OPTIONS= -a 464binary-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 478ifneq ($(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 482endif 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 492ifneq ($(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 496endif 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 502ifneq ($(UTIL_LINUX_NG),yes) 503 $(INSTALL) -p -m 0644 debian/libblkid.copyright \ 504 ${debdir}/libblkid${BLKID_SOVERSION}/usr/share/doc/libblkid${BLKID_SOVERSION}/copyright 505endif 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 541ifneq ($(BUILD_E2FSCK_STATIC),no) 542 DH_OPTIONS= dh_installchangelogs -pe2fsck-static 543endif 544ifneq ($(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 548endif 549 550 dh_fixperms 551ifneq ($(ismips),) 552 dh_strip -k -Xlib64ext2fs-nopic.a 553else 554 dh_strip -k 555endif 556 557 # debug package stuff 558 rm -rf ${udebdir}/usr 559ifneq ($(UTIL_LINUX_NG),yes) 560 rm -rf ${blkidudebdir}/usr 561 rm -rf ${uuidudebdir}/usr 562endif 563 564ifeq (,$(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 569ifneq ($(BUILD_E2FSCK_STATIC),no) 570 mv ${e2fsckstaticdir}/usr/lib/debug/sbin/* \ 571 ${debugdir}/$(USRLIB)/debug 572 rm -rf ${e2fsckstaticdir}/usr/lib 573endif 574 575ifneq ($(UTIL_LINUX_NG),yes) 576 mkdir -p ${uuidruntimedbgdir}/$(USRLIB) 577 mv ${uuidruntimedir}/usr/lib/debug ${uuidruntimedbgdir}/$(USRLIB) 578 rmdir ${uuidruntimedir}/usr/lib 579endif 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 593ifneq ($(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 601endif 602endif 603 604 # dpkg symbol handling 605ifneq (,$(findstring update-symbols,$(DEB_BUILD_OPTIONS))) 606SYMBOL_LIBS := e2fslibs libcomerr2 libss2 607ifneq ($(UTIL_LINUX_NG),yes) 608SYMBOL_LIBS += libblkid1 libuuid1 609endif 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 618endif 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 625ifneq ($(UTIL_LINUX_NG),yes) 626 $(INSTALL) -p -m 0644 debian/uuid-runtime.copyright \ 627 ${uuidruntimedbgdir}/usr/share/doc/uuid-runtime-dbg/copyright 628endif 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 636ifneq ($(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 642endif 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)' 649ifneq ($(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 654endif 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}' 669ifneq ($(UTIL_LINUX_NG),yes) 670 DH_OPTIONS= dh_gencontrol -puuid-dev \ 671 -u '-v${UUID_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}' 672endif 673 dh_gencontrol -pe2fsprogs-udeb -- -fdebian/files~ 674ifneq ($(UTIL_LINUX_NG),yes) 675 dh_gencontrol -plibblkid1-udeb -- -fdebian/files~ 676 dh_gencontrol -plibuuid1-udeb -- -fdebian/files~ 677endif 678 679 dpkg-distaddfile $(UDEB_NAME) debian-installer $(UDEB_PRIORITY) 680ifneq ($(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) 683endif 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) 687ifneq ($(UTIL_LINUX_NG),yes) 688 dh_builddeb -plibblkid1-udeb --filename=$(BLKID_UDEB_NAME) 689 dh_builddeb -plibuuid1-udeb --filename=$(UUID_UDEB_NAME) 690endif 691 692binary: binary-indep binary-arch 693 694.PHONY: binary binary-arch binary-indep clean checkroot mrproper \ 695 debug_flags debian-files 696 697debug_flags: 698 @echo CFLAGS is $(CFLAGS) 699 @echo LDFLAGS is $(LDFLAGS) 700 @echo CPPFLAGS is $(CPPFLAGS) 701