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