#!/usr/bin/make -f # -*- makefile -*- # export DH_VERBOSE=1 # %: # dh $@ include /usr/share/dpkg/architecture.mk -include /usr/share/dpkg/buildtools.mk include /usr/share/dpkg/default.mk STRIP ?= strip # Package name PACKAGE_NAME = taggrepper # Install program INSTALL = install INSTALL_FILE = $(INSTALL) -p -o root -g root -m 644 INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755 INSTALL_SCRIPT = $(INSTALL) -p -o root -g root -m 755 INSTALL_DIR = $(INSTALL) -p -d -o root -g root -m 755 # The installation directory PACKAGE_DIR = debian/$(PACKAGE_NAME) CFLAGS ?= -g $(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS) ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 endif LDFLAGS += -Wl,-z,defs $(shell dpkg-buildflags --get LDFLAGS) ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) else CROSS= --build $(DEB_BUILD_GNU_TYPE) endif ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_PROGRAM += -s endif config.status: configure $(checkdir) ifneq "$(wildcard /usr/share/misc/config.sub)" "" cp -f /usr/share/misc/config.sub config.sub endif ifneq "$(wildcard /usr/share/misc/config.guess)" "" cp -f /usr/share/misc/config.guess config.guess endif ./configure $(CROSS) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" build: build-arch build-indep build-arch: build-stamp build-indep: build-stamp build-stamp: config.status $(checkdir) $(MAKE) touch $@ clean: checkroot $(checkdir) rm -f build-stamp [ ! -f Makefile ] || $(MAKE) distclean rm -f config.sub config.guess rm -rf $(PACKAGE_DIR) debian/files debian/substvars config.log install: checkroot build $(checkdir) $(MAKE) DESTDIR=$(CURDIR)/$(PACKAGE_DIR) install # fix directory permissions find '$(PACKAGE_DIR)' -type d -print0 | xargs -0r chmod 0755 # Build architecture-independent files here. binary-indep: checkroot build install # We have nothing to do by default. # Build architecture-dependent files here. binary-arch: checkroot build install $(checkdir) $(INSTALL_DIR) $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME)/ $(INSTALL_FILE) -m 644 README.md $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME)/ $(INSTALL_FILE) -m 644 ChangeLog $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME)/changelog $(INSTALL_FILE) -m 644 debian/changelog $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME)/changelog.Debian for i in $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME)/changelog*;do \ gzip -9nv $$i; \ done; $(INSTALL_FILE) -m 644 debian/copyright $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME)/copyright $(INSTALL_DIR) $(PACKAGE_DIR)/usr/share/man/man1 $(INSTALL_FILE) -m 644 doc/$(PACKAGE_NAME).1 $(PACKAGE_DIR)/usr/share/man/man1 gzip -9nv $(PACKAGE_DIR)/usr/share/man/*/* # Strip binaries ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) $(STRIP) -R.note -R.comment $(PACKAGE_DIR)/usr/bin/* endif dpkg-shlibdeps $(PACKAGE_DIR)/usr/bin/taggrepper $(INSTALL_DIR) $(PACKAGE_DIR)/DEBIAN cd $(PACKAGE_DIR) && find * -type f ! -regex '^DEBIAN/.*' -print0 | LC_ALL=C sort -z | xargs -r0 md5sum > DEBIAN/md5sums dpkg-gencontrol -p$(PACKAGE_NAME) -P$(PACKAGE_DIR) find $(PACKAGE_DIR) -newermt "@$$SOURCE_DATE_EPOCH" -print0 | \ xargs -0r touch --no-dereference --date="@$$SOURCE_DATE_EPOCH" dpkg-deb --build $(PACKAGE_DIR) .. binary: binary-indep binary-arch define checkdir test -f src/taggrepper.c && test -f debian/rules endef checkroot: $(checkdir) test root = "`whoami`" .PHONY: build clean binary-indep binary-arch binary install