rules 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #!/usr/bin/make -f
  2. export DEB_BUILD_MAINT_OPTIONS = hardening=+all
  3. DPKG_EXPORT_BUILDFLAGS = 1
  4. include /usr/share/dpkg/buildflags.mk
  5. #export DH_OPTIONS
  6. DEB_HOST_GNU_TYPE ?=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
  7. DEB_BUILD_GNU_TYPE ?=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
  8. STRIP =strip
  9. ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
  10. STRIP =: nostrip
  11. endif
  12. CONFFLAGS =
  13. CC =gcc
  14. ifneq (,$(findstring diet,$(DEB_BUILD_OPTIONS)))
  15. CONFFLAGS =--disable-zlib
  16. CC =diet -v -Os gcc -nostdinc
  17. endif
  18. DIR =$(shell pwd)/debian/dropbear
  19. patch: deb-checkdir patch-stamp
  20. patch-stamp:
  21. for i in `ls -1 debian/diff/*.diff || :`; do \
  22. patch -p1 <$$i || exit 1; \
  23. done
  24. touch patch-stamp
  25. config.status: patch-stamp configure
  26. CC='$(CC)' \
  27. CFLAGS='$(CFLAGS)'' -DSFTPSERVER_PATH="\"/usr/lib/sftp-server\""' \
  28. ./configure --host='$(DEB_HOST_GNU_TYPE)' \
  29. --build='$(DEB_BUILD_GNU_TYPE)' --prefix=/usr \
  30. --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info \
  31. $(CONFFLAGS)
  32. build: deb-checkdir build-stamp
  33. build-stamp: config.status
  34. $(MAKE) CC='$(CC)' LD='$(CC)'
  35. touch build-stamp
  36. clean: deb-checkdir deb-checkuid
  37. test ! -r Makefile || $(MAKE) distclean
  38. rm -f libtomcrypt/Makefile libtommath/Makefile
  39. test ! -e patch-stamp || \
  40. for i in `ls -1r debian/diff/*.diff || :`; do \
  41. patch -p1 -R <$$i; \
  42. done
  43. rm -f patch-stamp build-stamp config.log config.status
  44. rm -rf '$(DIR)'
  45. rm -f debian/files debian/substvars debian/copyright changelog
  46. install: deb-checkdir deb-checkuid build-stamp
  47. rm -rf '$(DIR)'
  48. install -d -m0755 '$(DIR)'/etc/dropbear
  49. # programs
  50. install -d -m0755 '$(DIR)'/usr/sbin
  51. install -m0755 dropbear '$(DIR)'/usr/sbin/dropbear
  52. install -d -m0755 '$(DIR)'/usr/bin
  53. install -m0755 dbclient '$(DIR)'/usr/bin/dbclient
  54. install -m0755 dropbearkey '$(DIR)'/usr/bin/dropbearkey
  55. install -d -m0755 '$(DIR)'/usr/lib/dropbear
  56. install -m0755 dropbearconvert \
  57. '$(DIR)'/usr/lib/dropbear/dropbearconvert
  58. $(STRIP) -R .comment -R .note '$(DIR)'/usr/sbin/* \
  59. '$(DIR)'/usr/bin/* '$(DIR)'/usr/lib/dropbear/*
  60. # init and run scripts
  61. install -d -m0755 '$(DIR)'/etc/init.d
  62. install -m0755 debian/dropbear.init '$(DIR)'/etc/init.d/dropbear
  63. install -m0755 debian/service/run '$(DIR)'/etc/dropbear/run
  64. install -d -m0755 '$(DIR)'/etc/dropbear/log
  65. install -m0755 debian/service/log '$(DIR)'/etc/dropbear/log/run
  66. ln -s /var/log/dropbear '$(DIR)'/etc/dropbear/log/main
  67. # man pages
  68. install -d -m0755 '$(DIR)'/usr/share/man/man8
  69. install -d -m0755 '$(DIR)'/usr/share/man/man1
  70. install -m644 dropbear.8 '$(DIR)'/usr/share/man/man8/
  71. for i in dbclient.1 dropbearkey.1 dropbearconvert.1; do \
  72. install -m644 $$i '$(DIR)'/usr/share/man/man1/ || exit 1; \
  73. done
  74. gzip -9 '$(DIR)'/usr/share/man/man8/*.8
  75. gzip -9 '$(DIR)'/usr/share/man/man1/*.1
  76. # copyright, changelog
  77. cat debian/copyright.in LICENSE >debian/copyright
  78. test -r changelog || ln -s CHANGES changelog
  79. binary-indep:
  80. binary-arch: install dropbear.deb
  81. test '$(CC)' != 'gcc' || \
  82. dpkg-shlibdeps '$(DIR)'/usr/sbin/* '$(DIR)'/usr/bin/* \
  83. '$(DIR)'/usr/lib/dropbear/*
  84. dpkg-gencontrol -isp -pdropbear -P'$(DIR)'
  85. dpkg -b '$(DIR)' ..
  86. binary: binary-arch binary-indep
  87. .PHONY: patch build clean install binary-indep binary-arch binary
  88. include debian/implicit