File: rules

package info (click to toggle)
calc 2.15.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,848 kB
  • sloc: ansic: 62,147; makefile: 7,664; sh: 503; awk: 74; sed: 7
file content (123 lines) | stat: -rwxr-xr-x 3,159 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
#!/usr/bin/make -f

include /usr/share/dpkg/buildtools.mk
include /usr/share/dpkg/buildflags.mk


INSTDIRARGS = SCRIPTDIR=/usr/share/doc/calc/examples


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

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

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

build-stamp:
	dh_testdir

	# We always have to clean up first since we don't know which options were used
	# when building last time.
	-make clobber

	# First the library build. We build this without readline support to avoid
	# dependencies on libreadline in libcalc.
	make $(INSTDIRARGS) EXTRA_CFLAGS="$(CFLAGS) $(CPPFLAGS)" EXTRA_LDFLAGS="$(LDFLAGS)" LCC=$(CC)
ifeq (, $(filter nocheck,$(DEB_BUILD_OPTIONS)))
	make chk
endif

	# Clean up since we want to rebuild with different options below. But move the libraries
	# built above to a safe place first.
	mkdir -p debian/calc-dev-build
	mv libcalc.a debian/calc-dev-build
	mv custom/libcustcalc.a debian/calc-dev-build
	-make clobber
	
	# Now the build of the executable. This one uses readline.
	make $(INSTDIRARGS) EXTRA_CFLAGS="$(CFLAGS) $(CPPFLAGS)" EXTRA_LDFLAGS="$(LDFLAGS)" LCC=$(CC) \
	    USE_READLINE=-DUSE_READLINE READLINE_LIB=-lreadline
ifeq (, $(filter nocheck,$(DEB_BUILD_OPTIONS)))
	make chk
endif

	touch build-stamp

.PHONY: clean
clean:
	dh_testdir
	dh_testroot
	-rm -f build-stamp install-stamp

	-make clobber

	dh_clean
	-rm -fr debian/calc-dev-build

.PHONY: install
install: build-stamp
	dh_testdir
	dh_testroot
	dh_clean
	dh_installdirs

	make install $(INSTDIRARGS) T=$(shell pwd)/debian/calc

	# calc-dev
	mv debian/calc/usr/include/calc/*.h debian/calc-dev/usr/include/calc
	rmdir debian/calc/usr/include/calc/custom debian/calc/usr/include/calc debian/calc/usr/include
	cp debian/calc-dev-build/lib*calc.a debian/calc-dev/usr/lib
	cp sample_*.c debian/calc-dev/usr/share/doc/calc-dev/examples
	cp sample.README debian/calc-dev/usr/share/doc/calc-dev/examples/README
	# calc-common
	mv debian/calc/usr/share debian/calc-common/usr/share
	cd debian/calc-common/usr/share/doc && mv calc calc-common
	cd debian/calc-common/usr/share && mv calc/README doc/calc-common/README.calclib
	# calc
	rm debian/calc/usr/bin/calc-static debian/calc/usr/lib/libcalc.a debian/calc/usr/lib/libcustcalc.a
	rmdir debian/calc/usr/lib

	touch install-stamp

.PHONY: binary-indep
binary-indep: install
	dh_testdir -i
	dh_testroot -i
	dh_installdocs -pcalc-common BUGS README.md
	dh_installchangelogs -pcalc-common CHANGES
	dh_install -i
	dh_lintian -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

.PHONY: binary-arch
binary-arch: install
	dh_testdir -a
	dh_testroot -a
	dh_installdocs -pcalc-dev LIBRARY
	dh_installchangelogs -pcalc-dev CHANGES
	dh_link -pcalc usr/share/doc/calc-common usr/share/doc/calc
	dh_lintian -a
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

.PHONY: binary
binary: binary-indep binary-arch

.PHONY: get-orig-source
get-orig-source:
	cd $(dir $(firstword $(MAKEFILE_LIST)))/.. && \
	    uscan --verbose --force-download --rename --destdir $(CURDIR)