File: rules

package info (click to toggle)
cuneiform 1.1.0%2Bdfsg-4
  • links: PTS
  • area: non-free
  • in suites: wheezy
  • size: 70,900 kB
  • sloc: ansic: 183,501; cpp: 101,934; makefile: 82; sh: 55
file content (121 lines) | stat: -rwxr-xr-x 3,060 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
#!/usr/bin/make -f

here = $(dir $(firstword $(MAKEFILE_LIST)))/..
upstream_version = $(shell cd $(here) && dpkg-parsechangelog | sed -n -r -e '/^Version: ([0-9.]+)([+]dfsg).*/ { s//\1/; p; q; }')

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

CFLAGS = $(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS)
CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS) $(shell dpkg-buildflags --get CPPFLAGS)
LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS) -Wl,--as-needed

cmake_options = \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DCMAKE_VERBOSE_MAKEFILE=ON \
	-DCMAKE_BUILD_TYPE=relwithdebinfo \
	-DCMAKE_C_FLAGS_RELWITHDEBINFO="$(CFLAGS)" \
	-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(CXXFLAGS)" \
	-DCMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO="$(LDFLAGS)" \
	-DCMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO="$(LDFLAGS)" \
	-DCMAKE_INSTALL_RPATH=/usr/lib/$(DEB_HOST_MULTIARCH)/cuneiform

parallel = -j$(or $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))),1)

# These don't need to be exported and if they are we'll get the flags
# duplicated in the command line.
unexport CFLAGS
unexport CXXFLAGS
unexport LDFLAGS

export DPKG_GENSYMBOLS_CHECK_LEVEL = 4

# build and build-{arch,indep} targets
# ====================================

.PHONY: build build-arch build-indep

build: build-arch build-indep

build-indep:
# Nothing to do here.

build-arch: obj/build-stamp obj/test-stamp

obj/CMakeCache.txt:
	dh_testdir
	mkdir -p obj
	cd obj && cmake .. $(cmake_options)

obj/build-stamp: obj/CMakeCache.txt
	dh_testdir
	$(MAKE) $(parallel) -C obj
	touch $(@)

obj/test-stamp:
	dh_testdir
ifeq "$(filter nocheck,$(DEB_BUILD_OPTIONS))" ""
	CF_DATADIR=$(CURDIR)/datafiles/ debian/tests/ground-truth obj/cuneiform
endif
	touch $(@)


# binary and binary-{arch,indep} targets
# ======================================

.PHONY: binary binary-arch binary-indep

binary: binary-arch binary-indep

binary-arch: build-arch
	dh_testdir
	dh_testroot
	dh_prep -a
	$(MAKE) -C obj install DESTDIR=$(CURDIR)/debian/tmp/
	dh_install -p libcuneiform-dev '/usr/lib*/libcuneiform.so' /usr/lib/$(DEB_HOST_MULTIARCH)/
	dh_install -p libcuneiform0 '/usr/lib*/lib*.so.*' /usr/lib/$(DEB_HOST_MULTIARCH)/cuneiform/
	cd debian/libcuneiform0/usr/lib/$(DEB_HOST_MULTIARCH)/cuneiform/ && mv -t ../ libcuneiform.so.*
	dh_install -a
	dh_installdocs -a
	dh_installchangelogs -a
	dh_installman -a
	dh_compress -a
	dh_fixperms -a
	dh_strip -a
	dh_makeshlibs -a -X/cuneiform/
	dh_shlibdeps -a
	dh_installdeb -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a -- -Zxz

binary-indep: build-indep
	dh_testdir
	dh_testroot
	dh_prep -i -X tmp
	dh_install -i
	dh_installdocs -i
	dh_installchangelogs -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i -- -Zxz

# clean target
# ============

.PHONY: clean
clean:
	dh_testdir
	dh_clean
	rm -rf obj

# get-orig-source target
# ======================

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

# vim:ts=4 sw=4 noet