98ee7e5b339bb92f0d7fc7736d2fc39902de1716
[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 export BUILD_DATE = $(shell dpkg-parsechangelog | sed -n -e 's/^Date: //p')
15
16 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
17   NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
18   MAKEFLAGS += -j$(NUMJOBS)
19 endif
20
21 configure: configure-stamp
22 configure-stamp:
23         dh_testdir
24         cp -f /usr/share/misc/config.sub build-aux/config.sub
25         cp -f /usr/share/misc/config.guess build-aux/config.guess
26         autoreconf --force -v --install
27         RSH="/usr/bin/rsh" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure \
28                 --prefix=/usr \
29                 --libexecdir=/usr/lib/tar \
30                 --enable-backup-scripts \
31                 --with-lzma=xz \
32                 --disable-silent-rules \
33                 $(CONFARGS) 
34         touch configure-stamp
35
36 build: build-arch build-indep
37 build-arch: build-stamp
38 build-indep: build-stamp
39 build-stamp: configure-stamp
40         dh_testdir
41         RSH="/usr/bin/rsh" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" \
42                 LDFLAGS="$(LDFLAGS)" $(MAKE) $(MAKEFLAGS)
43
44 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
45 ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
46         @runas=`whoami` ; \
47         if test $$runas = "root" ; \
48         then \
49           echo "Sorry, but the test suite is not designed to be run as root."; \
50           exit 1 ;\
51         fi
52         $(MAKE) check
53 endif
54 endif
55
56         perl debian/tarman > debian/tar.1
57         touch build-stamp
58
59 clean:
60         dh_testdir
61         dh_testroot
62         rm -f build-stamp configure-stamp debian/tar.1
63         [ ! -f Makefile ] || $(MAKE) distclean
64         dh_clean
65
66 install: build
67         dh_testdir
68         dh_testroot
69         dh_clean -k
70         dh_installdirs
71
72         make install bindir=`pwd`/debian/tar/bin prefix=`pwd`/debian/tar/usr \
73                 libexecdir=`pwd`/debian/tar/usr/lib/tar 
74         install -m 755 debian/rmt.sh debian/tar/etc/rmt
75         mv debian/tar/usr/lib/tar/rmt debian/tar/usr/sbin/rmt-tar
76         install -m 755 debian/tarcat debian/tar/usr/sbin/tarcat
77
78         mv debian/tar/usr/sbin/backup debian/tar-scripts/usr/sbin/tar-backup
79         mv debian/tar/usr/sbin/restore debian/tar-scripts/usr/sbin/tar-restore
80         mv debian/tar/usr/lib/tar/backup.sh debian/tar-scripts/usr/lib/tar/
81         mv debian/tar/usr/lib/tar/dump-remind debian/tar-scripts/usr/lib/tar/
82
83 # Build architecture-independent files here.
84 binary-indep: build install
85
86 # Build architecture-dependent files here.
87 binary-arch: build install
88         dh_testdir
89         dh_testroot
90         dh_installdocs
91         mv -f debian/tar/usr/share/doc/tar/ChangeLog \
92                 debian/tar/usr/share/doc/tar/changelog
93         mv -f debian/tar/usr/share/doc/tar/ChangeLog.1 \
94                 debian/tar/usr/share/doc/tar/changelog.1
95         dh_installexamples
96         dh_installmenu
97         dh_installcron
98         dh_installman debian/tar.1 debian/rmt.8 debian/tarcat.1
99         mv debian/tar/usr/share/man/man8/rmt.8 \
100            debian/tar/usr/share/man/man8/rmt-tar.8
101         dh_installinfo
102         rm -f debian/tar/usr/share/info/dir*
103         dh_installmime
104         dh_installchangelogs #CHANGELOGS#
105         dh_link
106         dh_strip
107         dh_compress
108         dh_fixperms
109         dh_installdeb
110         dh_shlibdeps
111         dh_gencontrol
112         dh_md5sums
113         dh_builddeb
114
115 binary: binary-indep binary-arch
116 .PHONY: build clean binary-indep binary-arch binary install configure