rules 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #!/usr/bin/make -f
  2. # debian.rules file for rsync
  3. # Copyright 1996 by Philip Hands.
  4. # Copyright 2001 Colin Walters <walters@debian.org>
  5. # Based on the sample debian.rules file - for GNU Hello (1.3).
  6. # Copyright 1994,1995 by Ian Jackson.
  7. # I hereby give you perpetual unlimited permission to copy,
  8. # modify and relicense this file, provided that you do not remove
  9. # my name from the file itself. (I assert my moral right of
  10. # paternity under the Copyright, Designs and Patents Act 1988.)
  11. SHELL = /bin/bash
  12. BINS = rsync
  13. CFLAGS= -Wall
  14. INSTALL = install
  15. INSTALL_FILE = $(INSTALL) -p -o root -g root -m 644
  16. INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755
  17. INSTALL_SCRIPT = $(INSTALL) -p -o root -g root -m 755
  18. INSTALL_DIR = $(INSTALL) -p -d -o root -g root -m 755
  19. # policy stuff
  20. ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
  21. CFLAGS += -g
  22. else
  23. CFLAGS += -g -O2
  24. endif
  25. # backwards compatibility stuff, from dpkg-architecture manpage
  26. DEB_BUILD_ARCH := $(shell dpkg --print-architecture)
  27. DEB_BUILD_GNU_CPU := $(patsubst hurd-%,%,$(DEB_BUILD_ARCH))
  28. ifeq ($(filter-out hurd-%,$(DEB_BUILD_ARCH)),)
  29. DEB_BUILD_GNU_SYSTEM := gnu
  30. else
  31. DEB_BUILD_GNU_SYSTEM := linux
  32. endif
  33. DEB_BUILD_GNU_TYPE=$(DEB_BUILD_GNU_CPU)-$(DEB_BUILD_GNU_SYSTEM)
  34. DEB_HOST_ARCH=$(DEB_BUILD_ARCH)
  35. DEB_HOST_GNU_CPU=$(DEB_BUILD_GNU_CPU)
  36. DEB_HOST_GNU_SYSTEM=$(DEB_BUILD_GNU_SYSTEM)
  37. DEB_HOST_GNU_TYPE=$(DEB_BUILD_GNU_TYPE)
  38. DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
  39. DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
  40. # keep lintian happy:
  41. build: build-arch build-indep
  42. build-arch: build-stamp
  43. build-indep: build-stamp
  44. build-stamp:
  45. @echo building build tree
  46. -rm -rf debian/buildtree
  47. mkdir debian/buildtree
  48. cp -p * debian/buildtree || true
  49. cp -r lib popt support testsuite zlib debian/buildtree
  50. @echo applying misc Debian patches
  51. 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
  52. @echo configuring
  53. (cd debian/buildtree; ./configure --prefix=/usr --mandir='$${prefix}/share/man' --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE))
  54. @echo building
  55. $(MAKE) --directory=debian/buildtree CFLAGS="$(CFLAGS)" all
  56. touch build-stamp
  57. @echo done
  58. clean: checkdir
  59. -rm -f build-stamp
  60. -rm -rf debian/buildtree
  61. -rm -rf *~ debian/tmp debian/*~ debian/*.bak debian/files* debian/substvars
  62. binary-indep: checkroot build
  63. # nothing to do
  64. binary-arch: checkroot build
  65. -rm -rf debian/tmp
  66. $(INSTALL_DIR) debian/tmp \
  67. debian/tmp/DEBIAN \
  68. debian/tmp/usr/bin \
  69. debian/tmp/usr/share/doc/rsync/examples \
  70. debian/tmp/usr/share/doc/rsync/scripts \
  71. debian/tmp/usr/share/man/man1 \
  72. debian/tmp/usr/share/man/man5 \
  73. debian/tmp/usr/share/lintian/overrides \
  74. debian/tmp/lib/systemd/system \
  75. debian/tmp/etc \
  76. debian/tmp/etc/default \
  77. debian/tmp/etc/init.d
  78. # debian/tmp/usr/lib/debian-test/tests
  79. ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
  80. $(MAKE) --directory=debian/buildtree install-strip prefix=`pwd`/debian/tmp/usr exec_prefix=`pwd`/debian/tmp/usr
  81. else
  82. $(MAKE) --directory=debian/buildtree install prefix=`pwd`/debian/tmp/usr exec_prefix=`pwd`/debian/tmp/usr
  83. endif
  84. $(INSTALL_FILE) debian/changelog debian/tmp/usr/share/doc/rsync/changelog.Debian
  85. $(INSTALL_FILE) README tech_report.tex debian/tmp/usr/share/doc/rsync/
  86. $(INSTALL_FILE) TODO debian/tmp/usr/share/doc/rsync/
  87. $(INSTALL_FILE) NEWS debian/tmp/usr/share/doc/rsync/changelog
  88. $(INSTALL_FILE) packaging/cull_options debian/tmp/usr/share/doc/rsync/scripts/
  89. $(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/
  90. # $(INSTALL_FILE) debian/README.Debian debian/tmp/usr/share/doc/rsync/
  91. echo -e '\n\f' >> debian/tmp/usr/share/doc/rsync/changelog
  92. cat OLDNEWS >> debian/tmp/usr/share/doc/rsync/changelog
  93. gzip -9fr `find debian/tmp/usr/share/doc/ debian/tmp/usr/share/man/ -type f`
  94. $(INSTALL_FILE) debian/rsyncd.conf debian/logrotate.conf.rsync debian/tmp/usr/share/doc/rsync/examples/
  95. $(INSTALL_FILE) debian/copyright debian/tmp/usr/share/doc/rsync/
  96. # $(INSTALL_SCRIPT) test.sh debian/tmp/usr/lib/debian-test/tests/rsync
  97. $(INSTALL_SCRIPT) debian/postinst debian/tmp/DEBIAN/
  98. $(INSTALL_SCRIPT) debian/prerm debian/tmp/DEBIAN/
  99. $(INSTALL_SCRIPT) debian/postrm debian/tmp/DEBIAN/
  100. $(INSTALL_FILE) debian/rsync.service debian/tmp/lib/systemd/system/
  101. $(INSTALL_FILE) debian/default debian/tmp/etc/default/rsync
  102. $(INSTALL_SCRIPT) debian/init.d debian/tmp/etc/init.d/rsync
  103. $(INSTALL_FILE) debian/lintian.overrides debian/tmp/usr/share/lintian/overrides/rsync
  104. (cd debian/tmp; find ./etc -type f | sed s,.,,) > debian/tmp/DEBIAN/conffiles
  105. (cd debian/tmp; find lib usr -type f -print0 | xargs -0 md5sum) > debian/tmp/DEBIAN/md5sums
  106. dpkg-shlibdeps debian/tmp/usr/bin/$(BINS)
  107. dpkg-gencontrol -isp
  108. chown -R root.root debian/tmp
  109. chmod -R go=rX debian/tmp
  110. dpkg --build debian/tmp ..
  111. # Below here is fairly generic really
  112. binary: binary-indep binary-arch
  113. checkdir:
  114. @test -f rsync.c -a -f debian/rules
  115. checkroot: checkdir
  116. @test 0 = `id -u` || { echo "Error: not super-user"; exit 1; }
  117. .PHONY: binary binary-arch binary-indep clean checkroot checkdir build build-arch build-indep