File: rules

package info (click to toggle)
libmsv 1.1-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,464 kB
  • ctags: 212
  • sloc: sh: 11,419; ansic: 429; makefile: 109
file content (109 lines) | stat: -rwxr-xr-x 4,244 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
#!/usr/bin/make -f

INSTALL = install
INSTALL_FILE    = $(INSTALL) -p    -o root -g root  -m  644
INSTALL_PROGRAM = $(INSTALL) -p    -o root -g root  -m  755
INSTALL_SCRIPT  = $(INSTALL) -p    -o root -g root  -m  755
INSTALL_DIR     = $(INSTALL) -p -d -o root -g root  -m  755

DEB_BUILD_ARCH_OS ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)
DEB_BUILD_GNU_TYPE = $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE = $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
BUILD_DATE := $(shell dpkg-parsechangelog --show-field Date)

STRIP=strip

ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
	CONFARGS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
	STRIP=$(DEB_HOST_GNU_TYPE)-strip
endif

CFLAGS := $(shell dpkg-buildflags --get CFLAGS)
CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS)
LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)

package=libmsv1
devpkg=libmsv-dev

build: build-arch build-indep
build-indep: build-arch
build-arch: stamp-build
stamp-build: configure
	./configure --prefix=/usr CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
	$(MAKE)
	doxygen libmsvdox.cfg
	touch $@

clean:
	$(checkdir)
	rm -rf debian/$(package) debian/$(devpkg) debian/*.substvars
	rm -rf html man latex

binary: binary-arch
binary-indep: checkroot

binary-arch: checkroot
	$(INSTALL_DIR) debian/$(package)/usr/share/doc/$(package) \
		debian/$(devpkg)/usr/share/doc/$(devpkg)/html/search \
		debian/$(devpkg)/usr/share/man/man3 \
		debian/$(devpkg)/usr/lib \
		debian/$(package)/DEBIAN \
		debian/$(devpkg)/DEBIAN

	$(MAKE) install DESTDIR=$(CURDIR)/debian/$(package)

	$(INSTALL_FILE) debian/copyright debian/$(package)/usr/share/doc/$(package)
	$(INSTALL_FILE) debian/changelog debian/$(package)/usr/share/doc/$(package)/changelog.Debian
	gzip -9fn debian/$(package)/usr/share/doc/$(package)/changelog.Debian

	mv debian/$(package)/usr/lib/*.a debian/$(devpkg)/usr/lib
	mv debian/$(package)/usr/lib/*.so debian/$(devpkg)/usr/lib
	mv debian/$(package)/usr/include debian/$(devpkg)/usr
	rm -f debian/$(package)/usr/lib/*.la
	chmod 644 debian/$(package)/usr/lib/*.so.*

	$(INSTALL_FILE) debian/copyright debian/$(devpkg)/usr/share/doc/$(devpkg)
	$(INSTALL_FILE) html/search/* debian/$(devpkg)/usr/share/doc/$(devpkg)/html/search
	$(INSTALL_FILE) html/*.html html/*.png html/*.css html/dynsections.js debian/$(devpkg)/usr/share/doc/$(devpkg)/html
	ln -s ../../../javascript/jquery/jquery.min.js debian/$(devpkg)/usr/share/doc/$(devpkg)/html/jquery.js
	$(INSTALL_FILE) man/man3/msv*.3 debian/$(devpkg)/usr/share/man/man3
	gzip -9fn debian/$(devpkg)/usr/share/man/man3/*
	$(INSTALL_FILE) debian/changelog debian/$(devpkg)/usr/share/doc/$(devpkg)/changelog.Debian
	gzip -9fn debian/$(devpkg)/usr/share/doc/$(devpkg)/changelog.Debian

ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	strip debian/$(package)/usr/lib/*.so.*
endif
	$(INSTALL_SCRIPT) debian/$(package).postinst debian/$(package)/DEBIAN/postinst
	cd debian/$(package) && find * -type f ! -regex '^DEBIAN/.*' -print0 | LC_ALL=C sort -z | xargs -r0 md5sum > DEBIAN/md5sums
	echo 'libmsv 1 $(package)' >debian/$(package)/DEBIAN/shlibs
	dpkg-shlibdeps -Tdebian/$(package).substvars -dDepends debian/$(package)/usr/lib/*.so.*
	dpkg-gencontrol -ldebian/changelog -isp -p$(package) -Tdebian/$(package).substvars -Pdebian/$(package)
	chown -R root:root debian/$(package)
	chmod -R go=rX debian/$(package)
	find debian/$(package) -newermt '$(BUILD_DATE)' -print0 | \
		xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
	dpkg --build debian/$(package) ..

	cd debian/$(devpkg) && find * -type f ! -regex '^DEBIAN/.*' -print0 | LC_ALL=C sort -z | xargs -r0 md5sum > DEBIAN/md5sums
	dpkg-gencontrol -ldebian/changelog -isp -p$(devpkg) -Tdebian/$(devpkg).substvars -Pdebian/$(devpkg)
	chown -R root:root debian/$(devpkg)
	chmod -R go=rX debian/$(devpkg)
	find debian/$(devpkg) -newermt '$(BUILD_DATE)' -print0 | \
		xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
	dpkg --build debian/$(devpkg) ..


define checkdir
	test -f debian/rules
endef

checkroot:
	$(checkdir)
	test root = "`whoami`"

prebuild:
	autoreconf -fi
	$(RM) -rf autom4te.cache

.PHONY: binary binary-arch binary-indep build build-arch build-indep clean checkroot prebuild