#!/usr/bin/make -f # -*- makefile -*- DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) LIBDIR = usr/lib/$(DEB_HOST_MULTIARCH) LIBEXECDIR = $(LIBDIR)/schroot ifneq ($(DEB_HOST_ARCH_OS),linux) LVMSNAP_OPTIONS = --disable-lvm-snapshot BTRFSSNAP_OPTIONS = --disable-btrfs-snapshot else LVMSNAP_OPTIONS = --enable-lvm-snapshot BTRFSSNAP_OPTIONS = --enable-btrfs-snapshot endif ifneq ($(DEB_HOST_ARCH_OS),kfreebsd) UUID_OPTIONS = --enable-uuid else UUID_OPTIONS = --disable-uuid endif CFLAGS = -Wall -g ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O2 endif DH_OPTIONS = --with autotools_dev --builddirectory=debian/build --parallel DH_INSTALL_FILES = $(basename $(wildcard debian/*.install.in)) # Use debhelper's dh %: dh $@ $(DH_OPTIONS) %.install: %.install.in sed -e 's;@LIBDIR@;$(LIBDIR);g' -e 's;@LIBEXECDIR@;$(LIBEXECDIR);g' <$< >$@ override_dh_auto_configure: debian/build/config.status debian/build/config.status: configure dh_auto_configure -- \ --enable-dchroot --enable-dchroot-dsa \ --enable-static --disable-shared \ --with-bash-completion-dir=/etc/bash_completion.d \ $(LVMSNAP_OPTIONS) $(BTRFSSNAP_OPTIONS) $(UUID_OPTIONS) \ BTRFS=/sbin/btrfs \ BTRFSCTL=/sbin/btrfsctl \ LVCREATE=/sbin/lvcreate \ LVREMOVE=/sbin/lvremove dh_testdir override_dh_auto_clean: dh_auto_clean rm -f $(DH_INSTALL_FILES) rm -rf debian/install override_dh_auto_build: ifneq (,$(shell dh_listpackages -a 2>/dev/null)) $(MAKE) -C debian/build all PO4A= endif ifneq (,$(shell dh_listpackages -i 2>/dev/null)) $(MAKE) -C debian/build doc PO4A= endif override_dh_auto_test: install-arch: build-arch $(DH_INSTALL_FILES) dh $@ $(DH_OPTIONS) # Setuid executables chmod 4755 $(CURDIR)/debian/dchroot/usr/bin/dchroot chmod 4755 $(CURDIR)/debian/dchroot-dsa/usr/bin/dchroot-dsa chmod 4755 $(CURDIR)/debian/schroot/usr/bin/schroot # Lintian overrides mkdir -p $(CURDIR)/debian/dchroot/usr/share/lintian/overrides cp $(CURDIR)/debian/dchroot.lintian-overrides $(CURDIR)/debian/dchroot/usr/share/lintian/overrides/dchroot mkdir -p $(CURDIR)/debian/dchroot-dsa/usr/share/lintian/overrides cp $(CURDIR)/debian/dchroot-dsa.lintian-overrides $(CURDIR)/debian/dchroot-dsa/usr/share/lintian/overrides/dchroot-dsa mkdir -p $(CURDIR)/debian/schroot/usr/share/lintian/overrides cp $(CURDIR)/debian/schroot.lintian-overrides $(CURDIR)/debian/schroot/usr/share/lintian/overrides/schroot # Documentation symlinks rm -rf $(CURDIR)/debian/dchroot/usr/share/doc/dchroot ln -sf schroot $(CURDIR)/debian/dchroot/usr/share/doc/dchroot rm -rf $(CURDIR)/debian/dchroot-dsa/usr/share/doc/dchroot-dsa ln -sf schroot $(CURDIR)/debian/dchroot-dsa/usr/share/doc/dchroot-dsa # Requires fakeroot, so tests need running here. dh_auto_test install-indep: build-indep $(DH_INSTALL_FILES) dh $@ $(DH_OPTIONS) # Remove cruft find $(CURDIR)/debian/libsbuild-doc/usr/share/doc/libsbuild-doc -name '*.map' -print0 | xargs -0 rm -f find $(CURDIR)/debian/libsbuild-doc/usr/share/doc/libsbuild-doc -name '*.md5' -print0 | xargs -0 rm -f install: build $(DH_INSTALL_FILES) dh $@ $(DH_OPTIONS) override_dh_auto_install: ifneq (,$(shell dh_listpackages -a 2>/dev/null)) $(MAKE) -C debian/build install DESTDIR=$(CURDIR)/debian/install PO4A= endif ifneq (,$(shell dh_listpackages -i 2>/dev/null)) $(MAKE) -C debian/build/po install DESTDIR=$(CURDIR)/debian/install PO4A= endif override_dh_installchangelogs: dh_installchangelogs ChangeLog override_dh_installinit: dh_installinit --no-start --update-rcd-params='defaults' override_dh_strip: dh_strip --dbg-package=schroot-dbg .PHONY: override_dh_auto_configure override_dh_auto_clean override_dh_auto_build override_dh_auto_test override_dh_auto_install override_dh_installchangelogs override_dh_installinit override_dh_strip install-arch install-indep