File: rules

package info (click to toggle)
libopendbx 1.4.6-15
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,956 kB
  • sloc: sh: 10,899; ansic: 7,283; xml: 1,837; cpp: 1,696; makefile: 366; sed: 16
file content (174 lines) | stat: -rwxr-xr-x 5,163 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
#!/usr/bin/make -f

package			:= libopendbx1
backends		:= firebird mssql mysql pgsql odbc sqlite3 sybase
includes		:= -I/usr/include/mysql -I/usr/include/postgresql
tmpdir			:= debian/tmp

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
export DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

doxygen_version            := $(shell dpkg-query -W -f="\$${Version}\n" doxygen)

ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
	CONFFLAGS = --build $(DEB_HOST_GNU_TYPE)
else
	CONFFLAGS = --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif
ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
  with_check := disabled by DEB_BUILD_OPTIONS.
else
  ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
    with_check := disabled because cross-compiling.
  else
    with_check := yes
  endif
endif

ifneq (/usr/share/pkg-kde-tools/bin,$(filter /usr/share/pkg-kde-tools/bin,$(subst :, ,$(PATH))))
    export PATH := /usr/share/pkg-kde-tools/bin:$(PATH)
endif

CFLAGS = $(shell dpkg-buildflags --get CFLAGS) -Wall -pedantic -std=c99
CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS) -Wall -pedantic
LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)

build: build-stamp
build-stamp:
	dh_testdir
	dh_autoreconf
	CFLAGS="${CFLAGS}" \
	CPPFLAGS="${includes} ${CPPFLAGS}" \
	CXXFLAGS="${CXXFLAGS}" \
	LDFLAGS="${LDFLAGS}" \
	./configure ${CONFFLAGS} \
		--prefix=/usr \
		--disable-rpath \
		--with-backends="${backends}"

	$(MAKE)
	ln $(CURDIR)/lib/opendbx/api $(CURDIR)/lib/opendbx/api.dox

ifeq ($(with_check),yes)
	cp $(CURDIR)/debian/odbxtest.site $(CURDIR)/test
	cd test; ./odbxtest.sh
	rm -f $(CURDIR)/test/odbxtest.site
	rm -f $(CURDIR)/debian/testdb
	rm -r $(CURDIR)/test/testresult*
else
	@echo "Testsuite not run: $(with_check)."
endif
	touch build-stamp

build-arch: build-arch-stamp
build-arch-stamp: build-stamp

build-indep: build-indep-stamp
build-indep-stamp: build-stamp

install: install-indep install-arch
install-indep: install-indep-stamp
install-indep-stamp: build-indep-stamp

install-arch: install-arch-stamp
install-arch-stamp:
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	$(MAKE) install DESTDIR="${CURDIR}/${tmpdir}"

binary-arch: install
	dh_testdir -a
	dh_testroot -a

	dh_installdocs -p${package}
	dh_installchangelogs -p${package} ChangeLog
	dh_installman -p${package}-dev ${tmpdir}/usr/share/man/man3/*

	dh_install -p${package} "${tmpdir}/usr/lib/libopendbx.so.*" "usr/lib/"
	dh_install -p${package} "${tmpdir}/usr/lib/libopendbxplus.so.*" "usr/lib/"
	dh_install -p${package} --autodest "${tmpdir}/usr/share/locale/*/*/opendbx.mo"
	dh_install -p${package}-dev "${tmpdir}/usr/include/opendbx/api" "usr/include/opendbx"
	dh_install -p${package}-dev "${tmpdir}/usr/include/opendbx/api.h" "usr/include/opendbx"
	dh_install -p${package}-dev "${tmpdir}/usr/lib/libopendbx.so" "${tmpdir}/usr/lib/libopendbx.a" "usr/lib/"
	dh_install -p${package}-dev "${tmpdir}/usr/lib/libopendbxplus.so" "${tmpdir}/usr/lib/libopendbxplus.a" "usr/lib/"
	dh_install -p${package}-dev "opendbx.pc" "usr/lib/${DEB_HOST_MULTIARCH}/pkgconfig/"
	dh_link -p${package}-dev "usr/share/doc/${package}" "usr/share/doc/${package}-dev"
	dh_link -p${package}-dev "usr/include/opendbx/api.h" "usr/include/odbx.h"
	dh_link -popendbx-utils "usr/share/doc/${package}" "usr/share/doc/opendbx-utils"
	set -e ; \
	for be in ${backends} ; do \
		dh_install  -p${package}-$${be} "${tmpdir}/usr/lib/opendbx/lib$${be}backend.so*" "usr/lib/opendbx/" ; \
		dh_link -p${package}-$${be} "usr/share/doc/${package}" "usr/share/doc/${package}-$${be}" ; \
	done
	dh_installman -popendbx-utils ${tmpdir}/usr/share/man/man1/*
	dh_install -popendbx-utils
	mv $(CURDIR)/debian/opendbx-utils/usr/bin/odbxtest.sh $(CURDIR)/debian/opendbx-utils/usr/bin/odbxtest.master

	dh_link -a
	dh_strip -a
	dh_compress -a
	dh_fixperms -a

	dh_makeshlibs -a --exclude=backend
	dh_installdeb -a
	dh_shlibdeps -a
	dh_md5sums -a

	dh_gencontrol -p${package}
	dh_builddeb -p${package}
	dh_gencontrol -p${package}-dev
	dh_builddeb -p${package}-dev
	set -e ; \
	for be in ${backends} ; do \
		dh_gencontrol -p${package}-$${be} ; \
		dh_builddeb  -p${package}-$${be} ; \
	done
	dh_gencontrol -popendbx-utils
	dh_builddeb -popendbx-utils

binary-indep:
	dh_testdir -i
	dh_testroot -i
	dh_installdocs -i
	dh_installchangelogs -i ChangeLog
	dh_install -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_md5sums -i
	dh_gencontrol -i -- -Vdoxygen:Version=$(doxygen_version)
	dh_builddeb -i

binary: binary-arch binary-indep


clean:
	rm -f build*stamp
	rm -f install*stamp
	rm -f debian/files
	rm -rf doc/html
	rm -f doc/*.3
	rm -rf doc/man
	rm -rf doc/xml
	rm -rf doc/doxygen_sqlite3.db
	rm -rf utils/doc/odbx-sql.1
	rm -rf lib/opendbx/api.dox

	dh_testdir
	dh_testroot

	[ ! -f Makefile ] || $(MAKE) distclean
	dh_autoreconf_clean

	dh_clean

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