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