File: rules

package info (click to toggle)
octave2.1 1%3A2.1.73-13
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 37,028 kB
  • ctags: 20,874
  • sloc: cpp: 106,508; fortran: 46,978; ansic: 5,720; sh: 4,800; makefile: 3,186; yacc: 3,132; lex: 2,892; lisp: 1,715; perl: 778; awk: 174; exp: 134
file content (382 lines) | stat: -rwxr-xr-x 11,466 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
#!/usr/bin/make -f
# 							-*- makefile -*-
# debian/rules file for the Debian/GNU Linux octave package
# Copyright 1997-99,2000-03 by Dirk Eddelbuettel <edd@debian.org>
#
# $Id: rules 720 2006-08-20 11:03:37Z rafael $

include /usr/share/dpatch/dpatch.make

# in order: octave, octave2.1, 2.1.28, 2.1  (or whatever the version is)
source		:= $(shell head -1 debian/changelog | \
			perl -nle 'm/^([a-z]+)/ and print $$1')
PACKAGE		:= $(shell head -1 debian/changelog | \
			perl -nle 'm/^(\S+)\s+/ and print $$1')
version       	:= $(shell head -1 debian/changelog | \
			perl -nle 'm/\S+\s+\((?:\d:)*(\S+)-\S+\)/ and print $$1')
major       	:= $(shell echo $(version) | perl -nle \
			'm/(\d\.\d)\.\d+/ and print $$1')

ifeq ($(major),2.1)
priority	:= 80
else
priority	:= 70
endif

doc_package	= $(PACKAGE)-doc
html_package	= $(PACKAGE)-htmldoc
dev_package	= $(PACKAGE)-headers
emacs_package	= $(PACKAGE)-emacsen
info_package	= $(PACKAGE)-info

debbase		:= $(CURDIR)/debian
debtmp		:= $(debbase)/$(PACKAGE)
debdoc		:= $(debtmp)/usr/share/doc/$(PACKAGE)
debhtmldoc	:= $(debtmp)-htmldoc/usr/share/doc/$(PACKAGE)-htmldoc
deblsp		:= $(debbase)/$(emacs_package)/usr/share/emacs/site-lisp/$(emacs_package)
debini		:= $(debtmp)/usr/share/octave/site/m/startup
debininew	:= $(debtmp)/usr/share/octave/$(version)/m/startup

savefiles	:= configure config.h.in scripts/configure
texifiles	:= doc/interpreter/octave.texi		\
			doc/liboctave/liboctave.texi	\
			doc/faq/Octave-FAQ.texi

## edd  3 Feb 2003  gcc 3.2, also imposed uniformly via Build-Depends
## edd 27 Jun 2003  now that gcc 3.3 is in unstable and testing, relax this
#c_compiler	= /usr/bin/gcc-3.3
#cxx_compiler	= /usr/bin/g++-3.3
#f77_compiler	= /usr/bin/g77-3.3
c_compiler	= /usr/bin/gcc
cxx_compiler	= /usr/bin/g++
f77_compiler	= /usr/bin/gfortran
fc_flag		= --with-f77=$(f77_compiler)
fc_libs		=
compilerflags	= -O2
linkerflags	= -s

# default to blas, atlas can overload where available (see README.Atlas)
#atlas		= --with-blas=/usr/lib/libblas.so \
#		  --with-lapack=/usr/lib/liblapack.so
#atlas		= --with-blas=/usr/lib/libblas-3.so \
#		  --with-lapack=/usr/lib/liblapack-3.so
atlas		= --with-blas=-lblas-3 --with-lapack=-llapack-3

arch 		:= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

## edd 20 Jun 2002      no optimisation or debugging on baby systems
ifneq "$(findstring $(arch), arm-linux-gnu)" ""
compilerflags	= -O0 -g0
endif

# edd 25 Aug 2002  arm does not have atlas
ifeq ($(arch),arm-linux)
atlas		= --without-blas
endif

#export DH_VERBOSE=1

sliceterm = UNDEF+V_$(shell echo $(major) | sed s/\\./_/g)

debian/control: debian/in/control
	slice -o $(sliceterm):$@ $<

maintainer-clean:
	rm -f debian/control

maintainer-scripts:
	for in in debian/in/PACKAGE* ; do \
		out=`echo $$in | sed 's:/in/:/:;s/PACKAGE/$(PACKAGE)/'` ; \
		sed 's/@VERSION@/$(version)/g;s/@PACKAGE@/$(PACKAGE)/g;s/@MAJOR@/$(major)/g;s/@PRIORITY@/$(priority)/g;' \
			< $$in > $$out ; \
	done

	for f in octave-depends defs.make ; do \
		sed 's/@VERSION@/$(version)/g;s/@MAJOR@/$(major)/g' \
			< debian/in/$$f > debian/$$f ; \
	done
	cp debian/in/$(PACKAGE)-00list debian/patches/00list
	cp debian/in/$(PACKAGE)-watch debian/watch
	slice -o $(sliceterm):debian/$(PACKAGE).conf debian/in/PACKAGE.conf

get-orig-source: upstream
upstream:
	links ftp://ftp.octave.org/pub/octave/bleeding-edge

$(patsubst %,build-%,arch indep) :: build-% : \
		build-%-stamp configure-stamp make-%-stamp check-stamp
$(patsubst %,build-%-stamp,arch indep) :: build-%-stamp : \
		configure make-% check
	touch $@

configure: maintainer-scripts patch-stamp configure-stamp
configure-stamp:
	dh_testdir

	for f in $(savefiles) ; do	\
		cp $$f $$f-save ;				\
	done

	[ -f autogen.sh ] &&  ./autogen.sh && chmod 0755 configure

	DEFAULT_PAGER=pager				\
	CC=$(c_compiler) 				\
	CXX=$(cxx_compiler)				\
	F77=$(f77_compiler)				\
	FLIBS=$(fc_libs)				\
	infofile=/usr/share/info/$(PACKAGE).info	\
	./configure					\
			--prefix=/usr			\
			--datadir=/usr/share		\
			--libdir=/usr/lib		\
			--libexecdir=/usr/lib		\
			--infodir=/usr/share/info	\
			--mandir=/usr/share/man		\
			$(atlas)			\
			--with-hdf5			\
			--with-fftw			\
			$(fc_flag)			\
			--enable-shared			\
			--enable-rpath			\
			--disable-static		\
			--build $(arch)

	pod2man debian/octave-depends > octave-depends-$(version).1

	for f in $(texifiles) ; do					\
		cp $$f $$f-save ; 					\
		perl -pi -e 's/^(\@setfilename .+ctave)/$${1}$(major)/'	\
			$$f ; 						\
	done

	chmod +x debian/subdirs-vars.pl
	cp octMakefile octMakefile-orig
	for i in no-doc only-doc ; do				\
		debian/subdirs-vars.pl $$i			\
			< octMakefile > octMakefile-$$i ;	\
	done

	touch configure-stamp

make-arch: configure-stamp make-arch-stamp
make-arch-stamp:

	ln -fs octMakefile-no-doc octMakefile
	$(MAKE)		CFLAGS="$(compilerflags)"		\
			CXXFLAGS="$(compilerflags)"		\
			FFLAGS="$(compilerflags)"		\
			LDFLAGS="$(linkerflags)"		\
			CC="$(c_compiler)"			\
			CXX="$(cxx_compiler)"			\
			F77="$(f77_compiler)"

	touch make-arch-stamp

make-indep: configure-stamp make-indep-stamp
make-indep-stamp:

	ln -fs octMakefile-only-doc octMakefile
	$(MAKE)

	touch make-indep-stamp

check: configure-stamp make-arch-stamp check-stamp
check-stamp:
	ln -fs octMakefile-no-doc octMakefile
	-$(MAKE) 	check
	touch check-stamp

clean: unpatch
	dh_testdir
	dh_testroot

	-$(MAKE) -C doc clean
	-$(MAKE) -C doc/interpreter/images distclean
	-$(MAKE) -C doc maintainer-clean
	find doc -name \*.info\* | xargs rm -f

	-test -f octMakefile-orig && mv octMakefile-orig octMakefile
	-$(MAKE) -i distclean || $(MAKE) -f Makefile.in distclean

	rm -f build-*-stamp configure-stamp make-*-stamp check-stamp	\
		install-*-stamp Makefile.tmp octMakefile-*

	-for f in $(savefiles) ; do	\
		test -f $$f-save && mv $$f-save $$f ;			\
	done

	rm -f `ls debian/in/PACKAGE* | sed 's/PACKAGE/$(PACKAGE)/;s:/in::'`
	rm -f octave-depends-$(version).1
	( cd debian ; rm -f watch octave-depends defs.make )

	-for f in $(texifiles) ; do					\
		test -f $$f-save && mv $$f-save $$f ;			\
	done

	dh_clean

install: install-arch install-indep

install-indep: configure-stamp make-indep-stamp install-indep-stamp
install-indep-stamp :
	dh_testdir
	dh_testroot
	dh_installdirs -A

	ln -fs octMakefile-only-doc octMakefile
	$(MAKE) INSTALL_PROGRAM="install -s" DESTDIR=$(debtmp)	\
		install

	touch install-indep-stamp

install-arch: configure-stamp make-arch-stamp check-stamp install-arch-stamp
install-arch-stamp :
	dh_testdir
	dh_testroot
	dh_installdirs -A

	ln -fs octMakefile-no-doc octMakefile
	$(MAKE) INSTALL_PROGRAM="install -s" DESTDIR=$(debtmp)	\
		install

	dh_installman				\
		octave-depends-$(version).1	\
		doc/interpreter/octave.1	\
		doc/interpreter/octave-bug.1	\
		doc/interpreter/mkoctfile.1	\
		doc/interpreter/octave-config.1

	install debian/octave-depends \
		 $(debtmp)/usr/bin/octave-depends-$(version)
	install --mode=644 debian/defs.make \
		$(debtmp)/usr/share/octave/debian/defs.make-$(version)

	(cd $(debtmp)/usr/share/man/man1; 				\
		mv -v	octave.1	octave-$(version).1;    	\
		ln -s	octave-$(version).1	octave$(major).1;	\
		mv -v   octave-bug.1	octave-bug-$(version).1;	\
		mv -v	octave-config.1	octave-config-$(version).1;   	\
		mv -v   mkoctfile.1	mkoctfile-$(version).1;		)
	(cd $(debtmp)/usr/bin; 						\
		rm -v   octave	octave-bug mkoctfile octave-config)

	touch install-arch-stamp

binary-indep: build-indep install-indep
	dh_testdir -i
	dh_testroot -i

        # already installed by make
	dh_installinfo -n -p$(info_package)  	doc/*/*$(major)*.info*

	dh_installdocs -n -p$(doc_package) doc/*/*.pdf
	dh_installdocs -i
	for dir in faq interpreter liboctave ; do			\
		test -d $(debhtmldoc)/$$dir				\
			|| mkdir $(debhtmldoc)/$$dir ;			\
		find doc/$$dir \( -name \*.html -o -name \*.png \) 	\
			 -exec cp \{} $(debhtmldoc)/$$dir \; ;		\
	done

        # install Octave Emacs files and Debian Emacsen files
	dh_installdirs -p$(emacs_package)
	dh_installdirs -p$(emacs_package) \
		usr/share/emacs/site-lisp/$(emacs_package)
	install -p -m 0644 emacs/*.el		$(deblsp)
	dh_installemacsen -p$(emacs_package)
	install -p -m 0755 emacs/otags			\
		$(debbase)/$(emacs_package)/usr/bin/octave-tags-$(version)
	install -p -m 0644 emacs/otags.1			\
	     $(debbase)/$(emacs_package)/usr/share/man/man1/octave-tags-$(version).1

	dh_installchangelogs -i			ChangeLog
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: build-arch install-arch check
	dh_testdir -a
	dh_testroot -a
	dh_installdirs -p$(PACKAGE)

        # remove the /usr/share/info/dir stab
	rm -vf $(debtmp)/usr/share/info/dir

        # save the include files for the header package
	dh_movefiles -p$(dev_package) --sourcedir=debian/$(PACKAGE)	\
			usr/include/		 			\
			usr/bin/mkoctfile-$(version) 			\
			usr/bin/octave-config-$(version)		\
			usr/bin/octave-depends-$(version) 		\
			usr/share/man/man1/mkoctfile-$(version).1	\
			usr/share/man/man1/octave-config-$(version).1	\
			usr/share/man/man1/octave-depends-$(version).1	\
			usr/share/octave/debian/defs.make-$(version)
	rm -r $(debtmp)/usr/include
	rm -rf $(debtmp)/usr/share/info

	install -p -m 0644  debian/$(PACKAGE).conf  $(debtmp)/etc

        # install lintian overrride
	install -p -m 0644  debian/$(PACKAGE).lintian \
			$(debtmp)/usr/share/lintian/overrides/$(PACKAGE)

        ## link the conf.file back from /etc over the version.spec. rc
	ln -sf /etc/$(PACKAGE).conf 		$(debininew)/octaverc
        ## this file would exist under 2.0 and 2.1 with the same name
	rm -v 					$(debini)/octaverc

	dh_installdocs -a			README README.kpathsea	\
						NEWS* PROJECTS THANKS	\
						BUGS SENDING-PATCHES
	dh_installdocs -p$(PACKAGE) 		debian/README.Atlas
        # recreated in postinst in share/, not needed in lib
	rm -vf	$(debtmp)/usr/lib/octave/ls-R \
		$(debtmp)/usr/share/octave/ls-R

	dh_installexamples  -p$(dev_package)  	examples/*
	dh_installmenu -p$(PACKAGE)
	dh_installchangelogs -a ChangeLog ChangeLog.1
	for i in glob libcruft liboctave src scripts test doc; do \
		cp -vax $$i/ChangeLog $(debdoc)/changelog.$$i; done
	# make octaveX.Y a symlink to octave-x.y.z and link the manpage to octaveX.Y
	dh_link --package=$(PACKAGE) \
		usr/bin/octave-$(version) usr/bin/$(PACKAGE)
	dh_link --package=$(PACKAGE) \
		usr/share/man/man1/octave-$(version).1.gz \
		usr/share/man/man1/octave$(major).1.gz
	# make mkoctfileX.Y a symlink and symlink the manpage as well
	dh_link --package=$(dev_package) \
		usr/bin/mkoctfile-$(version) usr/bin/mkoctfile$(major)
	dh_link --package=$(dev_package) \
		usr/share/man/man1/mkoctfile-$(version).1.gz \
		usr/share/man/man1/mkoctfile$(major).1.gz
	# make octaveX.Y-depends a symlink and symlink the manpage as well
	dh_link --package=$(dev_package) \
		usr/bin/octave-depends-$(version) \
		usr/bin/octave$(major)-depends
	dh_link --package=$(dev_package) \
		usr/share/man/man1/octave-depends-$(version).1.gz \
		usr/share/man/man1/octave$(major)-depends.1.gz
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	if [ `dpkg-architecture -qDEB_BUILD_ARCH` = "m68k" ];then \
		echo "m68k:Depends=f2c" >> debian/$(PACKAGE)-headers.substvars; \
	fi
	dh_gencontrol -a
	dh_builddeb -a

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

binary: binary-arch binary-indep
.PHONY: build clean make configure binary-indep binary-arch binary

.NOTPARALLEL: