241026edc38a01d44df2d11acc509d0241370211
[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         install -m 755 debian/tarcat debian/tar/usr/sbin/tarcat
67
68 # Build architecture-independent files here.
69 binary-indep: build install
70
71 # Build architecture-dependent files here.
72 binary-arch: build install
73         dh_testdir
74         dh_testroot
75         dh_installdocs
76         mv -f debian/tar/usr/share/doc/tar/ChangeLog \
77                 debian/tar/usr/share/doc/tar/changelog
78         mv -f debian/tar/usr/share/doc/tar/ChangeLog.1 \
79                 debian/tar/usr/share/doc/tar/changelog.1
80         dh_installexamples
81         dh_installmenu
82         dh_installcron
83         dh_installman debian/tar.1 debian/rmt.8
84         mv debian/tar/usr/share/man/man8/rmt.8 \
85            debian/tar/usr/share/man/man8/rmt-tar.8
86         dh_installinfo
87         rm -f debian/tar/usr/share/info/dir*
88         dh_installmime
89         dh_installchangelogs #CHANGELOGS#
90         dh_link
91         dh_strip
92         dh_compress
93         dh_fixperms
94         dh_installdeb
95         dh_shlibdeps
96         dh_gencontrol
97         dh_md5sums
98         dh_builddeb
99
100 binary: binary-indep binary-arch
101 .PHONY: build clean binary-indep binary-arch binary install configure