File: rules

package info (click to toggle)
rs 20120414-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 68 kB
  • sloc: ansic: 419; makefile: 61
file content (72 lines) | stat: -rwxr-xr-x 1,728 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
#!/usr/bin/make -f
# $MirOS: contrib/hosted/tg/deb/rs/debian/rules,v 1.4 2012/04/14 13:16:06 tg Exp $

CC?=			gcc
EXTRA_CFLAGS=		-Wall -Wextra -Wformat
EXTRA_CPPFLAGS=		-DUSE_LIBBSD
EXTRA_LDFLAGS=		-Wl,--as-needed

ifneq (,$(wildcard /usr/share/dpkg/buildflags.mk))
# dpkg-dev (>= 1.16.1~)
DEB_CFLAGS_MAINT_APPEND=${EXTRA_CFLAGS}
DEB_CPPFLAGS_MAINT_APPEND=${EXTRA_CPPFLAGS}
DEB_LDFLAGS_MAINT_APPEND=${EXTRA_LDFLAGS}
DEB_BUILD_MAINT_OPTIONS=hardening=+all
include /usr/share/dpkg/buildflags.mk
else
# old-fashioned way to determine build flags
CFLAGS=			-O$(if $(findstring noopt,${DEB_BUILD_OPTIONS}),0,2) -g
CFLAGS+=		${EXTRA_CFLAGS}
CPPFLAGS+=		${EXTRA_CPPFLAGS}
LDFLAGS+=		${EXTRA_LDFLAGS}
endif

LDADD+=			-lbsd

build build-arch: rs
build-indep:

rs:
	dh_testdir
	-rm -f rs
	+for opts in '-flto=jobserver' '-fwhole-program --combine' ''; do \
		set -x; \
		${CC} ${CPPFLAGS} ${CFLAGS} $$opts ${LDFLAGS} -o rs \
		    rs.c ${LDADD}; \
		test -x rs && exit 0; \
	done; echo >&2 Compiling failed.; exit 1
ifeq (,$(filter nocheck,${DEB_BUILD_OPTIONS}))
	case $$(for i in 1 2 3 4 5 6 7 8 9; do echo $$i; done | \
	    ./rs 3 3 | md5sum) in \
	d37c2eb45172c55279711a8e53041912*) echo pass test;; \
	*) rm -f rs; echo FAIL test;; \
	esac; test -x rs
endif

clean:
	dh_testdir
	-rm -f rs
	dh_clean

binary-indep: build-indep

binary-arch: build-arch
	dh_testdir
	dh_testroot
	if test -x "$$(which dh_prep)"; then dh_prep; else dh_clean -k; fi
	dh_installchangelogs
	dh_installdocs
	dh_install
	dh_installman
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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