File: rules

package info (click to toggle)
ifeffit 1%3A1.3.0-3
  • links: PTS
  • area: contrib
  • in suites: etch, etch-m68k
  • size: 13,652 kB
  • ctags: 7,237
  • sloc: fortran: 33,599; ansic: 26,405; sh: 7,184; makefile: 5,469; python: 3,273; perl: 3,146; tcl: 95
file content (240 lines) | stat: -rwxr-xr-x 7,313 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
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This will fix the rpath lintian warning but breaks the python extensions.
# For now, we have kludged a solution in the build-perl stanza below.
#export FLIBS = -lfrtbegin -lg2c -lm -lgcc_s 

# change this when default Python version increases
PYVERS=$(shell pyversions -vr)

ifndef PERL
PERL = /usr/bin/perl
endif

# 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)


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

# This rule is used by the package maintainer to refresh the 
# documentation which is not included in the original tarball
# but is freely available on the program homepage.  It requires 
# wget to be installed and only needs to be run occasionally. 
get-docs:
	cd debian && \
	 wget http://cars9.uchicago.edu/~newville/feffit/feffit.ps && \
	 wget http://cars9.uchicago.edu/~newville/autobk/ProgramDoc/autobk.ps && \
	 wget http://cars9.uchicago.edu/dafs/diffkk/diffkk.ps && \
	 wget http://leonardo.phys.washington.edu/feff/Docs/feff/feff6.ps

config.status: configure
	dh_testdir
# Add here commands to configure the package.
	./configure --host=$(DEB_HOST_GNU_TYPE) \
	 --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
	 --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info \
	 --with-pgplot=/usr/lib/pgplot5/ 

build: build-stamp

build-stamp: config.status build-ifeffit build-python-all build-perl
	touch $@

build-ifeffit:
	dh_testdir
	$(MAKE) OPTIMIZE="$(CFLAGS)"
	touch $@

build-python-all: $(PYVERS:%=build-python%)
	cd wrappers/python && \
	 python setup.py build_scripts --build-dir=build/scripts || exit 1 ; 
	touch $@

# Build Python extensions for each version of Python
build-python%:
	dh_testdir
	cd wrappers/python && python$* setup.py build || exit 1 ; 
	touch $@

# Configure and build Perl extensions.  This must be done
# AFTER the main package is built
build-perl: build-ifeffit
	dh_testdir
# Here is the kludge to avoid the rpath lintian warning
	cp debian/Makefile.PL wrappers/perl/
	cd wrappers/perl && \
	 $(PERL) Makefile.PL INSTALLDIRS=vendor && \
	 $(MAKE) OPTIMIZE="$(CFLAGS)"
	touch $@

build-docs:
	dh_testdir
	mkdir tmp_docs
	cp -a examples tmp_docs
	-find tmp_docs/examples -name 'CVS' | xargs rm -rf
	chmod -R 0644 tmp_docs/examples/*
	rm -rf tmp_docs/examples/scripting
# get postscript documentation and convert to PDF
	mkdir tmp_docs/pdf
# Uncomment this if we want to download other documents during build.
# I am not sure this is a good thing for the buildds to do, so 
# leave it out for now.
	ps2pdf debian/feffit.ps tmp_docs/pdf/feffit.pdf ; \
	ps2pdf debian/autobk.ps tmp_docs/pdf/autobk.pdf ; \
	ps2pdf debian/diffkk.ps tmp_docs/pdf/diffkk.pdf ; \
	ps2pdf debian/feff6.ps tmp_docs/pdf/feff6.pdf ; \
	cd doc/Tutorial && make pdf && \
	 mv tutor.pdf ../../tmp_docs/pdf/ifeffit_tutorial.pdf
	cd doc/RefMan && make pdf && \
	 mv refman.pdf ../../tmp_docs/pdf/ifeffit_reference.pdf
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp build-ifeffit build-python* build-perl build-docs

	-$(MAKE) distclean
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
	cp -f /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
	cp -f /usr/share/misc/config.guess config.guess
endif

# Clean up any config leftovers in original tarball
	rm -f wrappers/perl/Makefile.PL
	rm -f wrappers/perl/Makefile
	rm -f wrappers/python/site_install.py
	rm -f wrappers/tcl/TclSetup.in
	rm -f readline/config.log
	rm -f readline/config.status
	rm -f readline/stamp-h
	rm -f readline/config.h
	rm -f readline/Makefile
	rm -f readline/doc/Makefile
	rm -f readline/shlib/Makefile
	rm -f readline/examples/Makefile

# Clean up PDF downloaded documents
	rm -rf tmp_docs
	cd doc/Tutorial && make clean && rm -f *.bak
	cd doc/RefMan && make clean && rm -f *.bak

# Clean up Python extensions
	rm -rf wrappers/python/*.pyc
	rm -rf wrappers/python/build
	rm -rf build

# Clean up Perl extensions
	rm -rf wrappers/perl/blib
	rm -rf wrappers/perl/pm-to-blib
	rm -rf wrappers/perl/*.o
	rm -rf wrappers/perl/*.bs
	rm -rf wrappers/perl/Makefile

	dh_clean

install: build install-prereq install-ifeffit install-python-all install-perl

install-prereq:
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

install-ifeffit:
	$(MAKE) install prefix=$(CURDIR)/debian/ifeffit/usr

# Install Python extensions into debian/python-ifeffit.
# Make sure to remove all the *.pyc and *.pyo compiled files
# from the package since they will be generated in the 
# postinst scripts and removed in the prerm scripts.
install-python-all: $(PYVERS:%=install-python%)
	cd wrappers/python && \
         python setup.py install_scripts --force \
	  --install-dir=$(CURDIR)/debian/python-ifeffit/usr/bin \
	  --build-dir=build/scripts || exit 1 ;
	dh_install --package=python-ifeffit debian/python-ifeffit.desktop \
	 usr/share/applications/

install-python%:
	cd wrappers/python && \
	 python$* setup.py install \
	  --prefix=$(CURDIR)/debian/python-ifeffit/usr || exit 1 ;
	-find $(CURDIR)/debian/ -name '*.py[co]' | xargs rm -f

# Install Perl extensions into debian/perl-ifeffit.
install-perl:
	cd wrappers/perl && $(MAKE) install \
	 PREFIX=$(CURDIR)/debian/perl-ifeffit/usr INSTALLDIRS=vendor
# The Makefile in wrappers/perl seems to be malformed and does not 
# install Ifeffit.pm in /usr/share/perl5.  We shall do it by hand ...
	dh_install --package=perl-ifeffit wrappers/perl/Ifeffit.pm \
	 usr/share/perl5/
# In fact, sometimes it puts them in /usr/lib/perl5 along with
# ifeffit_shell.pl and test_a.pl which we don't want for the pacakge.
# So get rid of 'em!
	rm -f $(CURDIR)/debian/perl-ifeffit/usr/lib/perl5/Ifeffit.pm
	rm -f $(CURDIR)/debian/perl-ifeffit/usr/lib/perl5/ifeffit_shell.pl
	rm -f $(CURDIR)/debian/perl-ifeffit/usr/lib/perl5/test_a.pl

install-docs: install-prereq

# Build architecture-independent files here.
binary-indep: build-docs install-docs
	dh_testdir -i
	dh_testroot -i
	dh_installdocs -i
	dh_installchangelogs ChangeLog -i
	dh_compress --exclude=.pdf --exclude=.iff --exclude=.dat \
	   --exclude=.chi --exclude=.xmu --exclude=.inp --exclude=.out \
	   --exclude=.sav --exclude=.py --exclude=LIST --exclude=AA -i
	dh_fixperms -i
	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 -a
	dh_installmenu -a
	dh_installman -a
	dh_installinfo -a
	dh_installchangelogs ChangeLog -a
	dh_pycentral --package=python-ifeffit
	dh_python --package=python-ifeffit
	dh_perl --package=perl-ifeffit
	dh_link -a
	dh_strip -a
	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