Merge branch 't/build-improvements'
[lopsub.git] / debian / rules
1 #!/usr/bin/make -f
2 # Invoke each target with `./debian/rules <target>'. All targets should be
3 # invoked with the package root as the current directory.
4
5 sourcepackage := liblopsub
6 package := liblopsub1
7 devpackage := liblopsub-dev
8
9 define checkdir
10 @test -f debian/rules -a -f lopsub.c || \
11 (echo Not in correct source directory; exit 1)
12 endef
13
14 SRCTOP := $(shell pwd)
15 TMPDIR := $(SRCTOP)/debian/tmp
16 DESTDIR := $(SRCTOP)/debian/$(package)
17 DEVDIR := $(SRCTOP)/debian/$(devpackage)
18 DOCS_DIR := $(DESTDIR)/usr/share/doc/$(package)
19 DEVDOCS_DIR := $(DEVDIR)/usr/share/doc/$(devpackage)
20 TRIPLET := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
21
22 build-arch:
23 $(checkdir)
24 $(MAKE)
25 build-indep:
26 build: build-indep build-arch
27
28 clean:
29 $(checkdir)
30 -rm -f debian/substvars
31 $(MAKE) distclean
32 dh_clean
33
34 INST_OWN = -o root -g root
35 MAKE_DIR = install -p -d $(INST_OWN) -m 755
36 INST_FILE = install -c $(INST_OWN) -m 644
37
38 binary: build
39 $(checkdir)
40 $(MAKE) PREFIX=/usr install DESTDIR=$(TMPDIR)
41 mv $(TMPDIR)/usr/lib $(TMPDIR)/usr/lib-$(TRIPLET)
42 $(MAKE_DIR) $(TMPDIR)/usr/lib
43 mv $(TMPDIR)/usr/lib-$(TRIPLET) $(TMPDIR)/usr/lib/$(TRIPLET)
44 dh_install -p $(package)
45 dh_install -p $(devpackage)
46 $(MAKE_DIR) $(DESTDIR)/DEBIAN $(DOCS_DIR) $(DEVDOCS_DIR)
47 echo 'activate-noawait ldconfig' > $(DESTDIR)/DEBIAN/triggers
48 $(INST_FILE) debian/copyright $(DOCS_DIR)/copyright
49 $(INST_FILE) debian/copyright $(DEVDOCS_DIR)/copyright
50 $(INST_FILE) debian/changelog $(DOCS_DIR)/changelog.Debian
51 $(INST_FILE) debian/changelog $(DEVDOCS_DIR)/changelog.Debian
52 gzip -fn9 $(DOCS_DIR)/changelog.Debian
53 gzip -fn9 $(DEVDOCS_DIR)/changelog.Debian
54 dh_makeshlibs
55 dh_shlibdeps
56 dh_strip
57 dh_shlibdeps
58 dh_gencontrol
59 dh_builddeb
60
61 binary-indep binary-arch: binary
62 .PHONY: clean build binary-arch binary-indep binary