File: rules

package info (click to toggle)
advi 1.6.0-12%2Betch2
  • links: PTS
  • area: main
  • in suites: etch
  • size: 17,524 kB
  • ctags: 2,830
  • sloc: ml: 12,261; sh: 4,299; ansic: 935; makefile: 748; perl: 57; tcl: 10
file content (193 lines) | stat: -rwxr-xr-x 6,315 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# We want to use dpatch.
include /usr/share/dpatch/dpatch.make
PACKAGE = advi
VERSION = 1.6.0

export DH_VERBOSE=1

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)

BACKUP_SOURCE = doc/manual.dvi \
		doc/manual.ps          \
		doc/manual.pdf         \
		doc/splash.dvi         \
		test/background.dvi    \
		test/color.dvi         \
		test/demo.dvi          \
		test/demo2.dvi         \
		test/demo_raw.dvi      \
		test/jpdemo.dvi        \
		test/trans.dvi         \
		test/trans2.dvi        \
		test/trans3.dvi        \
		test/trigo_source.dvi

OPTOPT = $(shell test -x /usr/bin/ocamlopt.opt && echo true)
OPT = $(shell test -x /usr/bin/ocamlopt && echo true)
# the native compiler is b0rked on arm, don't try to use it
ifeq ($(DEB_BUILD_ARCH),arm)
	OPT = false
	OPTOPT = false
endif

CFLAGS = -Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

config.status: configure
	dh_testdir
	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
	  --prefix=/usr --mandir=\$${prefix}/share/man \
	  --infodir=\$${prefix}/share/info

backup: backup-stamp
backup-stamp: 
	#for i in $(BACKUP_SOURCE); do /bin/cp -f $$i $$i.back; done
	touch backup-stamp
backup-clean:
	#if [ -e backup-stamp ]; then \
	#   for i in $(BACKUP_SOURCE); do /bin/cp -f $$i.back $$i; /bin/rm $$i.back; done;\
	#fi
	$(RM) backup-stamp

build: build-stamp
build-stamp: patch-stamp config.status
	dh_testdir

	$(MAKE) dep
ifeq ($(OPTOPT),true)
	@echo "Building the native code version with the native compilers"
	$(MAKE) HAVE_OPT=".opt" bin
	touch opt-built-stamp
else
ifeq ($(OPT),true)
	@echo "Building the native code version"
	$(MAKE) HAVE_OPT="" bin
	touch opt-built-stamp
else
	@echo "Building the bytecode version"
	$(MAKE) byt
endif
endif
	$(MAKE) doc
	ln -s tex/advilogo.eps test/
	#ln -s tex/bar.eps test/
	cd test && $(MAKE)
	rm test/advilogo.eps
	#rm test/bar.eps
	cd test && rm -fR *~ *.aux *.cmi *.cmo *.log *.out *.ps *.toc a.out adviclock test_cursors test_gpic.tex .advi/*

	ln -s tex/bar.eps examples/basics/
	cd examples && $(MAKE)
	rm examples/basics/bar.eps

	#We copy the man file manually
# FIXME We need to replace $Version (because we use the src, not the build one). Should we hardcode to the one found in
#       the pre-build version? Right now simply copy if make clean killed it (on freshly unpacked source, we use the
#       original; in the long run make clean has to be fixed
	#if [ ! -e doc/advi.1 ]; then cp -p doc_src/advi.man doc/advi.1; fi
	if [ ! -e doc/advi.1 ]; then cat doc_src/advi.man|sed 's/$$version/$(VERSION)/' > doc/advi.1; fi

	cd doc && $(MAKE)

	touch build-stamp

clean: realclean unpatch backup-clean

backup-clean: realclean
unpatch: realclean
realclean: patch-stamp backup
	dh_testdir
	dh_testroot
	rm -f build-stamp opt-built-stamp
	rm -f doc/advi.1
	-$(MAKE) veryclean
	rm -f .depend
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	if [ -e opt-built-stamp ]; then \
		$(MAKE) installbin DESTDIR=$(CURDIR)/debian/advi; \
	else \
		$(MAKE) installbyt DESTDIR=$(CURDIR)/debian/advi \
			INSTALLTARGET=advi; \
	fi
	chrpath -d $(CURDIR)/debian/advi/usr/bin/advi
	cp debian/utils/zadvi $(CURDIR)/debian/advi/usr/bin/zadvi
	echo "-cache-dir ~/.advi-cache" >> $(CURDIR)/debian/advi/etc/advirc


# Build architecture-independent files here.
binary-indep: build install
	dh_testdir -i
	dh_testroot -i 
	dh_installdocs -i
	dh_installexamples -i -X.aux -X.cmi -X.cmo -X.log -X.out -X.toc
	mkdir -p $(CURDIR)/debian/advi/usr/share/doc/advi/manual
	cd doc && cp -ivp mathmode.dvi splash.dvi scratch_write_splash.dvi scratch_draw_splash.dvi advi_remote.dvi manual.pdf $(CURDIR)/debian/advi/usr/share/doc/advi/manual
	mv $(CURDIR)/debian/advi-examples/usr/share/doc/advi-examples/examples/examples \
	   $(CURDIR)/debian/advi-examples/usr/share/doc/advi-examples/examples/upstream-examples
	rm $(CURDIR)/debian/advi-examples/usr/share/doc/advi-examples/examples/upstream-examples/seminar/a14/fig/*.png
	rm $(CURDIR)/debian/advi-examples/usr/share/doc/advi-examples/examples/upstream-examples/seminar/a14/fig/*.gif
	dh_installchangelogs -i
	dh_compress -i -Xadviback.ppm -X.mp3 -Xtaquin -Xfumicamltrans.ppm -Xinria.ps -Xmanual.pdf
	cd $(CURDIR)/debian/advi-examples/usr/share/doc/advi-examples/examples/upstream-examples/seminar/a14/fig/ && gunzip *.eps.gz
	cd $(CURDIR)/debian/advi-examples/usr/share/doc/advi-examples/examples/upstream-examples/seminar/clock/ && gunzip *.eps.gz
	cd $(CURDIR)/debian/advi-examples/usr/share/doc/advi-examples/examples/upstream-examples/slitex/skin_detection/ && gunzip *.eps.gz
	rm $(CURDIR)/debian/advi-examples/usr/share/doc/advi-examples/examples/upstream-examples/slitex/caml/inria.ps
	dh_fixperms -i
	chmod 644 $(CURDIR)/debian/advi-examples/usr/share/doc/advi-examples/examples/upstream-examples/prosper/LL/pdfrotate.pl
	chmod 644 $(CURDIR)/debian/advi-examples/usr/share/doc/advi-examples/examples/upstream-examples/basics/alltt.sty
	chmod 644 $(CURDIR)/debian/advi-examples/usr/share/doc/advi-examples/examples/test/mmm.anim.gif
	chmod 644 $(CURDIR)/debian/advi-examples/usr/share/doc/advi-examples/examples/test/music.mp3
# FIXME Also for ./examples/upstream-examples/seminar/a14/putimage ?
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_installdocs -a
	#dh_installexamples
	dh_installmenu -a
	dh_installman -a doc/advi.1
	dh_installchangelogs -a
	dh_link -a
	if [ -e opt-built-stamp ]; then \
		dh_strip -a; \
	else \
		dh_strip -a -Xadvi; \
	fi
	dh_compress -a 
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install