X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/763d5e6ad88ef3ba1cd1d7742d060e4f1e54c6b8..07184dd3deba9009e4c4391ef711a62aa57eb536:/debian/autorules.m4 diff --git a/debian/autorules.m4 b/debian/autorules.m4 index ed278a2..6b98a5c 100644 --- a/debian/autorules.m4 +++ b/debian/autorules.m4 @@ -1,6 +1,6 @@ #! /usr/bin/make -f # -# Copyright (C) 2004, 2005, 2006 Richard Kettlewell +# Copyright (C) 2004, 2005, 2006, 2007 Richard Kettlewell # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -23,25 +23,48 @@ INSTALL=install CONFIGURE=--prefix=/usr +INSTALL_DATA=$(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 + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) +CFLAGS=-O0 -g +else +CFLAGS=-O2 -g +endif +export CFLAGS +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) +INSTALL_PROGRAM += -s +endif +export INSTALL_DATA +export INSTALL_SCRIPT +export INSTALL_PROGRAM + m4_divert(-1)m4_dnl m4_changequote([,]) -m4_define([build], [[build]: +m4_define([build], [.PHONY: [build] +[build]: m4_syscmd([test -f ../configure || test -f ../config.status])m4_dnl -m4_ifelse(m4_sysval,0,[ ./configure ${CONFIGURE} +m4_ifelse(m4_sysval,0,[ if test -f config.status; then \ + ./config.status; else\ + ./configure ${CONFIGURE} ${CONFIGURE_EXTRA}; fi ])m4_dnl $(MAKE) prefix=/usr])m4_dnl -m4_define([binary], [[binary]: [binary]-arch [binary]-indep +m4_define([binary], [.PHONY: [binary] [binary]-arch [binary]-indep +[binary]: [binary]-arch [binary]-indep [binary]-arch: _archpkgs [binary]-indep: _indeppkgs]) m4_define([anypkg], [m4_define([_package], $1)m4_dnl m4_define([cleanup], cleanup [cleanpkg-$1])m4_dnl +.PHONY: cleanpkg-$1 cleanpkg-$1: rm -rf debian/$1 +.PHONY: pkg-$1 pkg-$1: [build] rm -rf debian/$1 mkdir -p debian/$1 @@ -51,8 +74,13 @@ pkg-$1: [build] debian/$1/usr/share/doc/$1/copyright cp debian/changelog \ debian/$1/usr/share/doc/$1/changelog.Debian - gzip -9 debian/$1/usr/share/doc/$1/copyright \ - debian/$1/usr/share/doc/$1/changelog.Debian + gzip -9 debian/$1/usr/share/doc/$1/changelog.Debian + @for f in preinst postinst prerm postrm conffiles templates config; do\ + if test -e debian/$$f.$1; then\ + echo cp debian/$$f.$1 debian/$1/DEBIAN/$$f; \ + cp debian/$$f.$1 debian/$1/DEBIAN/$$f; \ + fi;\ + done $2 dpkg-gencontrol -isp -p$1 -Pdebian/$1 -Tdebian/substvars.$1 chown -R root:root debian/$1 chmod -R g-ws debian/$1 @@ -96,7 +124,8 @@ anypkg([$1],[$2])]) m4_define([indeppkg], [m4_define([_indeppkgs], _indeppkgs pkg-$1)m4_dnl anypkg([$1],[$2])]) -m4_define([clean], [[clean]: cleanup +m4_define([clean], [.PHONY: [clean] +[clean]: cleanup -$(MAKE) distclean rm -f config.cache rm -f debian/files @@ -110,7 +139,8 @@ m4_define([_indeppkgs], []) m4_define([regenerate], [debian/rules: debian/autorules.m4 debian/rules.m4 rm -f debian/rules.tmp - m4 -P debian/autorules.m4 debian/rules.m4 > debian/rules.tmp + cd debian && \ + m4 -P autorules.m4 rules.m4 > rules.tmp chmod 555 debian/rules.tmp mv -f debian/rules.tmp debian/rules ])