local.mk 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. # GNU Guix --- Functional package management for GNU
  2. # Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
  3. # Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
  4. # Copyright © 2013 Andreas Enge <andreas@enge.fr>
  5. # Copyright © 2016 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
  6. # Copyright © 2016, 2018 Mathieu Lirzin <mthl@gnu.org>
  7. # Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
  8. #
  9. # This file is part of GNU Guix.
  10. #
  11. # GNU Guix is free software; you can redistribute it and/or modify it
  12. # under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; either version 3 of the License, or (at
  14. # your option) any later version.
  15. #
  16. # GNU Guix is distributed in the hope that it will be useful, but
  17. # WITHOUT ANY WARRANTY; without even the implied warranty of
  18. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. # GNU General Public License for more details.
  20. #
  21. # You should have received a copy of the GNU General Public License
  22. # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  23. info_TEXINFOS = %D%/guix.texi \
  24. %D%/guix.fr.texi \
  25. %D%/guix.de.texi
  26. %C%_guix_TEXINFOS = \
  27. %D%/contributing.texi \
  28. %D%/fdl-1.3.texi
  29. DOT_FILES = \
  30. %D%/images/bootstrap-graph.dot \
  31. %D%/images/bootstrap-packages.dot \
  32. %D%/images/coreutils-graph.dot \
  33. %D%/images/coreutils-bag-graph.dot \
  34. %D%/images/service-graph.dot \
  35. %D%/images/shepherd-graph.dot
  36. DOT_VECTOR_GRAPHICS = \
  37. $(DOT_FILES:%.dot=%.eps) \
  38. $(DOT_FILES:%.dot=%.pdf)
  39. EXTRA_DIST += \
  40. %D%/htmlxref.cnf \
  41. $(DOT_FILES) \
  42. $(DOT_VECTOR_GRAPHICS) \
  43. %D%/images/coreutils-size-map.eps \
  44. %D%/environment-gdb.scm \
  45. %D%/package-hello.scm
  46. OS_CONFIG_EXAMPLES_TEXI = \
  47. %D%/os-config-bare-bones.texi \
  48. %D%/os-config-desktop.texi \
  49. %D%/os-config-lightweight-desktop.texi
  50. TRANSLATED_INFO = \
  51. %D%/guix.de.texi \
  52. %D%/guix.fr.texi \
  53. %D%/contributing.de.texi \
  54. %D%/contributing.fr.texi
  55. # Bundle this file so that makeinfo finds it in out-of-source-tree builds.
  56. BUILT_SOURCES += $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
  57. EXTRA_DIST += $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
  58. MAINTAINERCLEANFILES = $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
  59. PO4A_PARAMS := -M UTF-8 -L UTF-8 #master and localized encoding
  60. PO4A_PARAMS += -k 0 # produce an output even if the translation is not complete
  61. PO4A_PARAMS += -f texinfo # texinfo format
  62. # When a change to guix.texi occurs, it is not translated immediately.
  63. # Because @pxref and @xref commands are reference to a section by name, they
  64. # should be translated. If a modification adds a reference to a section, this
  65. # reference is not translated, which means it references a section that does not
  66. # exist.
  67. # This command loops through the translated files looking for references. For
  68. # each of these references, it tries to find the translation and replaces the
  69. # reference name, even in untranslated strings.
  70. # The last sed is a multiline sed because some references span multiple lines.
  71. define xref_command
  72. cat "$@.tmp" | egrep '@p?x?ref' -A1 | sed 'N;s|--\n||g;P;D' | sed 's|^| |g' | \
  73. tr -d '\012' | sed 's|\(@p\?x\?ref\)|\n\1|g' | egrep '@p?x?ref' | \
  74. sed 's|^.*@p\?x\?ref{\([^,}]*\).*$$|\1|g' | sort | uniq | while read e; do \
  75. line=$$(grep -n "^msgid \"$$e\"" "$<" | cut -f1 --delimiter=":") ;\
  76. ((line++)) ;\
  77. if [ "$$line" != "1" ]; then \
  78. translation=$$(head -n $$line "$<" | tail -1 | grep msgstr | sed 's|msgstr "\(.*\)"|\1|') ;\
  79. if [ "$$translation" != "" ]; then \
  80. sed "N;s@\(p\?x\?ref\){$$(echo $$e | sed 's| |[\\n ]|g')\(,\|}\)@\1{$$translation\2@g;P;D" -i "$@.tmp" ;\
  81. fi ;\
  82. fi ;\
  83. done
  84. endef
  85. $(srcdir)/%D%/guix.%.texi: po/doc/guix-manual.%.po $(srcdir)/%D%/contributing.%.texi
  86. -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/guix.texi" -p "$<" -l "$@.tmp"
  87. -sed -i "s|guix\.info|$$(basename "$@" | sed 's|texi$$|info|')|" "$@.tmp"
  88. -$(AM_V_POXREF)$(xref_command)
  89. -mv "$@.tmp" "$@"
  90. $(srcdir)/%D%/contributing.%.texi: po/doc/guix-manual.%.po
  91. -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/contributing.texi" -p "$<" -l "$@.tmp"
  92. -$(AM_V_POXREF)$(xref_command)
  93. -mv "$@.tmp" "$@"
  94. %D%/os-config-%.texi: gnu/system/examples/%.tmpl
  95. $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
  96. cp "$<" "$@"
  97. infoimagedir = $(infodir)/images
  98. dist_infoimage_DATA = \
  99. $(DOT_FILES:%.dot=%.png) \
  100. %D%/images/coreutils-size-map.png
  101. # Try hard to obtain an image size and aspect that's reasonable for inclusion
  102. # in an Info or PDF document.
  103. DOT_OPTIONS = \
  104. -Gratio=.9 -Gnodesep=.005 -Granksep=.00005 \
  105. -Nfontsize=9 -Nheight=.1 -Nwidth=.1
  106. .dot.png:
  107. $(AM_V_DOT)$(DOT) -Tpng $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
  108. mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
  109. .dot.pdf:
  110. $(AM_V_DOT)$(DOT) -Tpdf $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
  111. mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
  112. .dot.eps:
  113. $(AM_V_DOT)$(DOT) -Teps $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
  114. mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
  115. .png.eps:
  116. $(AM_V_GEN)convert "$<" "$@-tmp.eps"; \
  117. mv "$@-tmp.eps" "$@"
  118. # We cannot add new dependencies to `%D%/guix.pdf' & co. (info "(automake)
  119. # Extending"). Using the `-local' rules is imperfect, because they may be
  120. # triggered after the main rule. Oh, well.
  121. pdf-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.pdf)
  122. info-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.png)
  123. ps-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.eps) \
  124. $(top_srcdir)/%D%/images/coreutils-size-map.eps
  125. dvi-local: ps-local
  126. ## ----------- ##
  127. ## Man pages. ##
  128. ## ----------- ##
  129. # The man pages are generated using GNU Help2man. In makefiles rules they
  130. # depend not on the binary, but on the source files. This usage allows a
  131. # manual page to be generated by the maintainer and included in the
  132. # distribution without requiring the end-user to have 'help2man' installed.
  133. # They are built in $(srcdir) like info manuals.
  134. sub_commands_mans = \
  135. $(srcdir)/%D%/guix-archive.1 \
  136. $(srcdir)/%D%/guix-build.1 \
  137. $(srcdir)/%D%/guix-challenge.1 \
  138. $(srcdir)/%D%/guix-download.1 \
  139. $(srcdir)/%D%/guix-edit.1 \
  140. $(srcdir)/%D%/guix-environment.1 \
  141. $(srcdir)/%D%/guix-gc.1 \
  142. $(srcdir)/%D%/guix-hash.1 \
  143. $(srcdir)/%D%/guix-import.1 \
  144. $(srcdir)/%D%/guix-lint.1 \
  145. $(srcdir)/%D%/guix-package.1 \
  146. $(srcdir)/%D%/guix-publish.1 \
  147. $(srcdir)/%D%/guix-pull.1 \
  148. $(srcdir)/%D%/guix-refresh.1 \
  149. $(srcdir)/%D%/guix-size.1 \
  150. $(srcdir)/%D%/guix-system.1
  151. dist_man1_MANS = \
  152. $(srcdir)/%D%/guix.1 \
  153. $(sub_commands_mans)
  154. gen_man = \
  155. LANGUAGE= $(top_builddir)/pre-inst-env $(HELP2MAN) \
  156. $(HELP2MANFLAGS)
  157. HELP2MANFLAGS = --source=GNU --info-page=$(PACKAGE_TARNAME)
  158. $(srcdir)/%D%/guix.1: scripts/guix.in $(sub_commands_mans)
  159. -$(AM_V_HELP2MAN)$(gen_man) --output="$@" `basename "$@" .1`
  160. # The 'case' ensures the man pages are only generated if the corresponding
  161. # source script (the first prerequisite) has been changed. The $(GOBJECTS)
  162. # prerequisite is solely meant to force these docs to be made only after all
  163. # Guile modules have been compiled.
  164. $(srcdir)/%D%/guix-%.1: guix/scripts/%.scm $(GOBJECTS)
  165. -@case '$?' in \
  166. *$<*) $(AM_V_P) && set -x || echo " HELP2MAN $@"; \
  167. $(gen_man) --output="$@" "guix $*";; \
  168. *) : ;; \
  169. esac
  170. if BUILD_DAEMON
  171. dist_man1_MANS += $(srcdir)/%D%/guix-daemon.1
  172. $(srcdir)/%D%/guix-daemon.1: nix/nix-daemon/guix-daemon.cc
  173. -$(AM_V_HELP2MAN)$(gen_man) --output="$@" `basename "$@" .1`
  174. endif