File: rules

package info (click to toggle)
mpqc 2.3.1-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 39,712 kB
  • ctags: 16,799
  • sloc: cpp: 258,686; sh: 14,041; perl: 5,992; ansic: 5,491; makefile: 2,738; fortran: 1,970; lisp: 1,269; yacc: 313; lex: 177; csh: 45
file content (174 lines) | stat: -rwxr-xr-x 4,907 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
#!/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.

export DH_COMPAT=3

include /usr/share/dpatch/dpatch.make

TOPDIR = $(CURDIR)
STATICDIR = $(CURDIR)/build-static
SHAREDDIR = $(CURDIR)/build-shared
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' ' '`

# 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 \
		--datadir=/usr/share/mpqc \
		--with-sc-datadir=/usr/share/mpqc \
		--disable-parallel 
#		--with-cxx=/usr/bin/g++-3.3 \
#		--with-cc=/usr/bin/gcc-3.3 \
#		--with-f77=/usr/bin/g77-3.3
#		--with-build-id=\"\" 

# 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

configure-doc-stamp:
	dh_testdir
	-mkdir $(DOCDIR)
	(cd $(DOCDIR); \
	$(TOPDIR)/configure $(COMMONARGS) --without-dot)
	touch configure-doc-stamp

configure-shared-stamp:
	dh_testdir
	-mkdir $(SHAREDDIR)
	(cd $(SHAREDDIR); \
	$(TOPDIR)/configure $(COMMONARGS) --enable-shared --disable-static)
	touch configure-shared-stamp

configure-static-stamp:
	dh_testdir
	-mkdir $(STATICDIR)
	(cd $(STATICDIR); \
	$(TOPDIR)/configure $(COMMONARGS) --includedir=/usr/include/sc)
	touch configure-static-stamp

build-arch: build-arch-stamp
build-arch-stamp: patch-stamp build-static-stamp build-shared-stamp
	touch build-arch-stamp

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

build-doc-stamp: configure-doc-stamp
	dh_testdir
	(cd $(DOCDIR)/doc; $(MAKE))
	touch build-doc-stamp

build-static-stamp: configure-static-stamp
	dh_testdir
	# lebedev.c brings up compiler errors with -O2
	(cd $(STATICDIR); $(MAKE) CFLAGS='-g -O2 -Wall')
	touch build-static-stamp

build-shared-stamp: configure-shared-stamp
	dh_testdir
	# FFLAGS are here because libtool compiles the sole fortran source without
	# -fPIC and lintian complains
	(cd $(SHAREDDIR); $(MAKE) FFLAGS='-g -O2 -fPIC -Wall' CFLAGS='-g -O2 -Wall')
	(cd $(SHAREDDIR)/src/bin/mpqc/validate; $(MAKE) inputs)
	touch build-shared-stamp

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

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 debian/libsc_dh_files

install-arch: build-arch install-arch-stamp
install-arch-stamp:
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs 
	(cd $(SHAREDDIR); $(MAKE) install \
		prefix=$(TMP_DIR)/usr \
		libdir=$(TMP_DIR)/usr/lib \
		includedir=$(TMP_DIR)/include/sc \
		scdatadir=$(TMP_DIR)/usr/share/mpqc)
	(cd $(STATICDIR); $(MAKE) install_devel \
		prefix=$(TMP_DIR)/usr \
		libdir=$(TMP_DIR)/usr/lib \
		includedir=$(TMP_DIR)/usr/include/sc \
		scdatadir=$(TMP_DIR)/usr/share/mpqc)
	touch install-arch-stamp	

test: build-arch install-arch
	-(cd $(SHAREDDIR)/src/bin/mpqc/validate; make check)

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
.PHONY: build clean binary-indep binary-arch binary install configure debian/control