4 PERKAMON_DIR = perkamon
9 PO4AFLAGS ?= -k $(THRESH) $(FLAGS)
11 PO4A_SUBDIRS = $(sort $(patsubst %.cfg, %, $(notdir $(wildcard po4a/*/*.cfg))))
13 .PHONY: all release translate
16 translate: translate-pages update-stats
17 release: release-pages update-tl-finish check-tl-nofinish
19 translate-pages: $(patsubst %, stamp/%, $(PO4A_SUBDIRS))
20 stamp/%: stamp-setup po4a/%/po/ja.po
21 @echo "*************** translate: $* ***************"
23 po4a $(PO4AFLAGS) --variable langs='$(LANGS)' --previous --srcdir . --destdir . po4a/$*/$*.cfg
27 ../../admin/JM-release-all.sh -c
29 update-stats: untrans.html
31 untrans.html: $(patsubst %, stats/%, $(PO4A_SUBDIRS))
32 @echo "*************** Updating translation statistics ***************"
33 ./tools/generate-list.pl $^ > $@
34 if [ -f EXCLUDED_PAGES.txt ]; then \
35 ./tools/generate-list.pl -e EXCLUDED_PAGES.txt $^ > untrans-partial.html; \
38 stats/%: stamp-setup po4a/%/po/ja.po
39 @echo "*************** stats: $* ***************"
43 ln -s ../_transtmp build/ja
44 LC_ALL=C po4a -k 100 $(FLAGS) --variable langs='$(LANGS)' --previous --srcdir . --destdir . po4a/$*/$*.cfg | tee _log.txt
45 ./tools/extract-untrans.pl < _log.txt > $@
47 ln -s ../draft build/ja
55 @cat stats/* | grep -v '^#' | cut -d , -f 1 | sort > _stats.txt
56 @grep '^[×☆]' translation_list | cut -d : -f 5-6 | sed -e 's/:/./' | sort > _tr_todo.txt
57 @for p in `comm -23 _tr_todo.txt _stats.txt`; do \
58 ../../admin/JM-tl-modify.pl -U translation_list $$p RO; \
60 @$(RM) _stats.txt _tr_todo.txt
63 @cat stats/* | grep -v '^#' | cut -d , -f 1 | sort > _stats.txt
64 @grep '^○' translation_list | cut -d : -f 5-6 | sed -e 's/:/./' | sort > _tr_finish.txt
65 @comm -12 _tr_finish.txt _stats.txt
66 @$(RM) _stats.txt _tr_finish.txt
69 set -e; for d in po4a/*; do \
70 echo "----- $$d -----"; cur=`pwd`; cd $$d/po; \
72 LC_ALL=C msgmerge --verbose -o $$f ja.po $$(basename $$d) \
78 set -e; for d in po4a/$*; do \
81 msgmerge --verbose -o $$f ja.po $$(basename $$d) \
87 @LC_ALL=C $(MAKE) stats PO4AFLAGS="$(PO4AFLAGS)" LANGS="$(LANGS)"
89 untrans-postats: jm-setup
90 @LC_ALL=C $(MAKE) stats PO4AFLAGS="$(PO4AFLAGS)" LANGS="$(LANGS)" \
91 2>&1 | grep -vE ' translated messages\.$$'
93 stats:: $(patsubst %, stats-%, $(LANGS))
95 @set -e; for subs in $(PO4A_SUBDIRS); do \
96 echo -n "$$subs: " >&2; \
97 msgfmt --statistics -o /dev/null po4a/$$subs/po/$*.po; \
99 @set -e; for subs in $(PO4A_SUBDIRS); do \
100 LC_ALL=C msgfmt --statistics -o /dev/null po4a/$$subs/po/$*.po; \
101 done 2>&1 | perl -e '$$f=$$t=$$u; while (<>) {if (/([0-9]*) translated/) {$$t+=$$1;} if (/([0-9]*) untranslated/) {$$u+=$$1;} if (/([0-9]*) fuzzy/) {$$f+=$$1;}} printf "%d translated, %d fuzzy, %d untranslated ==> %.2f%%\n", $$t, $$f, $$u, (100*$$t/($$t+$$f+$$u))'
103 man-pages-$(V).tar.xz:
104 wget https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/$@
106 stamp-unpack: man-pages-$(V).tar.xz
107 tar Jxf man-pages-$(V).tar.xz
108 @# Remove version from top-level directory so that V variable
109 @# does not have to be used in targets below
110 mv man-pages-$(V) man-pages
111 @# Remove stamp-setup to force re-run of 'setup' target
117 stamp-setup: stamp-unpack
120 for i in $$(seq 8); do mkdir build/C/man$$i; done
121 @# Some manual pages are only aliases, they contain a single line
122 @# .so target_man_page
123 @# Create a file named 'link', its format is:
124 @# target_man_page src_man_page
125 @# This file is used after pages are translated to create aliases
126 @# of translated manual pages.
127 set -e; for f in man-pages/man?/*.?; do \
128 if sed -e '1,3!d' $$f | grep -q '^\.so'; \
130 grep '^\.so' $$f | sed -e '1!d' -e 's/^\.so //' -e "s,$$, $${f#man-pages/}," >> build/C/link; \
132 cp $$f build/C/$${f#man-pages/}; \
135 LC_ALL=C sort build/C/link > temp && mv temp build/C/link
136 @# Remove empty directories, if any
137 -rmdir build/C/man* 2>/dev/null
138 @# Apply patches to fix groff syntax errors which prevent po4a processing
139 if test -f workaround.patch; \
141 cd build/C && patch -p2 < $(CURDIR)/workaround.patch; \
143 @set -e; if [ ! -e build/ja ]; then \
144 ln -s ../draft build/ja; \
146 ln -s ../add_ja po4a/add_ja
153 $(RM) -r man-pages build
159 && ../../../admin/JM-orig-upd.sh ../original \
160 && cp README man-pages-* Changes* ../original
162 sed -e 's/\^\\\.SH /^\\.S[Hh] /' ../man-pages/scripts/remove_COLOPHON.sh \
163 sh ../man-pages/scripts/remove_COLOPHON.sh man?/*.[1-8]
164 git add --all original/
165 git status original | ../../admin/git2upd > upd.txt
166 ../../admin/upd_tl.perl translation_list upd.txt $(V)
167 mv translation_list.* translation_list
168 $(MAKE) FLAGS="--no-translations -v --force" translate-pages
170 git add translation_list
171 git commit -m "LDP: Update original to LDP v$(V)" original/ translation_list
172 git add po4a/ stats/ untrans.html
173 git commit -m "LDP: Update POT and ja.po to LDP v$(V)" po4a/ stats/ untrans.html
176 @set -e; for f in po4a/*/*.cfg; do \
177 for i in $$(grep '^\[type: man\]' $$f | sed -e 's,.* build/C/,build/C/,' -e 's, \\,,'); do \
178 test -f $$i && continue; \
179 echo "Missing file $$i disabled in $$f"; \
180 sed -i -e '/\[type: man\] '"$$(echo $$i | sed -e 's,/,\\/,g')"'/,/[^\\]$$/s/^/#/' $$f; \
184 # Run this target after a new upstream release to see if pages have been added.
185 # Copy and paste output in po4a .cfg files
187 @set -e; for f in build/C/man?/*.?; do \
188 l="$${f#build/C/}"; \
189 grep -q "^\\[type: man\\] build/C/$$l" po4a/*/*.cfg && continue; \
190 o=$$(echo $$l | sed -e 's,/,/local-,'); \
191 printf '[type: man] %s \\\n\t%s \\\n' build/C/$$l "\$$lang:build/\$$lang/$$l"; \
192 if grep -q hlm $$f; then printf '\topt:"-o untranslated=hlm" \\\n'; fi; \
193 printf '\tadd_$$lang:?@po4a/add_$$lang/lists/local-pre.list \\\n'; \
194 printf '\tadd_$$lang:?@po4a/add_$$lang/lists/'$$o'.list \\\n'; \
195 printf '\tadd_$$lang:?po4a/add_$$lang/perkamon \\\n'; \
196 printf '\tadd_$$lang:?@po4a/add_$$lang/lists/'$$l'.list \\\n'; \
197 printf '\tadd_$$lang:?po4a/add_$$lang/addendum \\\n'; \
198 printf '\tadd_$$lang:?@po4a/add_$$lang/lists/local-post.list\n'; \
203 @echo "Available targets:"
204 @echo " translate Generate draft from po files"
205 @echo " translate-<SEC> Generate draft from the specified po file"
206 @echo " release Generate release from po files"
208 @echo " update-stats Update per-page trans stats"
209 @echo " clean-stats Remove all caches of per-page trans stats"
210 @echo " postats Display per-po trans stats"
211 @echo " untrans-postats Display per-po trans stats (untrans only)"
213 @echo " jm-setup Setup environment"
214 @echo " clean-setup Clean environment"