Code

rules: Enabled harding build flags (use dpkg-buildflags).
[pkg-tig.git] / debian / rules
1 #!/usr/bin/make -f
2 # debian/rules for tig
3 #
4 # Written by Sebastian Harl <tokkee@debian.org>
6 # Uncomment this to turn on verbose mode.
7 #export DH_VERBOSE=1
9 # These are used for cross-compiling and for saving the configure script
10 # from having to guess our platform (since we know it already)
11 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
12 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
14 export DEB_BUILD_MAINT_OPTIONS=hardening=+all
16 CFLAGS   = $(shell dpkg-buildflags --get CFLAGS)
17 CFLAGS  += -Wall -g -I/usr/include/ncursesw
19 CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
21 LDFLAGS  = $(shell dpkg-buildflags --get LDFLAGS)
23 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
24         CFLAGS += -O0
25 else
26         CFLAGS += -O2
27 endif
29 config.status: configure
30         dh_testdir
31         ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
32                 --prefix=/usr --mandir=\$${prefix}/share/man --sysconfdir=/etc \
33                 CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
35 build: build-arch build-indep
37 build-arch: build-stamp
38 build-indep: build-stamp
40 build-stamp: config.status
41         dh_testdir
42         
43         $(MAKE) all doc
44         
45         touch build-stamp
47 clean:
48         dh_testdir
49         dh_testroot
50         rm -f build-stamp
51         
52         $(MAKE) clean
53         
54         rm -f config.h config.log config.make config.status
55         rm -rf manual.html-chunked/
56         rm -f manual.pdf manual.html manual.toc
57         rm -f tig.1 tig.1.html tigrc.5 tigrc.5.html
58         rm -f NEWS.html README.html
59         
60         dh_clean 
62 install: build
63         dh_testdir
64         dh_testroot
65         dh_clean -k
66         dh_installdirs
67         
68         $(MAKE) install install-doc DESTDIR=$(CURDIR)/debian/tig
69         
70         mkdir -p debian/tig/etc/bash_completion.d
71         cp contrib/tig-completion.bash debian/tig/etc/bash_completion.d/tig
72         chmod 644 debian/tig/etc/bash_completion.d/tig
74 binary-indep:
75         # nothing to do here
77 binary-arch: build install
78         dh_testdir
79         dh_testroot
80         dh_installchangelogs NEWS
81         dh_installdocs BUGS manual.pdf
82         dh_installexamples contrib/tigrc
83         dh_link
84         dh_strip
85         dh_compress -X.pdf
86         dh_fixperms
87         dh_installdeb
88         dh_shlibdeps
89         dh_gencontrol
90         dh_md5sums
91         dh_builddeb
93 binary: binary-indep binary-arch
94 .PHONY: build clean binary-indep binary-arch binary install