File: rules

package info (click to toggle)
opus 1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 5,832 kB
  • sloc: ansic: 53,756; sh: 11,592; xml: 10,657; makefile: 424; asm: 360; perl: 264; python: 87
file content (163 lines) | stat: -rwxr-xr-x 4,240 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
#!/usr/bin/make -f
# Ron Lee 2003 - 2018

#export DH_VERBOSE=1
export DH_OPTIONS

SHELL = /bin/bash

NUM_CPUS = $(shell getconf _NPROCESSORS_ONLN 2>/dev/null)
PARALLEL = $(subst parallel=,,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NJOBS    = -j$(or $(PARALLEL),$(NUM_CPUS),1)


DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_HOST_ARCH      ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null)


# We don't need to add _FORTIFY_SOURCE here anymore, the upstream build system
# will do that for us on systems which support it and where the compiler does
# not already define it for us.
#
#HARD_CPPFLAGS = -D_FORTIFY_SOURCE=2
HARD_CFLAGS   = -Wformat=2
HARD_LDFLAGS  = -Wl,-z,now

# We don't need to add this here either anymore, the upstream build system will
# also use -fstack-protector-strong where it is supported.
#
#ifneq (,$(filter-out alpha hppa arm, $(DEB_HOST_ARCH)))
#	HARD_CFLAGS += -fstack-protector --param ssp-buffer-size=4
#endif
ifneq (,$(filter-out ia64 hppa avr32, $(DEB_HOST_ARCH)))
	HARD_LDFLAGS += -Wl,-z,relro
endif

# Keep dpkg-buildpackage the hell out of messing with our compile flags,
# we should trust upstream to know better than it what to use here.
# We explicitly re-add -g and -O2 here, since by explicitly overriding
# these variables, we otherwise disable autoconf adding them by default.
CPPFLAGS = $(HARD_CPPFLAGS)
CFLAGS   = $(HARD_CFLAGS) -g -O2
CXXFLAGS = $(HARD_CFLAGS) -g -O2
LDFLAGS  = $(HARD_LDFLAGS)


ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS = -g -O0
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	BUILD_TARGET = check-opus
else
	BUILD_TARGET = opus
endif


ifneq (,$(DEB_HOST_MULTIARCH))
	MADIR = /$(DEB_HOST_MULTIARCH)
	EXTRA_CONFIG_FLAGS = --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)
endif

ifneq (,$(filter arm armel mips mipsel, $(DEB_HOST_ARCH)))
	EXTRA_CONFIG_FLAGS += --enable-fixed-point
endif



objdir := objs


clean:
	dh_testdir
	dh_testroot
	$(RM) -r $(objdir)
	$(RM) *-stamp
	dh_clean


$(objdir)/config.status: configure
	dh_testdir
	mkdir -p $(objdir)
	cd $(objdir) &&	../configure --disable-maintainer-mode		\
				     --host=$(DEB_HOST_GNU_TYPE)	\
				     --build=$(DEB_BUILD_GNU_TYPE)	\
				     --prefix=/usr			\
				     $(EXTRA_CONFIG_FLAGS)		\
				     CPPFLAGS="$(CPPFLAGS)"		\
				     CFLAGS="$(CFLAGS)"			\
				     CXXFLAGS="$(CXXFLAGS)"		\
				     LDFLAGS="$(LDFLAGS)"

build: build-arch build-indep

build-arch: build-arch-stamp
build-arch-stamp: $(objdir)/config.status
	dh_testdir
	$(MAKE) $(NJOBS) -C $(objdir) $(BUILD_TARGET)
	touch $@

build-indep: build-indep-stamp
build-indep-stamp: $(objdir)/config.status
	dh_testdir
	$(MAKE) $(NJOBS) -C $(objdir) docs
	touch $@


install: install-arch install-indep

install-arch: install-arch-stamp
install-arch-stamp: build-arch
	dh_testdir
	$(MAKE) -C $(objdir) install-opus DESTDIR=$(CURDIR)/debian/tmp
	touch $@

install-indep: install-indep-stamp
install-indep-stamp: build-indep
	dh_testdir
	$(MAKE) -C $(objdir) install-docs DESTDIR=$(CURDIR)/debian/tmp
	touch $@


binary: binary-arch binary-indep

binary-indep: DH_OPTIONS = -i
binary-indep: install-indep
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installchangelogs
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-arch: install-arch
	dh_testdir
	dh_testroot
	dh_install -plibopus0    debian/tmp/usr/lib$(MADIR)/lib*.so.*		usr/lib$(MADIR)
	dh_install -plibopus-dev debian/tmp/usr/include/*			usr/include
	dh_install -plibopus-dev debian/tmp/usr/lib$(MADIR)/lib*.{a,so}		usr/lib$(MADIR)
	dh_install -plibopus-dev debian/tmp/usr/lib$(MADIR)/pkgconfig/opus.pc	usr/lib$(MADIR)/pkgconfig
	dh_installdocs -a
	dh_installchangelogs -a
	dh_strip -a --dbg-package=libopus-dbg
	dh_compress -a
	dh_fixperms -a
	dh_makeshlibs -plibopus0 -- -c0
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a


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