#!/usr/bin/make -f
-# Sample debian/rules that uses debhelper.
-# GNU copyright 1997 to 1999 by Joey Hess.
+# debian/rules for abook
+PACKAGE = abook
+TMP = $(CURDIR)/debian/$(PACKAGE)
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-# This is the debhelper compatability version to use.
-export DH_COMPAT=1
+CFLAGS = -g -Wall
+INSTALL = install
+INSTALL_FILE = $(INSTALL) -p -oroot -groot -m644
+INSTALL_PROGRAM = $(INSTALL) -p -oroot -groot -m755
+INSTALL_SCRIPT = $(INSTALL) -p -oroot -groot -m755
+INSTALL_DIR = $(INSTALL) -p -d -oroot -groot -m755
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+ INSTALL_PROGRAM += -s
+endif
-build: build-stamp
-build-stamp:
- dh_testdir
- ./configure --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
- # Add here commands to compile the package.
- $(MAKE)
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
- touch build-stamp
clean:
- dh_testdir
- dh_testroot
- rm -f build-stamp
-
- # Add here commands to clean up after the build process.
+ $(checkdir)
+ $(checkroot)
+ rm -rf build-stamp $(TMP) debian/files debian/substvars
-$(MAKE) distclean
- dh_clean
-install: build
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
+build: build-stamp
+build-stamp:
+ $(checkdir)
+ ./configure --prefix=/usr --mandir=\$${prefix}/share/man \
+ --infodir=\$${prefix}/share/info
+ $(MAKE) CFLAGS="$(CFLAGS)"
+ touch build-stamp
- # Add here commands to install the package into debian/tmp.
- $(MAKE) prefix=`pwd`/debian/tmp/usr install
+
+install: build
+ $(checkdir)
+ $(checkroot)
+ -rm -rf $(TMP)
+ $(INSTALL_DIR) $(TMP)
+ cd $(TMP) && $(INSTALL_DIR) usr/share/doc/$(PACKAGE)/examples \
+ usr/share/doc/$(PACKAGE)/contrib
+ $(MAKE) prefix=$(TMP)/usr install INSTALL_PROGRAM="$(INSTALL_PROGRAM)"
+ $(INSTALL_FILE) ChangeLog $(TMP)/usr/share/doc/$(PACKAGE)/changelog
+ $(INSTALL_FILE) ANNOUNCE AUTHORS BUGS FAQ README THANKS TODO \
+ $(TMP)/usr/share/doc/$(PACKAGE)
+ $(INSTALL_FILE) sample.abookrc contrib/mail2abook.py \
+ contrib/vcard2abook.pl $(TMP)/usr/share/doc/$(PACKAGE)/examples
+ $(INSTALL_FILE) contrib/abook+vim/README contrib/abook+vim/mail.vim \
+ $(TMP)/usr/share/doc/$(PACKAGE)/contrib
+ cd $(TMP)/usr/share && gzip -9 man/man1/abook.1 man/man5/abookrc.5 \
+ doc/$(PACKAGE)/examples/mail2abook.py doc/$(PACKAGE)/changelog \
+ doc/$(PACKAGE)/contrib/mail.vim
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
+
# Build architecture-dependent files here.
binary-arch: build install
-# dh_testversion
- dh_testdir
- dh_testroot
-# dh_installdebconf
- dh_installdocs
- dh_installexamples sample.abookrc contrib/mail2abook.py contrib/vcard2abook.pl
- dh_installmenu
-# dh_installemacsen
-# dh_installpam
-# dh_installinit
- dh_installcron
- dh_installmanpages
- dh_installinfo
-# dh_undocumented
- dh_installchangelogs ChangeLog
- dh_link
- dh_strip
- dh_compress
- dh_fixperms
-# dh_makeshlibs
- dh_installdeb
-# dh_perl
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
+ $(checkdir)
+ $(checkroot)
+ $(INSTALL_DIR) $(TMP)/DEBIAN $(TMP)/usr/lib/menu
+ $(INSTALL_FILE) debian/menu $(TMP)/usr/lib/menu/$(PACKAGE)
+ $(INSTALL_FILE) debian/copyright $(TMP)/usr/share/doc/$(PACKAGE)
+ $(INSTALL_FILE) debian/changelog \
+ $(TMP)/usr/share/doc/$(PACKAGE)/changelog.Debian
+ gzip -9 $(TMP)/usr/share/doc/$(PACKAGE)/changelog.Debian
+ $(INSTALL_SCRIPT) debian/config debian/postinst debian/postrm \
+ $(TMP)/DEBIAN
+ po2debconf debian/templates > $(TMP)/DEBIAN/templates
+ dpkg-shlibdeps -Tdebian/substvars -dDepends $(TMP)/usr/bin/abook
+ dpkg-gencontrol -ldebian/changelog -isp -Tdebian/substvars \
+ -p$(PACKAGE) -P$(TMP)
+ cd $(TMP) && find * -type f ! -regex '^DEBIAN/.*' -print0 | \
+ xargs -r0 md5sum > DEBIAN/md5sums
+ dpkg --build $(TMP) ..
+
binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
+
+
+define checkdir
+ test -f debian/rules
+endef
+
+define checkroot
+ test root = "`whoami`"
+endef
+
+.PHONY: clean build install binary-indep binary-arch binary