Import from Arch revision:
[disorder] / debian / autorules.m4
1 #! /usr/bin/make -f
2 #
3 # Copyright (C) 2004, 2005, 2006 Richard Kettlewell
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
23 INSTALL=install
24 CONFIGURE=--prefix=/usr
25
26 m4_divert(-1)m4_dnl
27
28 m4_changequote([,])
29
30 m4_define([build], [[build]:
31 m4_syscmd([test -f ../configure || test -f ../config.status])m4_dnl
32 m4_ifelse(m4_sysval,0,[ ./configure ${CONFIGURE}
33 ])m4_dnl
34 $(MAKE) prefix=/usr])m4_dnl
35
36 m4_define([binary], [[binary]: [binary]-arch [binary]-indep
37 [binary]-arch: _archpkgs
38 [binary]-indep: _indeppkgs])
39
40 m4_define([anypkg], [m4_define([_package], $1)m4_dnl
41 m4_define([cleanup], cleanup [cleanpkg-$1])m4_dnl
42 cleanpkg-$1:
43 rm -rf debian/$1
44
45 pkg-$1: [build]
46 rm -rf debian/$1
47 mkdir -p debian/$1
48 mkdir -p debian/$1/DEBIAN
49 mkdir -p debian/$1/usr/share/doc/$1
50 cp debian/copyright \
51 debian/$1/usr/share/doc/$1/copyright
52 cp debian/changelog \
53 debian/$1/usr/share/doc/$1/changelog.Debian
54 gzip -9 debian/$1/usr/share/doc/$1/copyright \
55 debian/$1/usr/share/doc/$1/changelog.Debian
56 $2 dpkg-gencontrol -isp -p$1 -Pdebian/$1 -Tdebian/substvars.$1
57 chown -R root:root debian/$1
58 chmod -R g-ws debian/$1
59 dpkg --[build] debian/$1 ..
60 ])
61
62 m4_define([_target],
63 [m4_ifelse([$2],[],[$1],[$2])])
64
65 m4_define([install_usrbin],
66 [$(INSTALL) -m 755 $1 \
67 debian/_package/usr/bin/_target([$1],[$2])])
68
69 m4_define([install_usrsbin],
70 [$(INSTALL) -m 755 $1 \
71 debian/_package/usr/sbin/_target([$1],[$2])])
72
73 m4_define([install_bin],
74 [$(INSTALL) -m 755 $1 \
75 debian/_package/bin/_target([$1],[$2])])
76
77 m4_define([install_sbin],
78 [$(INSTALL) -m 755 $1 \
79 debian/_package/sbin/_target([$1],[$2])])
80
81 m4_define([_mansect],
82 [m4_patsubst([$1], [^.*\.\([^.]*\)], [\1])])
83
84 m4_define([install_usrman],
85 [$(INSTALL) -m 644 $1 \
86 debian/_package/usr/share/man/man[]_mansect(_target([$1],[$2]))/_target([$1],[$2])
87 gzip -9 debian/_package/usr/share/man/man[]_mansect(_target([$1],[$2]))/_target([$1],[$2])])
88
89 m4_define([install_manlink],
90 [ln -s ../man[]_mansect([$1])/$1.gz \
91 debian/_package/usr/man/man[]_mansect([$2])/$2.gz])
92
93 m4_define([archpkg], [m4_define([_archpkgs], _archpkgs pkg-$1)m4_dnl
94 anypkg([$1],[$2])])
95
96 m4_define([indeppkg], [m4_define([_indeppkgs], _indeppkgs pkg-$1)m4_dnl
97 anypkg([$1],[$2])])
98
99 m4_define([clean], [[clean]: cleanup
100 -$(MAKE) distclean
101 rm -f config.cache
102 rm -f debian/files
103 rm -f debian/substvars.*])
104
105 m4_define([cleanup], [])
106
107 m4_define([_archpkgs], [])
108
109 m4_define([_indeppkgs], [])
110
111 m4_define([regenerate], [debian/rules: debian/autorules.m4 debian/rules.m4
112 rm -f debian/rules.tmp
113 m4 -P debian/autorules.m4 debian/rules.m4 > debian/rules.tmp
114 chmod 555 debian/rules.tmp
115 mv -f debian/rules.tmp debian/rules
116 ])
117
118 m4_divert(0)m4_dnl
119 # arch-tag:c5871f9bd46d5d2e2ed7302cbcaccd4b