rules 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. #!/usr/bin/make -f
  2. # Uncomment this to turn on verbose mode.
  3. #export DH_VERBOSE=1
  4. DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
  5. DEB_HOST_GNU_CPU ?= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
  6. DEB_HOST_GNU_SYSTEM ?= $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
  7. VERSION = $(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)
  8. ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
  9. CONFIG_DEBUG = true
  10. endif
  11. ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
  12. endif
  13. PACKAGE_PREFIX = busybox-cvs
  14. ARCH_FLOPPY_UDEB = $(shell sh debian/control-extract Architecture $(PACKAGE_PREFIX)-floppy-udeb)
  15. PACKAGES_DEB = $(PACKAGE_PREFIX) $(PACKAGE_PREFIX)-static
  16. PACKAGES_UDEB = $(PACKAGE_PREFIX)-udeb
  17. ifneq ($(filter $(DEB_HOST_ARCH),$(ARCH_FLOPPY_UDEB)),)
  18. PACKAGES_UDEB += $(PACKAGE_PREFIX)-floppy-udeb
  19. endif
  20. PACKAGES = $(PACKAGES_DEB) $(PACKAGES_UDEB)
  21. DEBHELPER_PACKAGES_DEB = $(patsubst %,-p%,$(PACKAGES_DEB))
  22. DEBHELPER_PACKAGES_UDEB = $(patsubst %,-p%,$(PACKAGES_UDEB))
  23. CONFIG = $(firstword $(wildcard ./debian/config-$(1)-$(DEB_HOST_GNU_SYSTEM)-$(DEB_HOST_GNU_CPU) ./debian/config-$(1)-$(DEB_HOST_GNU_SYSTEM) ./debian/config-$(1)))
  24. CONFIG_DEB = $(call CONFIG,deb)
  25. CONFIG_STATIC = $(call CONFIG,static)
  26. CONFIG_UDEB = $(call CONFIG,udeb)
  27. CONFIG_FLOPPY_UDEB = $(call CONFIG,floppy-udeb)
  28. configure: configure-stamp
  29. configure-stamp:
  30. sh ./configure
  31. touch $@
  32. build-arch: build-arch-deb-all build-arch-udeb-all
  33. build-arch-deb-all: build-arch-deb build-arch-static build-arch-doc
  34. build-arch-udeb-all: build-arch-udeb build-arch-floppy-udeb
  35. build-arch-deb: build-arch-deb-stamp
  36. build-arch-deb-stamp: configure-stamp
  37. $(MAKE) clean
  38. cp $(CONFIG_DEB) .config
  39. $(MAKE) dep
  40. $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG)
  41. install -d install-$(PACKAGE_PREFIX)/bin
  42. install busybox install-$(PACKAGE_PREFIX)/bin/busybox
  43. touch $@
  44. build-arch-static: build-arch-static-stamp
  45. build-arch-static-stamp: configure-stamp
  46. $(MAKE) clean
  47. cp $(CONFIG_STATIC) .config
  48. $(MAKE) dep
  49. $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG)
  50. install -d install-$(PACKAGE_PREFIX)-static/bin
  51. install busybox install-$(PACKAGE_PREFIX)-static/bin/busybox
  52. touch $@
  53. build-arch-udeb: build-arch-udeb-stamp
  54. build-arch-udeb-stamp: configure-stamp
  55. $(MAKE) clean
  56. cp $(CONFIG_UDEB) .config
  57. $(MAKE) dep
  58. $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG)
  59. $(MAKE) PREFIX=$(CURDIR)/install-$(PACKAGE_PREFIX)-udeb install
  60. # Remove init link, but init support is still compiled in to be
  61. # used.
  62. rm -f $(CURDIR)/install-$(PACKAGE_PREFIX)-udeb/sbin/init
  63. touch $@
  64. build-arch-floppy-udeb: build-arch-floppy-udeb-stamp
  65. build-arch-floppy-udeb-stamp: configure-stamp
  66. ifneq ($(filter $(DEB_HOST_ARCH),$(ARCH_FLOPPY_UDEB)),)
  67. $(MAKE) clean
  68. cp $(CONFIG_FLOPPY_UDEB) .config
  69. $(MAKE) dep
  70. $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG)
  71. $(MAKE) PREFIX=$(CURDIR)/install-$(PACKAGE_PREFIX)-floppy-udeb install
  72. endif
  73. touch $@
  74. build-arch-doc: build-arch-doc-stamp
  75. build-arch-doc-stamp: configure-stamp
  76. $(MAKE) docs/BusyBox.1
  77. cp docs/BusyBox.1 busybox.1
  78. touch $@
  79. build: build-arch
  80. clean:
  81. dh_testdir
  82. dh_testroot
  83. rm -f build-*-stamp configure-stamp debian/files~
  84. -$(MAKE) distclean
  85. -rm -rf busybox-deb busybox-static install* busybox.1
  86. dh_clean
  87. install-deb: build-arch-deb-all
  88. dh_testdir
  89. dh_testroot
  90. dh_clean -k $(DEBHELPER_PACKAGES_DEB)
  91. dh_installdirs $(DEBHELPER_PACKAGES_DEB)
  92. for i in $(PACKAGES_DEB); do \
  93. ( \
  94. cd install-$$i; \
  95. find -type d -exec install -d $(CURDIR)/debian/$$i/{} \;; \
  96. find \( -type f -o -type l \) -exec cp -a {} $(CURDIR)/debian/$$i/{} \;; \
  97. ); \
  98. done
  99. install -m644 debian/$(PACKAGE_PREFIX)-static.override \
  100. debian/$(PACKAGE_PREFIX)-static/usr/share/lintian/overrides/$(PACKAGE_PREFIX)-static
  101. install-udeb: build-arch-udeb-all
  102. dh_testdir
  103. dh_testroot
  104. dh_clean -k $(DEBHELPER_PACKAGES_UDEB)
  105. dh_installdirs $(DEBHELPER_PACKAGES_UDEB)
  106. for i in $(PACKAGES_UDEB); do \
  107. ( \
  108. cd install-$$i; \
  109. find -type d -exec install -d $(CURDIR)/debian/$$i/{} \;; \
  110. find \( -type f -o -type l \) -exec cp -a {} $(CURDIR)/debian/$$i/{} \;; \
  111. ); \
  112. done
  113. binary-arch: binary-arch-deb binary-arch-udeb
  114. # Build architecture-dependent files here.
  115. binary-arch-deb: build-arch-deb-all install-deb
  116. dh_testdir
  117. dh_testroot
  118. dh_installdocs $(DEBHELPER_PACKAGES_DEB)
  119. dh_installman $(DEBHELPER_PACKAGES_DEB)
  120. dh_installchangelogs Changelog $(DEBHELPER_PACKAGES_DEB)
  121. dh_strip $(DEBHELPER_PACKAGES_DEB)
  122. dh_link $(DEBHELPER_PACKAGES_DEB)
  123. dh_compress $(DEBHELPER_PACKAGES_DEB)
  124. dh_fixperms $(DEBHELPER_PACKAGES_DEB)
  125. dh_installdeb $(DEBHELPER_PACKAGES_DEB)
  126. dh_shlibdeps $(DEBHELPER_PACKAGES_DEB)
  127. dh_gencontrol $(DEBHELPER_PACKAGES_DEB)
  128. dh_md5sums $(DEBHELPER_PACKAGES_DEB)
  129. dh_builddeb $(DEBHELPER_PACKAGES_DEB)
  130. # Build architecture-dependent files here.
  131. binary-arch-udeb: build-arch-udeb-all install-udeb
  132. dh_testdir
  133. dh_testroot
  134. dh_strip $(DEBHELPER_PACKAGES_UDEB)
  135. dh_link $(DEBHELPER_PACKAGES_UDEB)
  136. dh_compress $(DEBHELPER_PACKAGES_UDEB)
  137. dh_fixperms $(DEBHELPER_PACKAGES_UDEB)
  138. dh_installdeb $(DEBHELPER_PACKAGES_UDEB)
  139. dh_shlibdeps $(DEBHELPER_PACKAGES_UDEB)
  140. dh_gencontrol $(DEBHELPER_PACKAGES_DEB)
  141. $(foreach PACKAGE, $(PACKAGES_UDEB), \
  142. dh_gencontrol -p$(PACKAGE) -- -fdebian/files~; \
  143. dpkg-distaddfile $(PACKAGE)_$(VERSION)_$(DEB_HOST_ARCH).udeb debian-installer extra; \
  144. dh_builddeb -p$(PACKAGE) --filename=$(PACKAGE)_$(VERSION)_$(DEB_HOST_ARCH).udeb; \
  145. )
  146. binary: binary-arch
  147. .PHONY: build clean binary-indep binary-arch binary install