File: rules

package info (click to toggle)
lyx 1.3.4-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 41,996 kB
  • ctags: 28,239
  • sloc: cpp: 169,428; sh: 11,309; ansic: 6,029; perl: 3,828; python: 1,659; makefile: 1,554; yacc: 356; tcl: 163; sed: 72
file content (454 lines) | stat: -rwxr-xr-x 19,082 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
#!/usr/bin/make -f
# Generated automatically from debian/packages
# by yada v0.29, of Wed, 19 May 2004

DEB_HOST_ARCH        := $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_GNU_CPU     := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
DEB_HOST_GNU_TYPE    := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_HOST_GNU_SYSTEM  := $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)

DEB_BUILD_ARCH       := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
DEB_BUILD_GNU_CPU    := $(shell dpkg-architecture -qDEB_BUILD_GNU_CPU)
DEB_BUILD_GNU_TYPE   := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_BUILD_GNU_SYSTEM := $(shell dpkg-architecture -qDEB_BUILD_GNU_SYSTEM)

VERSION:=$(shell LC_ALL=C dpkg-parsechangelog | sed -ne 's/^Version: *\([^2]*\)/\1/p')

SHELL=/bin/bash

.PHONY: default
default:
	@echo "Specify a target:"; \
	echo " build              compile the package"; \
	echo " build-arch         compile the architecture-dependent package"; \
	echo " build-indep        compile the architecture-independent package"; \
	echo " binary             make all binary packages"; \
	echo " binary-arch        make all architecture-dependent binary packages"; \
	echo " binary-indep       make all architecture-independent binary packages"; \
	echo " clean              clean up the source package"; \
	echo; \
	echo " clean-install-tree clean up only under debian/"; \
	echo

# Build the package and prepare the install tree

.PHONY: build-only build
build-only: debian/build-stamp
build: build-only

.PHONY: build-arch-only build-arch
build-arch-only: debian/build-arch-stamp
build-arch: build-arch-only

.PHONY: build-indep-only build-indep
build-indep-only: debian/build-indep-stamp
build-indep: build-indep-only

# Make sure these rules and the control file are up-to-date

.PHONY: rules control templates
rules: debian/rules
debian/rules: $(shell which yada) debian/packages-tmp
	yada rebuild rules

control: debian/control
debian/control: $(shell which yada) debian/packages-tmp
	yada rebuild control

templates: debian/templates
debian/templates: $(shell which yada) debian/packages-tmp
	yada rebuild templates

debian/build-stamp: debian/build-arch-stamp debian/build-indep-stamp
	@[ -f $(shell which yada) -a -f debian/rules ]
	yada patch "debian/patches/*.diff"
	@umask 022 \
	  && export pwd="$$(pwd)" \
	  && export TMPROOT="$$(pwd)/debian/tmp" \
	  && export SOURCE="lyx" \
	  && export VERSION="$(VERSION)" \
	  && export DEB_HOST_GNU_CPU="$(DEB_HOST_GNU_CPU)" \
	  && export DEB_HOST_GNU_TYPE="$(DEB_HOST_GNU_TYPE)" \
	  && export DEB_HOST_GNU_SYSTEM="$(DEB_HOST_GNU_SYSTEM)" \
	  && export DEB_BUILD_GNU_CPU="$(DEB_BUILD_GNU_CPU)" \
	  && export DEB_BUILD_GNU_TYPE="$(DEB_BUILD_GNU_TYPE)" \
	  && export DEB_BUILD_GNU_SYSTEM="$(DEB_BUILD_GNU_SYSTEM)" && (\
	echo -E 'eval "yada () { perl $$(which yada) \"\$$@\"; }"; set -e; set -v';\
	echo -E 'CC="$${CC:-gcc}"';\
	echo -E 'CXX="$${CXX:-g++}"';\
	echo -E 'CPP="$${CPP:-cpp}"';\
	echo -E 'CXXFLAGS="$${CXXFLAGS:-$$OPTIMIZATION -g}"';\
	echo -E 'if [ "$${DEB_BUILD_OPTIONS#*noopt}" != "$$DEB_BUILD_OPTIONS" ]; then';\
	echo -E '    CXXFLAGS="$$CXXFLAGS -O0"';\
	echo -E 'else';\
	echo -E '    CXXFLAGS="$$CXXFLAGS -O2"';\
	echo -E 'fi';\
	echo -E 'case "$$($$CXX -dumpversion)" in';\
	echo -E '   3.[3456789]*) CXXFLAGS="$$CXXFLAGS -fno-exceptions";;';\
	echo -E 'esac';\
	echo -E 'CONFIGURE_OPTIONS=" \';\
	echo -E '    --prefix=/usr \';\
	echo -E '    --infodir=/usr/share/info \';\
	echo -E '    --mandir=/usr/share/man';\
	echo -E '    --disable-dependency-tracking \';\
	echo -E '    --enable-warnings \';\
	echo -E '    --disable-debug \';\
	echo -E '    --enable-optimization='\''$$CXXFLAGS'\'' \';\
	echo -E '    --enable-assertions \';\
	echo -E '    --enable-shared \';\
	echo -E '    --enable-nls \';\
	echo -E '    --without-included-string \';\
	echo -E '    --with-aiksaurus \';\
	echo -E '    --with-gnu-ld \';\
	echo -E '    --without-pspell \';\
	echo -E '    --with-x \';\
	echo -E '    --without-included-gettext \';\
	echo -E '"';\
	echo -E 'libtoolize --automake --copy --force';\
	echo -E './autogen.sh';\
	echo -E 'test -d build-tree-qt || mkdir build-tree-qt';\
	echo -E 'cd build-tree-qt';\
	echo -E 'eval qt_cv_libname=-lqt-mt ../configure $$CONFIGURE_OPTIONS \';\
	echo -E '    --with-frontend=qt \';\
	echo -E '    --with-qt-dir=/usr/share/qt3 \';\
	echo -E '    CC="$$CC" CXX="$$CXX" CPP="$$CPP"';\
	echo -E 'cp -a /usr/bin/libtool .';\
	echo -E 'if [ -n "$$CONCURRENCY_LEVEL" ] && [ "$$CONCURRENCY_LEVEL" -gt 1 ]; then';\
	echo -E '    make -j $$CONCURRENCY_LEVEL';\
	echo -E 'else';\
	echo -E '    make';\
	echo -E 'fi';\
	echo -E 'cd ..';\
	echo -E 'test -d build-tree-xforms || mkdir build-tree-xforms';\
	echo -E 'cd build-tree-xforms';\
	echo -E 'eval ../configure $$CONFIGURE_OPTIONS \';\
	echo -E '    --with-frontend=xforms \';\
	echo -E '    CC="$$CC" CXX="$$CXX" CPP="$$CPP"';\
	echo -E 'cp -a /usr/bin/libtool .';\
	echo -E 'if [ -n "$$CONCURRENCY_LEVEL" ] && [ "$$CONCURRENCY_LEVEL" -gt 1 ]; then';\
	echo -E '    make -j $$CONCURRENCY_LEVEL';\
	echo -E 'else';\
	echo -E '    make';\
	echo -E 'fi';\
	echo -E 'cd ..';\
	echo -E 'for pod in debian/scripts/update-lyxrc; do';\
	echo -E '    eval pod2man $$(grep '\''^# pod2man '\'' $$pod | sed '\''s/^# pod2man //'\'') $$pod \';\
	echo -E '         > $$(basename $$pod).$$(grep '\''^# pod2man '\'' $$pod | sed -e '\''s/.*--section=//'\'' -e '\''s/ .*//'\'')';\
	echo -E 'done') | /bin/sh
	touch debian/build-stamp

debian/build-arch-stamp:
	@[ -f $(shell which yada) -a -f debian/rules ]
	yada patch "debian/patches/*.diff"
	touch debian/build-arch-stamp

debian/build-indep-stamp:
	@[ -f $(shell which yada) -a -f debian/rules ]
	yada patch "debian/patches/*.diff"
	touch debian/build-indep-stamp

.PHONY: install-tree
install-tree: install-tree-any
install-tree-any: \
	debian/tmp-lyx-xforms/DEBIAN/control \
	debian/tmp-lyx-qt/DEBIAN/control \
	debian/tmp-lyx-common/DEBIAN/control \
	debian/tmp-lyx/DEBIAN/control

debian/tmp-lyx-xforms/DEBIAN/control: debian/build-stamp debian/control
	rm -rf debian/tmp-lyx-xforms
	umask 022 && install -d debian/tmp-lyx-xforms/DEBIAN
	umask 022 && install -d debian/tmp-lyx-xforms/usr/share/doc/lyx-common
	umask 022 && ln -s lyx-common debian/tmp-lyx-xforms/usr/share/doc/lyx-xforms
	@umask 022 \
	  && export pwd="$$(pwd)" \
	  && export ROOT="$$(pwd)/debian/tmp-lyx-xforms" \
	  && export TMPROOT="$$(pwd)/debian/tmp" \
	  && export CONTROL="$$(pwd)/debian/tmp-lyx-xforms/DEBIAN" \
	  && export PACKAGE="lyx-xforms" \
	  && export SOURCE="lyx" \
	  && export VERSION="$(VERSION)" \
	  && export DEB_HOST_GNU_CPU="$(DEB_HOST_GNU_CPU)" \
	  && export DEB_HOST_GNU_TYPE="$(DEB_HOST_GNU_TYPE)" \
	  && export DEB_HOST_GNU_SYSTEM="$(DEB_HOST_GNU_SYSTEM)" \
	  && export DEB_BUILD_GNU_CPU="$(DEB_BUILD_GNU_CPU)" \
	  && export DEB_BUILD_GNU_TYPE="$(DEB_BUILD_GNU_TYPE)" \
	  && export DEB_BUILD_GNU_SYSTEM="$(DEB_BUILD_GNU_SYSTEM)" && (\
	echo -E 'eval "yada () { perl $$(which yada) \"\$$@\"; }"; set -e; set -v';\
	echo -E 'yada install -bin -as lyx-xforms build-tree-xforms/src/lyx';\
	echo -E 'yada install -man -as lyx-xforms.1 build-tree-xforms/lyx.1';\
	echo -E 'yada install -data -subdir pixmaps -as lyx-xforms.xpm debian/pixmaps/lyx.xpm') | /bin/sh
	@umask 022 \
	  && export pwd="$$(pwd)" \
	  && export ROOT="$$(pwd)/debian/tmp-lyx-xforms" \
	  && export TMPROOT="$$(pwd)/debian/tmp" \
	  && export CONTROL="$$(pwd)/debian/tmp-lyx-xforms/DEBIAN" \
	  && export PACKAGE="lyx-xforms" \
	  && export SOURCE="lyx" \
	  && export VERSION="$(VERSION)" && (\
	echo -E 'eval "yada () { perl $$(which yada) \"\$$@\"; }"; set -e; set -v';\
	echo -E 'yada perl';\
	echo -E 'yada python';\
	echo -E 'yada strip';\
	echo -E 'yada shlibdeps') | /bin/sh
	yada compress lyx-xforms
	yada generate maintscripts lyx-xforms
	find debian/tmp-lyx-xforms -type f -print \
	  | sed -n 's/^debian\/tmp-lyx-xforms\(\/etc\/.*\)$$/\1/p' \
	  > debian/tmp-lyx-xforms/DEBIAN/conffiles
	if test ! -s debian/tmp-lyx-xforms/DEBIAN/conffiles; then rm -f debian/tmp-lyx-xforms/DEBIAN/conffiles; fi
	yada rebuild control
	yada generate substvars lyx-xforms
	-rmdir debian/tmp-lyx-xforms/usr/share/doc/lyx-common
	umask 022 && dpkg-gencontrol -isp -plyx-xforms -Pdebian/tmp-lyx-xforms

debian/tmp-lyx-qt/DEBIAN/control: debian/build-stamp debian/control
	rm -rf debian/tmp-lyx-qt
	umask 022 && install -d debian/tmp-lyx-qt/DEBIAN
	umask 022 && install -d debian/tmp-lyx-qt/usr/share/doc/lyx-common
	umask 022 && ln -s lyx-common debian/tmp-lyx-qt/usr/share/doc/lyx-qt
	@umask 022 \
	  && export pwd="$$(pwd)" \
	  && export ROOT="$$(pwd)/debian/tmp-lyx-qt" \
	  && export TMPROOT="$$(pwd)/debian/tmp" \
	  && export CONTROL="$$(pwd)/debian/tmp-lyx-qt/DEBIAN" \
	  && export PACKAGE="lyx-qt" \
	  && export SOURCE="lyx" \
	  && export VERSION="$(VERSION)" \
	  && export DEB_HOST_GNU_CPU="$(DEB_HOST_GNU_CPU)" \
	  && export DEB_HOST_GNU_TYPE="$(DEB_HOST_GNU_TYPE)" \
	  && export DEB_HOST_GNU_SYSTEM="$(DEB_HOST_GNU_SYSTEM)" \
	  && export DEB_BUILD_GNU_CPU="$(DEB_BUILD_GNU_CPU)" \
	  && export DEB_BUILD_GNU_TYPE="$(DEB_BUILD_GNU_TYPE)" \
	  && export DEB_BUILD_GNU_SYSTEM="$(DEB_BUILD_GNU_SYSTEM)" && (\
	echo -E 'eval "yada () { perl $$(which yada) \"\$$@\"; }"; set -e; set -v';\
	echo -E 'yada install -bin -as lyx-qt build-tree-qt/src/lyx';\
	echo -E 'yada install -man -as lyx-qt.1 build-tree-qt/lyx.1';\
	echo -E 'yada install -data -subdir pixmaps -as lyx-qt.xpm debian/pixmaps/lyx.xpm') | /bin/sh
	@umask 022 \
	  && export pwd="$$(pwd)" \
	  && export ROOT="$$(pwd)/debian/tmp-lyx-qt" \
	  && export TMPROOT="$$(pwd)/debian/tmp" \
	  && export CONTROL="$$(pwd)/debian/tmp-lyx-qt/DEBIAN" \
	  && export PACKAGE="lyx-qt" \
	  && export SOURCE="lyx" \
	  && export VERSION="$(VERSION)" && (\
	echo -E 'eval "yada () { perl $$(which yada) \"\$$@\"; }"; set -e; set -v';\
	echo -E 'yada perl';\
	echo -E 'yada python';\
	echo -E 'yada strip';\
	echo -E 'yada shlibdeps') | /bin/sh
	yada compress lyx-qt
	yada generate maintscripts lyx-qt
	find debian/tmp-lyx-qt -type f -print \
	  | sed -n 's/^debian\/tmp-lyx-qt\(\/etc\/.*\)$$/\1/p' \
	  > debian/tmp-lyx-qt/DEBIAN/conffiles
	if test ! -s debian/tmp-lyx-qt/DEBIAN/conffiles; then rm -f debian/tmp-lyx-qt/DEBIAN/conffiles; fi
	yada rebuild control
	yada generate substvars lyx-qt
	-rmdir debian/tmp-lyx-qt/usr/share/doc/lyx-common
	umask 022 && dpkg-gencontrol -isp -plyx-qt -Pdebian/tmp-lyx-qt

debian/tmp-lyx-common/DEBIAN/control: debian/build-stamp debian/control
	rm -rf debian/tmp-lyx-common
	umask 022 && install -d debian/tmp-lyx-common/DEBIAN
	install -d debian/tmp-lyx-common/usr/share/doc/lyx-common
	umask 022; yada generate copyright \
	  > debian/tmp-lyx-common/usr/share/doc/lyx-common/copyright
	install -m 644 -p debian/changelog \
	  debian/tmp-lyx-common/usr/share/doc/lyx-common/changelog.Debian
	@umask 022 \
	  && export pwd="$$(pwd)" \
	  && export ROOT="$$(pwd)/debian/tmp-lyx-common" \
	  && export TMPROOT="$$(pwd)/debian/tmp" \
	  && export CONTROL="$$(pwd)/debian/tmp-lyx-common/DEBIAN" \
	  && export PACKAGE="lyx-common" \
	  && export SOURCE="lyx" \
	  && export VERSION="$(VERSION)" \
	  && export DEB_HOST_GNU_CPU="$(DEB_HOST_GNU_CPU)" \
	  && export DEB_HOST_GNU_TYPE="$(DEB_HOST_GNU_TYPE)" \
	  && export DEB_HOST_GNU_SYSTEM="$(DEB_HOST_GNU_SYSTEM)" \
	  && export DEB_BUILD_GNU_CPU="$(DEB_BUILD_GNU_CPU)" \
	  && export DEB_BUILD_GNU_TYPE="$(DEB_BUILD_GNU_TYPE)" \
	  && export DEB_BUILD_GNU_SYSTEM="$(DEB_BUILD_GNU_SYSTEM)" && (\
	echo -E 'eval "yada () { perl $$(which yada) \"\$$@\"; }"; set -e; set -v';\
	echo -E 'yada install -dir /etc /usr/share/texmf/tex/latex';\
	echo -E 'cd build-tree-qt';\
	echo -E 'make install DESTDIR=$$ROOT';\
	echo -E 'cd ..';\
	echo -E 'yada install -script debian/scripts/dviprint debian/scripts/update-lyxrc';\
	echo -E 'yada install -script -into /usr/share/lyx/scripts debian/scripts/lyx*.sh';\
	echo -E 'yada remove -bin lyx';\
	echo -E 'yada remove -man lyx.1';\
	echo -E 'yada remove -into /usr/share/lyx configure.cmd lyxrc.defaults packages.lst textclass.lst';\
	echo -E 'yada remove -into /usr/share/lyx/doc LaTeXConfig.lyx';\
	echo -E 'chmod +x $$ROOT/usr/share/lyx/reLyX/reLyXmain.pl';\
	echo -E 'chmod -x $$ROOT/usr/share/lyx/lyx2lyx/*.py $$ROOT/usr/share/lyx/lyx2lyx/*.pyc';\
	echo -E 'mv $$ROOT/usr/share/lyx/tex $$ROOT/usr/share/texmf/tex/latex/lyx';\
	echo -E 'sed -e '\''s/#\\print_command dvips/\\print_command dviprint/'\'' < lib/lyxrc.example > $$ROOT/etc/lyxrc';\
	echo -E 'yada remove -into /usr/share/lyx lyxrc.example';\
	echo -E 'yada symlink -into /usr/share/lyx -as lyxrc.example /etc/lyxrc';\
	echo -E 'yada install -man debian/man/noweb2lyx.1 debian/man/dviprint.1 update-lyxrc.1';\
	echo -E 'yada install -doc ANNOUNCE NEWS README UPGRADING') | /bin/sh
	@umask 022 \
	  && export pwd="$$(pwd)" \
	  && export ROOT="$$(pwd)/debian/tmp-lyx-common" \
	  && export TMPROOT="$$(pwd)/debian/tmp" \
	  && export CONTROL="$$(pwd)/debian/tmp-lyx-common/DEBIAN" \
	  && export PACKAGE="lyx-common" \
	  && export SOURCE="lyx" \
	  && export VERSION="$(VERSION)" && (\
	echo -E 'eval "yada () { perl $$(which yada) \"\$$@\"; }"; set -e; set -v';\
	echo -E 'yada perl';\
	echo -E 'yada python';\
	echo -E 'yada strip';\
	echo -E 'yada shlibdeps') | /bin/sh
	yada compress lyx-common
	yada generate maintscripts lyx-common
	find debian/tmp-lyx-common -type f -print \
	  | sed -n 's/^debian\/tmp-lyx-common\(\/etc\/.*\)$$/\1/p' \
	  > debian/tmp-lyx-common/DEBIAN/conffiles
	if test ! -s debian/tmp-lyx-common/DEBIAN/conffiles; then rm -f debian/tmp-lyx-common/DEBIAN/conffiles; fi
	yada rebuild control
	yada generate substvars lyx-common
	umask 022 && dpkg-gencontrol -isp -plyx-common -Pdebian/tmp-lyx-common

debian/tmp-lyx/DEBIAN/control: debian/build-stamp debian/control
	rm -rf debian/tmp-lyx
	umask 022 && install -d debian/tmp-lyx/DEBIAN
	install -d debian/tmp-lyx/usr/share/doc/lyx
	umask 022; yada generate copyright \
	  > debian/tmp-lyx/usr/share/doc/lyx/copyright
	install -m 644 -p debian/changelog \
	  debian/tmp-lyx/usr/share/doc/lyx/changelog.Debian
	@umask 022 \
	  && export pwd="$$(pwd)" \
	  && export ROOT="$$(pwd)/debian/tmp-lyx" \
	  && export TMPROOT="$$(pwd)/debian/tmp" \
	  && export CONTROL="$$(pwd)/debian/tmp-lyx/DEBIAN" \
	  && export PACKAGE="lyx" \
	  && export SOURCE="lyx" \
	  && export VERSION="$(VERSION)" \
	  && export DEB_HOST_GNU_CPU="$(DEB_HOST_GNU_CPU)" \
	  && export DEB_HOST_GNU_TYPE="$(DEB_HOST_GNU_TYPE)" \
	  && export DEB_HOST_GNU_SYSTEM="$(DEB_HOST_GNU_SYSTEM)" \
	  && export DEB_BUILD_GNU_CPU="$(DEB_BUILD_GNU_CPU)" \
	  && export DEB_BUILD_GNU_TYPE="$(DEB_BUILD_GNU_TYPE)" \
	  && export DEB_BUILD_GNU_SYSTEM="$(DEB_BUILD_GNU_SYSTEM)" && (\
	echo -E 'eval "yada () { perl $$(which yada) \"\$$@\"; }"; set -e; set -v';\
	echo -E 'yada install -doc -as README.Debian debian/README') | /bin/sh
	@umask 022 \
	  && export pwd="$$(pwd)" \
	  && export ROOT="$$(pwd)/debian/tmp-lyx" \
	  && export TMPROOT="$$(pwd)/debian/tmp" \
	  && export CONTROL="$$(pwd)/debian/tmp-lyx/DEBIAN" \
	  && export PACKAGE="lyx" \
	  && export SOURCE="lyx" \
	  && export VERSION="$(VERSION)" && (\
	echo -E 'eval "yada () { perl $$(which yada) \"\$$@\"; }"; set -e; set -v';\
	echo -E 'yada perl';\
	echo -E 'yada python';\
	echo -E 'yada strip';\
	echo -E 'yada shlibdeps') | /bin/sh
	yada compress lyx
	yada generate maintscripts lyx
	find debian/tmp-lyx -type f -print \
	  | sed -n 's/^debian\/tmp-lyx\(\/etc\/.*\)$$/\1/p' \
	  > debian/tmp-lyx/DEBIAN/conffiles
	if test ! -s debian/tmp-lyx/DEBIAN/conffiles; then rm -f debian/tmp-lyx/DEBIAN/conffiles; fi
	yada rebuild control
	yada generate substvars lyx
	umask 022 && dpkg-gencontrol -isp -plyx -Pdebian/tmp-lyx

# Build package files

.PHONY: binary binary-arch binary-indep
binary: binary-arch binary-indep
binary-arch: binary-arch-any

.PHONY: binary-arch-any
binary-arch-any: \
	binary-package-lyx-xforms \
	binary-package-lyx-qt
binary-indep: \
	binary-package-lyx-common \
	binary-package-lyx

.PHONY: binary-package-lyx-xforms
binary-package-lyx-xforms: check-root debian/tmp-lyx-xforms/DEBIAN/control
	@[ -f $(shell which yada) -a -f debian/rules ]
	chown -R 0.0 debian/tmp-lyx-xforms
	chmod -R u=rwX,go=rX debian/tmp-lyx-xforms
	@if [ -d debian/tmp-lyx-xforms/usr/doc/lyx-xforms ]; then \
	  echo "*** Yada warning: /usr/doc/lyx-xforms should be /usr/share/doc/lyx-xforms";\
	fi
	dpkg-deb --build debian/tmp-lyx-xforms ..

.PHONY: binary-package-lyx-qt
binary-package-lyx-qt: check-root debian/tmp-lyx-qt/DEBIAN/control
	@[ -f $(shell which yada) -a -f debian/rules ]
	chown -R 0.0 debian/tmp-lyx-qt
	chmod -R u=rwX,go=rX debian/tmp-lyx-qt
	@if [ -d debian/tmp-lyx-qt/usr/doc/lyx-qt ]; then \
	  echo "*** Yada warning: /usr/doc/lyx-qt should be /usr/share/doc/lyx-qt";\
	fi
	dpkg-deb --build debian/tmp-lyx-qt ..

.PHONY: binary-package-lyx-common
binary-package-lyx-common: check-root debian/tmp-lyx-common/DEBIAN/control
	@[ -f $(shell which yada) -a -f debian/rules ]
	chown -R 0.0 debian/tmp-lyx-common
	chmod -R u=rwX,go=rX debian/tmp-lyx-common
	@if [ -d debian/tmp-lyx-common/usr/doc/lyx-common ]; then \
	  echo "*** Yada warning: /usr/doc/lyx-common should be /usr/share/doc/lyx-common";\
	fi
	dpkg-deb --build debian/tmp-lyx-common ..

.PHONY: binary-package-lyx
binary-package-lyx: check-root debian/tmp-lyx/DEBIAN/control
	@[ -f $(shell which yada) -a -f debian/rules ]
	chown -R 0.0 debian/tmp-lyx
	chmod -R u=rwX,go=rX debian/tmp-lyx
	@if [ -d debian/tmp-lyx/usr/doc/lyx ]; then \
	  echo "*** Yada warning: /usr/doc/lyx should be /usr/share/doc/lyx";\
	fi
	dpkg-deb --build debian/tmp-lyx ..

.PHONY: check-root
check-root:
	@[ `id -u` = 0 ] || (echo "You must be root to do this!"; false)

debian/packages-tmp: debian/packages 
	yada rebuild packages

## Clean up afterwards

.PHONY: clean clean-install-tree clean-build

clean: clean-install-tree clean-build debian/control debian/rules
	rm -f debian/packages-tmp debian/packages-tmp-new debian/packages-tmp-include

clean-build:
	@[ -f $(shell which yada) -a -f debian/rules ]
	rm -f debian/build-stamp debian/build-arch-stamp debian/build-indep-stamp
	@umask 022 \
	  && export pwd="$$(pwd)" \
	  && export TMPROOT="$$(pwd)/debian/tmp" \
	  && export SOURCE="lyx" \
	  && export VERSION="$(VERSION)" \
	  && export DEB_HOST_GNU_CPU="$(DEB_HOST_GNU_CPU)" \
	  && export DEB_HOST_GNU_TYPE="$(DEB_HOST_GNU_TYPE)" \
	  && export DEB_HOST_GNU_SYSTEM="$(DEB_HOST_GNU_SYSTEM)" \
	  && export DEB_BUILD_GNU_CPU="$(DEB_BUILD_GNU_CPU)" \
	  && export DEB_BUILD_GNU_TYPE="$(DEB_BUILD_GNU_TYPE)" \
	  && export DEB_BUILD_GNU_SYSTEM="$(DEB_BUILD_GNU_SYSTEM)" && (\
	echo -E 'eval "yada () { perl $$(which yada) \"\$$@\"; }"; set -e; set -v';\
	echo -E 'rm -rf autom4te.cache build-tree-qt build-tree-xforms || true';\
	echo -E 'rm -f update-lyxrc.1 || true') | /bin/sh
	yada unpatch
	rm -rf debian/tmp

clean-install-tree: debian/rules
	@[ -f $(shell which yada) -a -f debian/rules ]
	rm -f debian/install-tree-stamp
	rm -rf debian/tmp-* debian/files* debian/substvars debian/shlibs.local debian/ucf