d978367b9c6f3ca1b9e719c8cbee497000db373b
[debian/tar] / debian / rules
1 #!/usr/bin/make -f
2
3 DEB_BUILD_GNU_TYPE = $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
4 DEB_HOST_GNU_TYPE = $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
5 ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
6 CONFARGS = --host=$(DEB_HOST_GNU_TYPE)
7 endif
8
9 CFLAGS = `dpkg-buildflags --get CFLAGS`
10 CFLAGS += -Wall
11 LDFLAGS += `dpkg-buildflags --get LDFLAGS`
12 CPPFLAGS = `dpkg-buildflags --get CPPFLAGS`
13
14 configure: configure-stamp
15 configure-stamp:
16         dh_testdir
17         cp -f /usr/share/misc/config.sub build-aux/config.sub
18         cp -f /usr/share/misc/config.guess build-aux/config.guess
19         RSH="/usr/bin/rsh" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure \
20                 --prefix=/usr \
21                 --libexecdir=/usr/sbin \
22                 --with-lzma=xz \
23                 $(CONFARGS) 
24         touch configure-stamp
25
26 build: build-arch build-indep
27 build-arch: build-stamp
28 build-indep: build-stamp
29 build-stamp: configure-stamp
30         dh_testdir
31         RSH="/usr/bin/rsh" CFLAGS="-O2 -g -Wall -fno-gnu89-inline" $(MAKE)
32
33 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
34 ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
35         @runas=`whoami` ; \
36         if test $$runas = "root" ; \
37         then \
38           echo "Sorry, but the test suite is not designed to be run as root."; \
39           exit 1 ;\
40         fi
41         (cd tests ; $(MAKE) clean)
42         $(MAKE) check
43 endif
44 endif
45
46         perl debian/tarman > debian/tar.1
47         touch build-stamp
48
49 clean:
50         dh_testdir
51         dh_testroot
52         rm -f build-stamp configure-stamp debian/tar.1
53         [ ! -f Makefile ] || $(MAKE) distclean
54         dh_clean
55
56 install: build
57         dh_testdir
58         dh_testroot
59         dh_clean -k
60         dh_installdirs
61
62         make install bindir=`pwd`/debian/tar/bin prefix=`pwd`/debian/tar/usr \
63                 libexecdir=`pwd`/debian/tar/usr/sbin 
64         install -m 755 debian/rmt.sh debian/tar/etc/rmt
65         mv debian/tar/usr/sbin/rmt debian/tar/usr/sbin/rmt-tar
66
67 # Build architecture-independent files here.
68 binary-indep: build install
69
70 # Build architecture-dependent files here.
71 binary-arch: build install
72         dh_testdir
73         dh_testroot
74         dh_installdocs
75         mv -f debian/tar/usr/share/doc/tar/ChangeLog \
76                 debian/tar/usr/share/doc/tar/changelog
77         mv -f debian/tar/usr/share/doc/tar/ChangeLog.1 \
78                 debian/tar/usr/share/doc/tar/changelog.1
79         dh_installexamples
80         dh_installmenu
81         dh_installcron
82         dh_installman debian/tar.1 debian/rmt.8
83         mv debian/tar/usr/share/man/man8/rmt.8 \
84            debian/tar/usr/share/man/man8/rmt-tar.8
85         dh_installinfo
86         rm -f debian/tar/usr/share/info/dir*
87         dh_installmime
88         dh_installchangelogs #CHANGELOGS#
89         dh_link
90         dh_strip
91         dh_compress
92         dh_fixperms
93         dh_installdeb
94         dh_shlibdeps
95         dh_gencontrol
96         dh_md5sums
97         dh_builddeb
98
99 binary: binary-indep binary-arch
100 .PHONY: build clean binary-indep binary-arch binary install configure