File: rules

package info (click to toggle)
rsync 3.0.3-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,472 kB
  • ctags: 3,518
  • sloc: ansic: 35,122; sh: 4,882; perl: 1,415; makefile: 267; python: 83
file content (131 lines) | stat: -rwxr-xr-x 5,365 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/usr/bin/make -f
# debian.rules file for rsync
# Copyright 1996 by Philip Hands.
# Copyright 2001 Colin Walters <walters@debian.org>
# Based on the  sample debian.rules file - for GNU Hello (1.3).
#   Copyright 1994,1995 by Ian Jackson.
# I hereby give you perpetual unlimited permission to copy,
# modify and relicense this file, provided that you do not remove
# my name from the file itself.  (I assert my moral right of
# paternity under the Copyright, Designs and Patents Act 1988.)


SHELL =	/bin/bash
BINS = rsync
CFLAGS= -Wall
INSTALL = install
INSTALL_FILE = $(INSTALL) -p    -o root -g root  -m  644
INSTALL_PROGRAM = $(INSTALL) -p    -o root -g root  -m  755
INSTALL_SCRIPT = $(INSTALL) -p    -o root -g root  -m  755
INSTALL_DIR = $(INSTALL) -p -d -o root -g root  -m  755

# policy stuff
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
CFLAGS += -g
else
CFLAGS += -g -O2
endif

# backwards compatibility stuff, from dpkg-architecture manpage
DEB_BUILD_ARCH := $(shell dpkg --print-installation-architecture)
DEB_BUILD_GNU_CPU := $(patsubst hurd-%,%,$(DEB_BUILD_ARCH))
ifeq ($(filter-out hurd-%,$(DEB_BUILD_ARCH)),)
DEB_BUILD_GNU_SYSTEM := gnu
else
DEB_BUILD_GNU_SYSTEM := linux
endif
DEB_BUILD_GNU_TYPE=$(DEB_BUILD_GNU_CPU)-$(DEB_BUILD_GNU_SYSTEM)

DEB_HOST_ARCH=$(DEB_BUILD_ARCH)
DEB_HOST_GNU_CPU=$(DEB_BUILD_GNU_CPU)
DEB_HOST_GNU_SYSTEM=$(DEB_BUILD_GNU_SYSTEM)
DEB_HOST_GNU_TYPE=$(DEB_BUILD_GNU_TYPE)

DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)


build:
	echo building build tree
	-rm -rf debian/buildtree
	mkdir debian/buildtree
	cp -p * debian/buildtree || true
	cp -r lib popt support testsuite zlib debian/buildtree
	@echo applying acl support patch
	cat patches/acls.diff | (cd debian/buildtree; patch -p1)
	@echo applying misc Debian patches
	for i in debian/patches/*.patch debian/patches/*.diff; do if [ -s $$i ]; then echo "  $$i ..."; cat $$i | (cd debian/buildtree; patch -p1) || exit 1; fi; done
	echo configuring
	(cd debian/buildtree; ./configure --prefix=/usr --mandir='$${prefix}/share/man' --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE))
	# --enable-acl-support
	echo building
	$(MAKE) --directory=debian/buildtree CFLAGS="$(CFLAGS)" all
	touch build
	echo done

clean: checkdir
	-rm -f build
	# -$(MAKE) -i distclean || $(MAKE) -f Makefile.in distclean
	-rm -rf debian/buildtree
	-rm -rf *~ debian/tmp debian/*~ debian/*.bak debian/files* debian/substvars
	# -rm -f lib/dummy zlib/dummy
	# rm -f config.cache config.log acconfig.h

binary-indep:	checkroot build
# nothing to do

binary-arch:	checkroot build
	-rm -rf debian/tmp
	$(INSTALL_DIR) 	debian/tmp \
			debian/tmp/DEBIAN \
			debian/tmp/usr/bin \
			debian/tmp/usr/share/doc/rsync/examples \
			debian/tmp/usr/share/doc/rsync/scripts \
			debian/tmp/usr/share/man/man1 \
			debian/tmp/usr/share/man/man5 \
			debian/tmp/etc \
			debian/tmp/etc/default \
			debian/tmp/etc/init.d
			# debian/tmp/usr/lib/debian-test/tests
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	$(MAKE) --directory=debian/buildtree install-strip prefix=`pwd`/debian/tmp/usr exec_prefix=`pwd`/debian/tmp/usr
else
	$(MAKE) --directory=debian/buildtree install prefix=`pwd`/debian/tmp/usr exec_prefix=`pwd`/debian/tmp/usr
endif
	$(INSTALL_FILE) debian/changelog debian/tmp/usr/share/doc/rsync/changelog.Debian
	$(INSTALL_FILE) README tech_report.tex debian/tmp/usr/share/doc/rsync/
	$(INSTALL_FILE) TODO                   debian/tmp/usr/share/doc/rsync/
	$(INSTALL_FILE) NEWS                   debian/tmp/usr/share/doc/rsync/changelog
	$(INSTALL_FILE) packaging/cull_options debian/tmp/usr/share/doc/rsync/scripts/
	$(INSTALL_FILE) support/atomic-rsync support/cvs2includes support/file-attr-restore support/files-to-excludes support/git-set-file-times support/logfilter support/lsh support/mnt-excl support/munge-symlinks support/rrsync support/rsyncstats debian/tmp/usr/share/doc/rsync/scripts/
	# $(INSTALL_FILE) debian/README.Debian   debian/tmp/usr/share/doc/rsync/
	echo -e '\n\f' >> debian/tmp/usr/share/doc/rsync/changelog
	cat OLDNEWS    >> debian/tmp/usr/share/doc/rsync/changelog
	gzip -9fr `find debian/tmp/usr/share/doc/ debian/tmp/usr/share/man/ -type f`
	$(INSTALL_FILE) debian/rsyncd.conf debian/logrotate.conf.rsync debian/tmp/usr/share/doc/rsync/examples/
	$(INSTALL_FILE) debian/copyright debian/tmp/usr/share/doc/rsync/
	# $(INSTALL_SCRIPT) test.sh debian/tmp/usr/lib/debian-test/tests/rsync
	$(INSTALL_SCRIPT) debian/postinst debian/tmp/DEBIAN/
	$(INSTALL_SCRIPT) debian/prerm    debian/tmp/DEBIAN/
	$(INSTALL_SCRIPT) debian/postrm   debian/tmp/DEBIAN/
	$(INSTALL_FILE) debian/default  debian/tmp/etc/default/rsync
	$(INSTALL_SCRIPT) debian/init.d debian/tmp/etc/init.d/rsync
	(cd debian/tmp; find ./etc -type f | sed s,.,,) > debian/tmp/DEBIAN/conffiles
	(cd debian/tmp; find usr -type f -print0 | xargs -0 md5sum) > debian/tmp/DEBIAN/md5sums
	dpkg-shlibdeps debian/tmp/usr/bin/$(BINS)
	dpkg-gencontrol -isp
	chown -R root.root debian/tmp
	chmod -R go=rX debian/tmp
	dpkg --build debian/tmp ..

# Below here is fairly generic really

binary:		binary-indep binary-arch

checkdir:
	@test -f rsync.c -a -f debian/rules

checkroot: checkdir
	@test 0 = `id -u` || { echo "Error: not super-user"; exit 1; }

.PHONY: binary binary-arch binary-indep clean checkroot checkdir