Commit | Line | Data |
---|---|---|
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 | ||
23 | INSTALL=install | |
24 | CONFIGURE=--prefix=/usr | |
25 | ||
07184dd3 RK |
26 | INSTALL_DATA=$(INSTALL) -p -o root -g root -m 644 |
27 | INSTALL_PROGRAM=$(INSTALL) -p -o root -g root -m 755 | |
28 | INSTALL_SCRIPT=$(INSTALL) -p -o root -g root -m 755 | |
29 | ||
30 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) | |
31 | CFLAGS=-O0 -g | |
32 | else | |
33 | CFLAGS=-O2 -g | |
34 | endif | |
35 | export CFLAGS | |
36 | ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) | |
37 | INSTALL_PROGRAM += -s | |
38 | endif | |
39 | export INSTALL_DATA | |
40 | export INSTALL_SCRIPT | |
41 | export INSTALL_PROGRAM | |
42 | ||
460b9539 | 43 | m4_divert(-1)m4_dnl |
44 | ||
45 | m4_changequote([,]) | |
46 | ||
825f60a3 RK |
47 | m4_define([build], [.PHONY: [build] |
48 | [build]: | |
460b9539 | 49 | m4_syscmd([test -f ../configure || test -f ../config.status])m4_dnl |
66ec39ed RK |
50 | m4_ifelse(m4_sysval,0,[ if test -f config.status; then \ |
51 | ./config.status; else\ | |
52 | ./configure ${CONFIGURE} ${CONFIGURE_EXTRA}; fi | |
460b9539 | 53 | ])m4_dnl |
54 | $(MAKE) prefix=/usr])m4_dnl | |
55 | ||
825f60a3 RK |
56 | m4_define([binary], [.PHONY: [binary] [binary]-arch [binary]-indep |
57 | [binary]: [binary]-arch [binary]-indep | |
460b9539 | 58 | [binary]-arch: _archpkgs |
59 | [binary]-indep: _indeppkgs]) | |
60 | ||
61 | m4_define([anypkg], [m4_define([_package], $1)m4_dnl | |
62 | m4_define([cleanup], cleanup [cleanpkg-$1])m4_dnl | |
825f60a3 | 63 | .PHONY: cleanpkg-$1 |
460b9539 | 64 | cleanpkg-$1: |
65 | rm -rf debian/$1 | |
66 | ||
825f60a3 | 67 | .PHONY: pkg-$1 |
460b9539 | 68 | pkg-$1: [build] |
69 | rm -rf debian/$1 | |
70 | mkdir -p debian/$1 | |
71 | mkdir -p debian/$1/DEBIAN | |
72 | mkdir -p debian/$1/usr/share/doc/$1 | |
73 | cp debian/copyright \ | |
74 | debian/$1/usr/share/doc/$1/copyright | |
75 | cp debian/changelog \ | |
76 | debian/$1/usr/share/doc/$1/changelog.Debian | |
f1b2e9ac | 77 | gzip -9 debian/$1/usr/share/doc/$1/changelog.Debian |
6f3acea9 RK |
78 | @for f in preinst postinst prerm postrm conffiles templates config; do\ |
79 | if test -e debian/$$f.$1; then\ | |
80 | echo cp debian/$$f.$1 debian/$1/DEBIAN/$$f; \ | |
81 | cp debian/$$f.$1 debian/$1/DEBIAN/$$f; \ | |
82 | fi;\ | |
83 | done | |
460b9539 | 84 | $2 dpkg-gencontrol -isp -p$1 -Pdebian/$1 -Tdebian/substvars.$1 |
85 | chown -R root:root debian/$1 | |
86 | chmod -R g-ws debian/$1 | |
87 | dpkg --[build] debian/$1 .. | |
88 | ]) | |
89 | ||
90 | m4_define([_target], | |
91 | [m4_ifelse([$2],[],[$1],[$2])]) | |
92 | ||
93 | m4_define([install_usrbin], | |
94 | [$(INSTALL) -m 755 $1 \ | |
95 | debian/_package/usr/bin/_target([$1],[$2])]) | |
96 | ||
97 | m4_define([install_usrsbin], | |
98 | [$(INSTALL) -m 755 $1 \ | |
99 | debian/_package/usr/sbin/_target([$1],[$2])]) | |
100 | ||
101 | m4_define([install_bin], | |
102 | [$(INSTALL) -m 755 $1 \ | |
103 | debian/_package/bin/_target([$1],[$2])]) | |
104 | ||
105 | m4_define([install_sbin], | |
106 | [$(INSTALL) -m 755 $1 \ | |
107 | debian/_package/sbin/_target([$1],[$2])]) | |
108 | ||
109 | m4_define([_mansect], | |
110 | [m4_patsubst([$1], [^.*\.\([^.]*\)], [\1])]) | |
111 | ||
112 | m4_define([install_usrman], | |
113 | [$(INSTALL) -m 644 $1 \ | |
114 | debian/_package/usr/share/man/man[]_mansect(_target([$1],[$2]))/_target([$1],[$2]) | |
115 | gzip -9 debian/_package/usr/share/man/man[]_mansect(_target([$1],[$2]))/_target([$1],[$2])]) | |
116 | ||
117 | m4_define([install_manlink], | |
118 | [ln -s ../man[]_mansect([$1])/$1.gz \ | |
119 | debian/_package/usr/man/man[]_mansect([$2])/$2.gz]) | |
120 | ||
121 | m4_define([archpkg], [m4_define([_archpkgs], _archpkgs pkg-$1)m4_dnl | |
122 | anypkg([$1],[$2])]) | |
123 | ||
124 | m4_define([indeppkg], [m4_define([_indeppkgs], _indeppkgs pkg-$1)m4_dnl | |
125 | anypkg([$1],[$2])]) | |
126 | ||
825f60a3 RK |
127 | m4_define([clean], [.PHONY: [clean] |
128 | [clean]: cleanup | |
460b9539 | 129 | -$(MAKE) distclean |
130 | rm -f config.cache | |
131 | rm -f debian/files | |
132 | rm -f debian/substvars.*]) | |
133 | ||
134 | m4_define([cleanup], []) | |
135 | ||
136 | m4_define([_archpkgs], []) | |
137 | ||
138 | m4_define([_indeppkgs], []) | |
139 | ||
140 | m4_define([regenerate], [debian/rules: debian/autorules.m4 debian/rules.m4 | |
141 | rm -f debian/rules.tmp | |
825f60a3 RK |
142 | cd debian && \ |
143 | m4 -P autorules.m4 rules.m4 > rules.tmp | |
460b9539 | 144 | chmod 555 debian/rules.tmp |
145 | mv -f debian/rules.tmp debian/rules | |
146 | ]) | |
147 | ||
148 | m4_divert(0)m4_dnl |