rules 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. #!/usr/bin/make -f
  2. # Basic package information.
  3. package := $(shell grep Source debian/control | sed 's/^Source: //')
  4. date := $(shell date +"%Y-%m-%d")
  5. version := $(shell dpkg-parsechangelog | awk '/^Version:/ { print $$2; exit }')
  6. # Currently, emacs23 is required (xemacs is not sufficient).
  7. EMACS := emacs24
  8. # Location of the source and build directories.
  9. SRCTOP := $(CURDIR)
  10. TMPTOP := $(SRCTOP)/debian/tmp
  11. DOCDIR := $(TMPTOP)/usr/share/doc/$(package)
  12. LIBDIR := $(TMPTOP)/usr/share/doc-base
  13. # SGML source files in the top-level directory. We do some common actions
  14. # with each of these: validate, build text, HTML, and one-page HTML output,
  15. # and generate a tarball of the source.
  16. SGML_FILES := policy menu-policy perl-policy upgrading-checklist
  17. # org-mode source files in the top-level directory. We generate text and
  18. # HTML versions from these.
  19. ORG_FILES := Process README
  20. # doc-base description files for the documents we include.
  21. DESC_FILES := copyright-format-1.0 debian-policy debian-menu-policy \
  22. debian-perl-policy debconf-spec fhs autopkgtest
  23. # Our local copy of the File Hierarchy Standard. We don't build this from
  24. # source, but we do have a copy of the source in FHS_ARCHIVE.
  25. FHS_ARCHIVE := fhs-2.3-source.tar.gz
  26. FHS_FILES := fhs-2.3.html fhs-2.3.ps.gz fhs-2.3.txt.gz fhs-2.3.pdf.gz
  27. # A list of the simple Policy files that we include in the documentation
  28. # directory of the generated package. The tarballs of source are handled
  29. # separately, as are the directories of HTML output.
  30. POLICY_FILES := $(SGML_FILES:=.sgml) $(SGML_FILES:=.txt.gz) \
  31. $(SGML_FILES:=-1.html) version.ent \
  32. virtual-package-names-list.txt \
  33. copyright-format/copyright-format-1.0.html \
  34. copyright-format/copyright-format-1.0.txt.gz \
  35. autopkgtest/autopkgtest.html \
  36. autopkgtest/autopkgtest.txt.gz \
  37. debconf_spec/debconf_specification.html \
  38. debconf_spec/debconf_specification.txt.gz \
  39. policy.ps.gz policy.pdf.gz README.txt README.html \
  40. Process.txt Process.html
  41. # Used by the clean rules. STAMPS_TO_CLEAN are the stamp files used to tell
  42. # make that a target has completed, and are removed first. FILES_TO_CLEAN
  43. # are individual generated files to remove. DIRS_TO_CLEAN are entire
  44. # directories to remove.
  45. STAMPS_TO_CLEAN := stamp-binary stamp-build
  46. DIRS_TO_CLEAN := $(SGML_FILES:=.html) debian/tmp fhs
  47. FILES_TO_CLEAN := $(SGML_FILES:=.txt) $(SGML_FILES:=.txt.gz) \
  48. $(SGML_FILES:=.html.tar.gz) $(SGML_FILES:=-1.html) \
  49. $(ORG_FILES:=.html) $(ORG_FILES:=.txt) \
  50. policy.pdf.gz policy.ps.gz \
  51. policy.pdf policy.ps policy.tpt policy.txt \
  52. copyright-format/version.xml \
  53. autopkgtest/version.txt \
  54. debconf_spec/include/version.xml version.ent \
  55. copyright-format.xml.tar.gz \
  56. debconf_specification.xml.tar.gz \
  57. debian/files
  58. # Install files and directories with the correct ownership and permissions.
  59. install := install -p -o root -g root -m 644
  60. mkdir := install -d -o root -g root -m 755
  61. all build build-indep: stamp-build
  62. build-arch:
  63. stamp-build: version.ent copyright-format/version.xml \
  64. autopkgtest/version.txt \
  65. debconf_spec/include/version.xml
  66. $(MAKE) $(SGML_FILES:=.sgml.validate) \
  67. $(SGML_FILES:=.html.tar.gz) \
  68. $(SGML_FILES:=-1.html) \
  69. $(SGML_FILES:=.txt.gz) \
  70. policy.ps.gz policy.pdf.gz
  71. $(MAKE) $(ORG_FILES:=.html) \
  72. $(ORG_FILES:=.txt)
  73. $(MAKE) -C copyright-format all
  74. $(MAKE) -C autopkgtest all
  75. $(MAKE) -C debconf_spec all
  76. cd copyright-format && \
  77. GZIP=-n9 tar -zcf ../copyright-format.xml.tar.gz *
  78. cd debconf_spec && \
  79. GZIP=-n9 tar -zcf ../debconf_specification.xml.tar.gz *
  80. touch stamp-build
  81. # Create the version files for inclusion in the various documents. We want
  82. # to put the Policy version and date in each document, even if they
  83. # separately have their own versions.
  84. configure: version.ent copyright-format/version.xml \
  85. autopkgtest/version.txt \
  86. debconf_spec/include/version.xml
  87. version.ent: debian/changelog
  88. rm -f $@
  89. echo "<!entity version \"$(version)\">" >> $@
  90. echo "<!entity date \"$(date)\">" >> $@
  91. copyright-format/version.xml: debian/changelog
  92. rm -f $@
  93. echo '<?xml version="1.0" standalone="no"?>' > $@
  94. echo '<!ENTITY version "$(version)">' >> $@
  95. echo '<!ENTITY date "$(date)">' >> $@
  96. debconf_spec/include/version.xml: debian/changelog
  97. rm -f $@
  98. echo '<?xml version="1.0" standalone="no"?>' > $@
  99. echo '<!ENTITY version "$(version)">' >> $@
  100. echo '<!ENTITY date "$(date)">' >> $@
  101. autopkgtest/version.txt: debian/changelog
  102. rm -f $@
  103. echo > $@
  104. echo '---' >> $@
  105. echo 'Debian Policy $(version), $(date)' >> $@
  106. clean:
  107. rm -f $(STAMPS_TO_CLEAN)
  108. $(MAKE) -C copyright-format clean
  109. $(MAKE) -C autopkgtest clean
  110. $(MAKE) -C debconf_spec clean
  111. rm -f $(FILES_TO_CLEAN)
  112. rm -rf $(DIRS_TO_CLEAN)
  113. rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
  114. -name '*~' -o -name '*.bak' -o -name '#*#' -o \
  115. -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
  116. -size 0 \) -print` TAGS
  117. binary: binary-indep binary-arch
  118. binary-arch:
  119. binary-indep: stamp-binary
  120. stamp-binary: stamp-build
  121. @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') -eq 0 || \
  122. (echo 'You must run this as root (or use fakeroot)' >&2; exit 1)
  123. rm -rf $(TMPTOP)
  124. $(mkdir) $(TMPTOP)/DEBIAN
  125. $(mkdir) $(DOCDIR)/fhs
  126. $(mkdir) $(LIBDIR)
  127. #
  128. # Install simple files.
  129. #
  130. $(install) $(POLICY_FILES) $(DOCDIR)/
  131. $(install) $(FHS_FILES) $(DOCDIR)/fhs/
  132. $(install) debian/changelog $(DOCDIR)/
  133. $(install) debian/copyright $(DOCDIR)/
  134. #
  135. # Install DocBook XML source.
  136. #
  137. $(install) copyright-format.xml.tar.gz $(DOCDIR)/
  138. $(install) debconf_specification.xml.tar.gz $(DOCDIR)/
  139. #
  140. # Install generated HTML directories.
  141. #
  142. @set -ex; for file in $(SGML_FILES); do \
  143. tar -C $(DOCDIR) -zxf $$file.html.tar.gz; \
  144. done
  145. #
  146. # Make upgrading-checklist-1.html a symlink to the copy in the policy.html
  147. # directory. This is temporary until it becomes a proper appendix.
  148. #
  149. rm -f $(DOCDIR)/upgrading-checklist-1.html
  150. ln -s policy.html/upgrading-checklist.html \
  151. $(DOCDIR)/upgrading-checklist-1.html
  152. #
  153. # Install doc-base files.
  154. #
  155. @set -ex; for file in $(DESC_FILES); do \
  156. $(install) $$file.desc $(LIBDIR)/$$file; \
  157. done
  158. #
  159. # Compress files and build MD5 checksums.
  160. #
  161. gzip -f9 $(DOCDIR)/*.sgml $(DOCDIR)/changelog
  162. gzip -f9 -n $(DOCDIR)/*.txt
  163. @set -ex; cd debian/tmp; \
  164. find . -path './DEBIAN' -prune -o -type f -printf '%P\0' \
  165. | xargs -r0 md5sum > DEBIAN/md5sums
  166. #
  167. # Build the package.
  168. #
  169. dpkg-gencontrol -p$(package) -Pdebian/tmp
  170. chown -R root:root debian/tmp
  171. chmod -R go=rX debian/tmp
  172. dpkg --build debian/tmp ..
  173. touch stamp-binary
  174. .PHONY: all configure build build-arch build-indep binary binary-arch
  175. .PHONY: binary-indep clean