File: rules

package info (click to toggle)
libb64 1.2-3
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 228 kB
  • ctags: 135
  • sloc: ansic: 303; makefile: 128; sh: 81; cpp: 65
file content (67 lines) | stat: -rwxr-xr-x 1,822 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
#!/usr/bin/make -f

static_lib = libb64.a
shared_lib = libb64.so
soversion = 0d
soname = $(shared_lib).$(soversion)

libdir = /usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)/

cflags = \
	 $(shell dpkg-buildflags --get CFLAGS) \
	 $(shell dpkg-buildflags --get CPPFLAGS)
ldflags = $(shell dpkg-buildflags --get LDFLAGS)

.PHONY: build build-indep build-arch
build build-arch: build-stamp

build-stamp: debian/control Makefile
	dh_testdir
	rm -rf src-shlib/
	cp -a src src-shlib/
	cd src-shlib/ && rm -f *.o *.a
	CFLAGS="$(cflags)" LDFLAGS="$(ldflags)" $(MAKE)
	CFLAGS="$(cflags) -fPIC" $(MAKE) -C src-shlib/
	cd src-shlib && $(CC) $(ldflags) -shared -Wl,-soname,$(soname) *.o -o $(soname)
	cd src-shlib && ln -sf $(soname) $(shared_lib)
ifeq "$(filter nocheck,$(DEB_BUILD_OPTIONS))" ""
	debian/tests/libb64-dev --build-time
endif
	touch $(@)

.PHONY: binary binary-indep binary-arch
binary binary-arch: debian/control build-stamp
	dh_testdir
	dh_testroot
	dh_prep
	dh_install -p libb64-dev src/$(static_lib) $(libdir)
	dh_install -p libb64-dev src-shlib/$(shared_lib) $(libdir)
	dh_install -p libb64-dev include/* /usr/include/
	dh_install -p libb64-$(soversion) src-shlib/$(soname) $(libdir)
	dh_installdocs AUTHORS BENCHMARKS README
	dh_installchangelogs CHANGELOG
	dh_compress
	dh_fixperms
	dh_strip
	dh_makeshlibs -- -c4
	dh_shlibdeps
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

.PHONY: clean
clean: debian/control Makefile
	$(MAKE) clean
	rm -rf src-shlib/
	dh_clean */depend

here = $(dir $(firstword $(MAKEFILE_LIST)))/..
debian_version = $(word 2,$(shell cd $(here) && dpkg-parsechangelog | grep ^Version:))
upstream_version = $(firstword $(subst -, ,$(debian_version)))

.PHONY: get-orig-source
get-orig-source:
	sh $(here)/debian/get-orig-source.sh $(upstream_version)

# vim:ts=4 sw=4 noet