Code

Don't update CFLAGS if DEB_BUILD_OPTIONS contains noopt.
[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 config.status: configure
24         dh_testdir
25         ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
26                 --prefix=/usr --mandir=\$${prefix}/share/man --sysconfdir=/etc \
27                 CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
29 build: build-arch build-indep
31 build-arch: build-stamp
32 build-indep: build-stamp
34 build-stamp: config.status
35         dh_testdir
36         
37         $(MAKE) all doc
38         
39         touch build-stamp
41 clean:
42         dh_testdir
43         dh_testroot
44         rm -f build-stamp
45         
46         $(MAKE) clean
47         
48         rm -f config.h config.log config.make config.status
49         rm -rf doc/manual.html-chunked/
50         rm -f doc/manual.pdf doc/manual.html doc/manual.toc doc/manual.tex
51         rm -f doc/tigmanual.7
52         rm -f doc/tig.1 doc/tig.1.html doc/tigrc.5 doc/tigrc.5.html
53         rm -f INSTALL.html NEWS.html README.html
54         
55         dh_clean
57 install: build
58         dh_testdir
59         dh_testroot
60         dh_prep
61         dh_installdirs
62         
63         $(MAKE) install install-doc DESTDIR=$(CURDIR)/debian/tig
64         # don't ship install instructions; README only links to them
65         rm -f debian/tig/usr/share/doc/tig/INSTALL.html \
66                 debian/tig/usr/share/doc/tig/README.html
67         
68         mkdir -p debian/tig/usr/share/bash-completion/completions
69         cp contrib/tig-completion.bash debian/tig/usr/share/bash-completion/completions/tig
70         chmod 644 debian/tig/usr/share/bash-completion/completions/tig
72 binary-indep:
73         # nothing to do here
75 binary-arch: build install
76         dh_testdir
77         dh_testroot
78         dh_installchangelogs NEWS.adoc
79         dh_installdocs doc/manual.pdf
80         dh_installexamples contrib/*.tigrc
81         dh_link
82         dh_strip
83         dh_compress -X.pdf
84         dh_fixperms
85         dh_installdeb
86         dh_shlibdeps
87         dh_gencontrol
88         dh_md5sums
89         dh_builddeb
91 binary: binary-indep binary-arch
92 .PHONY: build clean binary-indep binary-arch binary install