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