chiark / gitweb /
(untested) debian menu entry
[disorder] / debian / autorules.m4
CommitLineData
460b9539 1#! /usr/bin/make -f
2#
eb525fcd 3# Copyright (C) 2004, 2005, 2006, 2007 Richard Kettlewell
460b9539 4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18# USA
19#
20# This file was generated automatically - edit rules.m4 instead
21#
22
23INSTALL=install
24CONFIGURE=--prefix=/usr
25
07184dd3
RK
26INSTALL_DATA=$(INSTALL) -p -o root -g root -m 644
27INSTALL_PROGRAM=$(INSTALL) -p -o root -g root -m 755
28INSTALL_SCRIPT=$(INSTALL) -p -o root -g root -m 755
294c70ed 29MKDIR=mkdir -p -m 755
07184dd3
RK
30
31ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
32CFLAGS=-O0 -g
33else
34CFLAGS=-O2 -g
35endif
36export CFLAGS
37ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
38INSTALL_PROGRAM += -s
39endif
40export INSTALL_DATA
41export INSTALL_SCRIPT
42export INSTALL_PROGRAM
43
460b9539 44m4_divert(-1)m4_dnl
45
46m4_changequote([,])
47
825f60a3
RK
48m4_define([build], [.PHONY: [build]
49[build]:
460b9539 50m4_syscmd([test -f ../configure || test -f ../config.status])m4_dnl
66ec39ed
RK
51m4_ifelse(m4_sysval,0,[ if test -f config.status; then \
52 ./config.status; else\
53 ./configure ${CONFIGURE} ${CONFIGURE_EXTRA}; fi
460b9539 54])m4_dnl
55 $(MAKE) prefix=/usr])m4_dnl
56
825f60a3
RK
57m4_define([binary], [.PHONY: [binary] [binary]-arch [binary]-indep
58[binary]: [binary]-arch [binary]-indep
460b9539 59[binary]-arch: _archpkgs
60[binary]-indep: _indeppkgs])
61
62m4_define([anypkg], [m4_define([_package], $1)m4_dnl
63m4_define([cleanup], cleanup [cleanpkg-$1])m4_dnl
825f60a3 64.PHONY: cleanpkg-$1
460b9539 65cleanpkg-$1:
66 rm -rf debian/$1
67
825f60a3 68.PHONY: pkg-$1
460b9539 69pkg-$1: [build]
70 rm -rf debian/$1
294c70ed
RK
71 $(MKDIR) debian/$1
72 $(MKDIR) debian/$1/DEBIAN
73 $(MKDIR) debian/$1/usr/share/doc/$1
460b9539 74 cp debian/copyright \
75 debian/$1/usr/share/doc/$1/copyright
76 cp debian/changelog \
77 debian/$1/usr/share/doc/$1/changelog.Debian
f1b2e9ac 78 gzip -9 debian/$1/usr/share/doc/$1/changelog.Debian
6f3acea9
RK
79 @for f in preinst postinst prerm postrm conffiles templates config; do\
80 if test -e debian/$$f.$1; then\
81 echo cp debian/$$f.$1 debian/$1/DEBIAN/$$f; \
82 cp debian/$$f.$1 debian/$1/DEBIAN/$$f; \
83 fi;\
84 done
460b9539 85$2 dpkg-gencontrol -isp -p$1 -Pdebian/$1 -Tdebian/substvars.$1
86 chown -R root:root debian/$1
87 chmod -R g-ws debian/$1
88 dpkg --[build] debian/$1 ..
89])
90
91m4_define([_target],
92 [m4_ifelse([$2],[],[$1],[$2])])
93
94m4_define([install_usrbin],
95 [$(INSTALL) -m 755 $1 \
96 debian/_package/usr/bin/_target([$1],[$2])])
97
98m4_define([install_usrsbin],
99 [$(INSTALL) -m 755 $1 \
100 debian/_package/usr/sbin/_target([$1],[$2])])
101
102m4_define([install_bin],
103 [$(INSTALL) -m 755 $1 \
104 debian/_package/bin/_target([$1],[$2])])
105
106m4_define([install_sbin],
107 [$(INSTALL) -m 755 $1 \
108 debian/_package/sbin/_target([$1],[$2])])
109
110m4_define([_mansect],
111 [m4_patsubst([$1], [^.*\.\([^.]*\)], [\1])])
112
113m4_define([install_usrman],
114 [$(INSTALL) -m 644 $1 \
115 debian/_package/usr/share/man/man[]_mansect(_target([$1],[$2]))/_target([$1],[$2])
116 gzip -9 debian/_package/usr/share/man/man[]_mansect(_target([$1],[$2]))/_target([$1],[$2])])
117
118m4_define([install_manlink],
119 [ln -s ../man[]_mansect([$1])/$1.gz \
120 debian/_package/usr/man/man[]_mansect([$2])/$2.gz])
121
122m4_define([archpkg], [m4_define([_archpkgs], _archpkgs pkg-$1)m4_dnl
123anypkg([$1],[$2])])
124
125m4_define([indeppkg], [m4_define([_indeppkgs], _indeppkgs pkg-$1)m4_dnl
126anypkg([$1],[$2])])
127
825f60a3
RK
128m4_define([clean], [.PHONY: [clean]
129[clean]: cleanup
460b9539 130 -$(MAKE) distclean
131 rm -f config.cache
132 rm -f debian/files
133 rm -f debian/substvars.*])
134
135m4_define([cleanup], [])
136
137m4_define([_archpkgs], [])
138
139m4_define([_indeppkgs], [])
140
141m4_define([regenerate], [debian/rules: debian/autorules.m4 debian/rules.m4
142 rm -f debian/rules.tmp
825f60a3
RK
143 cd debian && \
144 m4 -P autorules.m4 rules.m4 > rules.tmp
460b9539 145 chmod 555 debian/rules.tmp
146 mv -f debian/rules.tmp debian/rules
147])
148
149m4_divert(0)m4_dnl