File: rules

package info (click to toggle)
libspe2 2.2.80-95-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 940 kB
  • ctags: 1,214
  • sloc: ansic: 9,316; makefile: 551; ada: 448; sh: 24
file content (190 lines) | stat: -rwxr-xr-x 4,914 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
#!/usr/bin/make -f
# -*- makefile -*-

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

export SHELL = /bin/bash

CFLAGS = -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

DEB_BUILD_ARCH	   ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_ARCH      ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

ifeq (,$(filter $(DEB_BUILD_ARCH), powerpc ppc64))
  sysroot = /usr/lib/cell/sysroot
  set_optflags = OPTFLAGS="$(CFLAGS)"
else
  on_powerpc = yes
endif

prefix = usr
libdir = usr/lib
ifeq ($(DEB_BUILD_ARCH),powerpc)
  libdir = usr/lib
endif
ifeq ($(DEB_BUILD_ARCH),ppc64)
  libdir = usr/lib64
endif
includedir2 = /usr/spu/include

# FIXME initdir = etc/init.d

patch: patch-stamp
patch-stamp:
#	QUILT_PATCHES=debian/patches quilt push -a || test $$? = 2
	touch patch-stamp

unpatch:
#	QUILT_PATCHES=debian/patches quilt pop -a || test $$? = 2
	rm -f patch-stamp

build: build64-stamp build-stamp
build-doc: build-doc-stamp

build64-stamp: patch-stamp
	$(MAKE) SHELL=/bin/bash clean
# EXTRA_CFLAGS includes -m32 for i386/amd64 ...
	$(MAKE) $(set_optflags) \
	    CC="gcc -m64" \
	    $(if $(on_powerpc),,EXTRA_CFLAGS="-mabi=altivec") \
	    SHELL=/bin/bash \
	    SYSROOT=$(if $(on_powerpc),,$(sysroot)) \
	    prefix=/$(prefix) libdir=/usr/lib64

# don't set SYSROOT for the install, move things after calling
# dh_install (which cannot handle variables or macros).
	$(MAKE) $(set_optflags) \
	    CC="gcc -m64" \
	    $(if $(on_powerpc),,EXTRA_CFLAGS="-mabi=altivec") \
	    SHELL=/bin/bash \
	    SYSROOT=$(if $(on_powerpc),,$(sysroot)) \
	    prefix=/$(prefix) libdir=/usr/lib64 \
	    DESTDIR=$(CURDIR)/debian/tmp64 \
		install
	touch $@

build-stamp: patch-stamp build64-stamp
	$(MAKE) SHELL=/bin/bash clean
	$(MAKE) $(set_optflags) \
	    CC="gcc -m32" \
	    SHELL=/bin/bash \
	    SYSROOT=$(if $(on_powerpc),,$(sysroot)) \
	    prefix=/$(prefix) libdir=/$(libdir)

ifeq ($(DEB_BUILD_ARCH),powerpc)
	$(MAKE) $(set_optflags) \
	    SHELL=/bin/bash \
	    SYSROOT=$(if $(on_powerpc),,$(sysroot)) \
	    prefix=/$(prefix) libdir=/$(libdir) \
		elfspe-all
endif
	touch $@

build-doc-stamp: patch-stamp
	$(MAKE) doc
	touch $@

clean: unpatch
	dh_testdir
	dh_testroot
	$(MAKE) SHELL=/bin/bash clean
	$(MAKE) -C tests SHELL=/bin/bash clean
	rm -f doc/img/*.pdf
	rm -f libspe12/libspe.so*
	rm -f elfspe/elfspe-register
	rm -rf build-* .pc
	rm -rf debian/tmp64
	rm -f *-stamp
	dh_clean

install:
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

# don't set SYSROOT for the install, move things after calling
# dh_install (which cannot handle variables or macros).
	$(MAKE) $(set_optflags) \
	    SHELL=/bin/bash \
	    SYSROOT=$(if $(on_powerpc),,$(sysroot)) \
	    prefix=/$(prefix) libdir=/$(libdir) \
	    DESTDIR=$(CURDIR)/debian/tmp \
		install

ifneq (,$(on_powerpc))
	$(MAKE) $(set_optflags) \
	    SHELL=/bin/bash \
	    SYSROOT= \
	    prefix=/$(prefix) libdir=/$(libdir) \
	    DESTDIR=$(CURDIR)/debian/tmp \
		elfspe-install
endif

	dh_install -plibspe2-2 --sourcedir=debian/tmp \
		'$(sysroot)/usr/lib/*2.so.*' $(sysroot)/usr/lib

	dh_install -plibspe2-dev --sourcedir=debian/tmp \
		'$(sysroot)/usr/lib/*2.so' '$(sysroot)/usr/lib/*2.a' $(sysroot)/usr/lib
	dh_install -plibspe2-dev --sourcedir=debian/tmp \
		'$(sysroot)/usr/include/*2*.h' '$(sysroot)/usr/include/cbea_map.h' $(sysroot)/usr/include
	dh_install -plibspe2-dev --sourcedir=debian/tmp \
		'$(sysroot)/usr/spu/include/*.h' usr/spu/include

	dh_install -plib64spe2-2 --sourcedir=debian/tmp64 \
		'$(sysroot)/usr/lib64/*2.so.*' $(sysroot)/usr/lib64

	dh_install -plib64spe2-dev --sourcedir=debian/tmp64 \
		'$(sysroot)/usr/lib64/*2.so' '$(sysroot)/usr/lib64/*2.a' $(sysroot)/usr/lib64

ifneq (,$(on_powerpc))
	dh_install -pelfspe2 --sourcedir=debian/tmp \
		'usr/bin/elfspe' usr/bin
	mkdir -p debian/elfspe2/usr/share/binfmts
	cp -p debian/elfspe.binfmt debian/elfspe2/usr/share/binfmts/elfspe
endif

	-find debian/{libspe2-2,libspe2-dev,elfspe2,lib64spe2-2,lib64spe2-dev} -type d -empty -delete

binary-indep: build-doc
binary-indep-disabled:
	dh_testdir
	dh_testroot
	dh_installchangelogs -i
	dh_installdocs -i doc/*.pdf
	dh_compress -i -X.pdf
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture dependant packages using the common target.
binary-arch: build install build-doc
	dh_testdir
	dh_testroot
	dh_installchangelogs -s
	dh_installdocs -s
	dh_installdocs -plibspe2-doc doc/*.pdf
	dh_strip -s
	dh_compress -s -X.pdf
	dh_fixperms -s
ifneq (,$(on_powerpc))
	dh_makeshlibs -s
	dh_shlibdeps -s
endif
	dh_installdeb -s
	dh_gencontrol -s
	dh_md5sums -s
	dh_builddeb -s

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