File: rules

package info (click to toggle)
mp3splt 2.6.2+20170630-3
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 8,672 kB
  • sloc: ansic: 41,869; sh: 13,220; xml: 3,097; makefile: 607; sed: 16
file content (218 lines) | stat: -rwxr-xr-x 6,940 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
#!/usr/bin/make -f
# Copyright Ron Lee 2003 - 2017

#export DH_VERBOSE=1

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)


HARD_CPPFLAGS = -D_FORTIFY_SOURCE=2
HARD_CFLAGS   = -Wformat=2
HARD_LDFLAGS  = -Wl,-z,now

ifneq (,$(filter-out alpha hppa arm, $(DEB_HOST_ARCH)))
	HARD_CFLAGS += -fstack-protector-strong --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


# The mp3splt project consists of three parts, a common shared library, and
# two front-end applications, one command-line the other a GUI.  Even though
# all parts of that are typically released in lockstep and must all be updated
# together, the libmp3splt and mp3splt-gtk releases have a different version
# to what the CLI mp3splt component does.  (presumably because they were split
# out of it at some later point in time when the GUI tool was added).
#
# We take the mp3splt binary package version from the changelog, since we use
# its version as the source package version.  For the library and GUI binary
# packages, we use the upstream version of those components, to minimise any
# confusion when comparing what we ship to upstream's latest release.  To get
# that, we parse it from the version that their respective configure reports.
# The debian revision part will obviously always be the same for all of them.
mp3splt_version     := $(shell dpkg-parsechangelog -SVersion)
debian_revision     := $(shell echo $(mp3splt_version) | sed -e 's/.*-//')
libmp3splt_version  := $(shell ./libmp3splt/configure  -V | awk '/libmp3splt configure/ {print $$3}')-$(debian_revision)
mp3splt_gtk_version := $(shell ./mp3splt-gtk/configure -V | awk '/mp3splt-gtk configure/ {print $$3}')-$(debian_revision)
SUBST_VARS           = -Vlibmp3splt:Version=$(libmp3splt_version) -Vmp3splt-gtk:Version=$(mp3splt_gtk_version)


lib_objdir := lib-objs
cli_objdir := cli-objs
gui_objdir := gui-objs


show-versions:
	@echo " mp3splt_version     = $(mp3splt_version)"
	@echo " libmp3splt_version  = $(libmp3splt_version)"
	@echo " mp3splt_gtk_version = $(mp3splt_gtk_version)"
	@echo " debian_revision     = $(debian_revision)"
	@echo " SUBST_VARS          = $(SUBST_VARS)"


clean:
	dh_testdir
	dh_testroot
	$(RM) -r $(lib_objdir) $(cli_objdir) $(gui_objdir)
	dh_clean


$(lib_objdir)/config.status: libmp3splt/configure
	dh_testdir
	mkdir -p $(lib_objdir)
	cd $(lib_objdir) &&						\
		../libmp3splt/configure --host=$(DEB_HOST_GNU_TYPE)	\
					--build=$(DEB_BUILD_GNU_TYPE)	\
					--prefix=/usr			\
					--disable-maintainer-mode	\
					--enable-silent-rules		\
					CPPFLAGS="$(CPPFLAGS)"		\
					CFLAGS="$(CFLAGS)"		\
					CXXFLAGS="$(CXXFLAGS)"		\
					LDFLAGS="$(LDFLAGS)"		\
	|| (cat config.log; exit 1)


# Set LIBMP3SPLT_CFLAGS and LIBMP3SPLT_LIBS so that we don't need an
# installed libmp3splt.pc to find the library files and headers.
lib_cflags  = -I$(CURDIR)/libmp3splt/include
lib_ldflags = -L$(CURDIR)/$(lib_objdir)/src/.libs -lmp3splt

$(cli_objdir)/config.status: mp3splt/configure
	dh_testdir
	mkdir -p $(cli_objdir)
	cd $(cli_objdir) &&						\
		../mp3splt/configure	--host=$(DEB_HOST_GNU_TYPE)	\
					--build=$(DEB_BUILD_GNU_TYPE)	\
					--prefix=/usr			\
					--disable-maintainer-mode	\
					--enable-silent-rules		\
					--disable-rpath			\
					--enable-oggsplt_symlink	\
					--enable-flacsplt_symlink	\
					LIBMP3SPLT_CFLAGS="$(lib_cflags)" \
					LIBMP3SPLT_LIBS="$(lib_ldflags)" \
					CPPFLAGS="$(CPPFLAGS)"		\
					CFLAGS="$(CFLAGS)"		\
					CXXFLAGS="$(CXXFLAGS)"		\
					LDFLAGS="$(LDFLAGS)"		\
	|| (cat config.log; exit 1)

$(gui_objdir)/config.status: mp3splt-gtk/configure
	dh_testdir
	mkdir -p $(gui_objdir)
	cd $(gui_objdir) &&						\
		../mp3splt-gtk/configure --host=$(DEB_HOST_GNU_TYPE)	\
					--build=$(DEB_BUILD_GNU_TYPE)	\
					--prefix=/usr			\
					--disable-maintainer-mode	\
					--disable-scrollkeeper		\
					--enable-silent-rules		\
					--disable-rpath			\
					LIBMP3SPLT_CFLAGS="$(lib_cflags)" \
					LIBMP3SPLT_LIBS="$(lib_ldflags)" \
					CPPFLAGS="$(CPPFLAGS)"		\
					CFLAGS="$(CFLAGS)"		\
					CXXFLAGS="$(CXXFLAGS)"		\
					LDFLAGS="$(LDFLAGS)"		\
	|| (cat config.log; exit 1)


build: build-arch
build-arch: build-lib-stamp build-cli-stamp build-gui-stamp
build-indep:

build-lib-stamp: $(lib_objdir)/config.status
	dh_testdir
	$(MAKE) $(NJOBS) -C $(lib_objdir)
	touch $@

build-cli-stamp: $(cli_objdir)/config.status
	dh_testdir
	$(MAKE) $(NJOBS) -C $(cli_objdir)
	touch $@

build-gui-stamp: $(gui_objdir)/config.status
	dh_testdir
	$(MAKE) $(NJOBS) -C $(gui_objdir)
	touch $@



install: install-arch
install-arch: install-lib-stamp install-cli-stamp install-gui-stamp
install-indep:

install-lib-stamp: build-lib-stamp
	dh_testdir
	cd $(lib_objdir) && $(MAKE) install DESTDIR=$(CURDIR)/debian/libmp3splt
	$(RM) debian/libmp3splt/usr/lib/libmp3splt0/*.{a,la,so}
	$(RM) debian/libmp3splt/usr/lib/*.{a,la,so}
	$(RM) debian/libmp3splt/usr/share/doc/libmp3splt/doxygen/*.md5
	$(RM) -r debian/libmp3splt/usr/lib/pkgconfig
	$(RM) -r debian/libmp3splt/usr/include
	dh_lintian -plibmp3splt
	touch $@

install-cli-stamp: build-cli-stamp
	dh_testdir
	cd $(cli_objdir) && $(MAKE) install DESTDIR=$(CURDIR)/debian/mp3splt
	touch $@

install-gui-stamp: build-gui-stamp
	dh_testdir
	cd $(gui_objdir) && $(MAKE) install DESTDIR=$(CURDIR)/debian/mp3splt-gtk
	touch $@



binary: binary-arch
binary-indep:

binary-arch: install-arch
	dh_testdir
	dh_testroot
	dh_installdocs -a
	dh_installchangelogs -a
	dh_strip -a --dbg-package=mp3splt-dbg
	dh_compress -a
	dh_fixperms -a
	dh_makeshlibs -plibmp3splt -V'libmp3splt (= $(libmp3splt_version))'
	dh_installdeb -a
	dh_shlibdeps -a -- -xlibmp3splt
	dh_gencontrol -pmp3splt -pmp3splt-dbg -- $(SUBST_VARS)
	dh_gencontrol -pmp3splt-gtk -- -v$(mp3splt_gtk_version) $(SUBST_VARS)
	dh_gencontrol -plibmp3splt  -- -v$(libmp3splt_version) $(SUBST_VARS)
	dh_md5sums -a
	dh_builddeb -a


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