File: rules

package info (click to toggle)
mpqc 2.3.1-6
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 39,580 kB
  • ctags: 16,804
  • sloc: cpp: 258,686; sh: 8,584; perl: 6,017; ansic: 5,491; makefile: 2,769; fortran: 1,970; lisp: 1,269; yacc: 313; lex: 177; csh: 45
file content (212 lines) | stat: -rwxr-xr-x 5,829 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
#!/usr/bin/make -f
# mpqc debian/rules file
#
# Copyright (c) 2001, 2002, 2003, 2004 by Michael Banck <mbanck@debian.org>
#
# This file is free software, you can redistribute it and/or 
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 dated June, 1991.

include /usr/share/dpatch/dpatch.make

TOPDIR = $(CURDIR)
SHAREDDIR = $(CURDIR)/build-shared
OPENMPIDIR = $(CURDIR)/build-mpi
DOCDIR = $(CURDIR)/build-doc

# This awk-magic assumes that no digits will be more than 9 :-/
VERSION=`head $(TOPDIR)/configure.in | grep sc_version | \
awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+/)) print substr($$0,RSTART,5)}'`
#SO_NAME=`head $(TOPDIR)/configure.in | grep sc_so_version | \
awk '{if (match($$0,/[0-9]+:[0-9]+:[0-9]+/)) print substr($$0,RSTART,1)}'`
SO_NAME=7

# Shortcuts to the debian packages staging areas
DOC_DIR = $(CURDIR)/debian/libsc-doc/usr
TMP_DIR = $(CURDIR)/debian/tmp

# The debhelper control files for the libsc$SO_NAME package
LIBSC_DH_FILES = `cd debian && ls libsc_SO_NAME_.* | sed -e 's/libsc_SO_NAME_\.//g' | tr '\n' ' '`

OPENMPIARCHES = alpha amd64 i386 ia64 powerpc kfreebsd-i386 kfreebsd-amd64 hurd-i386

# Common FLAGS
CFLAGS = -Wall -g
CXXFLAGS = -Wall -g
FFLAGS = -Wall -g -fPIC
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
	CXXFLAGS += -O0
	FFLAGS += -O0
else
	CFLAGS += -O2
	CXXFLAGS += -O2
	FFLAGS += -O2
endif

export F77=/usr/bin/gfortran

# Common configure option for all packages
COMMONARGS=	--prefix=/usr \
		--with-sc-includedir=/usr/include/sc \
		--enable-production \
		--host=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) \
		--libdir=/usr/lib \
		--includedir=/usr/include/sc \
		--datadir=/usr/share/mpqc \
		--with-sc-datadir=/usr/share/mpqc \
#		F77=gfortran
#		--with-cxx=/usr/bin/g++-3.3 \
#		--with-cc=/usr/bin/gcc-3.3 \
#		--with-f77=/usr/bin/g77-3.3
#		--with-build-id=\"\" 

OPENMPIARGS = \
	--with-cxx=/usr/bin/mpic++.openmpi \
	--with-cc=/usr/bin/mpicc.openmpi \
	--with-f77=/usr/bin/mpif77.openmpi \
	--enable-threads \
	--enable-always-use-mpi \
	--with-default-parallel=mpi

# check whether debian/control really has the right SO_NAME for libsc
check_soname:
	if grep Package:\ libsc$(SO_NAME) $(CURDIR)/debian/control >/dev/null; then exit 0; else exit 1; fi

$(DOCDIR)/config.status: configure
	dh_testdir
	mkdir -p $(DOCDIR)
	(cd $(DOCDIR); \
	    $(TOPDIR)/configure $(COMMONARGS) --without-dot)

$(SHAREDDIR)/config.status: configure
	dh_testdir
	mkdir -p $(SHAREDDIR)
	(cd $(SHAREDDIR); \
	    $(TOPDIR)/configure $(COMMONARGS) --enable-shared --disable-static --disable-parallel )

$(OPENMPIDIR)/config.status: configure
	dh_testdir
	mkdir -p $(OPENMPIDIR)
ifneq (,$(findstring $(DEB_HOST_ARCH),$(OPENMPIARCHES)))
	(cd $(OPENMPIDIR); \
	    $(TOPDIR)/configure $(COMMONARGS) $(OPENMPIARGS) )
else
	touch $@
endif

build: build-arch build-indep

build-arch: build-arch-stamp
build-arch-stamp: patch-stamp build-openmpi-stamp build-shared-stamp
	touch $@

build-indep: build-indep-stamp
build-indep-stamp: patch-stamp build-doc-stamp
	touch $@

build-doc-stamp: $(DOCDIR)/config.status
	dh_testdir
	$(MAKE) -C $(DOCDIR)/doc
	touch $@

build-openmpi-stamp: $(OPENMPIDIR)/config.status
	dh_testdir
ifneq (,$(findstring $(DEB_HOST_ARCH),$(OPENMPIARCHES)))
	$(MAKE) -C $(OPENMPIDIR) CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)"
endif
	touch $@

build-shared-stamp: $(SHAREDDIR)/config.status
	dh_testdir
	# FFLAGS are here because libtool compiles the sole fortran source without
	# -fPIC and lintian complains
	$(MAKE) -C $(SHAREDDIR) FFLAGS="$(FFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)"
	$(MAKE) -C $(SHAREDDIR)/src/bin/mpqc/validate inputs
	touch $@

clean: unpatch debian/control
	dh_testdir
	dh_testroot
	[ ! -f lib/LocalMakefile ] || $(MAKE) distclean
	# stuff that distclean doesn't clean:
	rm -f lib/LocalMakefile lib/Makedirlist doc/doxygen.cfg
	rm -rf $(OPENMPIDIR) $(SHAREDDIR) $(DOCDIR)
	rm -f debian/libsc$(SO_NAME).*
	rm -f debian/libsc_dh_files
	dh_clean *-stamp

debian/control:
	sed s/@SO_NAME@/$(SO_NAME)/g debian/control.in > debian/control

debian/libsc_dh_files:
	for i in $(LIBSC_DH_FILES); do \
		cp debian/libsc_SO_NAME_.$$i debian/libsc$(SO_NAME).$$i; \
	done
	touch $@

install-arch: build-arch install-arch-stamp
install-arch-stamp:
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	$(MAKE) -C $(SHAREDDIR) install \
		prefix=$(TMP_DIR)/usr \
		libdir=$(TMP_DIR)/usr/lib \
		includedir=$(TMP_DIR)/include/sc \
		scdatadir=$(TMP_DIR)/usr/share/mpqc
	$(MAKE) -C $(SHAREDDIR) install_devel \
		prefix=$(TMP_DIR)/usr \
		libdir=$(TMP_DIR)/usr/lib \
		includedir=$(TMP_DIR)/usr/include/sc \
		scdatadir=$(TMP_DIR)/usr/share/mpqc
ifneq (,$(findstring $(DEB_HOST_ARCH),$(OPENMPIARCHES)))
	install -m 755 $(OPENMPIDIR)/src/bin/mpqc/mpqc \
		$(CURDIR)/debian/mpqc-openmpi/usr/bin
endif
	touch install-arch-stamp	

test: build-arch install-arch
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	-SCLIBDIR=$(CURDIR)/lib $(MAKE) -C $(SHAREDDIR)/src/bin/mpqc/validate check
endif

binary-common: debian/libsc_dh_files
	dh_testdir
	dh_testroot
#	dh_installdebconf	
	dh_installdocs
	dh_installexamples
	dh_installmenu
	dh_installemacsen
#	dh_installmime
	dh_installcron
	dh_installman 
	dh_installinfo
	dh_installchangelogs 
	dh_install
	dh_link
	dh_strip 
	dh_compress
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_perl
	dh_shlibdeps 
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-indep: build-indep debian/control
	$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common

binary-arch: build-arch install-arch debian/control test
	$(MAKE) -f debian/rules DH_OPTIONS=-a binary-common

binary: binary-arch binary-indep

get-orig-source:
	uscan --force-download --repack

.PHONY: build clean test binary-indep binary-arch binary install debian/control get-orig-source