prepare an upload
[alioth/rs.git] / debian / rules
1 #!/usr/bin/make -f
2 # $MirOS: contrib/hosted/tg/deb/rs/debian/rules,v 1.3 2012/03/25 16:08:54 tg Exp $
3
4 CC?=                    gcc
5 EXTRA_CFLAGS=           -Wall -Wextra -Wformat
6 EXTRA_CPPFLAGS=         -DUSE_LIBBSD
7 EXTRA_LDFLAGS=          -Wl,--as-needed
8
9 ifneq (,$(wildcard /usr/share/dpkg/buildflags.mk))
10 # dpkg-dev (>= 1.16.1~)
11 DEB_CFLAGS_MAINT_APPEND=${EXTRA_CFLAGS}
12 DEB_CPPFLAGS_MAINT_APPEND=${EXTRA_CPPFLAGS}
13 DEB_LDFLAGS_MAINT_APPEND=${EXTRA_LDFLAGS}
14 DEB_BUILD_MAINT_OPTIONS=hardening=+all
15 include /usr/share/dpkg/buildflags.mk
16 else
17 # old-fashioned way to determine build flags
18 CFLAGS=                 -O$(if $(findstring noopt,${DEB_BUILD_OPTIONS}),0,2) -g
19 CFLAGS+=                ${EXTRA_CFLAGS}
20 CPPFLAGS+=              ${EXTRA_CPPFLAGS}
21 LDFLAGS+=               ${EXTRA_LDFLAGS}
22 endif
23
24 LDADD+=                 -lbsd
25
26 build build-arch: rs
27 build-indep:
28
29 rs:
30         dh_testdir
31         -rm -f rs
32         +for opts in '-flto=jobserver' '-fwhole-program --combine' ''; do \
33                 set -x; \
34                 ${CC} ${CPPFLAGS} ${CFLAGS} $$opts ${LDFLAGS} -o rs \
35                     rs.c ${LDADD}; \
36                 test -x rs && exit 0; \
37         done; echo >&2 Compiling failed.; exit 1
38
39 clean:
40         dh_testdir
41         -rm -f rs
42         dh_clean
43
44 binary-indep: build-indep
45
46 binary-arch: build-arch
47         dh_testdir
48         dh_testroot
49         if test -x "$$(which dh_prep)"; then dh_prep; else dh_clean -k; fi
50         dh_installchangelogs
51         dh_installdocs
52         dh_install
53         dh_installman
54         dh_link
55         dh_strip
56         dh_compress
57         dh_fixperms
58         dh_installdeb
59         dh_shlibdeps
60         dh_gencontrol
61         dh_md5sums
62         dh_builddeb
63
64 binary: binary-indep binary-arch
65 .PHONY: binary binary-arch binary-indep build build-arch build-indep clean